|
|
@ -193,6 +193,7 @@ function efi_vars() { |
|
|
|
|
|
|
|
|
|
|
|
function vm_boot() { |
|
|
|
function vm_boot() { |
|
|
|
local BALLOON="-device virtio-balloon" |
|
|
|
local BALLOON="-device virtio-balloon" |
|
|
|
|
|
|
|
local BOOT_STATUS="" |
|
|
|
local CPU="" |
|
|
|
local CPU="" |
|
|
|
local DISK_USED="" |
|
|
|
local DISK_USED="" |
|
|
|
local DISPLAY_DEVICE="" |
|
|
|
local DISPLAY_DEVICE="" |
|
|
@ -322,7 +323,6 @@ function vm_boot() { |
|
|
|
# Always Boot macOS using EFI |
|
|
|
# Always Boot macOS using EFI |
|
|
|
if [ "${guest_os}" == "macos" ]; then |
|
|
|
if [ "${guest_os}" == "macos" ]; then |
|
|
|
boot="efi" |
|
|
|
boot="efi" |
|
|
|
echo " - BOOT: EFI (${guest_os})" |
|
|
|
|
|
|
|
if [ -e "${VMDIR}/OVMF_CODE.fd" ] && [ -e "${VMDIR}/OVMF_VARS-1024x768.fd" ]; then |
|
|
|
if [ -e "${VMDIR}/OVMF_CODE.fd" ] && [ -e "${VMDIR}/OVMF_VARS-1024x768.fd" ]; then |
|
|
|
EFI_CODE="${VMDIR}/OVMF_CODE.fd" |
|
|
|
EFI_CODE="${VMDIR}/OVMF_CODE.fd" |
|
|
|
EFI_VARS="${VMDIR}/OVMF_VARS-1024x768.fd" |
|
|
|
EFI_VARS="${VMDIR}/OVMF_VARS-1024x768.fd" |
|
|
@ -344,6 +344,7 @@ function vm_boot() { |
|
|
|
echo " Use 'quickget' to download the required files." |
|
|
|
echo " Use 'quickget' to download the required files." |
|
|
|
exit 1 |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
BOOT_STATUS="EFI (macOS), OVMF ($(basename "${EFI_CODE}")), SecureBoot (${secureboot})." |
|
|
|
elif [[ "${boot}" == *"efi"* ]]; then |
|
|
|
elif [[ "${boot}" == *"efi"* ]]; then |
|
|
|
EFI_VARS="${VMDIR}/OVMF_VARS.fd" |
|
|
|
EFI_VARS="${VMDIR}/OVMF_VARS.fd" |
|
|
|
|
|
|
|
|
|
|
@ -354,36 +355,54 @@ function vm_boot() { |
|
|
|
mv "${VMDIR}/OVMF_VARS_4M.fd" "${EFI_VARS}" |
|
|
|
mv "${VMDIR}/OVMF_VARS_4M.fd" "${EFI_VARS}" |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if [ -e "/usr/share/OVMF/OVMF_CODE_4M.fd" ] || |
|
|
|
# OVMF_CODE_4M.fd is for booting guests in non-Secure Boot mode. |
|
|
|
[ -e "/usr/share/OVMF/x64/OVMF_CODE.fd" ] || |
|
|
|
# While this image technically supports Secure Boot, it does so |
|
|
|
[ -e "/usr/share/OVMF/OVMF_CODE.fd" ]; then |
|
|
|
# without requiring SMM support from QEMU |
|
|
|
echo " - BOOT: EFI (${guest_os})" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# OVMF_CODE.secboot.fd is like OVMF_CODE_4M.fd, but will abort if QEMU |
|
|
|
|
|
|
|
# does not support SMM. |
|
|
|
|
|
|
|
case ${secureboot} in |
|
|
|
|
|
|
|
on) |
|
|
|
|
|
|
|
if [ -e "/usr/share/OVMF/OVMF_CODE_4M.secboot.fd" ]; then |
|
|
|
|
|
|
|
EFI_CODE="/usr/share/OVMF/OVMF_CODE_4M.secboot.fd" |
|
|
|
|
|
|
|
efi_vars "/usr/share/OVMF/OVMF_VARS_4M.fd" "${EFI_VARS}" |
|
|
|
|
|
|
|
elif [ -e "/usr/share/OVMF/OVMF_CODE.secboot.fd" ]; then |
|
|
|
|
|
|
|
EFI_CODE="/usr/share/OVMF/OVMF_CODE.secboot.fd" "${EFI_VARS}" |
|
|
|
|
|
|
|
efi_vars "/usr/share/OVMF/OVMF_VARS.fd" "${EFI_VARS}" |
|
|
|
|
|
|
|
elif [ -e "/usr/share/OVMF/x64/OVMF_CODE.secboot.fd" ]; then |
|
|
|
|
|
|
|
EFI_CODE="/usr/share/OVMF/x64/OVMF_CODE.secboot.fd" "${EFI_VARS}" |
|
|
|
|
|
|
|
efi_vars "/usr/share/OVMF/x64/OVMF_VARS.fd" "${EFI_VARS}" |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
echo "ERROR! SecureBoot was requested but no SecureBoot capable firmware was found." |
|
|
|
|
|
|
|
exit 1 |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
BOOT_STATUS="EFI (${guest_os^}), OVMF ($(basename "${EFI_CODE}")), SecureBoot (${secureboot})." |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
*) |
|
|
|
if [ -e "/usr/share/OVMF/OVMF_CODE_4M.fd" ]; then |
|
|
|
if [ -e "/usr/share/OVMF/OVMF_CODE_4M.fd" ]; then |
|
|
|
EFI_CODE="/usr/share/OVMF/OVMF_CODE_4M.fd" |
|
|
|
EFI_CODE="/usr/share/OVMF/OVMF_CODE_4M.fd" |
|
|
|
elif [ -e "/usr/share/OVMF/x64/OVMF_CODE.fd" ]; then |
|
|
|
efi_vars "/usr/share/OVMF/OVMF_VARS_4M.fd" "${EFI_VARS}" |
|
|
|
EFI_CODE="/usr/share/OVMF/x64/OVMF_CODE.fd" |
|
|
|
|
|
|
|
elif [ -e "/usr/share/OVMF/OVMF_CODE.fd" ]; then |
|
|
|
elif [ -e "/usr/share/OVMF/OVMF_CODE.fd" ]; then |
|
|
|
EFI_CODE="/usr/share/OVMF/OVMF_CODE.fd" |
|
|
|
EFI_CODE="/usr/share/OVMF/OVMF_CODE.fd" |
|
|
|
fi |
|
|
|
efi_vars "/usr/share/OVMF/OVMF_VARS.fd" "${EFI_VARS}" |
|
|
|
|
|
|
|
elif [ -e "/usr/share/OVMF/x64/OVMF_CODE.fd" ]; then |
|
|
|
if [ ! -e "${EFI_VARS}" ]; then |
|
|
|
EFI_CODE="/usr/share/OVMF/x64/OVMF_CODE.fd" |
|
|
|
if [ -e "/usr/share/OVMF/OVMF_VARS_4M.fd" ]; then |
|
|
|
efi_vars "/usr/share/OVMF/x64/OVMF_VARS.fd" "${EFI_VARS}" |
|
|
|
cp "/usr/share/OVMF/OVMF_VARS_4M.fd" "${EFI_VARS}" |
|
|
|
|
|
|
|
elif [ -e "/usr/share/OVMF/x64/OVMF_VARS.fd" ]; then |
|
|
|
|
|
|
|
cp "/usr/share/OVMF/x64/OVMF_VARS.fd" "${EFI_VARS}" |
|
|
|
|
|
|
|
elif [ -e "/usr/share/OVMF/OVMF_VARS.fd" ]; then |
|
|
|
|
|
|
|
cp "/usr/share/OVMF/OVMF_VARS.fd" "${EFI_VARS}" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
|
|
|
|
|
BOOT_STATUS="Legacy BIOS (${guest_os^}) - EFI requested but no EFI firmware found." |
|
|
|
boot="legacy" |
|
|
|
boot="legacy" |
|
|
|
echo " - BOOT: Legacy BIOS (${guest_os}) - EFI requested but no EFI firmware found." |
|
|
|
secureboot="off" |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
BOOT_STATUS="EFI (${guest_os^}), OVMF ($(basename "${EFI_CODE}")), SecureBoot (${secureboot})." |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
esac |
|
|
|
else |
|
|
|
else |
|
|
|
echo " - BOOT: Legacy BIOS (${guest_os})" |
|
|
|
BOOT_STATUS="Legacy BIOS (${guest_os^})" |
|
|
|
|
|
|
|
secureboot="off" |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo " - BOOT: ${BOOT_STATUS}" |
|
|
|
|
|
|
|
|
|
|
|
# Make any OS specific adjustments |
|
|
|
# Make any OS specific adjustments |
|
|
|
case ${guest_os} in |
|
|
|
case ${guest_os} in |
|
|
|
freebsd|linux|openbsd) |
|
|
|
freebsd|linux|openbsd) |
|
|
@ -926,6 +945,7 @@ macos_release="" |
|
|
|
port_forwards=() |
|
|
|
port_forwards=() |
|
|
|
preallocation="off" |
|
|
|
preallocation="off" |
|
|
|
ram="" |
|
|
|
ram="" |
|
|
|
|
|
|
|
secureboot="off" |
|
|
|
tpm="off" |
|
|
|
tpm="off" |
|
|
|
usb_devices=() |
|
|
|
usb_devices=() |
|
|
|
|
|
|
|
|
|
|
|