-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add rosetta support #57
Conversation
pkg/vf/rosetta_amd64.go
Outdated
) | ||
|
||
func (dev *RosettaShare) toVz() (vz.DirectorySharingDeviceConfiguration, error) { | ||
return nil, fmt.Errorf("rosetta is unsupported on non-arm64 platforms") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this prevent startup or only provide an error message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will prevent startup (though I haven't tested it)
This adds support for `--device rosetta,mountTag=something` on the commandline. This is only available on system with Apple CPUs, vfkit will error out if this option is used on Intel CPUs. Once the VM is running and the rosetta share is mounted, rosetta support can be enabled by creating this file: $ cat /etc/binfmt.d/rosetta.conf :rosetta:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00:\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/mnt/rosetta:F and then running `systemctl restart systemd-binfmt` See these links for more details: https://developer.apple.com/documentation/virtualization/running_intel_binaries_in_linux_vms_with_rosetta?language=objc https://docs.kernel.org/admin-guide/binfmt-misc.html https://www.man7.org/linux/man-pages/man5/binfmt.d.5.html This fixes crc-org#23
When comparing strings with JSON content, assert.JSONEq is better than assert.Equal as it will give better output when the 2 strings don't match, and it tests for equivalence, not strict equality. This means changes in field order is not a failure for example.
To test this I did following and it is failing when restart diff --git a/go.mod b/go.mod
index 6fbb482a..32ff9879 100644
--- a/go.mod
+++ b/go.mod
@@ -210,3 +210,5 @@ require (
)
replace github.com/apcera/gssapi => github.com/openshift/gssapi v0.0.0-20161010215902-5fb4217df13b
+
+replace github.com/crc-org/vfkit => /Users/prkumar/work/github/vfkit
diff --git a/go.sum b/go.sum
index 44d1e108..63f3b69a 100644
--- a/go.sum
+++ b/go.sum
@@ -134,8 +134,6 @@ github.com/crc-org/admin-helper v0.0.12-0.20221012143549-fd5acd1c478e h1:T6m4n9Z
github.com/crc-org/admin-helper v0.0.12-0.20221012143549-fd5acd1c478e/go.mod h1:CerKYGP0C/zPeDd6T/k8H7TmyKKBWhfhAzAupcSKPMU=
github.com/crc-org/machine v0.0.0-20221028075518-f9b43442196b h1:VPbW5D21B1WToPvEA/EGwhi4e3lXevmRff9M1lUTc5g=
github.com/crc-org/machine v0.0.0-20221028075518-f9b43442196b/go.mod h1:9bEsvgLE3LIPfvGATt9Mo73gG1CKKS6A/++VqOONKqc=
-github.com/crc-org/vfkit v0.1.1 h1:F0QXj9ik1mhVq2R8FmWFhQH8SuFGYP5Xu2KF7cTvALs=
-github.com/crc-org/vfkit v0.1.1/go.mod h1:vjZiHDacUi0iLosvwyLvqJvJXQhByzlLQbMkdIfCQWk=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI=
diff --git a/pkg/drivers/vfkit/driver_darwin.go b/pkg/drivers/vfkit/driver_darwin.go
index 41c5e38a..63388b0b 100644
--- a/pkg/drivers/vfkit/driver_darwin.go
+++ b/pkg/drivers/vfkit/driver_darwin.go
@@ -235,6 +235,16 @@ func (d *Driver) Start() error {
return err
}
+ // Rosetta support
+ dev, err = config.RosettaShareNew("vz-rosetta")
+ if err != nil {
+ return err
+ }
+ err = vm.AddDevice(dev)
+ if err != nil {
+ return err
+ }
+ And then using it microshift preset it fails
|
There are some permission issues, maybe related to selinux. I'd recommend also adding empty |
Tried with To test out end to end for microshift bundle I need to remove the
|
You can also add empty files of the same names in |
That I tried and not working because it is with mounted binary and not the
|
Anyway all this selinux issue shouldn't stop this PR to get merge, PR is working as expected. /lgtm |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: praveenkumar The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
maybe |
This adds support for
--device rosetta,mountTag=something
on thecommandline. This is only available on system with Apple CPUs, vfkit
will error out if this option is used on Intel CPUs.
Once the VM is running and the rosetta share is mounted, rosetta support can be enabled by creating this file:
and then running
systemctl restart systemd-binfmt
See these links for more details:
https://developer.apple.com/documentation/virtualization/running_intel_binaries_in_linux_vms_with_rosetta?language=objc
https://docs.kernel.org/admin-guide/binfmt-misc.html
https://www.man7.org/linux/man-pages/man5/binfmt.d.5.html
This fixes #23