Unverified Commit 07e0c5be authored by Kroese's avatar Kroese Committed by GitHub
Browse files

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

parent f0886095
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 \
+17 −2
Original line number Diff line number Diff line
@@ -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"