Hi,
The second approach is the one described in the Ubuntu wiki[3], and
also requires passing two files to QEMU, except this time they come
from the opensbi and u-boot-qemu packages respectively. The usage
looks like
-bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf
-kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf
I think in this case the first file is a minimal build of OpenSBI
that likely just initializes enough hardware before handing control
to an arbitrary payload - in this case, u-boot.
Yes. These days opensbi seems to be loaded by default, so the first
line is not needed. In fact I'm running a guest here, on fedora 37 +
virt-preview with just this ...
<os>
<type arch='riscv64' machine='virt'>hvm</type>
<kernel>/home/kraxel/projects/u-boot/build-qemu-riscv64-smode/u-boot.bin</kernel>
<boot dev='hd'/>
</os>
... and it works fine.
There is also this variant ...
<qemu:commandline>
<qemu:arg value='-drive'/>
<qemu:arg
value='if=pflash,index=1,format=raw,file=/vmdisk/hdd/pool-risc-v/RISCV_VIRT.raw'/>
</qemu:commandline>
... to boot edk2 firmware. Note this is a single image carrying both
code and vars. Also note 'index=1', which I think is needed because the
(default) opensbi is loaded to the pflash device with 'index=0'.
This doesn't boot the distro due to grub2 not having full riscv64 efi
support (yet).
take care,
Gerd