Risc-v newbie attempting to run fedora in qemu and share experience with everybody

Hi everybody,
I’ve just finished rebasing from silverblue 36 to silverblue 37. All good.

Now I’m going to try to run risc-v in a qemu virtual machine. I’m following this wiki:

The wiki should mention silverblue specific instructions:
sudo rpm-ostree install nbdkit guestfs-tools
sudo rpm-ostree install qemu-system-riscv qemu-system-riscv-core

Here’s the first hiccup:
$ virt-builder --list | grep riscv64

virt-builder: error: failed to download
HTTP status code 404

To fix it for me:
cd /etc/virt-builder/repos.d/
sudo rm opensuse.*

Now it works:
$ virt-builder --list | grep riscv64

fedora-rawhide-developer-20190703n0 riscv64 Fedora® Rawhide Developer 20190703.n.0
fedora-rawhide-developer-20191030n0 riscv64 Fedora® Rawhide Developer 20191030.n.0
fedora-rawhide-developer-20191123.n.0 riscv64 Fedora® Rawhide Developer 20191123.n.0
fedora-rawhide-minimal-20191123.n.1 riscv64 Fedora® Rawhide Minimal 20191123.n.1
fedora-rawhide-developer-20200108.n.0 riscv64 Fedora® Rawhide Developer 20200108.n.0
fedora-rawhide-minimal-20200108.n.0 riscv64 Fedora® Rawhide Minimal 20200108.n.0

Now let’s fetch the latest and use that:
mkdir riscvplay
cd riscvplay/
virt-builder --arch riscv64 --size 20G --format raw --output fedora-rawhide-developer-20200108.n.0-sda.raw fedora-rawhide-developer-20200108.n.0
[ 2.5] Downloading: https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20200108.n.0-sda.raw.xz
[ 92.5] Planning how to build this image
[ 92.5] Uncompressing
[ 110.3] Resizing (using virt-resize) to expand the disk to 20.0G
[ 243.0] Opening the new disk
[ 248.6] Setting a random seed
[ 248.6] Setting the machine ID in /etc/machine-id
[ 248.7] Setting passwords
virt-builder: Setting random password of root to BLAHBLAHBLAH
[ 250.6] SELinux relabelling
[ 344.7] Finishing off
Output file: fedora-rawhide-developer-20200108.n.0-sda.raw
Output size: 20.0G
Output format: raw
Total usable space: 19.5G
Free space: 14.5G (74%)

On to the payload part:
virt-builder --arch riscv64 --notes fedora-rawhide-developer-20200108.n.0 | grep fw_payload

wget https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20200108.n.0-fw_payload-uboot-qemu-virt-smode.elf

-bios none
-machine virt
-smp 4
-m 2G
-kernel Fedora-Developer-Rawhide-20200108.n.0-fw_payload-uboot-qemu-virt-smode.elf
-object rng-random,filename=/dev/urandom,id=rng0
-device virtio-rng-device,rng=rng0
-device virtio-blk-device,drive=hd0
-drive file=fedora-rawhide-developer-20200108.n.0-sda.raw,format=raw,id=hd0
-device virtio-net-device,netdev=usernet
-netdev user,id=usernet,hostfwd=tcp::10000-:22

1 Like

The output of that launch of qemu gives the following:

OpenSBI v0.5 (Jan 7 2020 00:00:00)

/ __ \ / | _ _ |
| | | |
__ ___ _ __ | (
| |
) || |
| | | | '_ \ / _ \ '_ \ ___ | _ < | |
| || | |) | __/ | | |) | |) || |
/| ./ _|| ||/|____/|
| |

Platform Name : QEMU Virt Machine
Platform HART Features : RV64ACDFHIMSU
Platform Max HARTs : 8
Current Hart : 2
Firmware Base : 0x80000000
Firmware Size : 120 KB
Runtime SBI Version : 0.2

PMP0: 0x0000000080000000-0x000000008001ffff (A)
PMP1: 0x0000000000000000-0xffffffffffffffff (A,R,W,X)

U-Boot 2020.01 (Jan 07 2020 - 00:00:00 +0000)

CPU: rv64imafdcsuh
Model: riscv-virtio,qemu
In: uart@10000000
Out: uart@10000000
Err: uart@10000000
Warning: virtio-net#2 using MAC address from ROM
eth0: virtio-net#2
Hit any key to stop autoboot: 0

