-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Specify path to EFI firmware for aarch64
Without this, there will be no bootloader to start the VM image. Signed-off-by: Christophe Fergeau <[email protected]>
- Loading branch information
Showing
3 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package e2e | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
) | ||
|
||
func efiArgs() (string, error) { | ||
// file may not exist, that's ok | ||
_ = os.Remove("ovmf_vars.fd") | ||
ovmfVars, err := os.Create("ovmf_vars.fd") | ||
if err != nil { | ||
return "", err | ||
} | ||
defer ovmfVars.Close() | ||
if err := ovmfVars.Truncate(67108864); err != nil { | ||
return "", err | ||
} | ||
|
||
edk2Path := getEdk2CodeFd("edk2-aarch64-code.fd") | ||
return fmt.Sprintf(`-drive file=%s,if=pflash,format=raw,readonly=on -drive file=%s,if=pflash,format=raw `, edk2Path, ovmfVars.Name()), nil | ||
} | ||
|
||
/* | ||
* 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 { | ||
return filepath.Clean(filepath.Join(filepath.Dir(qemuExecutable()), "..", "share", "qemu")) | ||
} | ||
|
||
/* | ||
* 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 | ||
* install in /opt/homebrew | ||
*/ | ||
func getEdk2CodeFd(name string) string { | ||
dirs := []string{ | ||
getEdk2CodeFdPathFromQemuBinaryPath(), | ||
"/opt/homebrew/opt/podman/libexec/share/qemu", | ||
"/usr/local/share/qemu", | ||
"/opt/homebrew/share/qemu", | ||
} | ||
for _, dir := range dirs { | ||
fullpath := filepath.Join(dir, name) | ||
if _, err := os.Stat(fullpath); err == nil { | ||
return fullpath | ||
} | ||
} | ||
return name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//go:build !(darwin && arm64) | ||
|
||
package e2e | ||
|
||
func efiArgs() (string, error) { | ||
return "", nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters