This is an old revision of the document!
For testing your kernel builds it's much easier to use QEMU than normal hardware, especially if you are working on arch-specific code. QEMU has upstream support for RISC-V since version 2.12 so you may use the upstream binaries from your distribution or build your own either from the official qemu repo or from the riscv-qemu repo.
The process is the same no matter where you got your QEMU sources from, it's pretty standard…
git clone --depth=1 https://github.com/riscv/riscv-qemu.git cd riscv-qemu ./configure --target-list=riscv64-softmmu,riscv32-softmmu --prefix=<qemu install dir> make
There are various ways of invoking qemu, lets start with a standard virt machine that boots the test environment.
<qemu install dir>/bin/qemu-system-riscv64 -nographic -machine virt -smp 8 -m 2G \ -bios <path to bbl or fw_jump.elf (in case of OpenSBI)> \ -kernel <linux sources dir>/vmlinux \ -initrd <path to initramfs.img> \ -netdev user,id=unet -device virtio-net-device,netdev=unet -net user \ -object rng-random,filename=/dev/urandom,id=rng0 \ -device virtio-rng-device,rng=rng0
In case you built bbl or OpenSBI with the Linux kernel as its payload you can omit the
-bios parameter and point the
-kernel parameter directly to the combined bbl / fw_payload.elf binary.