Add Rosetta support for applehv(arm64)

Signed-off-by: Shion Tanaka <shtanaka@redhat.com>
This commit is contained in:
Shion Tanaka 2024-02-29 02:09:20 +09:00
parent 045b06084d
commit 2f0a04c6ee
6 changed files with 27 additions and 0 deletions

View File

@ -943,6 +943,11 @@ Virtualization provider to be used for running a podman-machine VM. Empty value
is interpreted as the default provider for the current host OS. On Linux/Mac
default is `QEMU` and on Windows it is `WSL`.
**rosetta**="true"
Rosetta supports running x86_64 Linux binaries on a Podman machine on Apple silicon.
The default value is `true`. Supported on AppleHV(arm64) machines only.
## FARMS TABLE
The `farms` table contains configuration options used to group up remote connections into farms that will be used when sending out builds to different machines in a farm via `podman buildfarm`.

View File

@ -663,6 +663,8 @@ type MachineConfig struct {
Volumes attributedstring.Slice `toml:"volumes,omitempty"`
// Provider is the virtualization provider used to run podman-machine VM
Provider string `toml:"provider,omitempty"`
// Rosetta is the flag to enable Rosetta in the podman-machine VM on Apple Silicon
Rosetta bool `toml:"rosetta,omitempty"`
}
// FarmConfig represents the "farm" TOML config tables

View File

@ -562,4 +562,15 @@ var _ = Describe("Config Local", func() {
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(config2.Machine.Memory).To(gomega.Equal(uint64(1024)))
})
It("Get Rosetta value", func() {
// Given
config, err := New(nil)
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(config.Machine.Rosetta).To(gomega.BeTrue())
// When
config2, err := NewConfig("testdata/containers_default.conf")
// Then
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(config2.Machine.Rosetta).To(gomega.BeFalse())
})
})

View File

@ -856,6 +856,11 @@ default_sysctls = [
#
#provider = ""
# Rosetta supports running x86_64 Linux binaries on a Podman machine on Apple silicon.
# The default value is `true`. Supported on AppleHV(arm64) machines only.
#
#rosetta=true
# The [machine] table MUST be the last entry in this file.
# (Unless another table is added)
# TOML does not provide a way to end a table other than a further table being

View File

@ -293,6 +293,7 @@ func defaultMachineConfig() MachineConfig {
Memory: 2048,
User: getDefaultMachineUser(),
Volumes: attributedstring.NewSlice(getDefaultMachineVolumes()),
Rosetta: true,
}
}

View File

@ -316,6 +316,9 @@ image = "https://example.com/$OS/$ARCH/foobar.ami"
memory=1024
# Rosetta supports running x86_64 Linux binaries on a Podman machine on Apple silicon.
# The default value is `true`. Supported on AppleHV(arm64) machines only.
rosetta=false
# The [machine] table MUST be the last thing in this file.
# (Unless another table is added)