Device 0: QEMU VirtIO Block Device
Type: Hard Disk
Capacity: 20480.0 MB = 20.0 GB (41943040 x 512)
… is now current device
Scanning virtio 0:1…
Found /extlinux/extlinux.conf
Retrieving file: /extlinux/extlinux.conf
586 bytes read in 2 ms (286.1 KiB/s)
Ignoring unknown command: ui
Ignoring malformed menu command: autoboot
Ignoring malformed menu command: hidden
Ignoring unknown command: totaltimeout
1: Fedora-Developer-Rawhide-20200108.n.0 (5.5.0-0.rc5.git0.1.1.riscv64.fc32.riscv64)
Retrieving file: /initramfs-5.5.0-0.rc5.git0.1.1.riscv64.fc32.riscv64.img
71786963 bytes read in 288 ms (237.7 MiB/s)
Retrieving file: /vmlinuz-5.5.0-0.rc5.git0.1.1.riscv64.fc32.riscv64
9248220 bytes read in 44 ms (200.4 MiB/s)
append: console=ttyS0 earlycon ro root=UUID=12bd5ff0-295f-40fe-a8ba-d08878f38173 rhgb quiet LANG=en_US.UTF-8
Uncompressing Kernel Image

Flattened Device Tree blob at 88000000

Booting using the fdt blob at 0x88000000
Using Device Tree in place at 0000000088000000, end 00000000880042bd

Starting kernel …

