User Tools

Site Tools


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.

Build QEMU from riscv-qemu

The process is the same no matter where you got your QEMU sources from, it's pretty standard…

git clone --depth=1
cd riscv-qemu
./configure --target-list=riscv64-softmmu,riscv32-softmmu --prefix=<qemu install dir>

Running Linux on QEMU

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 <bbl sources dir>/build//bbl \
				-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 with the Linux kernel as its payload you can omit the -bios parameter and point the -kernel parameter directly to the combined bbl binary.

developers/env_emul.1540901093.txt.gz · Last modified: 2018/10/30 14:04 by mick