Sure. Attached is a kernel image and I will post the rootfs in the next comment.
$ timeout --foreground 15s unbuffer \ qemu-system-riscv64 \ -bios /usr/lib/riscv64-linux-gnu/opensbi/qemu/virt/fw_jump.elf \ -display none \ -initrd rootfs.cpio \ -kernel Image \ -m 512m \ -M virt \ -nodefaults \ -serial mon:stdio ... sbi_trap_error: hart0: trap handler failed (error -2) sbi_trap_error: hart0: mcause=0x0000000000000007 mtval=0x0000000000100000 sbi_trap_error: hart0: mepc=0x000000008000d4b0 mstatus=0x0000000000001822 sbi_trap_error: hart0: ra=0x00000000800098de sp=0x0000000080015c78 sbi_trap_error: hart0: gp=0xffffffe0012e95e8 tp=0xffffffe0081c1e00 sbi_trap_error: hart0: s0=0x0000000080015c88 s1=0x0000000000000040 sbi_trap_error: hart0: a0=0x0000000000000000 a1=0x0000000080003f66 sbi_trap_error: hart0: a2=0x0000000080003f66 a3=0x0000000080003f66 sbi_trap_error: hart0: a4=0x0000000000100000 a5=0x0000000000005555 sbi_trap_error: hart0: a6=0x0000000000003f66 a7=0x0000000080011158 sbi_trap_error: hart0: s2=0x0000000000000000 s3=0x0000000080016000 sbi_trap_error: hart0: s4=0x0000000000000000 s5=0x0000000000000000 sbi_trap_error: hart0: s6=0x0000000000000001 s7=0x0000000000000000 sbi_trap_error: hart0: s8=0x0000000000000000 s9=0x0000000000000000 sbi_trap_error: hart0: s10=0x0000000000000000 s11=0x0000000000000008 sbi_trap_error: hart0: t0=0x0000000000000000 t1=0x0000000000000000 sbi_trap_error: hart0: t2=0x0000000000000000 t3=0x0000000000000000 sbi_trap_error: hart0: t4=0x0000000000000000 t5=0x0000000000000000 sbi_trap_error: hart0: t6=0x0000000000000000
$ echo ${?} 124
If it works, there should sbi_trap_error output and QEMU should exit cleanly.
Sure. Attached is a kernel image and I will post the rootfs in the next comment.
$ timeout --foreground 15s unbuffer \ riscv64- linux-gnu/ opensbi/ qemu/virt/ fw_jump. elf \ 0x0000000000000 007 mtval=0x0000000 000100000 8000d4b0 mstatus= 0x0000000000001 822 0098de sp=0x0000000080 015c78 2e95e8 tp=0xffffffe008 1c1e00 015c88 s1=0x0000000000 000040 000000 a1=0x0000000080 003f66 003f66 a3=0x0000000080 003f66 100000 a5=0x0000000000 005555 003f66 a7=0x0000000080 011158 000000 s3=0x0000000080 016000 000000 s5=0x0000000000 000000 000001 s7=0x0000000000 000000 000000 s9=0x0000000000 000000 0000000 s11=0x000000000 0000008 000000 t1=0x0000000000 000000 000000 t3=0x0000000000 000000 000000 t5=0x0000000000 000000 000000
qemu-system-riscv64 \
-bios /usr/lib/
-display none \
-initrd rootfs.cpio \
-kernel Image \
-m 512m \
-M virt \
-nodefaults \
-serial mon:stdio
...
sbi_trap_error: hart0: trap handler failed (error -2)
sbi_trap_error: hart0: mcause=
sbi_trap_error: hart0: mepc=0x00000000
sbi_trap_error: hart0: ra=0x0000000080
sbi_trap_error: hart0: gp=0xffffffe001
sbi_trap_error: hart0: s0=0x0000000080
sbi_trap_error: hart0: a0=0x0000000000
sbi_trap_error: hart0: a2=0x0000000080
sbi_trap_error: hart0: a4=0x0000000000
sbi_trap_error: hart0: a6=0x0000000000
sbi_trap_error: hart0: s2=0x0000000000
sbi_trap_error: hart0: s4=0x0000000000
sbi_trap_error: hart0: s6=0x0000000000
sbi_trap_error: hart0: s8=0x0000000000
sbi_trap_error: hart0: s10=0x000000000
sbi_trap_error: hart0: t0=0x0000000000
sbi_trap_error: hart0: t2=0x0000000000
sbi_trap_error: hart0: t4=0x0000000000
sbi_trap_error: hart0: t6=0x0000000000
$ echo ${?}
124
If it works, there should sbi_trap_error output and QEMU should exit cleanly.