Ports/riscv64/QEMU
Old QEMU (pre-6.0)
To the QEMU virt machine with one of the images one could proceed through the following steps:
Step 0. Install QEMU with riscv64 system support. For example, in the case of ALT x86_64: qemu-system-riscv-core.
Step 1.a The OpenSBI firmware is placed inside the qcow2/qcow2c image. Let us copy it out of the image.
root$ qemu-nbd -c /dev/nbd0 qemu-riscv64.qcow2c
root$ mount /dev/nbd0p1 /mnt
root$ cp -v /mnt/usr/share/opensbi/qemu/virt/firmware/fw_payload.elf .
user$ FIRM=./fw_payload.elf
Step 1.b Alternative option: download and install the last version of the OpenSBI for QEMU virt machine. The OpenSBI firmware for QEMU virt will be at /usr/share/opensbi/qemu/virt/firmware/fw_payload.elf
For example:
user$ curl -O http://ftp.altlinux.org/pub/distributions/ALTLinux/ports/riscv64/Sisyphus/noarch/RPMS.classic/opensbi-firmware-qemu-0.6-alt1.noarch.rpm
root$ rpm -i opensbi-firmware-qemu-0.6-alt1.noarch.rpm
user$ FIRM=/usr/share/opensbi/qemu/virt/firmware/fw_payload.elf
Step 2. Now, it is all set to run the QEMU with a qcow2/qcow2c image, just place the path to the image in QCOW variable:
$ QCOW=qemu-riscv64.qcow2c
$ qemu-system-riscv64 \
-nographic -machine virt -kernel "$FIRM" \
-m 2G -smp cpus=4 \
-drive file="$QCOW",id=hd0 -device virtio-blk-device,drive=hd0 \
-netdev user,id=eth0,hostfwd=tcp::5900-:5900 -device virtio-net-device,netdev=eth0
Step 3. For a graphical system, the following system setup is performing through VNC. To connect to the X11 VNC server one should enter the default password alt, it could be changed to another one at the inital setup of the system through GUI.