RISC-V cheat sheet

Tested in Ubuntu 24.04.

Qemu

Install:

$ sudo apt install qemu-system-misc u-boot-qemu

List 32-bits supported boards:

$ qemu-system-riscv32 --machine help

List 64-bits supported boards:

$ qemu-system-riscv64 --machine help

Download the Ubuntu preinstalled server image:

$ wget --continue https://cdimage.ubuntu.com/releases/24.04/release/ubuntu-24.04.1-preinstalled-server-riscv64.img.xz

Decompress the image:

$ xz --decompress --keep ubuntu-24.04.1-preinstalled-server-riscv64.img.xz

Resize the image:

$ qemu-img resize -f raw ubuntu-24.04.1-preinstalled-server-riscv64.img +5G

Run on the generic virtual platform virt:

$ qemu-system-riscv64 \
    -machine virt \
    -nographic \
    -m 2048 \
    -smp 4 \
    -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf \
    -device virtio-net-device,netdev=eth0 \
    -netdev user,id=eth0 \
    -device virtio-rng-pci \
    -drive file=ubuntu-24.04.1-preinstalled-server-riscv64.img,format=raw,if=virtio

Log in with user and password ubuntu.

References

1 Like