aarch64 fixes
This commit is contained in:
parent
50df5197d4
commit
97b58c722b
5 changed files with 20 additions and 19 deletions
|
|
@ -78,6 +78,12 @@ func runVM(passthroughArg string, fn func(context.Context, *vm.VM, *vm.FileManag
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
biosPath, err := store.CheckDownloadVMBIOS()
|
||||||
|
if err != nil {
|
||||||
|
slog.Error("Failed to check/download VM BIOS", "error", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
var passthroughConfig vm.PassthroughConfig
|
var passthroughConfig vm.PassthroughConfig
|
||||||
|
|
||||||
if passthroughArg != "" {
|
if passthroughArg != "" {
|
||||||
|
|
@ -92,6 +98,7 @@ func runVM(passthroughArg string, fn func(context.Context, *vm.VM, *vm.FileManag
|
||||||
}},
|
}},
|
||||||
|
|
||||||
MemoryAlloc: vmMemAllocFlag,
|
MemoryAlloc: vmMemAllocFlag,
|
||||||
|
BIOSPath: biosPath,
|
||||||
|
|
||||||
PassthroughConfig: passthroughConfig,
|
PassthroughConfig: passthroughConfig,
|
||||||
ExtraPortForwardingRules: forwardPortsRules,
|
ExtraPortForwardingRules: forwardPortsRules,
|
||||||
|
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
package constants
|
|
||||||
|
|
||||||
import "runtime"
|
|
||||||
|
|
||||||
func GetUnixWorkArch() string {
|
|
||||||
arch := "x86_64"
|
|
||||||
if runtime.GOOS == "arm64" {
|
|
||||||
arch = "arm64"
|
|
||||||
}
|
|
||||||
|
|
||||||
// CPU architectures other than amd64 and arm64 are not yet natively supported.
|
|
||||||
// Running on a non-officially-supported arch will result in use of x86_64 VM.
|
|
||||||
return arch
|
|
||||||
}
|
|
||||||
|
|
@ -19,7 +19,7 @@ var alpineBaseImageHash []byte
|
||||||
func init() {
|
func init() {
|
||||||
baseAlpineArch = "x86_64"
|
baseAlpineArch = "x86_64"
|
||||||
alpineBaseImageHash = utils.MustDecodeHex("925f6bc1039a0abcd0548d2c3054d54dce31cfa03c7eeba22d10d85dc5817c98")
|
alpineBaseImageHash = utils.MustDecodeHex("925f6bc1039a0abcd0548d2c3054d54dce31cfa03c7eeba22d10d85dc5817c98")
|
||||||
if runtime.GOOS == "arm64" {
|
if runtime.GOARCH == "arm64" {
|
||||||
baseAlpineArch = "aarch64"
|
baseAlpineArch = "aarch64"
|
||||||
alpineBaseImageHash = utils.MustDecodeHex("c94593729e4577650d9e73ada28e3cbe56964ab2a27240364f8616e920ed6d4e")
|
alpineBaseImageHash = utils.MustDecodeHex("c94593729e4577650d9e73ada28e3cbe56964ab2a27240364f8616e920ed6d4e")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,9 +81,9 @@ func (s *Storage) BuildVMImageWithInterruptHandler(showBuilderVMDisplay bool, ov
|
||||||
return errors.Wrap(err, "check/download base image")
|
return errors.Wrap(err, "check/download base image")
|
||||||
}
|
}
|
||||||
|
|
||||||
biosPath, err := s.CheckDownloadCPUArchSpecifics()
|
biosPath, err := s.CheckDownloadVMBIOS()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "check/download cpu arch specifics")
|
return errors.Wrap(err, "check/download vm bios")
|
||||||
}
|
}
|
||||||
|
|
||||||
s.logger.Info("Building VM image", "tags", constants.GetAlpineBaseImageTags(), "overwriting", removed, "dst", vmImagePath)
|
s.logger.Info("Building VM image", "tags", constants.GetAlpineBaseImageTags(), "overwriting", removed, "dst", vmImagePath)
|
||||||
|
|
@ -116,7 +116,7 @@ func (s *Storage) DataDirPath() string {
|
||||||
return s.path
|
return s.path
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) CheckDownloadCPUArchSpecifics() (string, error) {
|
func (s *Storage) CheckDownloadVMBIOS() (string, error) {
|
||||||
if runtime.GOARCH == "arm64" {
|
if runtime.GOARCH == "arm64" {
|
||||||
p, err := s.CheckDownloadAarch64EFIImage()
|
p, err := s.CheckDownloadAarch64EFIImage()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -126,6 +126,8 @@ func (s *Storage) CheckDownloadCPUArchSpecifics() (string, error) {
|
||||||
return p, nil
|
return p, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// On x86_64, there is no requirement to supply QEMU with any BIOS images.
|
||||||
|
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
vm/vm.go
8
vm/vm.go
|
|
@ -168,7 +168,13 @@ func NewVM(logger *slog.Logger, cfg VMConfig) (*VM, error) {
|
||||||
driveArgs += ",snapshot=on"
|
driveArgs += ",snapshot=on"
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdArgs = append(cmdArgs, "-drive", driveArgs, "-device", "virtio-blk-pci,drive=disk"+fmt.Sprint(i)+",bootindex="+fmt.Sprint(i))
|
devArgs := "virtio-blk-pci,drive=disk" + fmt.Sprint(i)
|
||||||
|
|
||||||
|
if cfg.CdromImagePath == "" {
|
||||||
|
devArgs += ",bootindex=" + fmt.Sprint(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
cmdArgs = append(cmdArgs, "-drive", driveArgs, "-device", devArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(cfg.PassthroughConfig.USB) != 0 {
|
if len(cfg.PassthroughConfig.USB) != 0 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue