All about the RISC-V disk images.
- 1 Latest image
- 2 Booting on Fedora QEMU
- 3 Booting in other places
- 4 Installing extra packages inside the VM
- 5 Using systemd or not using systemd
- 6 Power off
- 7 Disk image is too large/too small
- 8 Customizing the disk image
- 9 Sources
The stage4 disk image is built cleanly from RPMs with no broken dependencies and only a tiny number of modifications.
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
/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:
$ virt-copy-in -a stage4-disk.img /your/copy/of/RPMS /var/tmp
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
|Editing (vi)||vim-minimal |
(Included in base image)
To install a package use:
dnf install packagename
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
- Add your own
/initshell script (or binary).
- Ensure the
/initscript is executable.
/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.
If you are using systemd, run:
If you are not using systemd, run:
# sync # poweroff -f
Disk image is too large/too small
The disk image has a large virtual size. It is shipped as a sparse file so it will only use a small fraction of this space on the host. Make sure you use commands and filesystems which preserve sparseness, such as
cp --sparse=always, and the common Linux filesystems.
If the image is too large (or too small) to fit on external media, use the resize2fs command to resize it.
Customizing the disk image
To produce your own customized disk images, fork the stage4 repository and use it to build your own stage4 disk images.
- Fedora sources.
- Kernel build scripts, kernel config, and a link to the kernel sources we use.
- Scripts used to build the stage4 disk image.
- How the RPMs were installed in the stage4, and any subsequent modifications made.
- Links to all other documentation.