|
|
(9 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| This page describes the steps necessary to get Fedora for RISC-V running, either on emulated or real hardware.
| | The process of installing Fedora RISC-V might be target-dependent. Check out the relevant page for detailed information. |
|
| |
|
| = Quickstart = | | = Emulated hardware = |
|
| |
|
| This section assumes that you have already set up libvirt/QEMU on your machine and you're familiar with them, so it only highlights the details that are specific to RISC-V. It also assumes that you're running Fedora 40 as the host.
| | * [[Architectures/RISC-V/QEMU|QEMU]] |
|
| |
|
| First of all, you need to download a disk image from http://fedora.riscv.rocks/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id
| | = Real hardware = |
|
| |
|
| As of this writing, the most recent image is <code>Fedora-Minimal-40-20240502.n.0-sda.raw.xz</code> so I will be using that throughout the section. If you're using a different image, you will need to adjust things accordingly.
| | SiFive |
|
| |
|
| Once you've downloaded the image, start by uncompressing it:
| | * [[Architectures/RISC-V/HiFive-Premier-P550|HiFive Premier P550]] |
| | |
| <pre>
| |
| $ unxz Fedora-Minimal-40-20240502.n.0-sda.raw.xz
| |
| </pre>
| |
| | |
| You need to figure out the root filesystem's UUID so that you can later pass this information to the kernel. The <code>virt-filesystems</code> utility, part of the <code>guestfs-tools</code> package, takes care of that:
| |
| | |
| <pre>
| |
| $ virt-filesystems \
| |
| -a Fedora-Minimal-40-20240502.n.0-sda.raw \
| |
| --long \
| |
| --uuid \
| |
| | grep ^btrfsvol: \
| |
| | awk '{print $7}' \
| |
| | sort -u
| |
| ae525e47-51d5-4c98-8442-351d530612c3
| |
| </pre>
| |
| | |
| Additionally, you need to extract the kernel and initrd from the disk image. The <code>virt-get-kernel</code> tool automates this step:
| |
| | |
| <pre>
| |
| $ virt-get-kernel \
| |
| -a Fedora-Minimal-40-20240502.n.0-sda.raw
| |
| download: /boot/vmlinuz-6.8.7-300.4.riscv64.fc40.riscv64 -> ./vmlinuz-6.8.7-300.4.riscv64.fc40.riscv64
| |
| download: /boot/initramfs-6.8.7-300.4.riscv64.fc40.riscv64.img -> ./initramfs-6.8.7-300.4.riscv64.fc40.riscv64.img
| |
| </pre>
| |
| | |
| Now move all the files to a directory that libvirt has access to:
| |
| | |
| <pre>
| |
| $ sudo mv
| |
| Fedora-Minimal-40-20240502.n.0-sda.raw \
| |
| vmlinuz-6.8.7-300.4.riscv64.fc40.riscv64 \
| |
| initramfs-6.8.7-300.4.riscv64.fc40.riscv64.img \
| |
| /var/lib/libvirt/images/
| |
| </pre>
| |
| | |
| At this point, everything is ready and you can create the libvirt VM:
| |
| | |
| <pre>
| |
| $ virt-install \
| |
| --import \
| |
| --name fedora-riscv \
| |
| --osinfo fedora40 \
| |
| --arch riscv64 \
| |
| --vcpus 4 \
| |
| --ram 4096 \
| |
| --boot uefi,kernel=/var/lib/libvirt/images/vmlinuz-6.8.7-300.4.riscv64.fc40.riscv64,initrd=/var/lib/libvirt/images/initramfs-6.8.7-300.4.riscv64.fc40.riscv64.img,cmdline='root=UUID=ae525e47-51d5-4c98-8442-351d530612c3 ro rootflags=subvol=root rhgb LANG=en_US.UTF-8 console=ttyS0 earlycon=sbi' \
| |
| --disk path=/var/lib/libvirt/images/Fedora-Minimal-40-20240502.n.0-sda.raw \
| |
| --network default \
| |
| --graphics none
| |
| </pre>
| |
| | |
| Note how the UUID discovered earlier is included in the kernel command line. Quoting is also very important to get right.
| |
| | |
| You should see a bunch of output coming from edk2 (the UEFI implementation we're using), followed by the usual kernel boot messages and, eventually, a login prompt. Please be patient, as the use of emulation makes everything significantly slower. Additionally, a SELinux relabel followed by a reboot will be performed as part of the import process, which slows things down further. Subsequent boots will be a lot faster.
| |
| | |
| To shut down the VM, run <code>poweroff</code> inside the guest OS. To boot it up again, use
| |
| | |
| <pre>
| |
| $ virsh start fedora-riscv --console
| |
| </pre>
| |