evansm7 / vftool

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

how to create a debian install? #15

Closed TheTechnobear closed 3 years ago

TheTechnobear commented 3 years ago

could you give us some pointers about how you created your debian install...

the issue I have is there do not appear to be any 'live' images for arm64, just intel/amd

Ive worked out the basics of how to pull a vmlinuz and initrd from an install image. so I can boot the netinst image... but it doesnt find the network driver

Im guessing this is perhaps related to your comment

An example working commandline is:

    vftool -k ~/vm/debian/Image-5.9 -d ~/vm/debian/arm64_debian.img  -p 2 -m 4096 -a "console=hvc0 root=/dev/vda1"
I've used a plain/defconfig Linux 5.9 build (not gzipped):

    $ file Image-5.9
    Image-5.9: Linux kernel ARM64 boot executable Image, little-endian, 4K pages
Note that Virtualization.framework provides all IO as virtio-pci, including the console (i.e. not a UART). The debian install kernel does not have virtio drivers, unfortunately. I ended up using debootstrap (--foreign) to install to a disc image on a Linux box... but I hear good things about Fedora etc.

in particular Note that Virtualization.framework provides all IO as virtio-pci, including the console (i.e. not a UART). The debian install kernel does not have virtio drivers

could you provide a clue/reference to what you mean by

I ended up using debootstrap (--foreign) to install to a disc image on a Linux box

Id happy create an image on a linux box if thats how I can move forward :)

Ive seen others using the unbuntu cloud image, unfortunately this is causing me issues since I seem not be able to use qemu-user-static on it, I believe because binfmt_misc is not compiled as a kernel module. I guess I could recompile the kernel...

but really I wanted a debian stretch image anyway, so if I could boot a debian install that be perfect :)

thanks for any pointers

tommythorn commented 3 years ago

You can probably boot your Debian image using the kernel from the Ubuntu netinstall. Unfortunately I don't have time to verify it.

njhsi commented 3 years ago
  1. build arm64 kernel image. "$ make Image" https://wiki.debian.org/BuildADebianKernelPackage
  2. download Debian cloud image. you may need use qemu-nbd/img to dd out the rootfs partition to debian_icloud.img file.
  3. setup debian vm, using ubuntu's initrd, check the relevant ref $ vftool -k ubuntu.vm/vmlinuz -i ubuntu.vm/initrd -d debian/debian_cloud.img ...
  4. run debian vm $ vftool -k arm64kernel.img -d debian/debian_icloud.img ...
TheTechnobear commented 3 years ago

sorry, I not quite following the what you are doing here...

  1. build a deb kernel from source - ok
  2. which debian 'cloud' image? the only 'live' image they have is not for arm64, but intel/amd?!
  3. which unbuntu vm are you using here?.... what are we aiming to setup?
  4. ok, that I presume thats the final stage, where we use the debian kernel we made in (1) and use the configured 'debian cloud' image , done in step (3)

so I guess what I dont get is , what debian cloud image are we using, and what are we doing with it in step (3)

btw... Im dont need detailed instructions here, rather just pointers to what the process is/why. (hope that makes sense)

njhsi commented 3 years ago

google is kinda friend.

https://cloud.debian.org/images/cloud/buster/20201214-484/debian-10-generic-arm64-20201214-484.qcow2

== mkdir /mnt mount /dev/vda /mnt chroot /mnt

touch /etc/cloud/cloud-init.disabled

echo 'root:root' | chpasswd

!!! delete or comment out the '/boot' line in /etc/fstab, or there will be "A start job is running on /dev/disk/.." blocking!!

ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519

cat < /etc/network/interfaces.d/enp0s1 allow-hotplug enp0s1 iface enp0s1 inet dhcp auto lo iface lo inet loopback EOF

mkdir /root/.ssh cat < /root/.ssh/authorized_keys ssh-rsa <...> EOF

exit umount /dev/vda

TheTechnobear commented 3 years ago

thank you

darvintang commented 2 years ago
  • build arm64 kernel image. "$ make Image" https://wiki.debian.org/BuildADebianKernelPackage
  • download Debian cloud image. you may need use qemu-nbd/img to dd out the rootfs partition to debian_icloud.img file.
  • setup debian vm, using ubuntu's initrd, check the relevant ref $ vftool -k ubuntu.vm/vmlinuz -i ubuntu.vm/initrd -d debian/debian_cloud.img ...
  • run debian vm $ vftool -k arm64kernel.img -d debian/debian_icloud.img ...

how to use qemu-nbd/img to dd out the rootfs partition to debian_icloud.img file?