[Merge] ~adam-retter/uvtool:emu-riscv64 into uvtool:main
Christian Ehrhardt
mp+457345 at code.launchpad.net
Thu Dec 14 12:11:41 UTC 2023
The need of sudo.
For armhf (the only emulation so far) there was no working bootloader that could read the image and boot from the kernel/initrd installed on that image/disk.
Due to that the code - in emulation mode - goes like:
uvt-kvm: error: emulation needs root to extract kernel/initrd
But that is not true for riscv64 emulation.
On one hand we set the uboot.elf as kernel which then does the right thing.
And since it does the right thing the extracted initrd is added and ignored.
A guest starting has:
<kernel>/usr/lib/u-boot/qemu-riscv64_smode/uboot.elf</kernel>
<initrd>/var/lib/uvtool/libvirt/images/jammy-test-riscv64-initrd.img</initrd>
But you can remove the initrd line as it works just fine with the bootloader.
In fact, there are two options here
a) keep it similar to armhf
- no need to add u-boot-qemu and opensbi as dependency (as we'd skip the bootloader by providing it from the host)
- remove <kernel>/usr/lib/u-boot/qemu-riscv64_smode/uboot.elf</kernel> from the template
- continue to use sudo to run it
=> Tested and works
b) we want to be more of a real VM
- change the code flow for emulation into
1. one that needs extracted kernel/initrd on the host (armhf) and
2. one that does not (riscv64) not do that at all.
- This will also get rid of the need for `sudo`
If you like (b) more (I do) I've already written and tested that a bit.
Please grab for your branch
https://git.launchpad.net/~paelzer/uvtool/commit/?id=d5893f754b7b09f91a95d30382dde47e1e581a8a
from
https://code.launchpad.net/~paelzer/uvtool/+git/uvtool/+ref/emu-riscv64-extra
Sorry, but my testing was very minimal and I had no time to look for typos, or silly mistakes.
So please have a look and fix it up if needed.
--
https://code.launchpad.net/~adam-retter/uvtool/+git/uvtool/+merge/457345
Your team Ubuntu Sponsors is requested to review the proposed merge of ~adam-retter/uvtool:emu-riscv64 into uvtool:main.
More information about the Ubuntu-sponsors
mailing list