Page tree
Skip to end of metadata
Go to start of metadata

Testing RISC V under qemu

Build and Install

Building the full system emulator and the user mode emulator on Linux:

git clone --recursive
cd riscv-qemu
./configure \
make -j$(nproc)
# last operation require root right, so possible that you need sudo make install
make install

# it will be installed under /usr/local/bin so you need to add your path if it's in the default one

Use a working buildroot environment

Download buildroot project for risc-v

git clone
git checkout origin/riscv-start

Build buildroot enviroment

cd riscv-buildroot
make qemu_riscv64_virt_defconfig

This configuration let you work on version downloaded in the configuration

Use mainline kernel

# create file inside your buildroot directory

echo "LINUX_OVERRIDE_SRCDIR=linux-mainline" >

git clone git:// linux-mainline

# checkout the mainline commit id or tag you need for example
cd linux-mainline
git checkout v4.20-rc7 -b devel-riscv

# if you system is already build
make linux-dirclean

# otherwise follow the instruction on previous section
make qemu_riscv64_virt_defconfig

# configure the kernel
make linux-menuconfig

Run your built image

Your output image are in output/images. In order to execute just run:

qemu-system-riscv64 -M virt -kernel output/images/bbl -append "root=/dev/vda ro console=ttyS0" -drive file=output/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic
  • No labels