mk/qemu: more helpful error on missing UEFI

As best I can tell, on aarch64 and riscv64gc, the UEFI firmware is *required* for Redox to run. If not found, qemu will still run, but will get stuck.

It's better to error out explicitly and early.

This does not appear to be the case on x86_64 where skipping the firmware load still appears to boot Redox successfully, hence I didn't add the error there.
This commit is contained in:
radex 2026-10-04 17:24:16 +02:00 committed by Radek Pietruszewski
parent b668e904bc
commit 21f69c1c43
No known key found for this signature in database

View File

@ -85,6 +85,7 @@ else ifeq ($(ARCH),aarch64)
$(wildcard $(QEMU_BASE_DIR)/share/qemu/edk2-aarch64-code.fd) \
$(wildcard /opt/homebrew/opt/qemu/share/qemu/edk2-aarch64-code.fd) \
)
PFLASH0_NEEDED=yes
endif
else
FIRMWARE=$(BUILD)/qemu_uboot.rom
@ -120,6 +121,7 @@ else ifeq ($(ARCH),riscv64gc)
$(wildcard $(QEMU_BASE_DIR)/share/qemu/edk2-riscv-code.fd) \
$(wildcard /opt/homebrew/opt/qemu/share/qemu/edk2-riscv-code.fd) \
)
PFLASH0_NEEDED=yes
PFLASH1=$(firstword \
$(wildcard /usr/share/qemu-efi-riscv64/RISCV_VIRT_VARS.fd) \
$(wildcard /usr/share/edk2/riscv/RISCV_VIRT_VARS.fd) \
@ -128,6 +130,7 @@ else ifeq ($(ARCH),riscv64gc)
$(wildcard $(QEMU_BASE_DIR)/share/qemu/edk2-riscv-vars.fd) \
$(wildcard /opt/homebrew/opt/qemu/share/qemu/edk2-riscv-vars.fd) \
)
PFLASH1_NEEDED=yes
ifneq ($(usb),no)
QEMUFLAGS+=-device qemu-xhci -device usb-kbd -device usb-tablet
endif
@ -367,6 +370,10 @@ $(BUILD)/fw_vars.bin: $(PFLASH1)
chmod +w "$@"
endif
qemu-deps:
$(if $(PFLASH0_NEEDED),$(if $(PFLASH0),,$(error UEFI firmware needed but not found)),)
$(if $(PFLASH1_NEEDED),$(if $(PFLASH1),,$(error UEFI variables needed but not found)),)
$(EXTRA_DISK):
truncate -s 1g $@