All about the RISC-V disk images.
Latest image
The stage4 disk image is built cleanly from RPMs with no broken dependencies and only a tiny number of modifications (see below).
https://fedorapeople.org/groups/risc-v/disk-images/
The disk image does not include a bootloader, kernel or emulator.
Booting on Fedora QEMU
Download the vmlinux (kernel) from the same directory. Install the bootloader and QEMU:
# dnf copr enable rjones/riscv # dnf install riscv-qemu riscv-pk
Boot the disk image:
$ qemu-system-riscv -m 4G -kernel /usr/bin/bbl \ -append vmlinux \ -drive file=stage4-disk.img,format=raw -nographic
Booting in other places
You will most likely need to compile your own kernel and/or bootloader. Note that the kernel will need to include many features required by systemd and other parts of Fedora. For suggestions on what to configure, see this file.
Installing extra packages inside the VM
The disk image only has a basic set of packages installed. We build many more. To install them you will need to use the dnf
command. However you will need to configure it, and configuration is different depending on whether your RISC-V machine has network access or not.
Installing packages with a working network
Edit /etc/yum.repos.d/local.repo
, uncomment the https baseurl
and comment out the file baseurl
. DNF should be able to download packages from our public repo.
Installing packages without a working network
Fedora's QEMU does not support networking. Therefore you have to download all the RPMS from https://fedorapeople.org/groups/risc-v/RPMS/ (eg. using a recursive wget or rsync) and copy them into the disk image. Simply placing the whole RPMS directory under /var/tmp
will work:
$ guestfish -a stage4-disk.img -m /dev/sda ><fs> copy-in -a stage4-disk.img /your/copy/of/RPMS /var/tmp ><fs> exit
DNF groups
DNF groups should work, eg:
# dnf install @buildsys-build
Note about DNF caching
DNF aggressively caches, even local file repositories. Therefore if you get strange errors about missing packages when the packages are obviously there, do this command first:
# dnf clean all
Using systemd or not using systemd
The disk image boots using systemd as the init system. /init
inside the disk image is a symlink to systemd.
You will need a kernel which supports all the features required by systemd. If you want to change how the system boots, you will need to add systemd units.
If you prefer not to use systemd, then modify the disk image:
- Remove the
/init
symlink. - Add your own
/init
shell script (or binary). - Ensure the
/init
script is executable.
The /init
script needs to remount the root filesystem as rw
and a few other things. Look at the code of the Fedora autobuilder for an example.
Power off
If you are using systemd, run:
# poweroff
If you are not using systemd, run:
# sync # poweroff -f
Sources
- https://fedorapeople.org/groups/risc-v/SRPMS/
- Fedora sources.
- https://github.com/rwmjones/fedora-riscv-kernel
- Kernel build scripts, kernel config, and a link to the kernel sources we use.
- https://github.com/rwmjones/fedora-riscv-stage4
- Scripts used to build the stage4 disk image.
- https://github.com/rwmjones/fedora-riscv-stage4/blob/master/stage4-build-init.sh
- How the RPMs where installed in the stage4 and subsequent modifications.
- https://fedoraproject.org/wiki/Architectures/RISC-V
- Links to all other documentation.