Skip to content

Allow finding uefi firmware for qemu windows #982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions pkg/qemu/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,11 @@ func Cmdline(cfg Config) (string, []string, error) {
if err != nil {
return "", nil, err
}
args = append(args, "-drive", fmt.Sprintf("if=pflash,format=raw,readonly=on,file=%s", firmware))
if runtime.GOOS != "windows" {
args = append(args, "-drive", fmt.Sprintf("if=pflash,format=raw,readonly=on,file=%s", firmware))
} else {
args = append(args, "-bios", firmware)
}
}

// Disk
Expand Down Expand Up @@ -634,10 +638,12 @@ func getFirmware(qemuExe string, arch limayaml.Arch) (string, error) {
localDir := filepath.Dir(binDir) // "/usr/local"
userLocalDir := filepath.Join(currentUser.HomeDir, ".local") // "$HOME/.local"

relativePath := fmt.Sprintf("share/qemu/edk2-%s-code.fd", arch)
firmwareName := fmt.Sprintf("edk2-%s-code.fd", arch)
relativePath := filepath.Join("share", "qemu", firmwareName)
candidates := []string{
filepath.Join(userLocalDir, relativePath), // XDG-like
filepath.Join(localDir, relativePath), // macOS (homebrew)
filepath.Join(userLocalDir, relativePath), // XDG-like
filepath.Join(localDir, relativePath), // macOS (homebrew)
filepath.Join(binDir, "share", firmwareName), // Windows
}

switch arch {
Expand Down