Update boot.sh

This commit is contained in:
Kroese 2024-02-02 15:26:20 +01:00 committed by GitHub
parent 5a9a8d3f47
commit 286e864a3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,29 +5,28 @@ set -Eeuo pipefail
: "${TPM:="Y"}" # Enable TPM : "${TPM:="Y"}" # Enable TPM
: "${BOOT_MODE:="legacy"}" # Boot mode : "${BOOT_MODE:="legacy"}" # Boot mode
BIOS=""
SECURE="" SECURE=""
BOOT_OPTS="" BOOT_OPTS=""
BIOS="QEMU,VGA.bin"
DIR="/usr/share/qemu" DIR="/usr/share/qemu"
case "${BOOT_MODE,,}" in case "${BOOT_MODE,,}" in
uefi) uefi)
ROM="OVMF.fd"
BIOS="QEMU,VGA.bin" BIOS="QEMU,VGA.bin"
VARS="OVMF_VARS_4M.fd" ROM="AAVMF_CODE.fd"
VARS="AAVMF_VARS.fd"
;; ;;
secure) secure)
ROM="OVMF.fd"
BIOS="QEMU,VGA.bin" BIOS="QEMU,VGA.bin"
VARS="OVMF_VARS_4M.secboot.fd" ROM="AAVMF_CODE.fd"
VARS="AAVMF_VARS.fd"
;; ;;
windows) windows)
ROM="OVMF.fd"
BIOS="QEMU,VGA.bin" BIOS="QEMU,VGA.bin"
VARS="OVMF_VARS_4M.ms.fd" ROM="AAVMF_CODE.ms.fd"
VARS="AAVMF_VARS.ms.fd"
;; ;;
windows_legacy) windows_legacy)
BIOS="QEMU,VGA.bin"
USB="usb-ehci,id=ehci" USB="usb-ehci,id=ehci"
BOOT_OPTS="" BOOT_OPTS=""
;; ;;
@ -45,17 +44,17 @@ BOOT_OPTS="$BOOT_OPTS -device ramfb"
if [[ "${BOOT_MODE,,}" != "legacy" ]] && [[ "${BOOT_MODE,,}" != "windows_legacy" ]]; then if [[ "${BOOT_MODE,,}" != "legacy" ]] && [[ "${BOOT_MODE,,}" != "windows_legacy" ]]; then
OVMF="/usr/share/OVMF" AAVMF="/usr/share/AAVMF/"
DEST="$STORAGE/${BOOT_MODE,,}" DEST="$STORAGE/${BOOT_MODE,,}"
if [ ! -f "$DEST.rom" ]; then if [ ! -f "$DEST.rom" ]; then
[ ! -f "$DIR/$ROM" ] && error "UEFI boot file ($DIR/$ROM) not found!" && exit 44 [ ! -f "$AAVMF/$ROM" ] && error "UEFI boot file ($AAVMF/$ROM) not found!" && exit 44
cp "$DIR/$ROM" "$DEST.rom" cp "$AAVMF/$ROM" "$DEST.rom"
fi fi
if [ ! -f "$DEST.vars" ]; then if [ ! -f "$DEST.vars" ]; then
[ ! -f "$OVMF/$VARS" ] && error "UEFI vars file ($OVMF/$VARS) not found!" && exit 45 [ ! -f "$AAVVMF/$VARS" ] && error "UEFI vars file ($AAVMF/$VARS) not found!" && exit 45
cp "$OVMF/$VARS" "$DEST.vars" cp "$AAVMF/$VARS" "$DEST.vars"
fi fi
if [[ "${BOOT_MODE,,}" != "uefi" ]]; then if [[ "${BOOT_MODE,,}" != "uefi" ]]; then