From 21f69c1c43c6f432a293b2052b3ee5e6c296e620 Mon Sep 17 00:00:00 2001 From: radex Date: Sun, 4 Oct 2026 17:24:16 +0200 Subject: [PATCH] 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. --- mk/qemu.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mk/qemu.mk b/mk/qemu.mk index 03144ccb0..2e49790b1 100644 --- a/mk/qemu.mk +++ b/mk/qemu.mk @@ -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 $@