evansm7 / vftool

A simple macOS Virtualisation.framework wrapper
MIT License
987 stars 68 forks source link

Required kernel modules? #17

Open mbreese opened 3 years ago

mbreese commented 3 years ago

Is there a list of what kernel modules are required for an image to boot? I'm trying this on an Intel Mac (Big Sur).

I've been successful in getting an Ubuntu VM to load (using the Ubuntu cloud images and following the instructions from @droidix https://github.com/evansm7/vftool/issues/2#issuecomment-735455161). I've also managed to get the cloud image of Debian 10 to work, by adding certain virtio modules to the initrd image, but it's still strange...

Basically, the Debian kernel works with the following modules added:

However -- it doesn't work exactly like this. When loading the kernel with the following options -a "root=/dev/vda console=hvc0", the VM goes right into the initramfs image. Adding virtio_console got me this far.

Steps (in either a chroot from the initramfs image or using the Ubuntu kernel/initrd to edit the Debian initrd)

(initramfs) mkdir /mnt
(initramfs) mount -t ext4 /dev/vda /mnt
root@(none):/# echo "virtio_console" >> /etc/initramfs-tools/modules 
root@(none):/# update-initramfs -u

I then copied the file /boot/initrd.img-4.19.0-13-amd64 image out of the disk image to use with vftool.

The strangeness is that I can get a full VM to boot when I add the debug option to the kernel command. Starting the vm with -a "root=/dev/vda console=hvc0 debug" successfully boots the Debian VM. It seems like there is a timing issue where the storage device isn't found unless the kernel is in debug mode, but I don't have any guess as to where it is.

I'd like to be able to use as stock of a Debian kernel as possible, so does anyone know which kernel modules or arguments I might need to try to get this to work stably?

Here is the full command line that works:

vftool -k vmlinuz-4.19.0-13-amd64 -i newinitrd -d debian_10_cloud.img -t 1 -m 2048 -a "root=/dev/vda console=hvc0 debug"      

This is the command that doesn't:

vftool -k vmlinuz-4.19.0-13-amd64 -i newinitrd -d debian_10_cloud.img -t 1 -m 2048 -a "root=/dev/vda console=hvc0"      

I have the same results if I'm using the full disk with partitions (using root=/dev/vda1) and only the ext4 partition (using root=/dev/vda).

seanenck commented 3 years ago

I was able to bootstrap a debian instance using the comment mentioned above and additionally added notes.

Though, in my case, I'm using bullseye - I wonder if that would impact the behavior seen previously (I'm not going to try and use buster/current stable because I need a few things in bullseye anyway)

fanvinga commented 3 years ago

You can check my PR #20 😁

amit-bst commented 2 years ago

@fanvinga have any idea for android vm ?