[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[ 0.000000] Linux version 5.5.0-0.rc5.git0.1.1.riscv64.fc32.riscv64 (mockbuild@hifive.delorie.com) (gcc version 9.2.1 20191120 (Red Hat 9.2.1-2) (GCC)) #1 SMP Mon Jan 6 17:31:22 UTC 2020
[ 0.000000] earlycon: ns16550a0 at MMIO 0x0000000010000000 (options ‘’)
[ 0.000000] printk: bootconsole [ns16550a0] enabled
[ OK ] Started Show Plymouth Boot Screen.
[ OK ] Started Forward Password R…s to Plymouth Directory Watch.
[ OK ] Reached target Local Encrypted Volumes.
[ OK ] Reached target Paths.
[ OK ] Reached target System Initialization.
[ OK ] Reached target Basic System.
[ OK ] Started dracut initqueue hook.
[ OK ] Reached target Remote File Systems (Pre).
[ OK ] Reached target Remote File Systems.
Starting dracut pre-mount hook…
[ OK ] Started dracut pre-mount hook.
Starting File System Check…295f-40fe-a8ba-d08878f38173…
[ OK ] Started File System Check …0-295f-40fe-a8ba-d08878f38173.
Mounting /sysroot…
[ OK ] Mounted /sysroot.
[ OK ] Reached target Initrd Root File System.
Starting Reload Configuration from the Real Root…
[ OK ] Started Reload Configuration from the Real Root.
[ OK ] Reached target Initrd File Systems.
[ OK ] Reached target Initrd Default Target.
Starting dracut pre-pivot and cleanup hook…
[ OK ] Started dracut pre-pivot and cleanup hook.
Starting Cleaning Up and Shutting Down Daemons…
[ OK ] Stopped target Timers.
[ OK ] Stopped dracut pre-pivot and cleanup hook.
[ OK ] Stopped target Initrd Default Target.
[ OK ] Stopped target Basic System.
[ OK ] Stopped target Initrd Root Device.
[ OK ] Stopped target Paths.
[ OK ] Stopped target Remote File Systems.
[ OK ] Stopped target Remote File Systems (Pre).
[ OK ] Stopped target Slices.
[ OK ] Stopped target Sockets.
[ OK ] Stopped target System Initialization.
[ OK ] Stopped target Swap.
[ OK ] Stopped dracut pre-mount hook.
[ OK ] Stopped target Local Encrypted Volumes.
[ OK ] Stopped dracut initqueue hook.
Starting Plymouth switch root service…
[ OK ] Stopped Apply Kernel Variables.
[ OK ] Stopped Create Volatile Files and Directories.
[ OK ] Stopped target Local File Systems.
[ OK ] Stopped udev Coldplug all Devices.
[ OK ] Stopped dracut pre-trigger hook.
Stopping udev Kernel Device Manager…
Starting Setup Virtual Console…
[ OK ] Stopped udev Kernel Device Manager.
[ OK ] Started Plymouth switch root service.
[ OK ] Closed udev Control Socket.
[ OK ] Closed udev Kernel Socket.
[ OK ] Stopped dracut pre-udev hook.
[ OK ] Stopped dracut cmdline hook.
Starting Cleanup udevd DB…
[ OK ] Stopped Create Static Device Nodes in /dev.
[ OK ] Stopped Create list of sta… nodes for the current kernel.
[ OK ] Started Cleaning Up and Shutting Down Daemons.
[ OK ] Started Setup Virtual Console.
[ OK ] Started Cleanup udevd DB.
[ OK ] Reached target Switch Root.
Starting Switch Root…
[ OK ] Stopped Switch Root.
[ OK ] Created slice system-getty.slice.
[ OK ] Created slice system-serial\x2dgetty.slice.
[ OK ] Created slice system-sshd\x2dkeygen.slice.
[ OK ] Created slice User and Session Slice.
[ OK ] Started Forward Password R…uests to Wall Directory Watch.
[ OK ] Set up automount Arbitrary…s File System Automount Point.
[ OK ] Reached target Local Encrypted Volumes.
[ OK ] Stopped target Switch Root.
[ OK ] Stopped target Initrd File Systems.
[ OK ] Stopped target Initrd Root File System.
[ OK ] Reached target Paths.
[ OK ] Reached target Slices.
[ OK ] Reached target Swap.
[ OK ] Listening on Device-mapper event daemon FIFOs.
[ OK ] Listening on LVM2 poll daemon socket.
[ OK ] Listening on Process Core Dump Socket.
[ OK ] Listening on initctl Compatibility Named Pipe.
[ OK ] Listening on udev Control Socket.
[ OK ] Listening on udev Kernel Socket.
Mounting Huge Pages File System…
Mounting POSIX Message Queue File System…
Mounting Kernel Debug File System…
Mounting Temporary Directory (/tmp)…
Starting Create list of st…odes for the current kernel…
Starting Monitoring of LVM…meventd or progress polling…
Starting Preprocess NFS configuration convertion…
[ OK ] Stopped File System Check on Root Device.
[ OK ] Stopped Journal Service.
[ OK ] Started Entropy Daemon based on the HAVEGE algorithm.
Starting Journal Service…
Starting Remount Root and Kernel File Systems…
Starting Apply Kernel Variables…
Starting udev Coldplug all Devices…
Starting Setup Virtual Console…
[ OK ] Mounted Huge Pages File System.
[ OK ] Mounted POSIX Message Queue File System.
[ OK ] Mounted Kernel Debug File System.
[ OK ] Mounted Temporary Directory (/tmp).
[ OK ] Started Create list of sta… nodes for the current kernel.
[ OK ] Started Preprocess NFS configuration convertion.
[ OK ] Started Apply Kernel Variables.
[ OK ] Started Remount Root and Kernel File Systems.
Starting Rebuild Hardware Database…
Starting Load/Save Random Seed…
Starting Create System Users…
[ OK ] Started Journal Service.
Starting Flush Journal to Persistent Storage…
[ OK ] Started Load/Save Random Seed.
[ OK ] Started Create System Users.
Starting Create Static Device Nodes in /dev…
[ OK ] Started Flush Journal to Persistent Storage.
[ OK ] Started Create Static Device Nodes in /dev.
[ OK ] Started udev Coldplug all Devices.
[ OK ] Started Setup Virtual Console.
[ OK ] Started Rebuild Hardware Database.
Starting udev Kernel Device Manager…
[ OK ] Started udev Kernel Device Manager.
[ OK ] Started Monitoring of LVM2… dmeventd or progress polling.
[ OK ] Reached target Local File Systems (Pre).
Mounting /boot…
[ OK ] Mounted /boot.
[ OK ] Reached target Local File Systems.
Starting Restore /run/initramfs on shutdown…
Starting Rebuild Dynamic Linker Cache…
Starting Tell Plymouth To Write Out Runtime Data…
Starting Create Volatile Files and Directories…
[ OK ] Started Restore /run/initramfs on shutdown.
[ OK ] Started Tell Plymouth To Write Out Runtime Data.
[ OK ] Started Create Volatile Files and Directories.
Mounting RPC Pipe File System…
Starting Security Auditing Service…
Starting Rebuild Journal Catalog…
[ OK ] Mounted RPC Pipe File System.
[ OK ] Reached target rpc_pipefs.target.
[ OK ] Started Rebuild Journal Catalog.
[ OK ] Started Security Auditing Service.
Starting Update UTMP about System Boot/Shutdown…
[ OK ] Started Update UTMP about System Boot/Shutdown.
[ OK ] Started Rebuild Dynamic Linker Cache.
Starting Update is Completed…
[ OK ] Started Update is Completed.
[ OK ] Reached target System Initialization.
[ OK ] Started dnf makecache --timer.
[ OK ] Started Run system activit…ounting tool every 10 minutes.
[ OK ] Started Generate summary o…esterday’s process accounting.
[ OK ] Started Daily Cleanup of Temporary Directories.
[ OK ] Started daily update of the root trust anchor for DNSSEC.
[ OK ] Reached target Timers.
[ OK ] Listening on D-Bus System Message Bus Socket.
[ OK ] Listening on Open-iSCSI iscsid Socket.
[ OK ] Listening on Open-iSCSI iscsiuio Socket.
[ OK ] Listening on SSSD Kerberos…ache Manager responder socket.
[ OK ] Reached target Sockets.
[ OK ] Reached target Basic System.
Starting firewalld - dynamic firewall daemon…
Starting GSSAPI Proxy Daemon…
Starting LSB: Init script for live image…
Starting OpenSSH ecdsa Server Key Generation…
Starting OpenSSH ed25519 Server Key Generation…
Starting OpenSSH rsa Server Key Generation…
Starting System Security Services Daemon…
Starting Resets System Activity Logs…
Starting Disk Manager…
[ OK ] Started GSSAPI Proxy Daemon.
[ OK ] Reached target NFS client services.
[ OK ] Started Resets System Activity Logs.
Starting D-Bus System Message Bus…
[ OK ] Started OpenSSH ecdsa Server Key Generation.
[ OK ] Started OpenSSH ed25519 Server Key Generation.
[ OK ] Started D-Bus System Message Bus.
Starting Authorization Manager…
[ OK ] Started Authorization Manager.
[ OK ] Started System Security Services Daemon.
[ OK ] Reached target User and Group Name Lookups.
Starting Login Service…
[ OK ] Started OpenSSH rsa Server Key Generation.
[ OK ] Reached target sshd-keygen.target.
[ OK ] Started Login Service.
[ OK ] Started firewalld - dynamic firewall daemon.
[ OK ] Reached target Network (Pre).
Starting Network Manager…
[ OK ] Started Disk Manager.
[ OK ] Started Network Manager.
[ OK ] Reached target Network.
Starting Network Manager Wait Online…
[ OK ] Started Logout off all iSCSI sessions on shutdown.
[ OK ] Reached target Remote File Systems (Pre).
[ OK ] Reached target Remote File Systems.
Starting OpenSSH server daemon…
Starting Permit User Sessions…
Starting Hostname Service…
[ OK ] Started Permit User Sessions.
Starting Hold until boot process finishes up…
Starting Terminate Plymouth Boot Screen…
[ OK ] Started OpenSSH server daemon.

Welcome to the Fedora/RISC-V disk image

Build date: Wed Jan 8 10:28:16 UTC 2020

Kernel 5.5.0-0.rc5.git0.1.1.riscv64.fc32.riscv64 on an riscv64 (ttyS0)

The root password is ‘fedora_rocks!’.
root password logins are disabled in SSH starting Fedora 31.
User ‘riscv’ with password ‘fedora_rocks!’ in ‘wheel’ group is provided.

To install new packages use ‘dnf install …’

To upgrade disk image use ‘dnf upgrade --best’

If DNS isn’t working, try editing ‘/etc/yum.repos.d/fedora-riscv.repo’.

For updates and latest information read:


Koji: Build System Info | Fedora RISC-V
SCM: http://fedora.riscv.rocks:3000/
Distribution rep.: Index of /repos-dist
Koji internal rep.: Index of /repos
fedora-riscv login: riscv
[riscv@fedora-riscv ~]$ cat /etc/os-release
VERSION=“32 (Rawhide)”
PRETTY_NAME=“Fedora 32 (Rawhide)”
DOCUMENTATION_URL=“System Administrator’s Guide :: Fedora Docs
SUPPORT_URL=“Communicating and getting help - Fedora Project Wiki
PRIVACY_POLICY_URL=“Privacy Statement for the Fedora Project :: Fedora Docs
[riscv@fedora-riscv ~]$ uname -a
Linux fedora-riscv 5.5.0-0.rc5.git0.1.1.riscv64.fc32.riscv64 #1 SMP Mon Jan 6 17:31:22 UTC 2020 riscv64 riscv64 riscv64 GNU/Linux
[riscv@fedora-riscv ~]$

Even more amazing…the rust installer works from within this image:

curl --proto ‘=https’ --tlsv1.2 -sSf https://sh.rustup.rs | sh

It’s official I’m excited.

This is a bit outdated, but new disk images (F37 based) are incoming. Actually virt-builder index doesn’t even incl. the latest disk image, which mainly was for SiFive HiFive Unmatched (but it also works with QEMU too).

TL;DR Expect some updates to F37 sooner than later.

1 Like

I noticed davidlt mentioned on libera irc chats he recently updated some documents to do with running qemu on riscv.

It mentions uboot and spl files.