Talk:Ports/riscv64/QEMU

From ALT Linux Wiki
Revision as of 09:04, 11 November 2021 by IvanMelnikov (talk | contribs) (Created page with " Alternative version of the old instruction saved from re-written Regular/riscv64: = '''How to run on QEMU''' = In order to run the image on the QEMU system one need to f...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Alternative version of the old instruction saved from re-written Regular/riscv64:

How to run on QEMU

In order to run the image on the QEMU system one need to follow these steps:

Step 1. Install QEMU with riscv64 support. For example, in the case of ALT Sisyphus system: qemu-system-riscv-core.

Step 2.

ALT

Install or download and extract a package with OpenSBI and U-Boot. In the case of ALT (if it is not the case, please see here) one could add noarch repository sisyphus-riscv64 to the system and install the package opensbi-firmware-generic:

$ apt-repo add 'rpm [sisyphus-riscv64] http://ftp.altlinux.org/pub/distributions/ALTLinux ports/riscv64/Sisyphus/noarch classic'
$ apt-get update
$ apt-get install opensbi-firmware-generic

After that, the firmware will be at the path /usr/share/opensbi/generic/firmware/fw_payload.elf.

Other system

In that case one could download a package opensbi-firmware-generic-.* from the sisyphus-riscv64 noarch repository sisyphus-riscv64. After that it is possible to install the package rpm -i or extract it rpm2cpio. Besides that it is possible to get the firmware from the qcow2c image with qemu-nbd.

Step 3. Download one of the images for QEMU listed (above) and just replace <IMAGE> to the path of just downloaded qcow2c image and <FIRMWARE> to the fw_payload.elf:

$ qemu-system-riscv64 -nographic -machine virt \
                      -bios <FIRMWARE> \
                      -m 2G -smp cpus=4 \
                      -drive file=<IMAGE>,id=hd0 -device virtio-blk-device,drive=hd0 \
                      -netdev user,id=eth0 -device virtio-net-device,netdev=eth0

In the case of the XFCE graphical image, the user needs to redirect incoming TCP connections to the host port 5900 (VNC) to the guest port. One could do it with the following command:

$ qemu-system-riscv64 -nographic -machine virt \
                      -bios <FIRMWARE> \
                      -m 2G -smp cpus=4 \
                      -drive file=<IMAGE>,id=hd0 -device virtio-blk-device,drive=hd0 \
                      -netdev user,id=eth0,hostfwd=tcp::5900-:5900 -device virtio-net-device,netdev=eth0