This archive includes a 6.5-rc3 kernel and Gentoo Linux userspace configured for RISC-V to enable development and testing of RVV optimizations to OSS projects.
This setup has been tested with qemu-8.0.3. To boot the VM simply run:
There are two accounts available on the system, root and negge. Both have the same password: rise
At boot, the VM starts sshd on port 22. The start.sh script includes a setting to map host port 10000 to VM port 22. You can ssh in with the user account:
$ ssh -p 10000 negge@localhost
This machine has the latest developer tools installed. The following packages are built for RISC-V and available to use:
Testing RISC-V Extensions
There are two programs in the negge user directory:
$ ls test
hwcap hwcap.c testrvv testrvv.as testrvv.o
hwcapprogram tests that the 'V' bit is set by getauxval(AT_HWCAP)
testrvvprogram executes the vsetvli instruction and returns
These can be used to confirm that the 6.5-rc3 kernel is properly built with CONFIG_RISCV_ISA_V=y and CONFIG_RISCV_ISA_V_DEFAULT_ENABLE=y.
It is possible to use qemu-binfmt to mount and run the system in a chroot. This has the advantage of using the host kernel and MMU and is significantly faster.
As root, configure and start the qemu-binfmt service. You can confirm this is done correctly with:
$ cat /proc/sys/fs/binfmt_misc/qemu-riscv64
The VM already contains a staticly compiled x86_64 QEMU user binary with the patch from  backported to qemu-8.0.3 at:
To create the chroot, run the following commands as root:
mount -o loop,offset=1048576 gentoo.img /mnt/gentoo
cp /etc/resolv.conf /mnt/gentoo/etc
mount --bind /proc /mnt/gentoo/proc
mount --bind /sys /mnt/gentoo/sys
mount --bind /dev /mnt/gentoo/dev
mount --bind /dev/pts /mnt/gentoo/dev/pts
mount --bind /dev/shm /mnt/gentoo/dev/shm
You can enter the chroot with:
chroot /mnt/gentoo /bin/bash
env-update && source /etc/profile
Using the chroot is recommend for building and installing new packages into the VM with the emerge command.
Note, there are some differences between a qemu-user chroot and qemu-system
- The host kernel is still x86_64 so /proc/cpuinfo will not show the RISC-V ISA extensions
- Process concurrency is handled by the host kernel
For this reason it is recommended to develop and test RVV optimizations in the emulated VM.