From Fedora Project Wiki
Line 51: Line 51:
  # dnf clean all
  # dnf clean all
= Common tasks =
! Task !! Package
| Editing (vi) || vim-minimal
| Editing (emacs) || xemacs-nox
| Compiling || @buildsys-build
To install a package use: <code>dnf install packagename</code>
= Using systemd or not using systemd =
= Using systemd or not using systemd =

Revision as of 09:54, 23 October 2016

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.

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 (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

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

Common tasks

Task Package
Editing (vi) vim-minimal
Editing (emacs) xemacs-nox
Compiling @buildsys-build

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 /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

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 tar, xz, 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.