mk/qemu: improved Nix(OS) UEFI path search

The /run/libvirt/nix-ovmf/* paths cannot be relied upon to exist. As far as I can tell, this is only available on NixOS with libvirtd enabled.

On the other hand, on any Nix platform, UEFI firmware binaries can be found relative to the the qemu binary (including when using nix shell).
This commit is contained in:
radex 2026-10-04 17:19:34 +02:00 committed by Radek Pietruszewski
parent 996da092dd
commit b668e904bc
No known key found for this signature in database

View File

@ -5,6 +5,8 @@ QEMUFLAGS?=-d guest_errors -name "Redox OS $(ARCH)"
netboot?=no
redoxer?=no
VGA_SUPPORTED=no
QEMU_PATH?=$(shell command -v $(QEMU))
QEMU_BASE_DIR?=$(shell if [ $(QEMU_PATH) ]; then realpath $$(dirname $(QEMU_PATH))/..; fi)
ifeq ($(ARCH),i586)
audio?=ac97
@ -40,6 +42,7 @@ else ifeq ($(ARCH),x86_64)
PFLASH0=$(firstword \
$(wildcard /usr/share/qemu/edk2-x86_64-code.fd) \
$(wildcard /run/libvirt/nix-ovmf/edk2-x86_64-code.fd) \
$(wildcard $(QEMU_BASE_DIR)/share/qemu/edk2-x86_64-code.fd) \
$(wildcard /opt/homebrew/opt/qemu/share/qemu/edk2s-x86_64-code.fd) \
)
endif
@ -79,6 +82,7 @@ else ifeq ($(ARCH),aarch64)
PFLASH0=$(firstword \
$(wildcard /usr/share/qemu/edk2-aarch64-code.fd) \
$(wildcard /run/libvirt/nix-ovmf/edk2-aarch64-code.fd) \
$(wildcard $(QEMU_BASE_DIR)/share/qemu/edk2-aarch64-code.fd) \
$(wildcard /opt/homebrew/opt/qemu/share/qemu/edk2-aarch64-code.fd) \
)
endif
@ -113,6 +117,7 @@ else ifeq ($(ARCH),riscv64gc)
$(wildcard /usr/share/edk2/riscv/RISCV_VIRT_CODE.fd) \
$(wildcard /usr/share/qemu/edk2-riscv-code.fd) \
$(wildcard /run/libvirt/nix-ovmf/edk2-riscv-code.fd) \
$(wildcard $(QEMU_BASE_DIR)/share/qemu/edk2-riscv-code.fd) \
$(wildcard /opt/homebrew/opt/qemu/share/qemu/edk2-riscv-code.fd) \
)
PFLASH1=$(firstword \
@ -120,6 +125,7 @@ else ifeq ($(ARCH),riscv64gc)
$(wildcard /usr/share/edk2/riscv/RISCV_VIRT_VARS.fd) \
$(wildcard /usr/share/qemu/edk2-riscv-vars.fd) \
$(wildcard /run/libvirt/nix-ovmf/edk2-riscv-vars.fd) \
$(wildcard $(QEMU_BASE_DIR)/share/qemu/edk2-riscv-vars.fd) \
$(wildcard /opt/homebrew/opt/qemu/share/qemu/edk2-riscv-vars.fd) \
)
ifneq ($(usb),no)