Closed williamtheaker closed 1 month ago
It is not a use case we (dependent applications; Podman Machine, CRC) have, but nothing that prevents this.
I found this project via Podman actually! Have you been able to run macOS guests with vfkit? I've tried using .img files built by UTM and the last AGPLv3 build of Tart (0.38.0), but neither seem to actually boot despite vz not throwing an error. It's the same behavior as using an empty disk image.
vfkit \
--cpus 2 --memory 2048 \
--bootloader efi,variable-store=efi-variable-store,create \
--device virtio-blk,path=/Users/foo/.tart/vms/sonoma001/disk.img --device virtio-input,keyboard --device virtio-input,pointing --device virtio-gpu,width=1920,height=1080 --gui
INFO[0000] &{2 2048 {[efi variable-store=efi-variable-store create] true} [virtio-blk,path=/Users/foo/.tart/vms/sonoma001/disk.img virtio-input,keyboard virtio-input,pointing virtio-gpu,width=1920,height=1080] none:// true}
INFO[0000] boot parameters: &{EFIVariableStorePath:efi-variable-store CreateVariableStore:true}
INFO[0000]
INFO[0000] virtual machine parameters:
INFO[0000] vCPUs: 2
INFO[0000] memory: 2048 MiB
INFO[0000]
INFO[0000] Adding virtio-blk device (imagePath: /Users/foo/.tart/vms/sonoma001/disk.img)
INFO[0000] Adding virtio-input keyboard device
INFO[0000] Adding virtio-input pointing device
INFO[0000] Adding virtio-gpu device
INFO[0000] virtual machine is running
INFO[0000] waiting for VM to stop
INFO[0000] VM is stopped
^ running vfkit version: 0.5.1
I can get a code signing cert to compile vz with the required entitlements and test building an image with it, but wanted to make sure I'm not doing something obviously wrong first.
It looks like this might not work even when supplying an image that works with other tools because vfkit hasn't implemented VZMacPlatformConfiguration or VZMacOSBootLoader.
If you compare the vz examples for macOS and Linux, you can see the Linux VM uses slightly different calls, like VZGenericPlatformConfiguration.
I could be wrong about all this though 😅
It looks like this might not work even when supplying an image that works with other tools because vfkit hasn't implemented VZMacPlatformConfiguration or VZMacOSBootLoader.
If you compare the vz examples for macOS and Linux, you can see the Linux VM uses slightly different calls, like VZGenericPlatformConfiguration.
I could be wrong about all this though 😅
Yes, a few things are missing in vfkit
to run macOS guests, including the ones you mention (haven't checked if there are more :) This would be a nice addition to vfkit
, but not something I'm planning to work on soon.
If you want to try to implement this, I'd be happy to help with guidance/suggestions/... if needed.
A few thoughts about this (which might be wrong ;)
--bootloader macos
config option*vz.MacPlatformConfiguration
automatically and pass it to the VM--runtime-dir
option is needed, which I've wanted to have for a whileyou can see the Linux VM uses slightly different calls, like VZGenericPlatformConfiguration.
vfkit does not make use of this, I don't know if it should..
Thank you for the suggestions on how to get started. I'll open up a draft pull request when I have something worth sharing.
you can see the Linux VM uses slightly different calls, like VZGenericPlatformConfiguration.
vfkit does not make use of this, I don't know if it should..
Implementing VZGenericPlatformConfiguration would require dropping macOS 11 support.
It looks like the most common use of vfkit is running GNU/Linux guests, but of course the Virtualization framework also supports running macOS guests and vz can download and run macOS guests from .ipsw files. Is it possible to run a macOS guest using vfkit (ideally from a .ipsw)?