On Tue, May 23, 2023 at 11:59:41AM +0100, Richard W.M. Jones wrote: > I just came across this thread while trying to update the libvirt > instructions on that page. Specifically I need to add these to the > qemu command line: > > -bios /path/to/u-boot-spl.bin > -device loader,file=/path/to/u-boot.itb,addr=0x80200000 I recommend going through the entire thread if you haven't already, it's full of interesting details. And it would be useful to have another pair of eyes go over it, just in case something was missed :) Anyway, we found that the -device loader incantation above is effectively equivalent to -kernel, so you can just use that instead. Both -bios and -kernel are exposed by libvirt through XML elements of the same names. Further, since QEMU loads OpenSBI as -bios by default these days, you don't even need that part and can just use -kernel to point to the u-boot.bin file. In this case, you should use the file that would be installed as /usr/share/uboot/qemu-riscv64_smode/u-boot.bin by the uboot-images-riscv64 Fedora package. > Was any change made to libvirt / virt-install to make this possible? Not yet. I would love to make booting a riscv64 VM a simple case of adding <os firmware='u-boot'/> to the domain XML, and I'm more than willing to write the necessary libvirt patches, but a couple of things need to happen first: * the uboot-images-riscv64 package needs to be made available on non-riscv64 architectures; * a JSON firmware descriptor needs to be added to said package, pointing to /usr/share/uboot/qemu-riscv64_smode/u-boot.bin. The first part might be tricky, as it will probably involve a cross-compiler, but other distributions seem to have managed to do it already so I don't expect Fedora to face significant roadblocks. For the second part, something along the lines of # /usr/share/qemu/firmware/30-uboot-riscv64-smode.json { "interface-types": [ "uboot" ], "mapping": { "device": "kernel", "filename": /usr/share/uboot/qemu-riscv64_smode/u-boot.bin" }, "targets": [ { "architecture": "riscv64", "machines": [ "virt" ] } ] } should do the trick, but note that I haven't tested it :) My only question is why the u-boot-spl.bin/u-boot.itb approach was chosen to be documented in the Fedora wiki? Is there something that I've missed and that makes it superior, or can we follow along with what everyone else is doing? A question for David, perhaps. > For the benefit of the search engine gods, this works for now: > > # virt-install --import --memory 8192 -n fedora-37-riscv \ > --arch riscv64 --vcpus 8 \ > --disk fedora-37-riscv.qcow2,format=qcow2 \ > --osinfo fedora37 \ > --qemu-commandline=' -bios /path/to/u-boot-spl.bin -device loader,file=/path/to/u-boot.itb,addr=0x80200000 ' Based on the information above, using --boot kernel=/path/to/u-boot.bin should work... > 'Course you have to disable SELinux ... ... without requiring this :) -- Andrea Bolognani / Red Hat / Virtualization