summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnjan Nath <kaludios@gmail.com>2022-05-18 22:43:56 +0530
committerAnjan Nath <kaludios@gmail.com>2022-05-23 22:04:52 +0530
commit8fbb933f5abfc19994aab65d24e929587f6999ef (patch)
treee9277c21899e8329676c053ba0f2aea40be3b93c
parent12964c7b93457a05441db081270a51083a1398f4 (diff)
downloadpodman-8fbb933f5abfc19994aab65d24e929587f6999ef.tar.gz
podman-8fbb933f5abfc19994aab65d24e929587f6999ef.tar.bz2
podman-8fbb933f5abfc19994aab65d24e929587f6999ef.zip
look for firmware based on the path of qemu binary
this allows users to use a qemu installation that is not in the default /usr/local/bin location a user can configure engine.helper_binaries_dir key or update PATH to include the installation location to find the qemu binary [NO NEW TESTS NEEDED] Signed-off-by: Anjan Nath <kaludios@gmail.com>
-rw-r--r--pkg/machine/qemu/options_darwin_arm64.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkg/machine/qemu/options_darwin_arm64.go b/pkg/machine/qemu/options_darwin_arm64.go
index 4c954af00..2b40d3b6f 100644
--- a/pkg/machine/qemu/options_darwin_arm64.go
+++ b/pkg/machine/qemu/options_darwin_arm64.go
@@ -4,6 +4,8 @@ import (
"os"
"os/exec"
"path/filepath"
+
+ "github.com/containers/common/pkg/config"
)
var (
@@ -38,6 +40,22 @@ func getOvmfDir(imagePath, vmName string) string {
}
/*
+ * When QEmu is installed in a non-default location in the system
+ * we can use the qemu-system-* binary path to figure the install
+ * location for Qemu and use it to look for edk2-code-fd
+ */
+func getEdk2CodeFdPathFromQemuBinaryPath() string {
+ cfg, err := config.Default()
+ if err == nil {
+ execPath, err := cfg.FindHelperBinary(QemuCommand, true)
+ if err == nil {
+ return filepath.Clean(filepath.Join(filepath.Dir(execPath), "..", "share", "qemu"))
+ }
+ }
+ return ""
+}
+
+/*
* QEmu can be installed in multiple locations on MacOS, especially on
* Apple Silicon systems. A build from source will likely install it in
* /usr/local/bin, whereas Homebrew package management standard is to
@@ -45,6 +63,7 @@ func getOvmfDir(imagePath, vmName string) string {
*/
func getEdk2CodeFd(name string) string {
dirs := []string{
+ getEdk2CodeFdPathFromQemuBinaryPath(),
"/opt/homebrew/opt/podman/libexec/share/qemu",
"/usr/local/share/qemu",
"/opt/homebrew/share/qemu",