QEMU RISC-V Ubuntu quickstart
At the the writing, UTM didn’t have a known way to work with RISC-V, so we use QEMU directly on macOS (or Linux).
Obtain QEMU - on macOS via brew install qemu or on Linux via the package manager (e.g. apt install qemu).
We need a uboot.elf.
One way to get it is from a Linux machine or VM if on macOS by apt install u-boot-qemu and then copy the file from /usr/lib/u-boot/qemu/riscv64/uboot.elf to the machine where you want to run QEMU.
cp /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf ~/uboot.elfThen obtain the Ubuntu LTS RISCV image.
Extract the image like:
unxz ubuntu-24.04.4-preinstalled-server-riscv64.img.xzIt’s important to increase the disk size, otherwise the image will run of space quickly when installing compilers etc. Add say 10 GB of virtual HD space by:
qemu-img resize -f raw ubuntu-*-preinstalled-server-riscv64.img +10GThen run QEMU like (perhaps make a little script):
img=$HOME/riscv_vm/ubuntu-24.04.4-preinstalled-server-riscv64.img
uboot=$HOME/riscv_vm/uboot.elf
qemu-system-riscv64 \
-machine virt -nographic -m 2048 -smp 4 \
-kernel ${uboot} \
-device virtio-net-device,netdev=eth0 -netdev user,id=eth0 \
-device virtio-rng-pci \
-drive file=${img},format=raw,if=virtioThis should boot the Ubuntu image and in a few minutes get to the login prompt.
The default username is ubuntu and the password is ubuntu.