RISC-V is getting more and more popular, but if you want to run Linux on actual hardware it’s currently fairly expensive since you either need to rely on HiFive Unleashed SBC ($999), or expensive FPGAs.

Another solution is running Linux RISC-V via QEMU emulator, and I showed how to do this using BBL (Berkeley Boot Loader), Linux 4.14, and busybear rootfs. If you check the comments section of that earlier post you could also try out Fedora RISC-V images in QEMU.

Bootlin has now published a presentation showing how to run embedded Linux on RISC-V in QEMU with many of the same components as in the previous instructions, but with a more up-to-date Linux kernel (5.4), and using Buildroot to build everything from scratch including the toolchain, BBL, the Linux kernel, and a Busybox based root file system.

They explain each step in detail in the 45-page presentation to allow you to customize your final firmware to your requirements for example for choosing between glibc, uClibc or musl C libraries. They also link to some video playing the command to run for example to configure buildroot as shown below.

It’s always good to get started with QEMU to make yourself familiar with some of the potential pitfalls before low-cost hardware to play with RISC-V Linux come to market. You may not have to wait too long however, as based on a comment, some Kendryte K210 based boards such as Longgan Nano ($5) or Maixduino ($24 kit with camera and display), may get a uClinux port soon enough. uClinux is a version a Linux that works on hardware without MMU (memory management unit), and it can be a bit more complicated to debug notably due to kernel panics caused by stack overflows.