feat: Store UEFI vars in /storage (#27)

This commit is contained in:
Kroese 2024-06-07 22:16:20 +02:00 committed by GitHub
parent f0886095e9
commit 07e0c5be59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 3 deletions

View file

@ -46,7 +46,7 @@ COPY --chmod=755 ./src /run/
COPY --from=builder /images /images
ADD --chmod=755 $REPO_OSX_KVM/$VERSION_OSX_KVM/fetch-macOS-v2.py /run/
ADD --chmod=755 \
ADD --chmod=644 \
$REPO_OSX_KVM/$VERSION_OSX_KVM/OVMF_CODE.fd \
$REPO_OSX_KVM/$VERSION_OSX_KVM/OVMF_VARS.fd \
$REPO_OSX_KVM/$VERSION_OSX_KVM/OVMF_VARS-1024x768.fd \

View file

@ -14,17 +14,20 @@ OVMF="/usr/share/OVMF"
case "${BOOT_MODE,,}" in
full)
DEST="macos"
BOOT_DESC=" 1920x1080"
ROM="OVMF_CODE.fd"
VARS="OVMF_VARS-1920x1080.fd"
;;
hd)
DEST="macos_hd"
BOOT_DESC=" 1024x768"
ROM="OVMF_CODE.fd"
VARS="OVMF_VARS-1024x768.fd"
;;
default)
BOOT_DESC=""
DEST="macos_default"
ROM="OVMF_CODE.fd"
VARS="OVMF_VARS.fd"
;;
@ -44,8 +47,20 @@ osk=$(echo "bheuneqjbexolgurfrjbeqfthneqrqcyrnfrqbagfgrny(p)NccyrPbzchgreVap" |
BOOT_OPTS+=" -device isa-applesmc,osk=$osk"
# OVMF
BOOT_OPTS+=" -drive if=pflash,format=raw,readonly=on,file=$OVMF/$ROM"
BOOT_OPTS+=" -drive if=pflash,format=raw,file=$OVMF/$VARS"
DEST="$STORAGE/$DEST"
if [ ! -s "$DEST.rom" ] || [ ! -f "$DEST.rom" ]; then
[ ! -s "$OVMF/$ROM" ] || [ ! -f "$OVMF/$ROM" ] && error "UEFI boot file ($OVMF/$ROM) not found!" && exit 44
cp "$OVMF/$ROM" "$DEST.rom"
fi
if [ ! -s "$DEST.vars" ] || [ ! -f "$DEST.vars" ]; then
[ ! -s "$OVMF/$VARS" ] || [ ! -f "$OVMF/$VARS" ]&& error "UEFI vars file ($OVMF/$VARS) not found!" && exit 45
cp "$OVMF/$VARS" "$DEST.vars"
fi
BOOT_OPTS+=" -drive if=pflash,format=raw,readonly=on,file=$DEST.rom"
BOOT_OPTS+=" -drive if=pflash,format=raw,file=$DEST.vars"
# OpenCoreBoot
DISK_OPTS+=" -device virtio-blk-pci,drive=${BOOT_DRIVE_ID},scsi=off,bus=pcie.0,addr=0x5,iothread=io2,bootindex=$BOOT_INDEX"