This page contains details about cross-compiling for the RISC-V architecture called riscv32.
The RISC-V architecture provides 32-bit, 64-bit, and 128-bit variants.
While theoretically possible to run Debian on a 32-bit RISC-V architecture, most available 32-bit CPUs are limited to microcontrollers or low-memory systems.
Available devices
Description and website |
Docs |
|
|
Compilers and libraries
C compiler |
use --print-multi-lib to see compile targets, use for example -march=rv32imac -mabi=ilp32 |
|
C compiler |
use --print-targets to check support, use --target=riscv32 to build |
Emulators
QEMU
Install:
apt install qemu-system-misc opensbi
Run:
qemu-system-riscv32 \ -M virt -nographic -m 500M \ -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf \ -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf \ -device virtio-blk-device,drive=hd0 \ -netdev user,id=net0 -device virtio-net-device,netdev=net0
chroot
qemu-user-static supports riscv32 if you would like to install a 32-bit RISC-V Linux distro into a chroot.
Downstream
You can give a try on downstream Debian riscv32 rootfs here: https://github.com/yuzibo/riscv32