From 4c29b8231b3c89b00d83d70c7b828c79822d9a1a Mon Sep 17 00:00:00 2001 From: kairvee <145572028+kairveeehh@users.noreply.github.com> Date: Wed, 12 Feb 2025 16:16:25 +0530 Subject: [PATCH] Fix incorrect firmware path suggestion for aarch64 in qemu.go Previously, the error message in qemu.go incorrectly suggested copying "edk-/usr/bin/qemu-system-aarch64-code.fd" instead of the correct firmware file, "edk-aarch64-code.fd". This was due to qemuExe containing the full path to the QEMU binary instead of just the architecture name. This commit ensures that only "aarch64" is used in the error message, resulting in the correct suggestion: "edk-aarch64-code.fd". Signed-off-by: Kairvee Vaswani --- pkg/qemu/qemu.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/qemu/qemu.go b/pkg/qemu/qemu.go index 9bd5a8c521bd..3668095c22de 100644 --- a/pkg/qemu/qemu.go +++ b/pkg/qemu/qemu.go @@ -1159,7 +1159,8 @@ func getFirmware(qemuExe string, arch limayaml.Arch) (string, error) { } if arch == limayaml.X8664 { - return "", fmt.Errorf("could not find firmware for %q (hint: try setting `firmware.legacyBIOS` to `true`)", qemuExe) + return "", fmt.Errorf("could not find firmware for %q (hint: try setting `firmware.legacyBIOS` to `true`)", arch) } - return "", fmt.Errorf("could not find firmware for %q (hint: try copying the \"edk-%s-code.fd\" firmware to $HOME/.local/share/qemu/)", arch, qemuExe) + qemuArch := strings.TrimPrefix(filepath.Base(qemuExe), "qemu-system-") + return "", fmt.Errorf("could not find firmware for %q (hint: try copying the \"edk-%s-code.fd\" firmware to $HOME/.local/share/qemu/)", arch, qemuArch) }