From 8f9fa9f00e3b28caad71cd8ff52a94fdde45118a Mon Sep 17 00:00:00 2001 From: Danny Date: Thu, 19 Mar 2026 16:32:06 +0100 Subject: [PATCH] Fix OVMF detection for Arch Linux (split CODE/VARS files) Arch's edk2-ovmf package installs split files (OVMF_CODE.fd + OVMF_VARS.fd) instead of a single OVMF.fd. Updated the search to check OVMF_CODE.fd paths first, with a find fallback. QEMU boot command now handles both formats: - Split: -drive if=pflash,format=raw,readonly=on,file=OVMF_CODE.fd -drive if=pflash,format=raw,file=OVMF_VARS.fd - Single: -bios OVMF.fd Co-Authored-By: Claude Opus 4.6 (1M context) --- tests/proxmox/run-in-vm.sh | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/tests/proxmox/run-in-vm.sh b/tests/proxmox/run-in-vm.sh index ecb04f9..605af99 100755 --- a/tests/proxmox/run-in-vm.sh +++ b/tests/proxmox/run-in-vm.sh @@ -133,12 +133,24 @@ else record "host.nested_virt" "skip" "No VMX/SVM — QEMU boot tests will be slower" fi -# Check OVMF +# Check OVMF — Arch uses split CODE/VARS files, others use a single OVMF.fd OVMF="" -for p in /usr/share/edk2/x64/OVMF.fd /usr/share/edk2-ovmf/x64/OVMF.fd /usr/share/ovmf/x64/OVMF.fd /usr/share/OVMF/OVMF.fd; do +for p in \ + /usr/share/edk2/x64/OVMF_CODE.fd \ + /usr/share/edk2-ovmf/x64/OVMF_CODE.fd \ + /usr/share/OVMF/OVMF_CODE.fd \ + /usr/share/edk2/x64/OVMF.fd \ + /usr/share/edk2-ovmf/x64/OVMF.fd \ + /usr/share/ovmf/x64/OVMF.fd \ + /usr/share/OVMF/OVMF.fd \ + /usr/share/ovmf/OVMF.fd; do [ -f "$p" ] && OVMF="$p" && break done -[ -n "$OVMF" ] && record "host.ovmf" "pass" "$OVMF" || record "host.ovmf" "fail" "Not found" +# Last resort: find it +if [ -z "$OVMF" ]; then + OVMF=$(find /usr/share -name "OVMF_CODE.fd" -o -name "OVMF.fd" 2>/dev/null | head -1) +fi +[ -n "$OVMF" ] && record "host.ovmf" "pass" "$OVMF" || record "host.ovmf" "fail" "Not found — install edk2-ovmf" GCC_VER=$(gcc -dumpversion 2>/dev/null | cut -d. -f1) [ -n "$GCC_VER" ] && [ "$GCC_VER" -ge 12 ] && record "host.gcc_ver" "pass" "GCC ${GCC_VER}" || record "host.gcc_ver" "fail" "GCC ${GCC_VER:-missing} (need 12+)" @@ -393,11 +405,22 @@ if [ "$QUICK_MODE" = false ] && [ -f "${PROJECT_ROOT}/darkforge-live.iso" ] && [ KVM_FLAG="" [ -c /dev/kvm ] && KVM_FLAG="-enable-kvm" + # Build OVMF flags — split CODE/VARS files need -drive, single .fd uses -bios + OVMF_FLAGS="" + if echo "$OVMF" | grep -q "OVMF_CODE"; then + OVMF_VARS_TEMPLATE="$(dirname "$OVMF")/OVMF_VARS.fd" + OVMF_VARS_COPY="/tmp/darkforge-ovmf-vars.fd" + cp "$OVMF_VARS_TEMPLATE" "$OVMF_VARS_COPY" 2>/dev/null || dd if=/dev/zero of="$OVMF_VARS_COPY" bs=256K count=1 2>/dev/null + OVMF_FLAGS="-drive if=pflash,format=raw,readonly=on,file=${OVMF} -drive if=pflash,format=raw,file=${OVMF_VARS_COPY}" + else + OVMF_FLAGS="-bios ${OVMF}" + fi + timeout 60 qemu-system-x86_64 \ ${KVM_FLAG} \ -m 2G \ -smp 2 \ - -bios "$OVMF" \ + ${OVMF_FLAGS} \ -cdrom "${PROJECT_ROOT}/darkforge-live.iso" \ -drive "file=${QEMU_DISK},format=qcow2,if=virtio" \ -nographic \