Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(qemu): fix MacOS crosscompile path #1678

Merged
merged 3 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/md/melange_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ melange build [flags]
--cache-source string directory or bucket used for preloading the cache
--cleanup when enabled, the temp dir used for the guest will be cleaned up after completion (default true)
--cpu string default CPU resources to use for builds
--cpumodel string default memory resources to use for builds (default "host")
--cpumodel string default memory resources to use for builds
--create-build-log creates a package.log file containing a list of packages that were built by the command
--debug enables debug logging of build pipelines
--debug-runner when enabled, the builder pod will persist after the build succeeds or fails
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func buildCmd() *cobra.Command {
cmd.Flags().BoolVarP(&interactive, "interactive", "i", false, "when enabled, attaches stdin with a tty to the pod on failure")
cmd.Flags().BoolVar(&remove, "rm", true, "clean up intermediate artifacts (e.g. container images, temp dirs)")
cmd.Flags().StringVar(&cpu, "cpu", "", "default CPU resources to use for builds")
cmd.Flags().StringVar(&cpumodel, "cpumodel", "host", "default memory resources to use for builds")
cmd.Flags().StringVar(&cpumodel, "cpumodel", "", "default memory resources to use for builds")
cmd.Flags().StringVar(&disk, "disk", "", "disk size to use for builds")
cmd.Flags().StringVar(&memory, "memory", "", "default memory resources to use for builds")
cmd.Flags().DurationVar(&timeout, "timeout", 0, "default timeout for builds")
Expand Down
12 changes: 6 additions & 6 deletions pkg/container/qemu_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,14 +358,14 @@ func createMicroVM(ctx context.Context, cfg *Config) error {
}

// use kvm on linux, and Hypervisor.framework on macOS
if runtime.GOOS == "linux" {
if cfg.Arch.ToAPK() != apko_types.ParseArchitecture(runtime.GOARCH).ToAPK() {
baseargs = append(baseargs, "-accel", "tcg,thread=multi")
} else if _, err := os.Stat("/dev/kvm"); err == nil {
if cfg.Arch.ToAPK() != apko_types.ParseArchitecture(runtime.GOARCH).ToAPK() {
baseargs = append(baseargs, "-accel", "tcg,thread=multi")
} else {
if runtime.GOOS == "linux" {
baseargs = append(baseargs, "-accel", "kvm")
} else if runtime.GOOS == "darwin" {
baseargs = append(baseargs, "-accel", "hvf")
}
} else if runtime.GOOS == "darwin" {
baseargs = append(baseargs, "-accel", "hvf")
}

if cfg.CPUModel != "" {
Expand Down
Loading