Ports/riscv64/QEMU

This page describes how to start riscv64 virtual machine via QEMU.

QEMU, starting with version 6.0, includes OpenSBI firmware. For older QEMU versions you need to obtain the firmware -- check out the instructions in the section below.

Some ALT images for riscv64 include a VNC server that provides access to initial setup and graphical desktop (see Regular/riscv64 for more details). To access that server, it's convenient to forward port 5900 from the virtual machine to the host machine. The parameters necessary for that are included into QEMU command lines below.

QEMU 6.0+
QEMU 6.0 virtual machines with kernel 5.14 or newer have graphics (virtuo-gpu) and input (virtio-keyboard and virtio-tablet) working. Here are the steps run ALT images in QEMU:

Step 0: Install QEMU with riscv64 support to run the ALT port on RISC-V. If your host system is running ALT x86_64, you need qemu-system-riscv-core package:

apt-get install qemu-system-riscv-core qemu-device-display-virtio-gpu-gl qemu-ui-sdl seavgabios

Step 1: Download the recent version of   for riscv64. You can use the link to the package on the official website of the Sisyphus repository. Or find the package directly in the repository.

Extract /usr/share/u-boot/qemu-riscv64_smode/u-boot.bin file from the downloaded package. For example:

rpm2cpio u-boot-qemu-*.rpm | cpio -vi --to-stdout './usr/share/u-boot/qemu-riscv64_smode/u-boot.bin' > u-boot.bin

Step 2: Now you can start a virtual machine on QEMU via the following commands. Put the path to the image you want to run into the IMAGE environment variable, and path to the U-Boot binary you obtained on the step 1 to UBOOT environment variable:

If you need to access the virtual machine via VNC, replace -device virtio-vga-gl and -display sdl options with "-device virtio-vga -vnc :1" and connect to 5901 port (5900 port is taken for the network forwarding):

OpenSBI
To run riscv64 virtual machine on older (pre-6.0) QEMU, you need OpenSBI (firmware) binary.

Download the recent version of. You can use the link to the package on the official website of the Sisyphus repository. Or find the package directly in the repository.

Extract /usr/share/opensbi/generic/firmware/fw_jump.elf file from the downloaded package. For example:

rpm2cpio opensbi-*.rpm | cpio -vi --to-stdout './usr/share/opensbi/generic/firmware/fw_jump.elf' > fw_jump.elf

Now you can start a virtual machine on QEMU via the following commands. Put path to your image into IMAGE, path to the u-boot binary into UBOOT environment variable, and path to to u-boot, and path to  fw_jump.elf that you extracted from FIRM package into FIRM variable:

If you need a graphical interface, run the VNC server in the VM, for example, as described in Regular/riscv64.

Connect to VNC, for example, like this:

vncviewer localhost

Ports/riscv64/QEMU