Some work on supporting arm64
This commit is contained in:
parent
3cbe45c420
commit
8fd8def548
3 changed files with 19 additions and 5 deletions
1
go.mod
1
go.mod
|
|
@ -6,7 +6,6 @@ require (
|
|||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
|
||||
github.com/alessio/shellescape v1.4.2
|
||||
github.com/bramvdbogaerde/go-scp v1.2.1
|
||||
github.com/google/uuid v1.3.1
|
||||
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/sethvargo/go-password v0.2.0
|
||||
|
|
|
|||
2
go.sum
2
go.sum
|
|
@ -7,8 +7,6 @@ github.com/bramvdbogaerde/go-scp v1.2.1/go.mod h1:s4ZldBoRAOgUg8IrRP2Urmq5qqd2yP
|
|||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
|
||||
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5 h1:Ii+DKncOVM8Cu1Hc+ETb5K+23HdAMvESYE3ZJ5b5cMI=
|
||||
|
|
|
|||
21
vm/vm.go
21
vm/vm.go
|
|
@ -85,8 +85,21 @@ func NewVM(logger *slog.Logger, cfg VMConfig) (*VM, error) {
|
|||
|
||||
// TODO: Configurable memory allocation
|
||||
|
||||
baseCmd := "qemu-system-x86_64"
|
||||
cmdArgs := []string{"-serial", "stdio", "-enable-kvm", "-m", "2048", "-smp", fmt.Sprint(runtime.NumCPU())}
|
||||
cmdArgs := []string{"-serial", "stdio", "-m", "2048", "-smp", fmt.Sprint(runtime.NumCPU())}
|
||||
|
||||
baseCmd := "qemu-system"
|
||||
|
||||
switch runtime.GOARCH {
|
||||
case "amd64":
|
||||
cmdArgs = append(cmdArgs, "-accel", "kvm")
|
||||
baseCmd += "-x86_64"
|
||||
case "arm64":
|
||||
// TODO: EFI firmware path is temporary, for dev purposes only.
|
||||
cmdArgs = append(cmdArgs, "-accel", "hvf", "-bios", "/opt/homebrew/Cellar/qemu/8.1.0/share/qemu/edk2-aarch64-code.fd", "-M", "virt,highmem=off", "-cpu", "cortex-a57")
|
||||
baseCmd += "-aarch64"
|
||||
default:
|
||||
return nil, fmt.Errorf("arch '%v' is not supported", runtime.GOARCH)
|
||||
}
|
||||
|
||||
netdevOpts := "user,id=net0,hostfwd=tcp:127.0.0.1:" + fmt.Sprint(sshPort) + "-:22"
|
||||
|
||||
|
|
@ -109,6 +122,10 @@ func NewVM(logger *slog.Logger, cfg VMConfig) (*VM, error) {
|
|||
|
||||
if !cfg.ShowDisplay {
|
||||
cmdArgs = append(cmdArgs, "-display", "none")
|
||||
if runtime.GOARCH == "arm64" {
|
||||
// No video is configured by default in ARM. This will enable it.
|
||||
cmdArgs = append(cmdArgs, "-device", "virtio-gpu-device")
|
||||
}
|
||||
}
|
||||
|
||||
if len(cfg.USBDevices) != 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue