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) <noreply@anthropic.com>
This commit is contained in:
@@ -133,12 +133,24 @@ else
|
|||||||
record "host.nested_virt" "skip" "No VMX/SVM — QEMU boot tests will be slower"
|
record "host.nested_virt" "skip" "No VMX/SVM — QEMU boot tests will be slower"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check OVMF
|
# Check OVMF — Arch uses split CODE/VARS files, others use a single OVMF.fd
|
||||||
OVMF=""
|
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
|
[ -f "$p" ] && OVMF="$p" && break
|
||||||
done
|
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)
|
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+)"
|
[ -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=""
|
KVM_FLAG=""
|
||||||
[ -c /dev/kvm ] && KVM_FLAG="-enable-kvm"
|
[ -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 \
|
timeout 60 qemu-system-x86_64 \
|
||||||
${KVM_FLAG} \
|
${KVM_FLAG} \
|
||||||
-m 2G \
|
-m 2G \
|
||||||
-smp 2 \
|
-smp 2 \
|
||||||
-bios "$OVMF" \
|
${OVMF_FLAGS} \
|
||||||
-cdrom "${PROJECT_ROOT}/darkforge-live.iso" \
|
-cdrom "${PROJECT_ROOT}/darkforge-live.iso" \
|
||||||
-drive "file=${QEMU_DISK},format=qcow2,if=virtio" \
|
-drive "file=${QEMU_DISK},format=qcow2,if=virtio" \
|
||||||
-nographic \
|
-nographic \
|
||||||
|
|||||||
Reference in New Issue
Block a user