Merge pull request #19228 from spowelljr/amd64QemuOnArm64
Support running x86 QEMU on arm64pull/19273/head
commit
bf89c6a769
|
@ -42,6 +42,7 @@ import (
|
|||
|
||||
"k8s.io/klog/v2"
|
||||
pkgdrivers "k8s.io/minikube/pkg/drivers"
|
||||
"k8s.io/minikube/pkg/minikube/detect"
|
||||
"k8s.io/minikube/pkg/minikube/exit"
|
||||
"k8s.io/minikube/pkg/minikube/firewall"
|
||||
"k8s.io/minikube/pkg/minikube/out"
|
||||
|
@ -412,14 +413,11 @@ func (d *Driver) Start() error {
|
|||
}
|
||||
|
||||
// hardware acceleration is important, it increases performance by 10x
|
||||
if runtime.GOOS == "darwin" {
|
||||
// On macOS, enable the Hypervisor framework accelerator.
|
||||
accel := hardwareAcceleration()
|
||||
if accel != "" {
|
||||
klog.Infof("Using %s for hardware acceleration", accel)
|
||||
startCmd = append(startCmd,
|
||||
"-accel", "hvf")
|
||||
} else if _, err := os.Stat("/dev/kvm"); err == nil && runtime.GOOS == "linux" {
|
||||
// On Linux, enable the Kernel Virtual Machine accelerator.
|
||||
startCmd = append(startCmd,
|
||||
"-accel", "kvm")
|
||||
"-accel", accel)
|
||||
}
|
||||
|
||||
startCmd = append(startCmd,
|
||||
|
@ -546,6 +544,21 @@ func (d *Driver) Start() error {
|
|||
return WaitForTCPWithDelay(fmt.Sprintf("%s:%d", d.IPAddress, d.SSHPort), time.Second)
|
||||
}
|
||||
|
||||
func hardwareAcceleration() string {
|
||||
if detect.IsAmd64M1Emulation() {
|
||||
return "tcg"
|
||||
}
|
||||
if runtime.GOOS == "darwin" {
|
||||
// On macOS, enable the Hypervisor framework accelerator.
|
||||
return "hvf"
|
||||
}
|
||||
if _, err := os.Stat("/dev/kvm"); err == nil && runtime.GOOS == "linux" {
|
||||
// On Linux, enable the Kernel Virtual Machine accelerator.
|
||||
return "kvm"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func isBootpdError(err error) bool {
|
||||
if runtime.GOOS != "darwin" {
|
||||
return false
|
||||
|
|
|
@ -31,6 +31,7 @@ import (
|
|||
"k8s.io/minikube/pkg/drivers/qemu"
|
||||
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/detect"
|
||||
"k8s.io/minikube/pkg/minikube/download"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
"k8s.io/minikube/pkg/minikube/localpath"
|
||||
|
@ -76,6 +77,9 @@ func qemuFirmwarePath(customPath string) (string, error) {
|
|||
if runtime.GOOS == "windows" {
|
||||
return "C:\\Program Files\\qemu\\share\\edk2-x86_64-code.fd", nil
|
||||
}
|
||||
if detect.IsAmd64M1Emulation() {
|
||||
return "/opt/homebrew/opt/qemu/share/qemu/edk2-x86_64-code.fd", nil
|
||||
}
|
||||
arch := runtime.GOARCH
|
||||
// For macOS, find the correct brew installation path for qemu firmware
|
||||
if runtime.GOOS == "darwin" {
|
||||
|
|
Loading…
Reference in New Issue