https://fedoraproject.org/w/api.php?action=feedcontributions&user=Rjones&feedformat=atomFedora Project Wiki - User contributions [en]2024-03-19T06:20:40ZUser contributionsMediaWiki 1.39.4https://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Installing&diff=678205Architectures/RISC-V/Installing2023-05-23T10:44:06Z<p>Rjones: /* Boot under QEMU */ virt-edit for editing extlinux.conf</p>
<hr />
<div>This page describes the steps necessary to get Fedora for RISC-V running, either on emulated or real hardware.<br />
<br />
= Obtain a disk image =<br />
<br />
== Tested images ==<br />
<br />
These images have undergone some testing and thus are more likely to work without issues. If you are not sure which image to choose, go with one of these.<br />
<br />
=== Download using virt-builder ===<br />
<br />
This is the recommended way to obtain disk images.<br />
<br />
To install <code>virt-builder</code>, run <code>dnf install libguestfs-tools-c</code>.<br />
<br />
Before you can start using <code>virt-builder</code> for this task, a one-time setup is necessary:<br />
<br />
<pre><br />
$ mkdir -p ~/.config/virt-builder/repos.d/<br />
$ cat <<EOF >~/.config/virt-builder/repos.d/fedora-riscv.conf<br />
[fedora-riscv]<br />
uri=https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/index<br />
EOF<br />
</pre><br />
<br />
With that out of the way, you can get a list of available RISC-V templates with:<br />
<br />
<pre><br />
$ virt-builder --list | grep riscv64<br />
fedora-rawhide-developer-20191123.n.0 riscv64 Fedora® Rawhide Developer 20191123.n.0<br />
fedora-rawhide-minimal-20191123.n.1 riscv64 Fedora® Rawhide Minimal 20191123.n.1<br />
</pre><br />
<br />
Then tell <code>virt-builder</code> to build a custom disk image based on one of the templates:<br />
<br />
<pre><br />
$ virt-builder \<br />
--arch riscv64 \<br />
--size 20G \<br />
--format raw \<br />
--output Fedora-Developer-Rawhide-20191123.n.0-sda.raw \<br />
fedora-rawhide-developer-20191123.n.0<br />
[ 3.6] Downloading: https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-sda.raw.xz<br />
[ 6.1] Planning how to build this image<br />
[ 6.1] Uncompressing<br />
[ 32.8] Opening the new disk<br />
[ 38.4] Setting a random seed<br />
[ 38.4] Setting the machine ID in /etc/machine-id<br />
[ 38.4] Setting passwords<br />
virt-builder: Setting random password of root to 5PegnZtGMP47bXnw<br />
[ 39.9] Finishing off<br />
Output file: Fedora-Developer-Rawhide-20191123.n.0-sda.raw<br />
Output size: 20.0G<br />
Output format: raw<br />
Total usable space: 19.7G<br />
Free space: 14.7G (75%)<br />
</pre><br />
<br />
<code>virt-builder</code> has reasonable defaults, such as generating a random root password for you, but if you want more control you can pass additional arguments to customize the image further: for example, using <code>--format qcow2</code> will cause the output image to be in QCOW2 format. See <code>virt-builder --help</code> for more information.<br />
<br />
In addition to the disk image, a firmware image (which has to be downloaded separately) is needed as well. To find out the download URL, use:<br />
<br />
<pre><br />
$ virt-builder --arch riscv64 --notes fedora-rawhide-developer-20191123.n.0 | grep fw_payload<br />
https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf<br />
https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf.CHECKSUM<br />
</pre><br />
<br />
Then download it using your favorite HTTP client, for example:<br />
<br />
<pre><br />
$ wget https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf<br />
</pre><br />
<br />
=== Download manually ===<br />
<br />
If using <code>virt-builder</code> is not an option, you can download disk images manually from: https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/<br />
<br />
Download <code>Fedora-Developer-Rawhide-*.raw.xz</code> as well as the matching <code>Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf</code>.<br />
<br />
== Nightly builds ==<br />
<br />
You can find them here: http://fedora.riscv.rocks/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id<br />
<br />
Select the most recent (top) build and download <code>Fedora-Developer-Rawhide-*.raw.xz</code>.<br />
<br />
These disk images differ from the ones above in that:<br />
* the firmware is inside the disk image, in the <code>/boot</code> directory;<br />
* they are completely untested.<br />
<br />
= Prepare the disk image =<br />
<br />
These steps are only necessary if you haven't used <code>virt-builder</code>.<br />
<br />
== Uncompress the image ==<br />
<br />
Whether you have downloaded a tested image or a nightly build, you'll need to uncompress it before it can be used:<br />
<br />
<pre><br />
$ unxz Fedora-Developer-Rawhide-*.raw.xz<br />
</pre><br />
<br />
== Optional: expand the disk image ==<br />
<br />
You might want to expand the disk image before setting up the VM. Here is one example:<br />
<br />
<pre><br />
$ truncate -r Fedora-Developer-Rawhide-*.raw expanded.raw<br />
$ truncate -s 40G expanded.raw<br />
$ virt-resize -v -x --expand /dev/sda4 Fedora-Developer-Rawhide-*.raw expanded.raw<br />
$ virt-filesystems --long -h --all -a expanded.raw<br />
$ virt-df -h -a expanded.raw<br />
</pre><br />
<br />
The resulting disk image will work with QEMU as well as TinyEMU. Make sure you use <code>expanded.raw</code> instead of <code>Fedora-Developer-Rawhide-*.raw</code> when booting the guest.<br />
<br />
== Optional: create an overlay ==<br />
<br />
You can also create <code>qcow2</code> disk image with <code>raw</code> Fedora disk as backing one. This way Fedora <code>raw</code> is unmodified and all changes are written to <code>qcow2</code> layer. You will need to install <code>libguestfs-tools-c</code>.<br />
<br />
<pre><br />
$ qemu-img create -f qcow2 -F raw -b Fedora-Developer-Rawhide-*.raw overlay.qcow2 20G<br />
$ virt-resize -v -x --expand /dev/sda4 Fedora-Developer-Rawhide-*.raw overlay.qcow2<br />
$ virt-filesystems --long -h --all -a overlay.qcow2<br />
</pre><br />
<br />
The resulting disk image will only work with QEMU. Make sure you use <code>overlay.qcow2</code> instead of <code>Fedora-Developer-Rawhide-*.raw</code> when booting the guest.<br />
<br />
== Optional: set the hostname before booting ==<br />
<br />
If you want to change hostname before the first boot, install <code>libguestfs-tools-c</code> and then run:<br />
<br />
<pre><br />
$ virt-customize -a Fedora-Developer-Rawhide-*.raw --hostname fedora-riscv-mymagicbox<br />
</pre><br />
<br />
== Nightly builds only: extracting firmware (OpenSBI) ==<br />
<br />
Fedora/RISC-V does not support BLS (Boot Loader Specification - [https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault more details]).<br />
<br />
Disk images contain a <code>/boot</code> directory from where you can copy out the firmware.<br />
<br />
This is '''only''' necessary for nightly builds, since for tested images these files are provided as separate downloads alongside the image.<br />
<br />
Example session:<br />
<br />
<pre><br />
$ guestfish \<br />
add Fedora-Developer-Rawhide-*.raw : \<br />
run : \<br />
mount /dev/sda1 / : \<br />
ls /opensbi/unstable<br />
fw_jump.elf<br />
fw_payload-5.2.0-0.rc7.git0.1.0.riscv64.fc31.riscv64.elf<br />
fw_payload-uboot-qemu-virt-smode.elf<br />
$ guestfish \<br />
add Fedora-Developer-Rawhide-*.raw : run : mount /dev/sda1 / : \<br />
download /opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf fw_payload-uboot-qemu-virt-smode.elf<br />
</pre><br />
<br />
You can also use <code>guestmount</code> or QEMU/NBD to mount disk image. Examples:<br />
<pre><br />
$ mkdir a<br />
$ guestmount -a $PWD/Fedora-Developer-Rawhide-*.raw -m /dev/sda1 $PWD/a<br />
$ cp a/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf .<br />
$ guestunmount $PWD/a<br />
</pre><br />
<br />
<pre><br />
$ sudo modprobe nbd max_part=8<br />
$ sudo qemu-nbd -f raw --connect=/dev/nbd1 $PWD/Fedora-Developer-Rawhide-*.raw<br />
$ sudo fdisk -l /dev/nbd1<br />
Disk /dev/nbd1: 7.5 GiB, 8053063680 bytes, 15728640 sectors<br />
Units: sectors of 1 * 512 = 512 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
I/O size (minimum/optimal): 512 bytes / 512 bytes<br />
Disklabel type: gpt<br />
Disk identifier: F0F4268F-1B73-46FF-BABA-D87F075DCCA5<br />
<br />
Device Start End Sectors Size Type<br />
/dev/nbd1p1 2048 15001599 14999552 7.2G Linux filesystem<br />
$ sudo mount /dev/nbd1p1 a<br />
$ sudo cp a/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf .<br />
$ sudo umount a<br />
$ sudo qemu-nbd --disconnect /dev/nbd1<br />
</pre><br />
<br />
Note NBD is highly useful if you need to run <code>fdisk</code>, <code>e2fsck</code> (e.g. after VM crash and filesystem lock up), <code>resize2fs</code>. It might be beneficial to look into <code>nbdkit</code> and <code>nbd</code> packages.<br />
<br />
= Boot the image on virtual hardware =<br />
<br />
There are several options for booting the image on virtual hardware once you've prepared it following the steps above.<br />
<br />
== Boot with libvirt ==<br />
<br />
Detailed instructions how to install libvirt: https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-virtualization/<br />
<br />
Quick instructions for libvirt installation (tested on Fedora 30):<br />
<br />
<pre><br />
# dnf group install --with-optional virtualization<br />
# systemctl enable --now libvirtd<br />
</pre><br />
<br />
When running RISC-V guests, it's usually a good idea to use the very latest versions of QEMU, libvirt and virt-manager: the <code>virt-preview</code> repository offers just that for Fedora users. To enable it, simply run:<br />
<br />
<pre><br />
# dnf copr enable @virtmaint-sig/virt-preview<br />
</pre><br />
<br />
and update your system.<br />
<br />
The steps below assume you have copied both the disk image and the firmware into <code>/var/lib/libvirt/images</code>: this is the location where libvirt usually expects to find disk images, so while using a different location might work it's a good idea to do this and reduce the possibility of issues caused by filesystem permissions and such.<br />
<br />
Assuming you have QEMU &ge; 4.0.0, libvirt &ge; 5.3.0 and virt-manager &ge; 2.2.0, the installation will be as simple as:<br />
<br />
<pre><br />
# virt-install \<br />
--qemu-commandline='-bios none' \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--vcpus 8 \<br />
--memory 2048 \<br />
--os-variant fedora30 \<br />
--boot kernel=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
--import --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*.raw \<br />
--network network=default \<br />
--graphics none<br />
</pre><br />
<br />
If you are stuck with older software (QEMU &ge; 2.12.0, libvirt &ge; 4.7.0), then you're going to need a more verbose command line:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--machine virt \<br />
--vcpus 8 \<br />
--memory 2048 \<br />
--os-variant fedora30 \<br />
--boot kernel=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
--import --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*.raw,bus=virtio \<br />
--network network=default,model=virtio \<br />
--rng device=/dev/urandom,model=virtio \<br />
--channel name=org.qemu.guest_agent.0 \<br />
--graphics none<br />
</pre><br />
<br />
Additionally, when using older software components you won't get PCI support, and so enabling graphics will not be possible.<br />
<br />
Either one of the commands above will automatically boot you into the console. If you don't want that add <code>--noautoconsole</code> option. You can later use <code>virsh</code> tool to manage your VM and get to console.<br />
<br />
A quick reference of <code>virsh</code> commands:<br />
* <code>virsh list --all</code> - list all VMs and their states<br />
* <code>virsh console <name></code> - connect to serial console (remember: <code>Escape character is ^]</code>)<br />
* <code>virsh shutdown <name></code> - power down VM (see above for more details)<br />
* <code>virsh start <name></code> - power up VM<br />
* <code>virsh undefine <name></code> - remove VM<br />
* <code>virsh net-list</code> - list network (useful for the next command)<br />
* <code>virsh net-dhcp-leases <network_name></code> - list DHCP leases, <code><network_name></code> most likely will be <code>default</code>. This is useful when you want to get IPv4 and SSH to the VM.<br />
* <code>virsh domifaddr <name></code> - alternative for the above two commands, only shows IPv4 for one VM<br />
* <code>virsh reset <name></code> - hard reset VM<br />
* <code>virsh destroy <name></code> hard power down of VM<br />
<br />
If you want to use <code>ssh user@virtualMachine</code> you can setup libvirt NSS module. See: https://libvirt.org/nss.html<br />
<br />
You might want also to setup logging for serial console (in case kernel panics or something else).<br />
<br />
For this we will be using two commands: <code>virsh edit <name></code> (modifying VM XML) and <code>virsh dumpxml <name></code> (dump VM XML for backup). You need to modify <code><serial></code> node by adding <code><log file='/var/log/libvirt/qemu/fedora-riscv-mymagicbox.serial.log'/></code>. Then power down and power up the VM.<br />
<br />
Alternatively you can use <code>--serial log.file=/.../whatever.serial.log</code> with <code>virt-install</code> command.<br />
<br />
== Boot under QEMU ==<br />
<br />
Here is the last tested configuration for the instructions below:<br />
* Fedora 37<br />
* QEMU emulator version 7.2.0 (qemu-7.2.0-4.fc37)<br />
* Fedora-Developer-37-20221130.n.0.SiFive.Unmatched<br />
<br />
<pre><br />
# Download disk image<br />
wget https://dl.fedoraproject.org/pub/alt/risc-v/disk_images/Fedora-Developer-37-20221130.n.0.SiFive.Unmatched/Fedora-Developer-37-20221130.n.0-nvme.raw.img.xz<br />
wget https://dl.fedoraproject.org/pub/alt/risc-v/disk_images/Fedora-Developer-37-20221130.n.0.SiFive.Unmatched/Fedora-Developer-37-20221130.n.0-nvme.raw.img.xz.sha512sum<br />
<br />
# Verify<br />
sha512sum -c *.sha512sum<br />
<br />
# Uncompress<br />
unxz Fedora-Developer-37-20221130.n.0-nvme.raw.img.xz<br />
<br />
# Download the latest U-Boot (we need U-Boot SPL and U-Boot ITB files)<br />
mkdir u<br />
pushd u<br />
rpm2cpio http://fedora.riscv.rocks/kojifiles/packages/uboot-tools/2023.01/2.4.riscv64.fc37/noarch/uboot-images-riscv64-2023.01-2.4.riscv64.fc37.noarch.rpm | cpio -dvim<br />
popd<br />
<br />
# We need to modify extlinux.conf for QEMU<br />
<br />
virt-edit -a Fedora-Developer-37-20221130.n.0-nvme.raw.img /boot/extlinux/extlinux.conf<br />
<br />
# Or use kpartx:<br />
mkdir -p /tmp/disk_img<br />
sudo kpartx -a -v Fedora-Developer-37-20221130.n.0-nvme.raw.img<br />
# Output example<br />
add map loop2p1 (253:4): 0 1433600 linear 7:2 34<br />
add map loop2p2 (253:5): 0 19537853 linear 7:2 1433634<br />
# We need to mount the 1st partition (or /boot partition)<br />
sudo mount /dev/mapper/loop2p1 /tmp/disk_img<br />
# Edit extlinux.conf<br />
sudo nvim /tmp/disk_img/extlinux/extlinux.conf<br />
<br />
# Existing boot entry<br />
9 label Fedora-Developer-37-20221130.n.0 (6.0.10-300.0.riscv64.fc37.riscv64) <br />
10 kernel /vmlinuz-6.0.10-300.0.riscv64.fc37.riscv64 <br />
11 append ro root=UUID=d9334329-e2ad-4b72-8f5f-b61406e9d461 rhgb quiet LANG=en_US.UTF-8 console=ttySIF0,115200 earlycon<br />
12 fdtdir /dtb-6.0.10-300.0.riscv64.fc37.riscv64/ <br />
13 initrd /initramfs-6.0.10-300.0.riscv64.fc37.riscv64.img <br />
<br />
# Modified<br />
9 label Fedora-Developer-37-20221130.n.0 (6.0.10-300.0.riscv64.fc37.riscv64) <br />
10 kernel /vmlinuz-6.0.10-300.0.riscv64.fc37.riscv64 <br />
11 append ro root=UUID=d9334329-e2ad-4b72-8f5f-b61406e9d461 rhgb quiet LANG=en_US.UTF-8 console=ttyS0 earlycon <br />
12 initrd /initramfs-6.0.10-300.0.riscv64.fc37.riscv64.img <br />
<br />
# We want to remove fdtdir because we will get DTB from the QEMU itself<br />
# Set console to ttyS0<br />
<br />
# Unmount<br />
sudo sync<br />
sudo umount /tmp/disk_img<br />
sudo kpartx -d -v Fedora-Developer-37-20221130.n.0-nvme.raw.img<br />
<br />
# Launch QEMU<br />
qemu-system-riscv64 \<br />
-bios u/usr/share/uboot/qemu-riscv64_spl/u-boot-spl.bin \<br />
-nographic \<br />
-machine virt \<br />
-smp 4 \<br />
-m 4G \<br />
-device loader,file=u/usr/share/uboot/qemu-riscv64_spl/u-boot.itb,addr=0x80200000 \<br />
-object rng-random,filename=/dev/urandom,id=rng0 \<br />
-device virtio-rng-device,rng=rng0 \<br />
-device virtio-blk-device,drive=hd0 \<br />
-drive file=Fedora-Developer-37-20221130.n.0-nvme.raw.img,format=raw,id=hd0 \<br />
-device virtio-net-device,netdev=usernet \<br />
-netdev user,id=usernet,hostfwd=tcp::10000-:22<br />
</pre><br />
<br />
Once machine is booted you can connect via SSH:<br />
<br />
<pre><br />
$ ssh -p 10000 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o PubkeyAuthentication=no riscv@localhost<br />
</pre><br />
<br />
If need you can get DTB/DTS from QEMU:<br />
<pre><br />
qemu-system-riscv64 -nographic -smp 8 -m 2G -machine virt,dumpdtb=qemu-riscv.dtb<br />
dtc -I dtb -O dts qemu-riscv.dtb -o qemu-riscv.dts<br />
</pre><br />
<br />
This can run up to 32 CPUs.<br />
<br />
== Boot under TinyEMU (RISCVEMU) ==<br />
'''Note (2019 March 10):''' This is not supported anymore until TinyEMU is updated to support external initrd file. Please, use QEMU or libvirt/QEMU.<br />
<br />
RISCVEMU recently (2018-09-23) was renamed to TinyEMU (https://bellard.org/tinyemu/).<br />
<br />
TinyEMU allow booting Fedora disk images in TUI and GUI modes. You can experiment using JSLinux (no need to download/compile/etc) here: https://bellard.org/jslinux/<br />
<br />
Below are instructions how to boot Fedora into X11/Fluxbox GUI mode.<br />
<br />
'''Step 1'''. Compile TinyEMU:<br />
<br />
<pre><br />
wget https://bellard.org/tinyemu/tinyemu-2018-09-23.tar.gz<br />
tar xvf tinyemu-2018-09-23.tar.gz<br />
cd tinyemu-2018-09-23<br />
make<br />
</pre><br />
<br />
'''Step 2'''. Setup for booting Fedora:<br />
<br />
<pre><br />
mkdir fedora<br />
cd fedora<br />
cp ../temu .<br />
<br />
# Download pre-built BBL with embedded kernel<br />
wget https://bellard.org/jslinux/bbl64-4.15.bin<br />
<br />
# Create configuration file for TinyEMU<br />
cat <<EOF > root-riscv64.cfg<br />
/* VM configuration file */<br />
{<br />
version: 1,<br />
machine: "riscv64",<br />
memory_size: 1400,<br />
bios: "bbl64-4.15.bin",<br />
cmdline: "loglevel=3 console=tty0 root=/dev/vda rw TZ=${TZ}",<br />
drive0: { file: "Fedora-Developer-Rawhide-*-sda1.raw" },<br />
eth0: { driver: "user" },<br />
display0: {<br />
device: "simplefb",<br />
width: 1920,<br />
height: 1080,<br />
},<br />
input_device: "virtio",<br />
}<br />
EOF<br />
<br />
# Download disk image and unpack in the same directory<br />
</pre><br />
<br />
'''Step 3'''. Boot it.<br />
<br />
<pre><br />
./temu -rw root-riscv64.cfg<br />
</pre><br />
<br />
We need to use <code>-rw</code> if we want our changes to persist in disk image. Otherwise disk image will be loaded as read-only and all changes will not persist after reboot.<br />
<br />
= Boot the image on physical hardware =<br />
<br />
== Install on the HiFive Unleashed SD card ==<br />
<br />
The disk image can be copied directly to an SD card and run on the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].<br />
<br />
A good way to create the SD card is with this virt-builder command:<br />
<br />
<pre><br />
sudo virt-builder \<br />
--source https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/index \<br />
--no-check-signature \<br />
--arch riscv64 \<br />
--format raw \<br />
--hostname testing.example.com \<br />
--output /dev/sdXXX \<br />
--root-password password:riscv \<br />
fedora-rawhide-developer-20200108.n.0<br />
</pre><br />
<br />
== Install on the HiFive Unleashed using NBD server ==<br />
<br />
You will need a separate machine on the same network which can act as an NBD server. It can be any Linux machine with [https://github.com/qemu/qemu/blob/master/qemu-nbd.c qemu-nbd] or [https://github.com/libguestfs/nbdkit nbdkit] installed.<br />
<br />
You will first need to get it working on the SD card using the instructions in the previous section.<br />
<br />
On the HiFive board, install <code>dracut-network</code> and <code>nbd</code>, and rebuild the initramfs with NBD support using these commands:<br />
<pre><br />
dnf install dracut-network nbd<br />
dracut -m "nbd network base" -v --force<br />
</pre><br />
<br />
Shut down the HiFive board, remove the SD card, and copy the 4th partition from the SD card into a file or partition on the NBD server.<br />
<br />
You will need to change the UUID on this filesystem to a new random one (else it will conflict with the SD-card root filesystem), eg:<br />
<pre><br />
tune2fs -U random /dev/VG/jive<br />
</pre><br />
<br />
Start up the NBD server (in this example using <code>qemu-nbd</code> with the 4th partition having been copied to <code>/dev/VG/jive</code> listening on port 10810):<br />
<pre><br />
qemu-nbd -t -f raw -x "" -p 10810 /dev/VG/jive<br />
</pre><br />
<br />
Place the SD card back in the HiFive board and boot it. At this point you have still booted into the SD card's root filesystem (not NBD). Go and edit <code>/boot/extlinux/extlinux.conf</code>. To the <code>addappend</code> line you will need to set:<br />
<br />
<pre><br />
root=UUID=...uuid... netroot=nbd:192.168.0.220:10810 rootfstype=ext4 ro rootdelay=5 ip=dhcp rootwait<br />
</pre><br />
<br />
I would also advise removing <code>rhgb quiet</code> if they are present. Note you need to set <code>uuid</code> and the address and port number of the NBD server correctly. Immediately reboot and it should come up with an NBD root. Check the boot messages carefully to see whether it used the SD card or NBD root.<br />
<br />
== Install Fedora GNOME Desktop on SiFive HiFive Unleashed + Microsemi HiFive Unleashed Expansion board ==<br />
<br />
Detailed instructions are provided by Atish Patra from Western Digital Corporation (WDC). See their GitHub page for details and pictures: https://github.com/westerndigitalcorporation/RISC-V-Linux<br />
<br />
So far two GPUs are confirmed to be working: Radeon HD 6450 and Radeon HD 5450.<br />
<br />
= Use the image =<br />
<br />
Once the system is booted, login as <code>root</code> with <code>riscv</code> as password.<br />
<br />
X11 with Fluxbox can be started using: <code>startx /usr/bin/startfluxbox</code>. The disk image also includes awesome and i3 for testing. Dillo is available as a basic web browser (no javascript support) and pcmanfm as file manager.<br />
<br />
To gracefully shutdown just type <code>poweroff</code> into console.<br />
<br />
If you want more information being displayed during boot, remove <code>quiet</code> from the <code>append</code> line in <code>/boot/extlinux/extlinux.conf</code>.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Installing&diff=567117Architectures/RISC-V/Installing2020-02-28T14:52:55Z<p>Rjones: /* Install on the HiFive Unleashed using NBD server */</p>
<hr />
<div>This page describes the steps necessary to get Fedora for RISC-V running, either on emulated or real hardware.<br />
<br />
= Obtain a disk image =<br />
<br />
== Tested images ==<br />
<br />
These images have undergone some testing and thus are more likely to work without issues. If you are not sure which image to choose, go with one of these.<br />
<br />
=== Download using virt-builder ===<br />
<br />
This is the recommended way to obtain disk images.<br />
<br />
Before you can start using <code>virt-builder</code> for this task, a one-time setup is necessary:<br />
<br />
<pre><br />
$ mkdir -p ~/.config/virt-builder/repos.d/<br />
$ cat <<EOF >~/.config/virt-builder/repos.d/fedora-riscv.conf<br />
[fedora-riscv]<br />
uri=https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/index<br />
EOF<br />
</pre><br />
<br />
With that out of the way, you can get a list of available RISC-V templates with:<br />
<br />
<pre><br />
$ virt-builder --list | grep riscv64<br />
fedora-rawhide-developer-20191123.n.0 riscv64 Fedora® Rawhide Developer 20191123.n.0<br />
fedora-rawhide-minimal-20191123.n.1 riscv64 Fedora® Rawhide Minimal 20191123.n.1<br />
</pre><br />
<br />
Then tell <code>virt-builder</code> to build a custom disk image based on one of the templates:<br />
<br />
<pre><br />
$ virt-builder \<br />
--arch riscv64 \<br />
--size 20G \<br />
--format raw \<br />
--output Fedora-Developer-Rawhide-20191123.n.0-sda.raw \<br />
fedora-rawhide-developer-20191123.n.0<br />
[ 3.6] Downloading: https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-sda.raw.xz<br />
[ 6.1] Planning how to build this image<br />
[ 6.1] Uncompressing<br />
[ 32.8] Opening the new disk<br />
[ 38.4] Setting a random seed<br />
[ 38.4] Setting the machine ID in /etc/machine-id<br />
[ 38.4] Setting passwords<br />
virt-builder: Setting random password of root to 5PegnZtGMP47bXnw<br />
[ 39.9] Finishing off<br />
Output file: Fedora-Developer-Rawhide-20191123.n.0-sda.raw<br />
Output size: 20.0G<br />
Output format: raw<br />
Total usable space: 19.7G<br />
Free space: 14.7G (75%)<br />
</pre><br />
<br />
<code>virt-builder</code> has reasonable defaults, such as generating a random root password for you, but if you want more control you can pass additional arguments to customize the image further: for example, using <code>--format qcow2</code> will cause the output image to be in QCOW2 format. See <code>virt-builder --help</code> for more information.<br />
<br />
In addition to the disk image, a firmware image (which has to be downloaded separately) is needed as well. To find out the download URL, use:<br />
<br />
<pre><br />
$ virt-builder --arch riscv64 --notes fedora-rawhide-developer-20191123.n.0 | grep fw_payload<br />
https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf<br />
https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf.CHECKSUM<br />
</pre><br />
<br />
Then download it using your favorite HTTP client, for example:<br />
<br />
<pre><br />
$ wget https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf<br />
</pre><br />
<br />
=== Download manually ===<br />
<br />
If using <code>virt-builder</code> is not an option, you can download disk images manually from: https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/<br />
<br />
Download <code>Fedora-Developer-Rawhide-*.raw.xz</code> as well as the matching <code>Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf</code>.<br />
<br />
== Nightly builds ==<br />
<br />
You can find them here: http://fedora.riscv.rocks/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id<br />
<br />
Select the most recent (top) build and download <code>Fedora-Developer-Rawhide-*.raw.xz</code>.<br />
<br />
These disk images differ from the ones above in that:<br />
* the firmware is inside the disk image, in the <code>/boot</code> directory;<br />
* they are completely untested.<br />
<br />
= Prepare the disk image =<br />
<br />
These steps are only necessary if you haven't used <code>virt-builder</code>.<br />
<br />
== Uncompress the image ==<br />
<br />
Whether you have downloaded a tested image or a nightly build, you'll need to uncompress it before it can be used:<br />
<br />
<pre><br />
$ unxz Fedora-Developer-Rawhide-*.raw.xz<br />
</pre><br />
<br />
== Optional: expand the disk image ==<br />
<br />
You might want to expand the disk image before setting up the VM. Here is one example:<br />
<br />
<pre><br />
$ truncate -r Fedora-Developer-Rawhide-*.raw expanded.raw<br />
$ truncate -s 40G expanded.raw<br />
$ virt-resize -v -x --expand /dev/sda4 Fedora-Developer-Rawhide-*.raw expanded.raw<br />
$ virt-filesystems --long -h --all -a expanded.raw<br />
$ virt-df -h -a expanded.raw<br />
</pre><br />
<br />
The resulting disk image will work with QEMU as well as TinyEMU. Make sure you use <code>expanded.raw</code> instead of <code>Fedora-Developer-Rawhide-*.raw</code> when booting the guest.<br />
<br />
== Optional: create an overlay ==<br />
<br />
You can also create <code>qcow2</code> disk image with <code>raw</code> Fedora disk as backing one. This way Fedora <code>raw</code> is unmodified and all changes are written to <code>qcow2</code> layer. You will need to install <code>libguestfs-tools-c</code>.<br />
<br />
<pre><br />
$ qemu-img create -f qcow2 -F raw -b Fedora-Developer-Rawhide-*.raw overlay.qcow2 20G<br />
$ virt-resize -v -x --expand /dev/sda4 Fedora-Developer-Rawhide-*.raw overlay.qcow2<br />
$ virt-filesystems --long -h --all -a overlay.qcow2<br />
</pre><br />
<br />
The resulting disk image will only work with QEMU. Make sure you use <code>overlay.qcow2</code> instead of <code>Fedora-Developer-Rawhide-*.raw</code> when booting the guest.<br />
<br />
== Optional: set the hostname before booting ==<br />
<br />
If you want to change hostname before the first boot, install <code>libguestfs-tools-c</code> and then run:<br />
<br />
<pre><br />
$ virt-customize -a Fedora-Developer-Rawhide-*.raw --hostname fedora-riscv-mymagicbox<br />
</pre><br />
<br />
== Nightly builds only: extracting firmware (OpenSBI) ==<br />
<br />
Fedora/RISC-V does not support BLS (Boot Loader Specification - [https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault more details]).<br />
<br />
Disk images contain a <code>/boot</code> directory from where you can copy out the firmware.<br />
<br />
This is '''only''' necessary for nightly builds, since for tested images these files are provided as separate downloads alongside the image.<br />
<br />
Example session:<br />
<br />
<pre><br />
$ guestfish \<br />
add Fedora-Developer-Rawhide-*.raw : \<br />
run : \<br />
mount /dev/sda1 / : \<br />
ls /opensbi/unstable<br />
fw_jump.elf<br />
fw_payload-5.2.0-0.rc7.git0.1.0.riscv64.fc31.riscv64.elf<br />
fw_payload-uboot-qemu-virt-smode.elf<br />
$ guestfish \<br />
add Fedora-Developer-Rawhide-*.raw : run : mount /dev/sda1 / : \<br />
download /opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf fw_payload-uboot-qemu-virt-smode.elf<br />
</pre><br />
<br />
You can also use <code>guestmount</code> or QEMU/NBD to mount disk image. Examples:<br />
<pre><br />
$ mkdir a<br />
$ guestmount -a $PWD/Fedora-Developer-Rawhide-*.raw -m /dev/sda1 $PWD/a<br />
$ cp a/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf .<br />
$ guestunmount $PWD/a<br />
</pre><br />
<br />
<pre><br />
$ sudo modprobe nbd max_part=8<br />
$ sudo qemu-nbd -f raw --connect=/dev/nbd1 $PWD/Fedora-Developer-Rawhide-*.raw<br />
$ sudo fdisk -l /dev/nbd1<br />
Disk /dev/nbd1: 7.5 GiB, 8053063680 bytes, 15728640 sectors<br />
Units: sectors of 1 * 512 = 512 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
I/O size (minimum/optimal): 512 bytes / 512 bytes<br />
Disklabel type: gpt<br />
Disk identifier: F0F4268F-1B73-46FF-BABA-D87F075DCCA5<br />
<br />
Device Start End Sectors Size Type<br />
/dev/nbd1p1 2048 15001599 14999552 7.2G Linux filesystem<br />
$ sudo mount /dev/nbd1p1 a<br />
$ sudo cp a/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf .<br />
$ sudo umount a<br />
$ sudo qemu-nbd --disconnect /dev/nbd1<br />
</pre><br />
<br />
Note NBD is highly useful if you need to run <code>fdisk</code>, <code>e2fsck</code> (e.g. after VM crash and filesystem lock up), <code>resize2fs</code>. It might be beneficial to look into <code>nbdkit</code> and <code>nbd</code> packages.<br />
<br />
= Boot the image on virtual hardware =<br />
<br />
There are several options for booting the image on virtual hardware once you've prepared it following the steps above.<br />
<br />
== Boot with libvirt ==<br />
<br />
Detailed instructions how to install libvirt: https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-virtualization/<br />
<br />
Quick instructions for libvirt installation (tested on Fedora 30):<br />
<br />
<pre><br />
# dnf group install --with-optional virtualization<br />
# systemctl enable --now libvirtd<br />
</pre><br />
<br />
When running RISC-V guests, it's usually a good idea to use the very latest versions of QEMU, libvirt and virt-manager: the <code>virt-preview</code> repository offers just that for Fedora users. To enable it, simply run:<br />
<br />
<pre><br />
# dnf copr enable @virtmaint-sig/virt-preview<br />
</pre><br />
<br />
and update your system.<br />
<br />
The steps below assume you have copied both the disk image and the firmware into <code>/var/lib/libvirt/images</code>: this is the location where libvirt usually expects to find disk images, so while using a different location might work it's a good idea to do this and reduce the possibility of issues caused by filesystem permissions and such.<br />
<br />
Assuming you have QEMU &ge; 4.0.0, libvirt &ge; 5.3.0 and virt-manager &ge; 2.2.0, the installation will be as simple as:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--vcpus 8 \<br />
--memory 2048 \<br />
--os-variant fedora30 \<br />
--boot kernel=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
--import --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*.raw \<br />
--network network=default \<br />
--graphics none<br />
</pre><br />
<br />
If you are stuck with older software (QEMU &ge; 2.12.0, libvirt &ge; 4.7.0), then you're going to need a more verbose command line:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--machine virt \<br />
--vcpus 8 \<br />
--memory 2048 \<br />
--os-variant fedora30 \<br />
--boot kernel=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
--import --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*.raw,bus=virtio \<br />
--network network=default,model=virtio \<br />
--rng device=/dev/urandom,model=virtio \<br />
--channel name=org.qemu.guest_agent.0 \<br />
--graphics none<br />
</pre><br />
<br />
Additionally, when using older software components you won't get PCI support, and so enabling graphics will not be possible.<br />
<br />
Either one of the commands above will automatically boot you into the console. If you don't want that add <code>--noautoconsole</code> option. You can later use <code>virsh</code> tool to manage your VM and get to console.<br />
<br />
A quick reference of <code>virsh</code> commands:<br />
* <code>virsh list --all</code> - list all VMs and their states<br />
* <code>virsh console <name></code> - connect to serial console (remember: <code>Escape character is ^]</code>)<br />
* <code>virsh shutdown <name></code> - power down VM (see above for more details)<br />
* <code>virsh start <name></code> - power up VM<br />
* <code>virsh undefine <name></code> - remove VM<br />
* <code>virsh net-list</code> - list network (useful for the next command)<br />
* <code>virsh net-dhcp-leases <network_name></code> - list DHCP leases, <code><network_name></code> most likely will be <code>default</code>. This is useful when you want to get IPv4 and SSH to the VM.<br />
* <code>virsh domifaddr <name></code> - alternative for the above two commands, only shows IPv4 for one VM<br />
* <code>virsh reset <name></code> - hard reset VM<br />
* <code>virsh destroy <name></code> hard power down of VM<br />
<br />
If you want to use <code>ssh user@virtualMachine</code> you can setup libvirt NSS module. See: https://wiki.libvirt.org/page/NSS_module<br />
<br />
You might want also to setup logging for serial console (in case kernel panics or something else).<br />
<br />
For this we will be using two commands: <code>virsh edit <name></code> (modifying VM XML) and <code>virsh dumpxml <name></code> (dump VM XML for backup). You need to modify <code><serial></code> node by adding <code><log file='/var/log/libvirt/qemu/fedora-riscv-mymagicbox.serial.log'/></code>. Then power down and power up the VM.<br />
<br />
Alternatively you can use <code>--serial log.file=/.../whatever.serial.log</code> with <code>virt-install</code> command.<br />
<br />
== Boot under QEMU ==<br />
<br />
You will get the best results if your QEMU version is 4.0.0 or newer, but any version since 2.12.0 will work.<br />
<br />
<pre><br />
$ qemu-system-riscv64 \<br />
-nographic \<br />
-machine virt \<br />
-smp 8 \<br />
-m 2G \<br />
-kernel Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
-object rng-random,filename=/dev/urandom,id=rng0 \<br />
-device virtio-rng-device,rng=rng0 \<br />
-device virtio-blk-device,drive=hd0 \<br />
-drive file=Fedora-Developer-Rawhide-*.raw,format=raw,id=hd0 \<br />
-device virtio-net-device,netdev=usernet \<br />
-netdev user,id=usernet,hostfwd=tcp::10000-:22<br />
</pre><br />
<br />
Once machine is booted you can connect via SSH:<br />
<br />
<pre><br />
$ ssh -p 10000 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o PubkeyAuthentication=no root@localhost<br />
</pre><br />
<br />
== Boot under TinyEMU (RISCVEMU) ==<br />
'''Note (2019 March 10):''' This is not supported anymore until TinyEMU is updated to support external initrd file. Please, use QEMU or libvirt/QEMU.<br />
<br />
RISCVEMU recently (2018-09-23) was renamed to TinyEMU (https://bellard.org/tinyemu/).<br />
<br />
TinyEMU allow booting Fedora disk images in TUI and GUI modes. You can experiment using JSLinux (no need to download/compile/etc) here: https://bellard.org/jslinux/<br />
<br />
Below are instructions how to boot Fedora into X11/Fluxbox GUI mode.<br />
<br />
'''Step 1'''. Compile TinyEMU:<br />
<br />
<pre><br />
wget https://bellard.org/tinyemu/tinyemu-2018-09-23.tar.gz<br />
tar xvf tinyemu-2018-09-23.tar.gz<br />
cd tinyemu-2018-09-23<br />
make<br />
</pre><br />
<br />
'''Step 2'''. Setup for booting Fedora:<br />
<br />
<pre><br />
mkdir fedora<br />
cd fedora<br />
cp ../temu .<br />
<br />
# Download pre-built BBL with embedded kernel<br />
wget https://bellard.org/jslinux/bbl64-4.15.bin<br />
<br />
# Create configuration file for TinyEMU<br />
cat <<EOF > root-riscv64.cfg<br />
/* VM configuration file */<br />
{<br />
version: 1,<br />
machine: "riscv64",<br />
memory_size: 1400,<br />
bios: "bbl64-4.15.bin",<br />
cmdline: "loglevel=3 console=tty0 root=/dev/vda rw TZ=${TZ}",<br />
drive0: { file: "Fedora-Developer-Rawhide-*-sda1.raw" },<br />
eth0: { driver: "user" },<br />
display0: {<br />
device: "simplefb",<br />
width: 1920,<br />
height: 1080,<br />
},<br />
input_device: "virtio",<br />
}<br />
EOF<br />
<br />
# Download disk image and unpack in the same directory<br />
</pre><br />
<br />
'''Step 3'''. Boot it.<br />
<br />
<pre><br />
./temu -rw root-riscv64.cfg<br />
</pre><br />
<br />
We need to use <code>-rw</code> if we want our changes to persist in disk image. Otherwise disk image will be loaded as read-only and all changes will not persist after reboot.<br />
<br />
= Boot the image on physical hardware =<br />
<br />
== Install on the HiFive Unleashed SD card ==<br />
<br />
The disk image can be copied directly to an SD card and run on the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].<br />
<br />
A good way to create the SD card is with this virt-builder command:<br />
<br />
<pre><br />
sudo virt-builder \<br />
--source https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/index \<br />
--no-check-signature \<br />
--arch riscv64 \<br />
--format raw \<br />
--hostname testing.example.com \<br />
--output /dev/sdXXX \<br />
--root-password password:riscv \<br />
fedora-rawhide-developer-20200108.n.0<br />
</pre><br />
<br />
== Install on the HiFive Unleashed using NBD server ==<br />
<br />
You will need a separate machine on the same network which can act as an NBD server. It can be any Linux machine with [https://github.com/qemu/qemu/blob/master/qemu-nbd.c qemu-nbd] or [https://github.com/libguestfs/nbdkit nbdkit] installed.<br />
<br />
You will first need to get it working on the SD card using the instructions in the previous section.<br />
<br />
On the HiFive board, install <code>dracut-network</code> and <code>nbd</code>, and rebuild the initramfs with NBD support using these commands:<br />
<pre><br />
dnf install dracut-network nbd<br />
dracut -m "nbd network base" -v --force<br />
</pre><br />
<br />
Shut down the HiFive board, remove the SD card, and copy the 4th partition from the SD card into a file or partition on the NBD server.<br />
<br />
You will need to change the UUID on this filesystem to a new random one (else it will conflict with the SD-card root filesystem), eg:<br />
<pre><br />
tune2fs -U random /dev/VG/jive<br />
</pre><br />
<br />
Start up the NBD server (in this example using <code>qemu-nbd</code> with the 4th partition having been copied to <code>/dev/VG/jive</code> listening on port 10810):<br />
<pre><br />
qemu-nbd -t -f raw -x "" -p 10810 /dev/VG/jive<br />
</pre><br />
<br />
Place the SD card back in the HiFive board and boot it. At this point you have still booted into the SD card's root filesystem (not NBD). Go and edit <code>/boot/extlinux/extlinux.conf</code>. To the <code>addappend</code> line you will need to set:<br />
<br />
<pre><br />
root=UUID=...uuid... netroot=nbd:192.168.0.220:10810 rootfstype=ext4 ro rootdelay=5 ip=dhcp rootwait<br />
</pre><br />
<br />
I would also advise removing <code>rhgb quiet</code> if they are present. Note you need to set <code>uuid</code> and the address and port number of the NBD server correctly. Immediately reboot and it should come up with an NBD root. Check the boot messages carefully to see whether it used the SD card or NBD root.<br />
<br />
== Install Fedora GNOME Desktop on SiFive HiFive Unleashed + Microsemi HiFive Unleashed Expansion board ==<br />
<br />
Detailed instructions are provided by Atish Patra from Western Digital Corporation (WDC). See their GitHub page for details and pictures: https://github.com/westerndigitalcorporation/RISC-V-Linux<br />
<br />
So far two GPUs are confirmed to be working: Radeon HD 6450 and Radeon HD 5450.<br />
<br />
= Use the image =<br />
<br />
Once the system is booted, login as <code>root</code> with <code>riscv</code> as password.<br />
<br />
X11 with Fluxbox can be started using: <code>startx /usr/bin/startfluxbox</code>. The disk image also includes awesome and i3 for testing. Dillo is available as a basic web browser (no javascript support) and pcmanfm as file manager.<br />
<br />
To gracefully shutdown just type <code>poweroff</code> into console.<br />
<br />
If you want more information being displayed during boot, remove <code>quiet</code> from the <code>append</code> line in <code>/boot/extlinux/extlinux.conf</code>.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Installing&diff=567116Architectures/RISC-V/Installing2020-02-28T14:52:01Z<p>Rjones: /* Install on the HiFive Unleashed using NBD server */</p>
<hr />
<div>This page describes the steps necessary to get Fedora for RISC-V running, either on emulated or real hardware.<br />
<br />
= Obtain a disk image =<br />
<br />
== Tested images ==<br />
<br />
These images have undergone some testing and thus are more likely to work without issues. If you are not sure which image to choose, go with one of these.<br />
<br />
=== Download using virt-builder ===<br />
<br />
This is the recommended way to obtain disk images.<br />
<br />
Before you can start using <code>virt-builder</code> for this task, a one-time setup is necessary:<br />
<br />
<pre><br />
$ mkdir -p ~/.config/virt-builder/repos.d/<br />
$ cat <<EOF >~/.config/virt-builder/repos.d/fedora-riscv.conf<br />
[fedora-riscv]<br />
uri=https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/index<br />
EOF<br />
</pre><br />
<br />
With that out of the way, you can get a list of available RISC-V templates with:<br />
<br />
<pre><br />
$ virt-builder --list | grep riscv64<br />
fedora-rawhide-developer-20191123.n.0 riscv64 Fedora® Rawhide Developer 20191123.n.0<br />
fedora-rawhide-minimal-20191123.n.1 riscv64 Fedora® Rawhide Minimal 20191123.n.1<br />
</pre><br />
<br />
Then tell <code>virt-builder</code> to build a custom disk image based on one of the templates:<br />
<br />
<pre><br />
$ virt-builder \<br />
--arch riscv64 \<br />
--size 20G \<br />
--format raw \<br />
--output Fedora-Developer-Rawhide-20191123.n.0-sda.raw \<br />
fedora-rawhide-developer-20191123.n.0<br />
[ 3.6] Downloading: https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-sda.raw.xz<br />
[ 6.1] Planning how to build this image<br />
[ 6.1] Uncompressing<br />
[ 32.8] Opening the new disk<br />
[ 38.4] Setting a random seed<br />
[ 38.4] Setting the machine ID in /etc/machine-id<br />
[ 38.4] Setting passwords<br />
virt-builder: Setting random password of root to 5PegnZtGMP47bXnw<br />
[ 39.9] Finishing off<br />
Output file: Fedora-Developer-Rawhide-20191123.n.0-sda.raw<br />
Output size: 20.0G<br />
Output format: raw<br />
Total usable space: 19.7G<br />
Free space: 14.7G (75%)<br />
</pre><br />
<br />
<code>virt-builder</code> has reasonable defaults, such as generating a random root password for you, but if you want more control you can pass additional arguments to customize the image further: for example, using <code>--format qcow2</code> will cause the output image to be in QCOW2 format. See <code>virt-builder --help</code> for more information.<br />
<br />
In addition to the disk image, a firmware image (which has to be downloaded separately) is needed as well. To find out the download URL, use:<br />
<br />
<pre><br />
$ virt-builder --arch riscv64 --notes fedora-rawhide-developer-20191123.n.0 | grep fw_payload<br />
https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf<br />
https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf.CHECKSUM<br />
</pre><br />
<br />
Then download it using your favorite HTTP client, for example:<br />
<br />
<pre><br />
$ wget https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf<br />
</pre><br />
<br />
=== Download manually ===<br />
<br />
If using <code>virt-builder</code> is not an option, you can download disk images manually from: https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/<br />
<br />
Download <code>Fedora-Developer-Rawhide-*.raw.xz</code> as well as the matching <code>Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf</code>.<br />
<br />
== Nightly builds ==<br />
<br />
You can find them here: http://fedora.riscv.rocks/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id<br />
<br />
Select the most recent (top) build and download <code>Fedora-Developer-Rawhide-*.raw.xz</code>.<br />
<br />
These disk images differ from the ones above in that:<br />
* the firmware is inside the disk image, in the <code>/boot</code> directory;<br />
* they are completely untested.<br />
<br />
= Prepare the disk image =<br />
<br />
These steps are only necessary if you haven't used <code>virt-builder</code>.<br />
<br />
== Uncompress the image ==<br />
<br />
Whether you have downloaded a tested image or a nightly build, you'll need to uncompress it before it can be used:<br />
<br />
<pre><br />
$ unxz Fedora-Developer-Rawhide-*.raw.xz<br />
</pre><br />
<br />
== Optional: expand the disk image ==<br />
<br />
You might want to expand the disk image before setting up the VM. Here is one example:<br />
<br />
<pre><br />
$ truncate -r Fedora-Developer-Rawhide-*.raw expanded.raw<br />
$ truncate -s 40G expanded.raw<br />
$ virt-resize -v -x --expand /dev/sda4 Fedora-Developer-Rawhide-*.raw expanded.raw<br />
$ virt-filesystems --long -h --all -a expanded.raw<br />
$ virt-df -h -a expanded.raw<br />
</pre><br />
<br />
The resulting disk image will work with QEMU as well as TinyEMU. Make sure you use <code>expanded.raw</code> instead of <code>Fedora-Developer-Rawhide-*.raw</code> when booting the guest.<br />
<br />
== Optional: create an overlay ==<br />
<br />
You can also create <code>qcow2</code> disk image with <code>raw</code> Fedora disk as backing one. This way Fedora <code>raw</code> is unmodified and all changes are written to <code>qcow2</code> layer. You will need to install <code>libguestfs-tools-c</code>.<br />
<br />
<pre><br />
$ qemu-img create -f qcow2 -F raw -b Fedora-Developer-Rawhide-*.raw overlay.qcow2 20G<br />
$ virt-resize -v -x --expand /dev/sda4 Fedora-Developer-Rawhide-*.raw overlay.qcow2<br />
$ virt-filesystems --long -h --all -a overlay.qcow2<br />
</pre><br />
<br />
The resulting disk image will only work with QEMU. Make sure you use <code>overlay.qcow2</code> instead of <code>Fedora-Developer-Rawhide-*.raw</code> when booting the guest.<br />
<br />
== Optional: set the hostname before booting ==<br />
<br />
If you want to change hostname before the first boot, install <code>libguestfs-tools-c</code> and then run:<br />
<br />
<pre><br />
$ virt-customize -a Fedora-Developer-Rawhide-*.raw --hostname fedora-riscv-mymagicbox<br />
</pre><br />
<br />
== Nightly builds only: extracting firmware (OpenSBI) ==<br />
<br />
Fedora/RISC-V does not support BLS (Boot Loader Specification - [https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault more details]).<br />
<br />
Disk images contain a <code>/boot</code> directory from where you can copy out the firmware.<br />
<br />
This is '''only''' necessary for nightly builds, since for tested images these files are provided as separate downloads alongside the image.<br />
<br />
Example session:<br />
<br />
<pre><br />
$ guestfish \<br />
add Fedora-Developer-Rawhide-*.raw : \<br />
run : \<br />
mount /dev/sda1 / : \<br />
ls /opensbi/unstable<br />
fw_jump.elf<br />
fw_payload-5.2.0-0.rc7.git0.1.0.riscv64.fc31.riscv64.elf<br />
fw_payload-uboot-qemu-virt-smode.elf<br />
$ guestfish \<br />
add Fedora-Developer-Rawhide-*.raw : run : mount /dev/sda1 / : \<br />
download /opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf fw_payload-uboot-qemu-virt-smode.elf<br />
</pre><br />
<br />
You can also use <code>guestmount</code> or QEMU/NBD to mount disk image. Examples:<br />
<pre><br />
$ mkdir a<br />
$ guestmount -a $PWD/Fedora-Developer-Rawhide-*.raw -m /dev/sda1 $PWD/a<br />
$ cp a/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf .<br />
$ guestunmount $PWD/a<br />
</pre><br />
<br />
<pre><br />
$ sudo modprobe nbd max_part=8<br />
$ sudo qemu-nbd -f raw --connect=/dev/nbd1 $PWD/Fedora-Developer-Rawhide-*.raw<br />
$ sudo fdisk -l /dev/nbd1<br />
Disk /dev/nbd1: 7.5 GiB, 8053063680 bytes, 15728640 sectors<br />
Units: sectors of 1 * 512 = 512 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
I/O size (minimum/optimal): 512 bytes / 512 bytes<br />
Disklabel type: gpt<br />
Disk identifier: F0F4268F-1B73-46FF-BABA-D87F075DCCA5<br />
<br />
Device Start End Sectors Size Type<br />
/dev/nbd1p1 2048 15001599 14999552 7.2G Linux filesystem<br />
$ sudo mount /dev/nbd1p1 a<br />
$ sudo cp a/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf .<br />
$ sudo umount a<br />
$ sudo qemu-nbd --disconnect /dev/nbd1<br />
</pre><br />
<br />
Note NBD is highly useful if you need to run <code>fdisk</code>, <code>e2fsck</code> (e.g. after VM crash and filesystem lock up), <code>resize2fs</code>. It might be beneficial to look into <code>nbdkit</code> and <code>nbd</code> packages.<br />
<br />
= Boot the image on virtual hardware =<br />
<br />
There are several options for booting the image on virtual hardware once you've prepared it following the steps above.<br />
<br />
== Boot with libvirt ==<br />
<br />
Detailed instructions how to install libvirt: https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-virtualization/<br />
<br />
Quick instructions for libvirt installation (tested on Fedora 30):<br />
<br />
<pre><br />
# dnf group install --with-optional virtualization<br />
# systemctl enable --now libvirtd<br />
</pre><br />
<br />
When running RISC-V guests, it's usually a good idea to use the very latest versions of QEMU, libvirt and virt-manager: the <code>virt-preview</code> repository offers just that for Fedora users. To enable it, simply run:<br />
<br />
<pre><br />
# dnf copr enable @virtmaint-sig/virt-preview<br />
</pre><br />
<br />
and update your system.<br />
<br />
The steps below assume you have copied both the disk image and the firmware into <code>/var/lib/libvirt/images</code>: this is the location where libvirt usually expects to find disk images, so while using a different location might work it's a good idea to do this and reduce the possibility of issues caused by filesystem permissions and such.<br />
<br />
Assuming you have QEMU &ge; 4.0.0, libvirt &ge; 5.3.0 and virt-manager &ge; 2.2.0, the installation will be as simple as:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--vcpus 8 \<br />
--memory 2048 \<br />
--os-variant fedora30 \<br />
--boot kernel=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
--import --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*.raw \<br />
--network network=default \<br />
--graphics none<br />
</pre><br />
<br />
If you are stuck with older software (QEMU &ge; 2.12.0, libvirt &ge; 4.7.0), then you're going to need a more verbose command line:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--machine virt \<br />
--vcpus 8 \<br />
--memory 2048 \<br />
--os-variant fedora30 \<br />
--boot kernel=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
--import --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*.raw,bus=virtio \<br />
--network network=default,model=virtio \<br />
--rng device=/dev/urandom,model=virtio \<br />
--channel name=org.qemu.guest_agent.0 \<br />
--graphics none<br />
</pre><br />
<br />
Additionally, when using older software components you won't get PCI support, and so enabling graphics will not be possible.<br />
<br />
Either one of the commands above will automatically boot you into the console. If you don't want that add <code>--noautoconsole</code> option. You can later use <code>virsh</code> tool to manage your VM and get to console.<br />
<br />
A quick reference of <code>virsh</code> commands:<br />
* <code>virsh list --all</code> - list all VMs and their states<br />
* <code>virsh console <name></code> - connect to serial console (remember: <code>Escape character is ^]</code>)<br />
* <code>virsh shutdown <name></code> - power down VM (see above for more details)<br />
* <code>virsh start <name></code> - power up VM<br />
* <code>virsh undefine <name></code> - remove VM<br />
* <code>virsh net-list</code> - list network (useful for the next command)<br />
* <code>virsh net-dhcp-leases <network_name></code> - list DHCP leases, <code><network_name></code> most likely will be <code>default</code>. This is useful when you want to get IPv4 and SSH to the VM.<br />
* <code>virsh domifaddr <name></code> - alternative for the above two commands, only shows IPv4 for one VM<br />
* <code>virsh reset <name></code> - hard reset VM<br />
* <code>virsh destroy <name></code> hard power down of VM<br />
<br />
If you want to use <code>ssh user@virtualMachine</code> you can setup libvirt NSS module. See: https://wiki.libvirt.org/page/NSS_module<br />
<br />
You might want also to setup logging for serial console (in case kernel panics or something else).<br />
<br />
For this we will be using two commands: <code>virsh edit <name></code> (modifying VM XML) and <code>virsh dumpxml <name></code> (dump VM XML for backup). You need to modify <code><serial></code> node by adding <code><log file='/var/log/libvirt/qemu/fedora-riscv-mymagicbox.serial.log'/></code>. Then power down and power up the VM.<br />
<br />
Alternatively you can use <code>--serial log.file=/.../whatever.serial.log</code> with <code>virt-install</code> command.<br />
<br />
== Boot under QEMU ==<br />
<br />
You will get the best results if your QEMU version is 4.0.0 or newer, but any version since 2.12.0 will work.<br />
<br />
<pre><br />
$ qemu-system-riscv64 \<br />
-nographic \<br />
-machine virt \<br />
-smp 8 \<br />
-m 2G \<br />
-kernel Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
-object rng-random,filename=/dev/urandom,id=rng0 \<br />
-device virtio-rng-device,rng=rng0 \<br />
-device virtio-blk-device,drive=hd0 \<br />
-drive file=Fedora-Developer-Rawhide-*.raw,format=raw,id=hd0 \<br />
-device virtio-net-device,netdev=usernet \<br />
-netdev user,id=usernet,hostfwd=tcp::10000-:22<br />
</pre><br />
<br />
Once machine is booted you can connect via SSH:<br />
<br />
<pre><br />
$ ssh -p 10000 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o PubkeyAuthentication=no root@localhost<br />
</pre><br />
<br />
== Boot under TinyEMU (RISCVEMU) ==<br />
'''Note (2019 March 10):''' This is not supported anymore until TinyEMU is updated to support external initrd file. Please, use QEMU or libvirt/QEMU.<br />
<br />
RISCVEMU recently (2018-09-23) was renamed to TinyEMU (https://bellard.org/tinyemu/).<br />
<br />
TinyEMU allow booting Fedora disk images in TUI and GUI modes. You can experiment using JSLinux (no need to download/compile/etc) here: https://bellard.org/jslinux/<br />
<br />
Below are instructions how to boot Fedora into X11/Fluxbox GUI mode.<br />
<br />
'''Step 1'''. Compile TinyEMU:<br />
<br />
<pre><br />
wget https://bellard.org/tinyemu/tinyemu-2018-09-23.tar.gz<br />
tar xvf tinyemu-2018-09-23.tar.gz<br />
cd tinyemu-2018-09-23<br />
make<br />
</pre><br />
<br />
'''Step 2'''. Setup for booting Fedora:<br />
<br />
<pre><br />
mkdir fedora<br />
cd fedora<br />
cp ../temu .<br />
<br />
# Download pre-built BBL with embedded kernel<br />
wget https://bellard.org/jslinux/bbl64-4.15.bin<br />
<br />
# Create configuration file for TinyEMU<br />
cat <<EOF > root-riscv64.cfg<br />
/* VM configuration file */<br />
{<br />
version: 1,<br />
machine: "riscv64",<br />
memory_size: 1400,<br />
bios: "bbl64-4.15.bin",<br />
cmdline: "loglevel=3 console=tty0 root=/dev/vda rw TZ=${TZ}",<br />
drive0: { file: "Fedora-Developer-Rawhide-*-sda1.raw" },<br />
eth0: { driver: "user" },<br />
display0: {<br />
device: "simplefb",<br />
width: 1920,<br />
height: 1080,<br />
},<br />
input_device: "virtio",<br />
}<br />
EOF<br />
<br />
# Download disk image and unpack in the same directory<br />
</pre><br />
<br />
'''Step 3'''. Boot it.<br />
<br />
<pre><br />
./temu -rw root-riscv64.cfg<br />
</pre><br />
<br />
We need to use <code>-rw</code> if we want our changes to persist in disk image. Otherwise disk image will be loaded as read-only and all changes will not persist after reboot.<br />
<br />
= Boot the image on physical hardware =<br />
<br />
== Install on the HiFive Unleashed SD card ==<br />
<br />
The disk image can be copied directly to an SD card and run on the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].<br />
<br />
A good way to create the SD card is with this virt-builder command:<br />
<br />
<pre><br />
sudo virt-builder \<br />
--source https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/index \<br />
--no-check-signature \<br />
--arch riscv64 \<br />
--format raw \<br />
--hostname testing.example.com \<br />
--output /dev/sdXXX \<br />
--root-password password:riscv \<br />
fedora-rawhide-developer-20200108.n.0<br />
</pre><br />
<br />
== Install on the HiFive Unleashed using NBD server ==<br />
<br />
You will need a separate machine on the same network which can act as an NBD server. It can be any Linux machine with [https://github.com/qemu/qemu/blob/master/qemu-nbd.c qemu-nbd] or [https://github.com/libguestfs/nbdkit nbdkit] installed.<br />
<br />
You will first need to get it working on the SD card using the instructions in the previous section.<br />
<br />
On the HiFive board, install <code>dracut-network</code> and <code>nbd</code>, and rebuild the initramfs with NBD support using these commands:<br />
<pre><br />
dnf install dracut-network nbd<br />
dracut -m "nbd network base" -v --force<br />
</pre><br />
<br />
Shut down the HiFive board, remove the SD card, and copy the 4th partition from the SD card into a file or partition on the NBD server.<br />
<br />
You will need to change the UUID on this filesystem to a new random one (else it will conflict with the SD-card root filesystem), eg:<br />
<pre><br />
tune2fs -U random /dev/VG/jive<br />
</pre><br />
<br />
Start up the NBD server (in this example using <code>qemu-nbd</code> with the 4th partition having been copied to <code>/dev/VG/jive</code> listening on port 10810):<br />
<pre><br />
qemu-nbd -t -f raw -x "" -p 10810 /dev/VG/jive<br />
</pre><br />
<br />
Place the SD card back in the HiFive board and boot it. At this point you have still booted into the SD card's root filesystem (not NBD). Go and edit <code>/boot/extlinux/extlinux.conf</code>. To the <code>addappend</code> line you will need to set:<br />
<br />
<pre><br />
root=UUID=...uuid... netroot=nbd:192.168.0.220:10810 rootfstype=ext4 rw rootdelay=5 ip=dhcp rootwait<br />
</pre><br />
<br />
I would also advise removing <code>rhgb quiet</code> if they are present. Note you need to set <code>uuid</code> and the address and port number of the NBD server correctly. Immediately reboot and it should come up with an NBD root. Check the boot messages carefully to see whether it used the SD card or NBD root.<br />
<br />
== Install Fedora GNOME Desktop on SiFive HiFive Unleashed + Microsemi HiFive Unleashed Expansion board ==<br />
<br />
Detailed instructions are provided by Atish Patra from Western Digital Corporation (WDC). See their GitHub page for details and pictures: https://github.com/westerndigitalcorporation/RISC-V-Linux<br />
<br />
So far two GPUs are confirmed to be working: Radeon HD 6450 and Radeon HD 5450.<br />
<br />
= Use the image =<br />
<br />
Once the system is booted, login as <code>root</code> with <code>riscv</code> as password.<br />
<br />
X11 with Fluxbox can be started using: <code>startx /usr/bin/startfluxbox</code>. The disk image also includes awesome and i3 for testing. Dillo is available as a basic web browser (no javascript support) and pcmanfm as file manager.<br />
<br />
To gracefully shutdown just type <code>poweroff</code> into console.<br />
<br />
If you want more information being displayed during boot, remove <code>quiet</code> from the <code>append</code> line in <code>/boot/extlinux/extlinux.conf</code>.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Installing&diff=567115Architectures/RISC-V/Installing2020-02-28T14:40:09Z<p>Rjones: /* Install on the HiFive Unleashed using NBD server */</p>
<hr />
<div>This page describes the steps necessary to get Fedora for RISC-V running, either on emulated or real hardware.<br />
<br />
= Obtain a disk image =<br />
<br />
== Tested images ==<br />
<br />
These images have undergone some testing and thus are more likely to work without issues. If you are not sure which image to choose, go with one of these.<br />
<br />
=== Download using virt-builder ===<br />
<br />
This is the recommended way to obtain disk images.<br />
<br />
Before you can start using <code>virt-builder</code> for this task, a one-time setup is necessary:<br />
<br />
<pre><br />
$ mkdir -p ~/.config/virt-builder/repos.d/<br />
$ cat <<EOF >~/.config/virt-builder/repos.d/fedora-riscv.conf<br />
[fedora-riscv]<br />
uri=https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/index<br />
EOF<br />
</pre><br />
<br />
With that out of the way, you can get a list of available RISC-V templates with:<br />
<br />
<pre><br />
$ virt-builder --list | grep riscv64<br />
fedora-rawhide-developer-20191123.n.0 riscv64 Fedora® Rawhide Developer 20191123.n.0<br />
fedora-rawhide-minimal-20191123.n.1 riscv64 Fedora® Rawhide Minimal 20191123.n.1<br />
</pre><br />
<br />
Then tell <code>virt-builder</code> to build a custom disk image based on one of the templates:<br />
<br />
<pre><br />
$ virt-builder \<br />
--arch riscv64 \<br />
--size 20G \<br />
--format raw \<br />
--output Fedora-Developer-Rawhide-20191123.n.0-sda.raw \<br />
fedora-rawhide-developer-20191123.n.0<br />
[ 3.6] Downloading: https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-sda.raw.xz<br />
[ 6.1] Planning how to build this image<br />
[ 6.1] Uncompressing<br />
[ 32.8] Opening the new disk<br />
[ 38.4] Setting a random seed<br />
[ 38.4] Setting the machine ID in /etc/machine-id<br />
[ 38.4] Setting passwords<br />
virt-builder: Setting random password of root to 5PegnZtGMP47bXnw<br />
[ 39.9] Finishing off<br />
Output file: Fedora-Developer-Rawhide-20191123.n.0-sda.raw<br />
Output size: 20.0G<br />
Output format: raw<br />
Total usable space: 19.7G<br />
Free space: 14.7G (75%)<br />
</pre><br />
<br />
<code>virt-builder</code> has reasonable defaults, such as generating a random root password for you, but if you want more control you can pass additional arguments to customize the image further: for example, using <code>--format qcow2</code> will cause the output image to be in QCOW2 format. See <code>virt-builder --help</code> for more information.<br />
<br />
In addition to the disk image, a firmware image (which has to be downloaded separately) is needed as well. To find out the download URL, use:<br />
<br />
<pre><br />
$ virt-builder --arch riscv64 --notes fedora-rawhide-developer-20191123.n.0 | grep fw_payload<br />
https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf<br />
https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf.CHECKSUM<br />
</pre><br />
<br />
Then download it using your favorite HTTP client, for example:<br />
<br />
<pre><br />
$ wget https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf<br />
</pre><br />
<br />
=== Download manually ===<br />
<br />
If using <code>virt-builder</code> is not an option, you can download disk images manually from: https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/<br />
<br />
Download <code>Fedora-Developer-Rawhide-*.raw.xz</code> as well as the matching <code>Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf</code>.<br />
<br />
== Nightly builds ==<br />
<br />
You can find them here: http://fedora.riscv.rocks/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id<br />
<br />
Select the most recent (top) build and download <code>Fedora-Developer-Rawhide-*.raw.xz</code>.<br />
<br />
These disk images differ from the ones above in that:<br />
* the firmware is inside the disk image, in the <code>/boot</code> directory;<br />
* they are completely untested.<br />
<br />
= Prepare the disk image =<br />
<br />
These steps are only necessary if you haven't used <code>virt-builder</code>.<br />
<br />
== Uncompress the image ==<br />
<br />
Whether you have downloaded a tested image or a nightly build, you'll need to uncompress it before it can be used:<br />
<br />
<pre><br />
$ unxz Fedora-Developer-Rawhide-*.raw.xz<br />
</pre><br />
<br />
== Optional: expand the disk image ==<br />
<br />
You might want to expand the disk image before setting up the VM. Here is one example:<br />
<br />
<pre><br />
$ truncate -r Fedora-Developer-Rawhide-*.raw expanded.raw<br />
$ truncate -s 40G expanded.raw<br />
$ virt-resize -v -x --expand /dev/sda4 Fedora-Developer-Rawhide-*.raw expanded.raw<br />
$ virt-filesystems --long -h --all -a expanded.raw<br />
$ virt-df -h -a expanded.raw<br />
</pre><br />
<br />
The resulting disk image will work with QEMU as well as TinyEMU. Make sure you use <code>expanded.raw</code> instead of <code>Fedora-Developer-Rawhide-*.raw</code> when booting the guest.<br />
<br />
== Optional: create an overlay ==<br />
<br />
You can also create <code>qcow2</code> disk image with <code>raw</code> Fedora disk as backing one. This way Fedora <code>raw</code> is unmodified and all changes are written to <code>qcow2</code> layer. You will need to install <code>libguestfs-tools-c</code>.<br />
<br />
<pre><br />
$ qemu-img create -f qcow2 -F raw -b Fedora-Developer-Rawhide-*.raw overlay.qcow2 20G<br />
$ virt-resize -v -x --expand /dev/sda4 Fedora-Developer-Rawhide-*.raw overlay.qcow2<br />
$ virt-filesystems --long -h --all -a overlay.qcow2<br />
</pre><br />
<br />
The resulting disk image will only work with QEMU. Make sure you use <code>overlay.qcow2</code> instead of <code>Fedora-Developer-Rawhide-*.raw</code> when booting the guest.<br />
<br />
== Optional: set the hostname before booting ==<br />
<br />
If you want to change hostname before the first boot, install <code>libguestfs-tools-c</code> and then run:<br />
<br />
<pre><br />
$ virt-customize -a Fedora-Developer-Rawhide-*.raw --hostname fedora-riscv-mymagicbox<br />
</pre><br />
<br />
== Nightly builds only: extracting firmware (OpenSBI) ==<br />
<br />
Fedora/RISC-V does not support BLS (Boot Loader Specification - [https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault more details]).<br />
<br />
Disk images contain a <code>/boot</code> directory from where you can copy out the firmware.<br />
<br />
This is '''only''' necessary for nightly builds, since for tested images these files are provided as separate downloads alongside the image.<br />
<br />
Example session:<br />
<br />
<pre><br />
$ guestfish \<br />
add Fedora-Developer-Rawhide-*.raw : \<br />
run : \<br />
mount /dev/sda1 / : \<br />
ls /opensbi/unstable<br />
fw_jump.elf<br />
fw_payload-5.2.0-0.rc7.git0.1.0.riscv64.fc31.riscv64.elf<br />
fw_payload-uboot-qemu-virt-smode.elf<br />
$ guestfish \<br />
add Fedora-Developer-Rawhide-*.raw : run : mount /dev/sda1 / : \<br />
download /opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf fw_payload-uboot-qemu-virt-smode.elf<br />
</pre><br />
<br />
You can also use <code>guestmount</code> or QEMU/NBD to mount disk image. Examples:<br />
<pre><br />
$ mkdir a<br />
$ guestmount -a $PWD/Fedora-Developer-Rawhide-*.raw -m /dev/sda1 $PWD/a<br />
$ cp a/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf .<br />
$ guestunmount $PWD/a<br />
</pre><br />
<br />
<pre><br />
$ sudo modprobe nbd max_part=8<br />
$ sudo qemu-nbd -f raw --connect=/dev/nbd1 $PWD/Fedora-Developer-Rawhide-*.raw<br />
$ sudo fdisk -l /dev/nbd1<br />
Disk /dev/nbd1: 7.5 GiB, 8053063680 bytes, 15728640 sectors<br />
Units: sectors of 1 * 512 = 512 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
I/O size (minimum/optimal): 512 bytes / 512 bytes<br />
Disklabel type: gpt<br />
Disk identifier: F0F4268F-1B73-46FF-BABA-D87F075DCCA5<br />
<br />
Device Start End Sectors Size Type<br />
/dev/nbd1p1 2048 15001599 14999552 7.2G Linux filesystem<br />
$ sudo mount /dev/nbd1p1 a<br />
$ sudo cp a/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf .<br />
$ sudo umount a<br />
$ sudo qemu-nbd --disconnect /dev/nbd1<br />
</pre><br />
<br />
Note NBD is highly useful if you need to run <code>fdisk</code>, <code>e2fsck</code> (e.g. after VM crash and filesystem lock up), <code>resize2fs</code>. It might be beneficial to look into <code>nbdkit</code> and <code>nbd</code> packages.<br />
<br />
= Boot the image on virtual hardware =<br />
<br />
There are several options for booting the image on virtual hardware once you've prepared it following the steps above.<br />
<br />
== Boot with libvirt ==<br />
<br />
Detailed instructions how to install libvirt: https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-virtualization/<br />
<br />
Quick instructions for libvirt installation (tested on Fedora 30):<br />
<br />
<pre><br />
# dnf group install --with-optional virtualization<br />
# systemctl enable --now libvirtd<br />
</pre><br />
<br />
When running RISC-V guests, it's usually a good idea to use the very latest versions of QEMU, libvirt and virt-manager: the <code>virt-preview</code> repository offers just that for Fedora users. To enable it, simply run:<br />
<br />
<pre><br />
# dnf copr enable @virtmaint-sig/virt-preview<br />
</pre><br />
<br />
and update your system.<br />
<br />
The steps below assume you have copied both the disk image and the firmware into <code>/var/lib/libvirt/images</code>: this is the location where libvirt usually expects to find disk images, so while using a different location might work it's a good idea to do this and reduce the possibility of issues caused by filesystem permissions and such.<br />
<br />
Assuming you have QEMU &ge; 4.0.0, libvirt &ge; 5.3.0 and virt-manager &ge; 2.2.0, the installation will be as simple as:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--vcpus 8 \<br />
--memory 2048 \<br />
--os-variant fedora30 \<br />
--boot kernel=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
--import --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*.raw \<br />
--network network=default \<br />
--graphics none<br />
</pre><br />
<br />
If you are stuck with older software (QEMU &ge; 2.12.0, libvirt &ge; 4.7.0), then you're going to need a more verbose command line:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--machine virt \<br />
--vcpus 8 \<br />
--memory 2048 \<br />
--os-variant fedora30 \<br />
--boot kernel=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
--import --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*.raw,bus=virtio \<br />
--network network=default,model=virtio \<br />
--rng device=/dev/urandom,model=virtio \<br />
--channel name=org.qemu.guest_agent.0 \<br />
--graphics none<br />
</pre><br />
<br />
Additionally, when using older software components you won't get PCI support, and so enabling graphics will not be possible.<br />
<br />
Either one of the commands above will automatically boot you into the console. If you don't want that add <code>--noautoconsole</code> option. You can later use <code>virsh</code> tool to manage your VM and get to console.<br />
<br />
A quick reference of <code>virsh</code> commands:<br />
* <code>virsh list --all</code> - list all VMs and their states<br />
* <code>virsh console <name></code> - connect to serial console (remember: <code>Escape character is ^]</code>)<br />
* <code>virsh shutdown <name></code> - power down VM (see above for more details)<br />
* <code>virsh start <name></code> - power up VM<br />
* <code>virsh undefine <name></code> - remove VM<br />
* <code>virsh net-list</code> - list network (useful for the next command)<br />
* <code>virsh net-dhcp-leases <network_name></code> - list DHCP leases, <code><network_name></code> most likely will be <code>default</code>. This is useful when you want to get IPv4 and SSH to the VM.<br />
* <code>virsh domifaddr <name></code> - alternative for the above two commands, only shows IPv4 for one VM<br />
* <code>virsh reset <name></code> - hard reset VM<br />
* <code>virsh destroy <name></code> hard power down of VM<br />
<br />
If you want to use <code>ssh user@virtualMachine</code> you can setup libvirt NSS module. See: https://wiki.libvirt.org/page/NSS_module<br />
<br />
You might want also to setup logging for serial console (in case kernel panics or something else).<br />
<br />
For this we will be using two commands: <code>virsh edit <name></code> (modifying VM XML) and <code>virsh dumpxml <name></code> (dump VM XML for backup). You need to modify <code><serial></code> node by adding <code><log file='/var/log/libvirt/qemu/fedora-riscv-mymagicbox.serial.log'/></code>. Then power down and power up the VM.<br />
<br />
Alternatively you can use <code>--serial log.file=/.../whatever.serial.log</code> with <code>virt-install</code> command.<br />
<br />
== Boot under QEMU ==<br />
<br />
You will get the best results if your QEMU version is 4.0.0 or newer, but any version since 2.12.0 will work.<br />
<br />
<pre><br />
$ qemu-system-riscv64 \<br />
-nographic \<br />
-machine virt \<br />
-smp 8 \<br />
-m 2G \<br />
-kernel Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
-object rng-random,filename=/dev/urandom,id=rng0 \<br />
-device virtio-rng-device,rng=rng0 \<br />
-device virtio-blk-device,drive=hd0 \<br />
-drive file=Fedora-Developer-Rawhide-*.raw,format=raw,id=hd0 \<br />
-device virtio-net-device,netdev=usernet \<br />
-netdev user,id=usernet,hostfwd=tcp::10000-:22<br />
</pre><br />
<br />
Once machine is booted you can connect via SSH:<br />
<br />
<pre><br />
$ ssh -p 10000 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o PubkeyAuthentication=no root@localhost<br />
</pre><br />
<br />
== Boot under TinyEMU (RISCVEMU) ==<br />
'''Note (2019 March 10):''' This is not supported anymore until TinyEMU is updated to support external initrd file. Please, use QEMU or libvirt/QEMU.<br />
<br />
RISCVEMU recently (2018-09-23) was renamed to TinyEMU (https://bellard.org/tinyemu/).<br />
<br />
TinyEMU allow booting Fedora disk images in TUI and GUI modes. You can experiment using JSLinux (no need to download/compile/etc) here: https://bellard.org/jslinux/<br />
<br />
Below are instructions how to boot Fedora into X11/Fluxbox GUI mode.<br />
<br />
'''Step 1'''. Compile TinyEMU:<br />
<br />
<pre><br />
wget https://bellard.org/tinyemu/tinyemu-2018-09-23.tar.gz<br />
tar xvf tinyemu-2018-09-23.tar.gz<br />
cd tinyemu-2018-09-23<br />
make<br />
</pre><br />
<br />
'''Step 2'''. Setup for booting Fedora:<br />
<br />
<pre><br />
mkdir fedora<br />
cd fedora<br />
cp ../temu .<br />
<br />
# Download pre-built BBL with embedded kernel<br />
wget https://bellard.org/jslinux/bbl64-4.15.bin<br />
<br />
# Create configuration file for TinyEMU<br />
cat <<EOF > root-riscv64.cfg<br />
/* VM configuration file */<br />
{<br />
version: 1,<br />
machine: "riscv64",<br />
memory_size: 1400,<br />
bios: "bbl64-4.15.bin",<br />
cmdline: "loglevel=3 console=tty0 root=/dev/vda rw TZ=${TZ}",<br />
drive0: { file: "Fedora-Developer-Rawhide-*-sda1.raw" },<br />
eth0: { driver: "user" },<br />
display0: {<br />
device: "simplefb",<br />
width: 1920,<br />
height: 1080,<br />
},<br />
input_device: "virtio",<br />
}<br />
EOF<br />
<br />
# Download disk image and unpack in the same directory<br />
</pre><br />
<br />
'''Step 3'''. Boot it.<br />
<br />
<pre><br />
./temu -rw root-riscv64.cfg<br />
</pre><br />
<br />
We need to use <code>-rw</code> if we want our changes to persist in disk image. Otherwise disk image will be loaded as read-only and all changes will not persist after reboot.<br />
<br />
= Boot the image on physical hardware =<br />
<br />
== Install on the HiFive Unleashed SD card ==<br />
<br />
The disk image can be copied directly to an SD card and run on the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].<br />
<br />
A good way to create the SD card is with this virt-builder command:<br />
<br />
<pre><br />
sudo virt-builder \<br />
--source https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/index \<br />
--no-check-signature \<br />
--arch riscv64 \<br />
--format raw \<br />
--hostname testing.example.com \<br />
--output /dev/sdXXX \<br />
--root-password password:riscv \<br />
fedora-rawhide-developer-20200108.n.0<br />
</pre><br />
<br />
== Install on the HiFive Unleashed using NBD server ==<br />
<br />
You will need a separate machine on the same network which can act as an NBD server. It can be any Linux machine with [https://github.com/qemu/qemu/blob/master/qemu-nbd.c qemu-nbd] or [https://github.com/libguestfs/nbdkit nbdkit] installed.<br />
<br />
You will first need to get it working on the SD card using the instructions in the previous section.<br />
<br />
On the HiFive board, install <code>dracut-network</code> and <code>nbd</code>, and rebuild the initramfs with NBD support using these commands:<br />
<pre><br />
dnf install dracut-network nbd<br />
dracut -m "nbd network base" -v --force<br />
</pre><br />
<br />
Shut down the HiFive board, remove the SD card, and copy the 4th partition from the SD card into a file or partition on the NBD server.<br />
<br />
Start up the NBD server (in this example using <code>qemu-nbd</code> with the 4th partition having been copied to <code>/dev/VG/jive</code> listening on port 10810):<br />
<pre><br />
qemu-nbd -t -f raw -x "" -p 10810 /dev/VG/jive<br />
</pre><br />
<br />
Place the SD card back in the HiFive board and boot it. At this point you have still booted into the SD card's root filesystem (not NBD). Go and edit <code>/boot/extlinux/extlinux.conf</code>. To the <code>addappend</code> line you will need to set:<br />
<br />
<pre><br />
root=UUID=...uuid... netroot=nbd:192.168.0.220:10810 rootfstype=ext4 rw rootdelay=5 ip=dhcp rootwait<br />
</pre><br />
<br />
I would also advise removing <code>rhgb quiet</code> if they are present. Note you need to set <code>uuid</code> and the address and port number of the NBD server correctly. Immediately reboot and it should come up with an NBD root. Check the boot messages carefully to see whether it used the SD card or NBD root.<br />
<br />
== Install Fedora GNOME Desktop on SiFive HiFive Unleashed + Microsemi HiFive Unleashed Expansion board ==<br />
<br />
Detailed instructions are provided by Atish Patra from Western Digital Corporation (WDC). See their GitHub page for details and pictures: https://github.com/westerndigitalcorporation/RISC-V-Linux<br />
<br />
So far two GPUs are confirmed to be working: Radeon HD 6450 and Radeon HD 5450.<br />
<br />
= Use the image =<br />
<br />
Once the system is booted, login as <code>root</code> with <code>riscv</code> as password.<br />
<br />
X11 with Fluxbox can be started using: <code>startx /usr/bin/startfluxbox</code>. The disk image also includes awesome and i3 for testing. Dillo is available as a basic web browser (no javascript support) and pcmanfm as file manager.<br />
<br />
To gracefully shutdown just type <code>poweroff</code> into console.<br />
<br />
If you want more information being displayed during boot, remove <code>quiet</code> from the <code>append</code> line in <code>/boot/extlinux/extlinux.conf</code>.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Installing&diff=567114Architectures/RISC-V/Installing2020-02-28T14:39:40Z<p>Rjones: /* Install on the HiFive Unleashed using NBD server */</p>
<hr />
<div>This page describes the steps necessary to get Fedora for RISC-V running, either on emulated or real hardware.<br />
<br />
= Obtain a disk image =<br />
<br />
== Tested images ==<br />
<br />
These images have undergone some testing and thus are more likely to work without issues. If you are not sure which image to choose, go with one of these.<br />
<br />
=== Download using virt-builder ===<br />
<br />
This is the recommended way to obtain disk images.<br />
<br />
Before you can start using <code>virt-builder</code> for this task, a one-time setup is necessary:<br />
<br />
<pre><br />
$ mkdir -p ~/.config/virt-builder/repos.d/<br />
$ cat <<EOF >~/.config/virt-builder/repos.d/fedora-riscv.conf<br />
[fedora-riscv]<br />
uri=https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/index<br />
EOF<br />
</pre><br />
<br />
With that out of the way, you can get a list of available RISC-V templates with:<br />
<br />
<pre><br />
$ virt-builder --list | grep riscv64<br />
fedora-rawhide-developer-20191123.n.0 riscv64 Fedora® Rawhide Developer 20191123.n.0<br />
fedora-rawhide-minimal-20191123.n.1 riscv64 Fedora® Rawhide Minimal 20191123.n.1<br />
</pre><br />
<br />
Then tell <code>virt-builder</code> to build a custom disk image based on one of the templates:<br />
<br />
<pre><br />
$ virt-builder \<br />
--arch riscv64 \<br />
--size 20G \<br />
--format raw \<br />
--output Fedora-Developer-Rawhide-20191123.n.0-sda.raw \<br />
fedora-rawhide-developer-20191123.n.0<br />
[ 3.6] Downloading: https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-sda.raw.xz<br />
[ 6.1] Planning how to build this image<br />
[ 6.1] Uncompressing<br />
[ 32.8] Opening the new disk<br />
[ 38.4] Setting a random seed<br />
[ 38.4] Setting the machine ID in /etc/machine-id<br />
[ 38.4] Setting passwords<br />
virt-builder: Setting random password of root to 5PegnZtGMP47bXnw<br />
[ 39.9] Finishing off<br />
Output file: Fedora-Developer-Rawhide-20191123.n.0-sda.raw<br />
Output size: 20.0G<br />
Output format: raw<br />
Total usable space: 19.7G<br />
Free space: 14.7G (75%)<br />
</pre><br />
<br />
<code>virt-builder</code> has reasonable defaults, such as generating a random root password for you, but if you want more control you can pass additional arguments to customize the image further: for example, using <code>--format qcow2</code> will cause the output image to be in QCOW2 format. See <code>virt-builder --help</code> for more information.<br />
<br />
In addition to the disk image, a firmware image (which has to be downloaded separately) is needed as well. To find out the download URL, use:<br />
<br />
<pre><br />
$ virt-builder --arch riscv64 --notes fedora-rawhide-developer-20191123.n.0 | grep fw_payload<br />
https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf<br />
https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf.CHECKSUM<br />
</pre><br />
<br />
Then download it using your favorite HTTP client, for example:<br />
<br />
<pre><br />
$ wget https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf<br />
</pre><br />
<br />
=== Download manually ===<br />
<br />
If using <code>virt-builder</code> is not an option, you can download disk images manually from: https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/<br />
<br />
Download <code>Fedora-Developer-Rawhide-*.raw.xz</code> as well as the matching <code>Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf</code>.<br />
<br />
== Nightly builds ==<br />
<br />
You can find them here: http://fedora.riscv.rocks/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id<br />
<br />
Select the most recent (top) build and download <code>Fedora-Developer-Rawhide-*.raw.xz</code>.<br />
<br />
These disk images differ from the ones above in that:<br />
* the firmware is inside the disk image, in the <code>/boot</code> directory;<br />
* they are completely untested.<br />
<br />
= Prepare the disk image =<br />
<br />
These steps are only necessary if you haven't used <code>virt-builder</code>.<br />
<br />
== Uncompress the image ==<br />
<br />
Whether you have downloaded a tested image or a nightly build, you'll need to uncompress it before it can be used:<br />
<br />
<pre><br />
$ unxz Fedora-Developer-Rawhide-*.raw.xz<br />
</pre><br />
<br />
== Optional: expand the disk image ==<br />
<br />
You might want to expand the disk image before setting up the VM. Here is one example:<br />
<br />
<pre><br />
$ truncate -r Fedora-Developer-Rawhide-*.raw expanded.raw<br />
$ truncate -s 40G expanded.raw<br />
$ virt-resize -v -x --expand /dev/sda4 Fedora-Developer-Rawhide-*.raw expanded.raw<br />
$ virt-filesystems --long -h --all -a expanded.raw<br />
$ virt-df -h -a expanded.raw<br />
</pre><br />
<br />
The resulting disk image will work with QEMU as well as TinyEMU. Make sure you use <code>expanded.raw</code> instead of <code>Fedora-Developer-Rawhide-*.raw</code> when booting the guest.<br />
<br />
== Optional: create an overlay ==<br />
<br />
You can also create <code>qcow2</code> disk image with <code>raw</code> Fedora disk as backing one. This way Fedora <code>raw</code> is unmodified and all changes are written to <code>qcow2</code> layer. You will need to install <code>libguestfs-tools-c</code>.<br />
<br />
<pre><br />
$ qemu-img create -f qcow2 -F raw -b Fedora-Developer-Rawhide-*.raw overlay.qcow2 20G<br />
$ virt-resize -v -x --expand /dev/sda4 Fedora-Developer-Rawhide-*.raw overlay.qcow2<br />
$ virt-filesystems --long -h --all -a overlay.qcow2<br />
</pre><br />
<br />
The resulting disk image will only work with QEMU. Make sure you use <code>overlay.qcow2</code> instead of <code>Fedora-Developer-Rawhide-*.raw</code> when booting the guest.<br />
<br />
== Optional: set the hostname before booting ==<br />
<br />
If you want to change hostname before the first boot, install <code>libguestfs-tools-c</code> and then run:<br />
<br />
<pre><br />
$ virt-customize -a Fedora-Developer-Rawhide-*.raw --hostname fedora-riscv-mymagicbox<br />
</pre><br />
<br />
== Nightly builds only: extracting firmware (OpenSBI) ==<br />
<br />
Fedora/RISC-V does not support BLS (Boot Loader Specification - [https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault more details]).<br />
<br />
Disk images contain a <code>/boot</code> directory from where you can copy out the firmware.<br />
<br />
This is '''only''' necessary for nightly builds, since for tested images these files are provided as separate downloads alongside the image.<br />
<br />
Example session:<br />
<br />
<pre><br />
$ guestfish \<br />
add Fedora-Developer-Rawhide-*.raw : \<br />
run : \<br />
mount /dev/sda1 / : \<br />
ls /opensbi/unstable<br />
fw_jump.elf<br />
fw_payload-5.2.0-0.rc7.git0.1.0.riscv64.fc31.riscv64.elf<br />
fw_payload-uboot-qemu-virt-smode.elf<br />
$ guestfish \<br />
add Fedora-Developer-Rawhide-*.raw : run : mount /dev/sda1 / : \<br />
download /opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf fw_payload-uboot-qemu-virt-smode.elf<br />
</pre><br />
<br />
You can also use <code>guestmount</code> or QEMU/NBD to mount disk image. Examples:<br />
<pre><br />
$ mkdir a<br />
$ guestmount -a $PWD/Fedora-Developer-Rawhide-*.raw -m /dev/sda1 $PWD/a<br />
$ cp a/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf .<br />
$ guestunmount $PWD/a<br />
</pre><br />
<br />
<pre><br />
$ sudo modprobe nbd max_part=8<br />
$ sudo qemu-nbd -f raw --connect=/dev/nbd1 $PWD/Fedora-Developer-Rawhide-*.raw<br />
$ sudo fdisk -l /dev/nbd1<br />
Disk /dev/nbd1: 7.5 GiB, 8053063680 bytes, 15728640 sectors<br />
Units: sectors of 1 * 512 = 512 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
I/O size (minimum/optimal): 512 bytes / 512 bytes<br />
Disklabel type: gpt<br />
Disk identifier: F0F4268F-1B73-46FF-BABA-D87F075DCCA5<br />
<br />
Device Start End Sectors Size Type<br />
/dev/nbd1p1 2048 15001599 14999552 7.2G Linux filesystem<br />
$ sudo mount /dev/nbd1p1 a<br />
$ sudo cp a/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf .<br />
$ sudo umount a<br />
$ sudo qemu-nbd --disconnect /dev/nbd1<br />
</pre><br />
<br />
Note NBD is highly useful if you need to run <code>fdisk</code>, <code>e2fsck</code> (e.g. after VM crash and filesystem lock up), <code>resize2fs</code>. It might be beneficial to look into <code>nbdkit</code> and <code>nbd</code> packages.<br />
<br />
= Boot the image on virtual hardware =<br />
<br />
There are several options for booting the image on virtual hardware once you've prepared it following the steps above.<br />
<br />
== Boot with libvirt ==<br />
<br />
Detailed instructions how to install libvirt: https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-virtualization/<br />
<br />
Quick instructions for libvirt installation (tested on Fedora 30):<br />
<br />
<pre><br />
# dnf group install --with-optional virtualization<br />
# systemctl enable --now libvirtd<br />
</pre><br />
<br />
When running RISC-V guests, it's usually a good idea to use the very latest versions of QEMU, libvirt and virt-manager: the <code>virt-preview</code> repository offers just that for Fedora users. To enable it, simply run:<br />
<br />
<pre><br />
# dnf copr enable @virtmaint-sig/virt-preview<br />
</pre><br />
<br />
and update your system.<br />
<br />
The steps below assume you have copied both the disk image and the firmware into <code>/var/lib/libvirt/images</code>: this is the location where libvirt usually expects to find disk images, so while using a different location might work it's a good idea to do this and reduce the possibility of issues caused by filesystem permissions and such.<br />
<br />
Assuming you have QEMU &ge; 4.0.0, libvirt &ge; 5.3.0 and virt-manager &ge; 2.2.0, the installation will be as simple as:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--vcpus 8 \<br />
--memory 2048 \<br />
--os-variant fedora30 \<br />
--boot kernel=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
--import --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*.raw \<br />
--network network=default \<br />
--graphics none<br />
</pre><br />
<br />
If you are stuck with older software (QEMU &ge; 2.12.0, libvirt &ge; 4.7.0), then you're going to need a more verbose command line:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--machine virt \<br />
--vcpus 8 \<br />
--memory 2048 \<br />
--os-variant fedora30 \<br />
--boot kernel=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
--import --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*.raw,bus=virtio \<br />
--network network=default,model=virtio \<br />
--rng device=/dev/urandom,model=virtio \<br />
--channel name=org.qemu.guest_agent.0 \<br />
--graphics none<br />
</pre><br />
<br />
Additionally, when using older software components you won't get PCI support, and so enabling graphics will not be possible.<br />
<br />
Either one of the commands above will automatically boot you into the console. If you don't want that add <code>--noautoconsole</code> option. You can later use <code>virsh</code> tool to manage your VM and get to console.<br />
<br />
A quick reference of <code>virsh</code> commands:<br />
* <code>virsh list --all</code> - list all VMs and their states<br />
* <code>virsh console <name></code> - connect to serial console (remember: <code>Escape character is ^]</code>)<br />
* <code>virsh shutdown <name></code> - power down VM (see above for more details)<br />
* <code>virsh start <name></code> - power up VM<br />
* <code>virsh undefine <name></code> - remove VM<br />
* <code>virsh net-list</code> - list network (useful for the next command)<br />
* <code>virsh net-dhcp-leases <network_name></code> - list DHCP leases, <code><network_name></code> most likely will be <code>default</code>. This is useful when you want to get IPv4 and SSH to the VM.<br />
* <code>virsh domifaddr <name></code> - alternative for the above two commands, only shows IPv4 for one VM<br />
* <code>virsh reset <name></code> - hard reset VM<br />
* <code>virsh destroy <name></code> hard power down of VM<br />
<br />
If you want to use <code>ssh user@virtualMachine</code> you can setup libvirt NSS module. See: https://wiki.libvirt.org/page/NSS_module<br />
<br />
You might want also to setup logging for serial console (in case kernel panics or something else).<br />
<br />
For this we will be using two commands: <code>virsh edit <name></code> (modifying VM XML) and <code>virsh dumpxml <name></code> (dump VM XML for backup). You need to modify <code><serial></code> node by adding <code><log file='/var/log/libvirt/qemu/fedora-riscv-mymagicbox.serial.log'/></code>. Then power down and power up the VM.<br />
<br />
Alternatively you can use <code>--serial log.file=/.../whatever.serial.log</code> with <code>virt-install</code> command.<br />
<br />
== Boot under QEMU ==<br />
<br />
You will get the best results if your QEMU version is 4.0.0 or newer, but any version since 2.12.0 will work.<br />
<br />
<pre><br />
$ qemu-system-riscv64 \<br />
-nographic \<br />
-machine virt \<br />
-smp 8 \<br />
-m 2G \<br />
-kernel Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
-object rng-random,filename=/dev/urandom,id=rng0 \<br />
-device virtio-rng-device,rng=rng0 \<br />
-device virtio-blk-device,drive=hd0 \<br />
-drive file=Fedora-Developer-Rawhide-*.raw,format=raw,id=hd0 \<br />
-device virtio-net-device,netdev=usernet \<br />
-netdev user,id=usernet,hostfwd=tcp::10000-:22<br />
</pre><br />
<br />
Once machine is booted you can connect via SSH:<br />
<br />
<pre><br />
$ ssh -p 10000 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o PubkeyAuthentication=no root@localhost<br />
</pre><br />
<br />
== Boot under TinyEMU (RISCVEMU) ==<br />
'''Note (2019 March 10):''' This is not supported anymore until TinyEMU is updated to support external initrd file. Please, use QEMU or libvirt/QEMU.<br />
<br />
RISCVEMU recently (2018-09-23) was renamed to TinyEMU (https://bellard.org/tinyemu/).<br />
<br />
TinyEMU allow booting Fedora disk images in TUI and GUI modes. You can experiment using JSLinux (no need to download/compile/etc) here: https://bellard.org/jslinux/<br />
<br />
Below are instructions how to boot Fedora into X11/Fluxbox GUI mode.<br />
<br />
'''Step 1'''. Compile TinyEMU:<br />
<br />
<pre><br />
wget https://bellard.org/tinyemu/tinyemu-2018-09-23.tar.gz<br />
tar xvf tinyemu-2018-09-23.tar.gz<br />
cd tinyemu-2018-09-23<br />
make<br />
</pre><br />
<br />
'''Step 2'''. Setup for booting Fedora:<br />
<br />
<pre><br />
mkdir fedora<br />
cd fedora<br />
cp ../temu .<br />
<br />
# Download pre-built BBL with embedded kernel<br />
wget https://bellard.org/jslinux/bbl64-4.15.bin<br />
<br />
# Create configuration file for TinyEMU<br />
cat <<EOF > root-riscv64.cfg<br />
/* VM configuration file */<br />
{<br />
version: 1,<br />
machine: "riscv64",<br />
memory_size: 1400,<br />
bios: "bbl64-4.15.bin",<br />
cmdline: "loglevel=3 console=tty0 root=/dev/vda rw TZ=${TZ}",<br />
drive0: { file: "Fedora-Developer-Rawhide-*-sda1.raw" },<br />
eth0: { driver: "user" },<br />
display0: {<br />
device: "simplefb",<br />
width: 1920,<br />
height: 1080,<br />
},<br />
input_device: "virtio",<br />
}<br />
EOF<br />
<br />
# Download disk image and unpack in the same directory<br />
</pre><br />
<br />
'''Step 3'''. Boot it.<br />
<br />
<pre><br />
./temu -rw root-riscv64.cfg<br />
</pre><br />
<br />
We need to use <code>-rw</code> if we want our changes to persist in disk image. Otherwise disk image will be loaded as read-only and all changes will not persist after reboot.<br />
<br />
= Boot the image on physical hardware =<br />
<br />
== Install on the HiFive Unleashed SD card ==<br />
<br />
The disk image can be copied directly to an SD card and run on the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].<br />
<br />
A good way to create the SD card is with this virt-builder command:<br />
<br />
<pre><br />
sudo virt-builder \<br />
--source https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/index \<br />
--no-check-signature \<br />
--arch riscv64 \<br />
--format raw \<br />
--hostname testing.example.com \<br />
--output /dev/sdXXX \<br />
--root-password password:riscv \<br />
fedora-rawhide-developer-20200108.n.0<br />
</pre><br />
<br />
== Install on the HiFive Unleashed using NBD server ==<br />
<br />
You will need a separate machine on the same network which can act as an NBD server. It can be any Linux machine with [https://github.com/qemu/qemu/blob/master/qemu-nbd.c qemu-nbd] or [https://github.com/libguestfs/nbdkit nbdkit] installed.<br />
<br />
You will first need to get it working on the SD card using the instructions in the previous section.<br />
<br />
On the HiFive board, install <code>dracut-network</code> and <code>nbd</code>, and rebuild the initramfs with NBD support using these commands:<br />
<pre><br />
dnf install dracut-network nbd<br />
dracut -m "nbd network base" -v --force<br />
</pre><br />
<br />
Shut down the HiFive board, remove the SD card, and copy the 4th partition from the SD card into a file or partition on the NBD server.<br />
<br />
Start up the NBD server (in this example using <code>qemu-nbd</code> with the 4th partition having been copied to <code>/dev/VG/jive</code> listening on port 10810):<br />
<pre><br />
qemu-nbd -t -f raw -x "" -p 10810 /dev/VG/jive<br />
</pre><br />
<br />
Place the SD card back in the HiFive board and boot it. At this point you have still booted into the SD card's root filesystem (not NBD). Go and edit <code>/boot/extlinux/extlinux.conf</code>. To the <code>addappend</code> line you will need to set:<br />
<br />
<pre><br />
root=UUID=<uuid> netroot=nbd:192.168.0.220:10810 rootfstype=ext4 rw rootdelay=5 ip=dhcp rootwait<br />
</code><br />
<br />
I would also advise removing <code>rhgb quiet</code> if they are present. Note you need to set <code>uuid</code> and the address and port number of the NBD server correctly. Immediately reboot and it should come up with an NBD root. Check the boot messages carefully to see whether it used the SD card or NBD root.<br />
<br />
== Install Fedora GNOME Desktop on SiFive HiFive Unleashed + Microsemi HiFive Unleashed Expansion board ==<br />
<br />
Detailed instructions are provided by Atish Patra from Western Digital Corporation (WDC). See their GitHub page for details and pictures: https://github.com/westerndigitalcorporation/RISC-V-Linux<br />
<br />
So far two GPUs are confirmed to be working: Radeon HD 6450 and Radeon HD 5450.<br />
<br />
= Use the image =<br />
<br />
Once the system is booted, login as <code>root</code> with <code>riscv</code> as password.<br />
<br />
X11 with Fluxbox can be started using: <code>startx /usr/bin/startfluxbox</code>. The disk image also includes awesome and i3 for testing. Dillo is available as a basic web browser (no javascript support) and pcmanfm as file manager.<br />
<br />
To gracefully shutdown just type <code>poweroff</code> into console.<br />
<br />
If you want more information being displayed during boot, remove <code>quiet</code> from the <code>append</code> line in <code>/boot/extlinux/extlinux.conf</code>.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Installing&diff=566275Architectures/RISC-V/Installing2020-02-18T21:27:44Z<p>Rjones: /* Install on the HiFive Unleashed using NBD server */</p>
<hr />
<div>This page describes the steps necessary to get Fedora for RISC-V running, either on emulated or real hardware.<br />
<br />
= Obtain a disk image =<br />
<br />
== Tested images ==<br />
<br />
These images have undergone some testing and thus are more likely to work without issues. If you are not sure which image to choose, go with one of these.<br />
<br />
=== Download using virt-builder ===<br />
<br />
This is the recommended way to obtain disk images.<br />
<br />
Before you can start using <code>virt-builder</code> for this task, a one-time setup is necessary:<br />
<br />
<pre><br />
$ mkdir -p ~/.config/virt-builder/repos.d/<br />
$ cat <<EOF >~/.config/virt-builder/repos.d/fedora-riscv.conf<br />
[fedora-riscv]<br />
uri=https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/index<br />
EOF<br />
</pre><br />
<br />
With that out of the way, you can get a list of available RISC-V templates with:<br />
<br />
<pre><br />
$ virt-builder --list | grep riscv64<br />
fedora-rawhide-developer-20191123.n.0 riscv64 Fedora® Rawhide Developer 20191123.n.0<br />
fedora-rawhide-minimal-20191123.n.1 riscv64 Fedora® Rawhide Minimal 20191123.n.1<br />
</pre><br />
<br />
Then tell <code>virt-builder</code> to build a custom disk image based on one of the templates:<br />
<br />
<pre><br />
$ virt-builder \<br />
--arch riscv64 \<br />
--size 20G \<br />
--format raw \<br />
--output Fedora-Developer-Rawhide-20191123.n.0-sda.raw \<br />
fedora-rawhide-developer-20191123.n.0<br />
[ 3.6] Downloading: https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-sda.raw.xz<br />
[ 6.1] Planning how to build this image<br />
[ 6.1] Uncompressing<br />
[ 32.8] Opening the new disk<br />
[ 38.4] Setting a random seed<br />
[ 38.4] Setting the machine ID in /etc/machine-id<br />
[ 38.4] Setting passwords<br />
virt-builder: Setting random password of root to 5PegnZtGMP47bXnw<br />
[ 39.9] Finishing off<br />
Output file: Fedora-Developer-Rawhide-20191123.n.0-sda.raw<br />
Output size: 20.0G<br />
Output format: raw<br />
Total usable space: 19.7G<br />
Free space: 14.7G (75%)<br />
</pre><br />
<br />
<code>virt-builder</code> has reasonable defaults, such as generating a random root password for you, but if you want more control you can pass additional arguments to customize the image further: for example, using <code>--format qcow2</code> will cause the output image to be in QCOW2 format. See <code>virt-builder --help</code> for more information.<br />
<br />
In addition to the disk image, a firmware image (which has to be downloaded separately) is needed as well. To find out the download URL, use:<br />
<br />
<pre><br />
$ virt-builder --arch riscv64 --notes fedora-rawhide-developer-20191123.n.0 | grep fw_payload<br />
https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf<br />
https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf.CHECKSUM<br />
</pre><br />
<br />
Then download it using your favorite HTTP client, for example:<br />
<br />
<pre><br />
$ wget https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf<br />
</pre><br />
<br />
=== Download manually ===<br />
<br />
If using <code>virt-builder</code> is not an option, you can download disk images manually from: https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/<br />
<br />
Download <code>Fedora-Developer-Rawhide-*.raw.xz</code> as well as the matching <code>Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf</code>.<br />
<br />
== Nightly builds ==<br />
<br />
You can find them here: http://fedora.riscv.rocks/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id<br />
<br />
Select the most recent (top) build and download <code>Fedora-Developer-Rawhide-*.raw.xz</code>.<br />
<br />
These disk images differ from the ones above in that:<br />
* the firmware is inside the disk image, in the <code>/boot</code> directory;<br />
* they are completely untested.<br />
<br />
= Prepare the disk image =<br />
<br />
These steps are only necessary if you haven't used <code>virt-builder</code>.<br />
<br />
== Uncompress the image ==<br />
<br />
Whether you have downloaded a tested image or a nightly build, you'll need to uncompress it before it can be used:<br />
<br />
<pre><br />
$ unxz Fedora-Developer-Rawhide-*.raw.xz<br />
</pre><br />
<br />
== Optional: expand the disk image ==<br />
<br />
You might want to expand the disk image before setting up the VM. Here is one example:<br />
<br />
<pre><br />
$ truncate -r Fedora-Developer-Rawhide-*.raw expanded.raw<br />
$ truncate -s 40G expanded.raw<br />
$ virt-resize -v -x --expand /dev/sda4 Fedora-Developer-Rawhide-*.raw expanded.raw<br />
$ virt-filesystems --long -h --all -a expanded.raw<br />
$ virt-df -h -a expanded.raw<br />
</pre><br />
<br />
The resulting disk image will work with QEMU as well as TinyEMU. Make sure you use <code>expanded.raw</code> instead of <code>Fedora-Developer-Rawhide-*.raw</code> when booting the guest.<br />
<br />
== Optional: create an overlay ==<br />
<br />
You can also create <code>qcow2</code> disk image with <code>raw</code> Fedora disk as backing one. This way Fedora <code>raw</code> is unmodified and all changes are written to <code>qcow2</code> layer. You will need to install <code>libguestfs-tools-c</code>.<br />
<br />
<pre><br />
$ qemu-img create -f qcow2 -F raw -b Fedora-Developer-Rawhide-*.raw overlay.qcow2 20G<br />
$ virt-resize -v -x --expand /dev/sda4 Fedora-Developer-Rawhide-*.raw overlay.qcow2<br />
$ virt-filesystems --long -h --all -a overlay.qcow2<br />
</pre><br />
<br />
The resulting disk image will only work with QEMU. Make sure you use <code>overlay.qcow2</code> instead of <code>Fedora-Developer-Rawhide-*.raw</code> when booting the guest.<br />
<br />
== Optional: set the hostname before booting ==<br />
<br />
If you want to change hostname before the first boot, install <code>libguestfs-tools-c</code> and then run:<br />
<br />
<pre><br />
$ virt-customize -a Fedora-Developer-Rawhide-*.raw --hostname fedora-riscv-mymagicbox<br />
</pre><br />
<br />
== Nightly builds only: extracting firmware (OpenSBI) ==<br />
<br />
Fedora/RISC-V does not support BLS (Boot Loader Specification - [https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault more details]).<br />
<br />
Disk images contain a <code>/boot</code> directory from where you can copy out the firmware.<br />
<br />
This is '''only''' necessary for nightly builds, since for tested images these files are provided as separate downloads alongside the image.<br />
<br />
Example session:<br />
<br />
<pre><br />
$ guestfish \<br />
add Fedora-Developer-Rawhide-*.raw : \<br />
run : \<br />
mount /dev/sda1 / : \<br />
ls /opensbi/unstable<br />
fw_jump.elf<br />
fw_payload-5.2.0-0.rc7.git0.1.0.riscv64.fc31.riscv64.elf<br />
fw_payload-uboot-qemu-virt-smode.elf<br />
$ guestfish \<br />
add Fedora-Developer-Rawhide-*.raw : run : mount /dev/sda1 / : \<br />
download /opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf fw_payload-uboot-qemu-virt-smode.elf<br />
</pre><br />
<br />
You can also use <code>guestmount</code> or QEMU/NBD to mount disk image. Examples:<br />
<pre><br />
$ mkdir a<br />
$ guestmount -a $PWD/Fedora-Developer-Rawhide-*.raw -m /dev/sda1 $PWD/a<br />
$ cp a/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf .<br />
$ guestunmount $PWD/a<br />
</pre><br />
<br />
<pre><br />
$ sudo modprobe nbd max_part=8<br />
$ sudo qemu-nbd -f raw --connect=/dev/nbd1 $PWD/Fedora-Developer-Rawhide-*.raw<br />
$ sudo fdisk -l /dev/nbd1<br />
Disk /dev/nbd1: 7.5 GiB, 8053063680 bytes, 15728640 sectors<br />
Units: sectors of 1 * 512 = 512 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
I/O size (minimum/optimal): 512 bytes / 512 bytes<br />
Disklabel type: gpt<br />
Disk identifier: F0F4268F-1B73-46FF-BABA-D87F075DCCA5<br />
<br />
Device Start End Sectors Size Type<br />
/dev/nbd1p1 2048 15001599 14999552 7.2G Linux filesystem<br />
$ sudo mount /dev/nbd1p1 a<br />
$ sudo cp a/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf .<br />
$ sudo umount a<br />
$ sudo qemu-nbd --disconnect /dev/nbd1<br />
</pre><br />
<br />
Note NBD is highly useful if you need to run <code>fdisk</code>, <code>e2fsck</code> (e.g. after VM crash and filesystem lock up), <code>resize2fs</code>. It might be beneficial to look into <code>nbdkit</code> and <code>nbd</code> packages.<br />
<br />
= Boot the image on virtual hardware =<br />
<br />
There are several options for booting the image on virtual hardware once you've prepared it following the steps above.<br />
<br />
== Boot with libvirt ==<br />
<br />
Detailed instructions how to install libvirt: https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-virtualization/<br />
<br />
Quick instructions for libvirt installation (tested on Fedora 30):<br />
<br />
<pre><br />
# dnf group install --with-optional virtualization<br />
# systemctl enable --now libvirtd<br />
</pre><br />
<br />
When running RISC-V guests, it's usually a good idea to use the very latest versions of QEMU, libvirt and virt-manager: the <code>virt-preview</code> repository offers just that for Fedora users. To enable it, simply run:<br />
<br />
<pre><br />
# dnf copr enable @virtmaint-sig/virt-preview<br />
</pre><br />
<br />
and update your system.<br />
<br />
The steps below assume you have copied both the disk image and the firmware into <code>/var/lib/libvirt/images</code>: this is the location where libvirt usually expects to find disk images, so while using a different location might work it's a good idea to do this and reduce the possibility of issues caused by filesystem permissions and such.<br />
<br />
Assuming you have QEMU &ge; 4.0.0, libvirt &ge; 5.3.0 and virt-manager &ge; 2.2.0, the installation will be as simple as:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--vcpus 8 \<br />
--memory 2048 \<br />
--os-variant fedora30 \<br />
--boot kernel=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
--import --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*.raw \<br />
--network network=default \<br />
--graphics none<br />
</pre><br />
<br />
If you are stuck with older software (QEMU &ge; 2.12.0, libvirt &ge; 4.7.0), then you're going to need a more verbose command line:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--machine virt \<br />
--vcpus 8 \<br />
--memory 2048 \<br />
--os-variant fedora30 \<br />
--boot kernel=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
--import --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*.raw,bus=virtio \<br />
--network network=default,model=virtio \<br />
--rng device=/dev/urandom,model=virtio \<br />
--channel name=org.qemu.guest_agent.0 \<br />
--graphics none<br />
</pre><br />
<br />
Additionally, when using older software components you won't get PCI support, and so enabling graphics will not be possible.<br />
<br />
Either one of the commands above will automatically boot you into the console. If you don't want that add <code>--noautoconsole</code> option. You can later use <code>virsh</code> tool to manage your VM and get to console.<br />
<br />
A quick reference of <code>virsh</code> commands:<br />
* <code>virsh list --all</code> - list all VMs and their states<br />
* <code>virsh console <name></code> - connect to serial console (remember: <code>Escape character is ^]</code>)<br />
* <code>virsh shutdown <name></code> - power down VM (see above for more details)<br />
* <code>virsh start <name></code> - power up VM<br />
* <code>virsh undefine <name></code> - remove VM<br />
* <code>virsh net-list</code> - list network (useful for the next command)<br />
* <code>virsh net-dhcp-leases <network_name></code> - list DHCP leases, <code><network_name></code> most likely will be <code>default</code>. This is useful when you want to get IPv4 and SSH to the VM.<br />
* <code>virsh domifaddr <name></code> - alternative for the above two commands, only shows IPv4 for one VM<br />
* <code>virsh reset <name></code> - hard reset VM<br />
* <code>virsh destroy <name></code> hard power down of VM<br />
<br />
If you want to use <code>ssh user@virtualMachine</code> you can setup libvirt NSS module. See: https://wiki.libvirt.org/page/NSS_module<br />
<br />
You might want also to setup logging for serial console (in case kernel panics or something else).<br />
<br />
For this we will be using two commands: <code>virsh edit <name></code> (modifying VM XML) and <code>virsh dumpxml <name></code> (dump VM XML for backup). You need to modify <code><serial></code> node by adding <code><log file='/var/log/libvirt/qemu/fedora-riscv-mymagicbox.serial.log'/></code>. Then power down and power up the VM.<br />
<br />
Alternatively you can use <code>--serial log.file=/.../whatever.serial.log</code> with <code>virt-install</code> command.<br />
<br />
== Boot under QEMU ==<br />
<br />
You will get the best results if your QEMU version is 4.0.0 or newer, but any version since 2.12.0 will work.<br />
<br />
<pre><br />
$ qemu-system-riscv64 \<br />
-nographic \<br />
-machine virt \<br />
-smp 8 \<br />
-m 2G \<br />
-kernel Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
-object rng-random,filename=/dev/urandom,id=rng0 \<br />
-device virtio-rng-device,rng=rng0 \<br />
-device virtio-blk-device,drive=hd0 \<br />
-drive file=Fedora-Developer-Rawhide-*.raw,format=raw,id=hd0 \<br />
-device virtio-net-device,netdev=usernet \<br />
-netdev user,id=usernet,hostfwd=tcp::10000-:22<br />
</pre><br />
<br />
Once machine is booted you can connect via SSH:<br />
<br />
<pre><br />
$ ssh -p 10000 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o PubkeyAuthentication=no root@localhost<br />
</pre><br />
<br />
== Boot under TinyEMU (RISCVEMU) ==<br />
'''Note (2019 March 10):''' This is not supported anymore until TinyEMU is updated to support external initrd file. Please, use QEMU or libvirt/QEMU.<br />
<br />
RISCVEMU recently (2018-09-23) was renamed to TinyEMU (https://bellard.org/tinyemu/).<br />
<br />
TinyEMU allow booting Fedora disk images in TUI and GUI modes. You can experiment using JSLinux (no need to download/compile/etc) here: https://bellard.org/jslinux/<br />
<br />
Below are instructions how to boot Fedora into X11/Fluxbox GUI mode.<br />
<br />
'''Step 1'''. Compile TinyEMU:<br />
<br />
<pre><br />
wget https://bellard.org/tinyemu/tinyemu-2018-09-23.tar.gz<br />
tar xvf tinyemu-2018-09-23.tar.gz<br />
cd tinyemu-2018-09-23<br />
make<br />
</pre><br />
<br />
'''Step 2'''. Setup for booting Fedora:<br />
<br />
<pre><br />
mkdir fedora<br />
cd fedora<br />
cp ../temu .<br />
<br />
# Download pre-built BBL with embedded kernel<br />
wget https://bellard.org/jslinux/bbl64-4.15.bin<br />
<br />
# Create configuration file for TinyEMU<br />
cat <<EOF > root-riscv64.cfg<br />
/* VM configuration file */<br />
{<br />
version: 1,<br />
machine: "riscv64",<br />
memory_size: 1400,<br />
bios: "bbl64-4.15.bin",<br />
cmdline: "loglevel=3 console=tty0 root=/dev/vda rw TZ=${TZ}",<br />
drive0: { file: "Fedora-Developer-Rawhide-*-sda1.raw" },<br />
eth0: { driver: "user" },<br />
display0: {<br />
device: "simplefb",<br />
width: 1920,<br />
height: 1080,<br />
},<br />
input_device: "virtio",<br />
}<br />
EOF<br />
<br />
# Download disk image and unpack in the same directory<br />
</pre><br />
<br />
'''Step 3'''. Boot it.<br />
<br />
<pre><br />
./temu -rw root-riscv64.cfg<br />
</pre><br />
<br />
We need to use <code>-rw</code> if we want our changes to persist in disk image. Otherwise disk image will be loaded as read-only and all changes will not persist after reboot.<br />
<br />
= Boot the image on physical hardware =<br />
<br />
== Install on the HiFive Unleashed SD card ==<br />
<br />
The disk image can be copied directly to an SD card and run on the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].<br />
<br />
A good way to create the SD card is with this virt-builder command:<br />
<br />
<pre><br />
sudo virt-builder \<br />
--source https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/index \<br />
--no-check-signature \<br />
--arch riscv64 \<br />
--format raw \<br />
--hostname testing.example.com \<br />
--output /dev/sdXXX \<br />
--root-password password:riscv \<br />
fedora-rawhide-developer-20200108.n.0<br />
</pre><br />
<br />
== Install on the HiFive Unleashed using NBD server ==<br />
<br />
You will need a separate machine on the same network which can act as an NBD server. It can be any Linux machine with [https://github.com/qemu/qemu/blob/master/qemu-nbd.c qemu-nbd] or [https://github.com/libguestfs/nbdkit nbdkit] installed.<br />
<br />
You will first need to get it working on the SD card using the instructions in the previous section.<br />
<br />
On the HiFive board, install <code>dracut-network</code> and <code>nbd</code>, and rebuild the initramfs with NBD support using these commands:<br />
<pre><br />
dnf install dracut-network nbd<br />
dracut -m "nbd network base" -v --force<br />
</pre><br />
<br />
Shut down the HiFive board, remove the SD card, and copy the 4th partition from the SD card into a file or partition on the NBD server.<br />
<br />
== Install Fedora GNOME Desktop on SiFive HiFive Unleashed + Microsemi HiFive Unleashed Expansion board ==<br />
<br />
Detailed instructions are provided by Atish Patra from Western Digital Corporation (WDC). See their GitHub page for details and pictures: https://github.com/westerndigitalcorporation/RISC-V-Linux<br />
<br />
So far two GPUs are confirmed to be working: Radeon HD 6450 and Radeon HD 5450.<br />
<br />
= Use the image =<br />
<br />
Once the system is booted, login as <code>root</code> with <code>riscv</code> as password.<br />
<br />
X11 with Fluxbox can be started using: <code>startx /usr/bin/startfluxbox</code>. The disk image also includes awesome and i3 for testing. Dillo is available as a basic web browser (no javascript support) and pcmanfm as file manager.<br />
<br />
To gracefully shutdown just type <code>poweroff</code> into console.<br />
<br />
If you want more information being displayed during boot, remove <code>quiet</code> from the <code>append</code> line in <code>/boot/extlinux/extlinux.conf</code>.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Installing&diff=566273Architectures/RISC-V/Installing2020-02-18T21:12:41Z<p>Rjones: /* Boot the image on physical hardware */</p>
<hr />
<div>This page describes the steps necessary to get Fedora for RISC-V running, either on emulated or real hardware.<br />
<br />
= Obtain a disk image =<br />
<br />
== Tested images ==<br />
<br />
These images have undergone some testing and thus are more likely to work without issues. If you are not sure which image to choose, go with one of these.<br />
<br />
=== Download using virt-builder ===<br />
<br />
This is the recommended way to obtain disk images.<br />
<br />
Before you can start using <code>virt-builder</code> for this task, a one-time setup is necessary:<br />
<br />
<pre><br />
$ mkdir -p ~/.config/virt-builder/repos.d/<br />
$ cat <<EOF >~/.config/virt-builder/repos.d/fedora-riscv.conf<br />
[fedora-riscv]<br />
uri=https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/index<br />
EOF<br />
</pre><br />
<br />
With that out of the way, you can get a list of available RISC-V templates with:<br />
<br />
<pre><br />
$ virt-builder --list | grep riscv64<br />
fedora-rawhide-developer-20191123.n.0 riscv64 Fedora® Rawhide Developer 20191123.n.0<br />
fedora-rawhide-minimal-20191123.n.1 riscv64 Fedora® Rawhide Minimal 20191123.n.1<br />
</pre><br />
<br />
Then tell <code>virt-builder</code> to build a custom disk image based on one of the templates:<br />
<br />
<pre><br />
$ virt-builder \<br />
--arch riscv64 \<br />
--size 20G \<br />
--format raw \<br />
--output Fedora-Developer-Rawhide-20191123.n.0-sda.raw \<br />
fedora-rawhide-developer-20191123.n.0<br />
[ 3.6] Downloading: https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-sda.raw.xz<br />
[ 6.1] Planning how to build this image<br />
[ 6.1] Uncompressing<br />
[ 32.8] Opening the new disk<br />
[ 38.4] Setting a random seed<br />
[ 38.4] Setting the machine ID in /etc/machine-id<br />
[ 38.4] Setting passwords<br />
virt-builder: Setting random password of root to 5PegnZtGMP47bXnw<br />
[ 39.9] Finishing off<br />
Output file: Fedora-Developer-Rawhide-20191123.n.0-sda.raw<br />
Output size: 20.0G<br />
Output format: raw<br />
Total usable space: 19.7G<br />
Free space: 14.7G (75%)<br />
</pre><br />
<br />
<code>virt-builder</code> has reasonable defaults, such as generating a random root password for you, but if you want more control you can pass additional arguments to customize the image further: for example, using <code>--format qcow2</code> will cause the output image to be in QCOW2 format. See <code>virt-builder --help</code> for more information.<br />
<br />
In addition to the disk image, a firmware image (which has to be downloaded separately) is needed as well. To find out the download URL, use:<br />
<br />
<pre><br />
$ virt-builder --arch riscv64 --notes fedora-rawhide-developer-20191123.n.0 | grep fw_payload<br />
https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf<br />
https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf.CHECKSUM<br />
</pre><br />
<br />
Then download it using your favorite HTTP client, for example:<br />
<br />
<pre><br />
$ wget https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf<br />
</pre><br />
<br />
=== Download manually ===<br />
<br />
If using <code>virt-builder</code> is not an option, you can download disk images manually from: https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/<br />
<br />
Download <code>Fedora-Developer-Rawhide-*.raw.xz</code> as well as the matching <code>Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf</code>.<br />
<br />
== Nightly builds ==<br />
<br />
You can find them here: http://fedora.riscv.rocks/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id<br />
<br />
Select the most recent (top) build and download <code>Fedora-Developer-Rawhide-*.raw.xz</code>.<br />
<br />
These disk images differ from the ones above in that:<br />
* the firmware is inside the disk image, in the <code>/boot</code> directory;<br />
* they are completely untested.<br />
<br />
= Prepare the disk image =<br />
<br />
These steps are only necessary if you haven't used <code>virt-builder</code>.<br />
<br />
== Uncompress the image ==<br />
<br />
Whether you have downloaded a tested image or a nightly build, you'll need to uncompress it before it can be used:<br />
<br />
<pre><br />
$ unxz Fedora-Developer-Rawhide-*.raw.xz<br />
</pre><br />
<br />
== Optional: expand the disk image ==<br />
<br />
You might want to expand the disk image before setting up the VM. Here is one example:<br />
<br />
<pre><br />
$ truncate -r Fedora-Developer-Rawhide-*.raw expanded.raw<br />
$ truncate -s 40G expanded.raw<br />
$ virt-resize -v -x --expand /dev/sda4 Fedora-Developer-Rawhide-*.raw expanded.raw<br />
$ virt-filesystems --long -h --all -a expanded.raw<br />
$ virt-df -h -a expanded.raw<br />
</pre><br />
<br />
The resulting disk image will work with QEMU as well as TinyEMU. Make sure you use <code>expanded.raw</code> instead of <code>Fedora-Developer-Rawhide-*.raw</code> when booting the guest.<br />
<br />
== Optional: create an overlay ==<br />
<br />
You can also create <code>qcow2</code> disk image with <code>raw</code> Fedora disk as backing one. This way Fedora <code>raw</code> is unmodified and all changes are written to <code>qcow2</code> layer. You will need to install <code>libguestfs-tools-c</code>.<br />
<br />
<pre><br />
$ qemu-img create -f qcow2 -F raw -b Fedora-Developer-Rawhide-*.raw overlay.qcow2 20G<br />
$ virt-resize -v -x --expand /dev/sda4 Fedora-Developer-Rawhide-*.raw overlay.qcow2<br />
$ virt-filesystems --long -h --all -a overlay.qcow2<br />
</pre><br />
<br />
The resulting disk image will only work with QEMU. Make sure you use <code>overlay.qcow2</code> instead of <code>Fedora-Developer-Rawhide-*.raw</code> when booting the guest.<br />
<br />
== Optional: set the hostname before booting ==<br />
<br />
If you want to change hostname before the first boot, install <code>libguestfs-tools-c</code> and then run:<br />
<br />
<pre><br />
$ virt-customize -a Fedora-Developer-Rawhide-*.raw --hostname fedora-riscv-mymagicbox<br />
</pre><br />
<br />
== Nightly builds only: extracting firmware (OpenSBI) ==<br />
<br />
Fedora/RISC-V does not support BLS (Boot Loader Specification - [https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault more details]).<br />
<br />
Disk images contain a <code>/boot</code> directory from where you can copy out the firmware.<br />
<br />
This is '''only''' necessary for nightly builds, since for tested images these files are provided as separate downloads alongside the image.<br />
<br />
Example session:<br />
<br />
<pre><br />
$ guestfish \<br />
add Fedora-Developer-Rawhide-*.raw : \<br />
run : \<br />
mount /dev/sda1 / : \<br />
ls /opensbi/unstable<br />
fw_jump.elf<br />
fw_payload-5.2.0-0.rc7.git0.1.0.riscv64.fc31.riscv64.elf<br />
fw_payload-uboot-qemu-virt-smode.elf<br />
$ guestfish \<br />
add Fedora-Developer-Rawhide-*.raw : run : mount /dev/sda1 / : \<br />
download /opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf fw_payload-uboot-qemu-virt-smode.elf<br />
</pre><br />
<br />
You can also use <code>guestmount</code> or QEMU/NBD to mount disk image. Examples:<br />
<pre><br />
$ mkdir a<br />
$ guestmount -a $PWD/Fedora-Developer-Rawhide-*.raw -m /dev/sda1 $PWD/a<br />
$ cp a/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf .<br />
$ guestunmount $PWD/a<br />
</pre><br />
<br />
<pre><br />
$ sudo modprobe nbd max_part=8<br />
$ sudo qemu-nbd -f raw --connect=/dev/nbd1 $PWD/Fedora-Developer-Rawhide-*.raw<br />
$ sudo fdisk -l /dev/nbd1<br />
Disk /dev/nbd1: 7.5 GiB, 8053063680 bytes, 15728640 sectors<br />
Units: sectors of 1 * 512 = 512 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
I/O size (minimum/optimal): 512 bytes / 512 bytes<br />
Disklabel type: gpt<br />
Disk identifier: F0F4268F-1B73-46FF-BABA-D87F075DCCA5<br />
<br />
Device Start End Sectors Size Type<br />
/dev/nbd1p1 2048 15001599 14999552 7.2G Linux filesystem<br />
$ sudo mount /dev/nbd1p1 a<br />
$ sudo cp a/opensbi/unstable/fw_payload-uboot-qemu-virt-smode.elf .<br />
$ sudo umount a<br />
$ sudo qemu-nbd --disconnect /dev/nbd1<br />
</pre><br />
<br />
Note NBD is highly useful if you need to run <code>fdisk</code>, <code>e2fsck</code> (e.g. after VM crash and filesystem lock up), <code>resize2fs</code>. It might be beneficial to look into <code>nbdkit</code> and <code>nbd</code> packages.<br />
<br />
= Boot the image on virtual hardware =<br />
<br />
There are several options for booting the image on virtual hardware once you've prepared it following the steps above.<br />
<br />
== Boot with libvirt ==<br />
<br />
Detailed instructions how to install libvirt: https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-virtualization/<br />
<br />
Quick instructions for libvirt installation (tested on Fedora 30):<br />
<br />
<pre><br />
# dnf group install --with-optional virtualization<br />
# systemctl enable --now libvirtd<br />
</pre><br />
<br />
When running RISC-V guests, it's usually a good idea to use the very latest versions of QEMU, libvirt and virt-manager: the <code>virt-preview</code> repository offers just that for Fedora users. To enable it, simply run:<br />
<br />
<pre><br />
# dnf copr enable @virtmaint-sig/virt-preview<br />
</pre><br />
<br />
and update your system.<br />
<br />
The steps below assume you have copied both the disk image and the firmware into <code>/var/lib/libvirt/images</code>: this is the location where libvirt usually expects to find disk images, so while using a different location might work it's a good idea to do this and reduce the possibility of issues caused by filesystem permissions and such.<br />
<br />
Assuming you have QEMU &ge; 4.0.0, libvirt &ge; 5.3.0 and virt-manager &ge; 2.2.0, the installation will be as simple as:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--vcpus 8 \<br />
--memory 2048 \<br />
--os-variant fedora30 \<br />
--boot kernel=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
--import --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*.raw \<br />
--network network=default \<br />
--graphics none<br />
</pre><br />
<br />
If you are stuck with older software (QEMU &ge; 2.12.0, libvirt &ge; 4.7.0), then you're going to need a more verbose command line:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--machine virt \<br />
--vcpus 8 \<br />
--memory 2048 \<br />
--os-variant fedora30 \<br />
--boot kernel=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
--import --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*.raw,bus=virtio \<br />
--network network=default,model=virtio \<br />
--rng device=/dev/urandom,model=virtio \<br />
--channel name=org.qemu.guest_agent.0 \<br />
--graphics none<br />
</pre><br />
<br />
Additionally, when using older software components you won't get PCI support, and so enabling graphics will not be possible.<br />
<br />
Either one of the commands above will automatically boot you into the console. If you don't want that add <code>--noautoconsole</code> option. You can later use <code>virsh</code> tool to manage your VM and get to console.<br />
<br />
A quick reference of <code>virsh</code> commands:<br />
* <code>virsh list --all</code> - list all VMs and their states<br />
* <code>virsh console <name></code> - connect to serial console (remember: <code>Escape character is ^]</code>)<br />
* <code>virsh shutdown <name></code> - power down VM (see above for more details)<br />
* <code>virsh start <name></code> - power up VM<br />
* <code>virsh undefine <name></code> - remove VM<br />
* <code>virsh net-list</code> - list network (useful for the next command)<br />
* <code>virsh net-dhcp-leases <network_name></code> - list DHCP leases, <code><network_name></code> most likely will be <code>default</code>. This is useful when you want to get IPv4 and SSH to the VM.<br />
* <code>virsh domifaddr <name></code> - alternative for the above two commands, only shows IPv4 for one VM<br />
* <code>virsh reset <name></code> - hard reset VM<br />
* <code>virsh destroy <name></code> hard power down of VM<br />
<br />
If you want to use <code>ssh user@virtualMachine</code> you can setup libvirt NSS module. See: https://wiki.libvirt.org/page/NSS_module<br />
<br />
You might want also to setup logging for serial console (in case kernel panics or something else).<br />
<br />
For this we will be using two commands: <code>virsh edit <name></code> (modifying VM XML) and <code>virsh dumpxml <name></code> (dump VM XML for backup). You need to modify <code><serial></code> node by adding <code><log file='/var/log/libvirt/qemu/fedora-riscv-mymagicbox.serial.log'/></code>. Then power down and power up the VM.<br />
<br />
Alternatively you can use <code>--serial log.file=/.../whatever.serial.log</code> with <code>virt-install</code> command.<br />
<br />
== Boot under QEMU ==<br />
<br />
You will get the best results if your QEMU version is 4.0.0 or newer, but any version since 2.12.0 will work.<br />
<br />
<pre><br />
$ qemu-system-riscv64 \<br />
-nographic \<br />
-machine virt \<br />
-smp 8 \<br />
-m 2G \<br />
-kernel Fedora-Developer-Rawhide-*-fw_payload-uboot-qemu-virt-smode.elf \<br />
-object rng-random,filename=/dev/urandom,id=rng0 \<br />
-device virtio-rng-device,rng=rng0 \<br />
-device virtio-blk-device,drive=hd0 \<br />
-drive file=Fedora-Developer-Rawhide-*.raw,format=raw,id=hd0 \<br />
-device virtio-net-device,netdev=usernet \<br />
-netdev user,id=usernet,hostfwd=tcp::10000-:22<br />
</pre><br />
<br />
Once machine is booted you can connect via SSH:<br />
<br />
<pre><br />
$ ssh -p 10000 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o PubkeyAuthentication=no root@localhost<br />
</pre><br />
<br />
== Boot under TinyEMU (RISCVEMU) ==<br />
'''Note (2019 March 10):''' This is not supported anymore until TinyEMU is updated to support external initrd file. Please, use QEMU or libvirt/QEMU.<br />
<br />
RISCVEMU recently (2018-09-23) was renamed to TinyEMU (https://bellard.org/tinyemu/).<br />
<br />
TinyEMU allow booting Fedora disk images in TUI and GUI modes. You can experiment using JSLinux (no need to download/compile/etc) here: https://bellard.org/jslinux/<br />
<br />
Below are instructions how to boot Fedora into X11/Fluxbox GUI mode.<br />
<br />
'''Step 1'''. Compile TinyEMU:<br />
<br />
<pre><br />
wget https://bellard.org/tinyemu/tinyemu-2018-09-23.tar.gz<br />
tar xvf tinyemu-2018-09-23.tar.gz<br />
cd tinyemu-2018-09-23<br />
make<br />
</pre><br />
<br />
'''Step 2'''. Setup for booting Fedora:<br />
<br />
<pre><br />
mkdir fedora<br />
cd fedora<br />
cp ../temu .<br />
<br />
# Download pre-built BBL with embedded kernel<br />
wget https://bellard.org/jslinux/bbl64-4.15.bin<br />
<br />
# Create configuration file for TinyEMU<br />
cat <<EOF > root-riscv64.cfg<br />
/* VM configuration file */<br />
{<br />
version: 1,<br />
machine: "riscv64",<br />
memory_size: 1400,<br />
bios: "bbl64-4.15.bin",<br />
cmdline: "loglevel=3 console=tty0 root=/dev/vda rw TZ=${TZ}",<br />
drive0: { file: "Fedora-Developer-Rawhide-*-sda1.raw" },<br />
eth0: { driver: "user" },<br />
display0: {<br />
device: "simplefb",<br />
width: 1920,<br />
height: 1080,<br />
},<br />
input_device: "virtio",<br />
}<br />
EOF<br />
<br />
# Download disk image and unpack in the same directory<br />
</pre><br />
<br />
'''Step 3'''. Boot it.<br />
<br />
<pre><br />
./temu -rw root-riscv64.cfg<br />
</pre><br />
<br />
We need to use <code>-rw</code> if we want our changes to persist in disk image. Otherwise disk image will be loaded as read-only and all changes will not persist after reboot.<br />
<br />
= Boot the image on physical hardware =<br />
<br />
== Install on the HiFive Unleashed SD card ==<br />
<br />
The disk image can be copied directly to an SD card and run on the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].<br />
<br />
A good way to create the SD card is with this virt-builder command:<br />
<br />
<pre><br />
sudo virt-builder \<br />
--source https://dl.fedoraproject.org/pub/alt/risc-v/repo/virt-builder-images/images/index \<br />
--no-check-signature \<br />
--arch riscv64 \<br />
--format raw \<br />
--hostname testing.example.com \<br />
--output /dev/sdXXX \<br />
--root-password password:riscv \<br />
fedora-rawhide-developer-20200108.n.0<br />
</pre><br />
<br />
== Install on the HiFive Unleashed using NBD server ==<br />
<br />
You will first need to get it working on the SD card using the instructions in the previous section.<br />
<br />
<br />
<br />
== Install Fedora GNOME Desktop on SiFive HiFive Unleashed + Microsemi HiFive Unleashed Expansion board ==<br />
<br />
Detailed instructions are provided by Atish Patra from Western Digital Corporation (WDC). See their GitHub page for details and pictures: https://github.com/westerndigitalcorporation/RISC-V-Linux<br />
<br />
So far two GPUs are confirmed to be working: Radeon HD 6450 and Radeon HD 5450.<br />
<br />
= Use the image =<br />
<br />
Once the system is booted, login as <code>root</code> with <code>riscv</code> as password.<br />
<br />
X11 with Fluxbox can be started using: <code>startx /usr/bin/startfluxbox</code>. The disk image also includes awesome and i3 for testing. Dillo is available as a basic web browser (no javascript support) and pcmanfm as file manager.<br />
<br />
To gracefully shutdown just type <code>poweroff</code> into console.<br />
<br />
If you want more information being displayed during boot, remove <code>quiet</code> from the <code>append</code> line in <code>/boot/extlinux/extlinux.conf</code>.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Installing&diff=554000Architectures/RISC-V/Installing2019-09-30T08:59:00Z<p>Rjones: Update links to Koji</p>
<hr />
<div>This page describes the steps necessary to get Fedora for RISC-V running, either on emulated or real hardware.<br />
<br />
= Obtain and prepare a disk image =<br />
<br />
== Tested images ==<br />
<br />
You can find them here: https://dl.fedoraproject.org/pub/alt/risc-v/disk-images/fedora/<br />
<br />
Download <code>Fedora-Developer-Rawhide-*-sda1.raw.xz</code> as well as <code>bbl-*.riscv64</code> and <code>initramfs-*.img</code>.<br />
<br />
These disk images:<br />
* contain a single "naked" filesystem (<code>root=/dev/vda</code>);<br />
* have SELinux set to enforcing=1;<br />
* have restored default SELinux security context (<code>restorecon -Rv /</code>);<br />
* kernel, initramfs, config and BBL are available as separate downloads;<br />
* have been booted in QEMU/libvirt a few times to verify.<br />
<br />
If you are not sure which image to choose, go with this one.<br />
<br />
== Nightly builds ==<br />
<br />
You can find them here: http://fedora.riscv.rocks/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id<br />
<br />
Select the most recent (top) build and download <code>Fedora-Developer-Rawhide-*-sda.raw.xz</code>.<br />
<br />
These disk images:<br />
* contain a partitioned disk (<code>root=/dev/vda1</code>);<br />
* have SELinux set to enforcing=1;<br />
* have restored default SELinux security context (<code>restorecon -Rv /</code>);<br />
* kernel, initramfs, config and BBL are inside the disk image, in the <code>/boot</code> directory;<br />
* are completely untested.<br />
<br />
If you choose this image, you'll have to tweak most of the commands below to account for the different names for the root partition and the disk image itself.<br />
<br />
== Uncompress the image ==<br />
<br />
Whether you have downloaded a tested image or a nightly build, you'll need to uncompress it before it can be used:<br />
<br />
<pre><br />
$ unxz Fedora-Developer-Rawhide-*.raw.xz<br />
</pre><br />
<br />
== Optional: expand the disk image ==<br />
<br />
You might want to expand the disk image before setting up the VM. Here is one example:<br />
<br />
<pre><br />
truncate -r Fedora-Developer-Rawhide-*-sda.raw expanded.raw<br />
truncate -s 40G expanded.raw<br />
virt-resize -v -x --expand /dev/sda1 Fedora-Developer-Rawhide-*-sda.raw expanded.raw<br />
virt-filesystems --long -h --all -a expanded.raw<br />
virt-df -h -a expanded.raw<br />
</pre><br />
<br />
You can only perform this operation if you downloaded a nightly build.<br />
<br />
The resulting disk image will work with QEMU as well as TinyEMU. Make sure you use <code>expanded.raw</code> instead of <code>Fedora-Developer-Rawhide-*-sda.raw</code> when booting the guest.<br />
<br />
== Optional: create an overlay ==<br />
<br />
You can also create <code>qcow2</code> disk image with <code>raw</code> Fedora disk as backing one. This way Fedora <code>raw</code> is unmodified and all changes are written to <code>qcow2</code> layer. You will need to install <code>libguestfs-tools-c</code>.<br />
<br />
<pre><br />
qemu-img create -f qcow2 -F raw -b Fedora-Developer-Rawhide-*-sda.raw overlay.qcow2 20G<br />
virt-resize -v -x --expand /dev/sda1 Fedora-Developer-Rawhide-*-sda.raw overlay.qcow2<br />
virt-filesystems --long -h --all -a overlay.qcow2<br />
</pre><br />
<br />
You can only perform this operation if you downloaded a nightly build.<br />
<br />
The resulting disk image will only work with QEMU. Make sure you use <code>overlay.qcow2</code> instead of <code>Fedora-Developer-Rawhide-*-sda.raw</code> when booting the guest.<br />
<br />
== Optional: set the hostname before booting ==<br />
<br />
If you want to change hostname before the first boot, install <code>libguestfs-tools-c</code> and then run:<br />
<br />
<pre><br />
virt-customize -a Fedora-Developer-Rawhide-*-sda1.raw --hostname fedora-riscv-mymagicbox<br />
</pre><br />
<br />
== Nightly builds only: extracting kernel, config, initramfs and BBL ==<br />
<br />
Fedora/RISC-V does not support BLS (Boot Loader Specification - [https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault more details]).<br />
<br />
Disk images contain a <code>/boot</code> directory from where you can copy out kernel, config, initramfs and BBL (contains embedded kernel).<br />
<br />
This is '''only''' necessary for nightly builds, since for tested images these files are provided as separate downloads alongside the image.<br />
<br />
Example session:<br />
<br />
<pre><br />
$ export LIBGUESTFS_BACKEND=direct<br />
$ guestfish \<br />
add Fedora-Developer-Rawhide-20190126.n.0-sda.raw : run : \<br />
mount /dev/sda1 / : ls /boot | grep -E '^(bbl|config|initramfs|vmlinuz)' | grep -v rescue<br />
bbl-5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64<br />
config-5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64<br />
initramfs-5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64.img<br />
vmlinuz-5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64<br />
$ guestfish \<br />
add Fedora-Developer-Rawhide-20190126.n.0-sda.raw : run : mount /dev/sda1 / : \<br />
download /boot/bbl-5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64 bbl-5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64 : \<br />
download /boot/config-5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64 config-5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64 : \<br />
download /boot/initramfs-5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64.img initramfs-5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64.img : \<br />
download /boot/vmlinuz-5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64 vmlinuz-5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64<br />
</pre><br />
<br />
You can also use <code>guestmount</code> or QEMU/NBD to mount disk image. Examples:<br />
<pre><br />
$ mkdir a<br />
$ guestmount -a $PWD/Fedora-Developer-Rawhide-20190126.n.0-sda.raw -m /dev/sda1 $PWD/a<br />
$ cp a/boot/bbl-5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64 .<br />
$ guestunmount $PWD/a<br />
</pre><br />
<br />
<pre><br />
$ sudo modprobe nbd max_part=8<br />
$ sudo qemu-nbd -f raw --connect=/dev/nbd1 $PWD/Fedora-Developer-Rawhide-20190126.n.0-sda.raw<br />
$ sudo fdisk -l /dev/nbd1<br />
Disk /dev/nbd1: 7.5 GiB, 8053063680 bytes, 15728640 sectors<br />
Units: sectors of 1 * 512 = 512 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
I/O size (minimum/optimal): 512 bytes / 512 bytes<br />
Disklabel type: gpt<br />
Disk identifier: F0F4268F-1B73-46FF-BABA-D87F075DCCA5<br />
<br />
Device Start End Sectors Size Type<br />
/dev/nbd1p1 2048 15001599 14999552 7.2G Linux filesystem<br />
$ sudo mount /dev/nbd1p1 a<br />
$ sudo cp a/boot/initramfs-5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64.img .<br />
$ sudo umount a<br />
$ sudo qemu-nbd --disconnect /dev/nbd1<br />
</pre><br />
<br />
Note NBD is highly useful if you need to run <code>fdisk</code>, <code>e2fsck</code> (e.g. after VM crash and filesystem lock up), <code>resize2fs</code>. It might be beneficial to look into <code>nbdkit</code> and <code>nbd</code> packages.<br />
<br />
= Boot the image on virtual hardware =<br />
<br />
There are several options for booting the image on virtual hardware once you've prepared it following the steps above.<br />
<br />
== Boot with libvirt ==<br />
<br />
Detailed instructions how to install libvirt: https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-virtualization/<br />
<br />
Quick instructions for libvirt installation (tested on Fedora 30):<br />
<br />
<pre><br />
dnf group install --with-optional virtualization<br />
systemctl enable --now libvirtd<br />
</pre><br />
<br />
When running RISC-V guests, it's usually a good idea to use the very latest versions of QEMU, libvirt and virt-manager: the <code>virt-preview</code> repository offers just that for Fedora users. To enable it, simply run:<br />
<br />
<pre><br />
dnf copr enable @virtmaint-sig/virt-preview<br />
</pre><br />
<br />
and update your system.<br />
<br />
Assuming you have QEMU &ge; 4.0.0, libvirt &ge; 5.3.0 and virt-manager &ge; 2.2.0, the installation will be as simple as:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--vcpus 8 \<br />
--memory 2048 \<br />
--os-variant fedora30 \<br />
--boot kernel=/var/lib/libvirt/images/bbl-*.riscv64,initrd=/var/lib/libvirt/images/initramfs-*.img,kernel_args="console=ttyS0 ro root=/dev/vda" \<br />
--import --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*-sda1.raw \<br />
--network network=default \<br />
--graphics none<br />
</pre><br />
<br />
If you want graphics rather than serial console, simply replace <code>--graphics none</code> with <code>--graphics spice</code>.<br />
<br />
If you are stuck with older software (QEMU &ge; 2.12.0, libvirt &ge; 4.7.0), then you're going to need a more verbose command line:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--machine virt \<br />
--vcpus 8 \<br />
--memory 2048 \<br />
--os-variant fedora30 \<br />
--boot kernel=/var/lib/libvirt/images/bbl-*.riscv64,initrd=/var/lib/libvirt/images/initramfs-*.img,kernel_args="console=ttyS0 ro root=/dev/vda" \<br />
--import --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-*-sda1.raw,bus=virtio \<br />
--network network=default,model=virtio \<br />
--rng device=/dev/urandom,model=virtio \<br />
--channel name=org.qemu.guest_agent.0 \<br />
--graphics none<br />
</pre><br />
<br />
Additionally, when using older software components you won't get PCI support, and so enabling graphics will not be possible.<br />
<br />
Either one of the commands above will automatically boot you into the console. If you don't want that add <code>--noautoconsole</code> option. You can later use <code>virsh</code> tool to manage your VM and get to console.<br />
<br />
A quick reference of <code>virsh</code> commands:<br />
* <code>virsh list --all</code> - list all VMs and their states<br />
* <code>virsh console <name></code> - connect to serial console (remember: <code>Escape character is ^]</code>)<br />
* <code>virsh shutdown <name></code> - power down VM (see above for more details)<br />
* <code>virsh start <name></code> - power up VM<br />
* <code>virsh undefine <name></code> - remove VM<br />
* <code>virsh net-list</code> - list network (useful for the next command)<br />
* <code>virsh net-dhcp-leases <network_name></code> - list DHCP leases, <code><network_name></code> most likely will be <code>default</code>. This is useful when you want to get IPv4 and SSH to the VM.<br />
* <code>virsh domifaddr <name></code> - alternative for the above two commands, only shows IPv4 for one VM<br />
* <code>virsh reset <name></code> - hard reset VM<br />
* <code>virsh destroy <name></code> hard power down of VM<br />
<br />
If you want to use <code>ssh user@virtualMachine</code> you can setup libvirt NSS module. See: https://wiki.libvirt.org/page/NSS_module<br />
<br />
You might want also to setup logging for serial console (in case kernel panics or something else).<br />
<br />
For this we will be using two commands: <code>virsh edit <name></code> (modifying VM XML) and <code>virsh dumpxml <name></code> (dump VM XML for backup). You need to modify <code><serial></code> node by adding <code><log file='/var/log/libvirt/qemu/fedora-riscv-mymagicbox.serial.log'/></code>. Then power down and power up the VM.<br />
<br />
Alternatively you can use <code>--serial log.file=/.../whatever.serial.log</code> with <code>virt-install</code> command.<br />
<br />
== Boot under QEMU ==<br />
<br />
You will get the best results if your QEMU version is 4.0.0 or newer, but any version since 2.12.0 will work.<br />
<br />
<pre><br />
qemu-system-riscv64 \<br />
-nographic \<br />
-machine virt \<br />
-smp 8 \<br />
-m 2G \<br />
-kernel bbl \<br />
-initrd initramfs-*.img \<br />
-object rng-random,filename=/dev/urandom,id=rng0 \<br />
-device virtio-rng-device,rng=rng0 \<br />
-append "console=ttyS0 ro root=/dev/vda" \<br />
-device virtio-blk-device,drive=hd0 \<br />
-drive file=Fedora-Developer-Rawhide-*-sda1.raw,format=raw,id=hd0 \<br />
-device virtio-net-device,netdev=usernet \<br />
-netdev user,id=usernet,hostfwd=tcp::10000-:22<br />
</pre><br />
<br />
Once machine is booted you can connect via SSH:<br />
<br />
<pre><br />
ssh -p 10000 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o PubkeyAuthentication=no root@localhost<br />
</pre><br />
<br />
== Boot under TinyEMU (RISCVEMU) ==<br />
'''Note (2019 March 10):''' This is not supported anymore until TinyEMU is updated to support external initrd file. Please, use QEMU or libvirt/QEMU.<br />
<br />
RISCVEMU recently (2018-09-23) was renamed to TinyEMU (https://bellard.org/tinyemu/).<br />
<br />
TinyEMU allow booting Fedora disk images in TUI and GUI modes. You can experiment using JSLinux (no need to download/compile/etc) here: https://bellard.org/jslinux/<br />
<br />
Below are instructions how to boot Fedora into X11/Fluxbox GUI mode.<br />
<br />
'''Step 1'''. Compile TinyEMU:<br />
<br />
<pre><br />
wget https://bellard.org/tinyemu/tinyemu-2018-09-23.tar.gz<br />
tar xvf tinyemu-2018-09-23.tar.gz<br />
cd tinyemu-2018-09-23<br />
make<br />
</pre><br />
<br />
'''Step 2'''. Setup for booting Fedora:<br />
<br />
<pre><br />
mkdir fedora<br />
cd fedora<br />
cp ../temu .<br />
<br />
# Download pre-built BBL with embedded kernel<br />
wget https://bellard.org/jslinux/bbl64-4.15.bin<br />
<br />
# Create configuration file for TinyEMU<br />
cat <<EOF > root-riscv64.cfg<br />
/* VM configuration file */<br />
{<br />
version: 1,<br />
machine: "riscv64",<br />
memory_size: 1400,<br />
bios: "bbl64-4.15.bin",<br />
cmdline: "loglevel=3 console=tty0 root=/dev/vda rw TZ=${TZ}",<br />
drive0: { file: "Fedora-Developer-Rawhide-*-sda1.raw" },<br />
eth0: { driver: "user" },<br />
display0: {<br />
device: "simplefb",<br />
width: 1920,<br />
height: 1080,<br />
},<br />
input_device: "virtio",<br />
}<br />
EOF<br />
<br />
# Download disk image and unpack in the same directory<br />
</pre><br />
<br />
'''Step 3'''. Boot it.<br />
<br />
<pre><br />
./temu -rw root-riscv64.cfg<br />
</pre><br />
<br />
We need to use <code>-rw</code> if we want our changes to persist in disk image. Otherwise disk image will be loaded as read-only and all changes will not persist after reboot.<br />
<br />
= Boot the image on physical hardware =<br />
<br />
== Install on the HiFive Unleashed SD card ==<br />
<br />
These are instructions for the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].<br />
<br />
The disk image (above) is partitioned, but usually we need an unpartitioned ("naked") filesystem. There are several ways to get this, but the easiest is:<br />
<br />
<pre><br />
$ guestfish -a Fedora-Developer-Rawhide-*-sda.raw \<br />
run : download /dev/sda1 Fedora-Developer-Rawhide-*-sda1.raw<br />
</pre><br />
<br />
This creates a naked ext4 filesystem called <code>*-sda1.raw</code>. The naked ext4 filesystem can be copied over the second partition of the SD card.<br />
<br />
You can also build a custom bbl+kernel+initramfs to boot directly into the SD card using [https://github.com/rwmjones/fedora-riscv-kernel these sources].<br />
<br />
== Install on the HiFive Unleashed using NBD server ==<br />
<br />
Look at https://github.com/rwmjones/fedora-riscv-kernel in the <code>sifive_u540</code> branch. This is quite complex to set up so it's best to ask on the <code>#fedora-riscv</code> IRC channel.<br />
<br />
== Install Fedora GNOME Desktop on SiFive HiFive Unleashed + Microsemi HiFive Unleashed Expansion board ==<br />
<br />
Detailed instructions are provided by Atish Patra from Western Digital Corporation (WDC). See their GitHub page for details and pictures: https://github.com/westerndigitalcorporation/RISC-V-Linux<br />
<br />
So far two GPUs are confirmed to be working: Radeon HD 6450 and Radeon HD 5450.<br />
<br />
= Use the image =<br />
<br />
Once the system is booted, login as <code>root</code> with <code>riscv</code> as password.<br />
<br />
X11 with Fluxbox can be started using: <code>startx /usr/bin/startfluxbox</code>. The disk image also includes awesome and i3 for testing. Dillo is available as a basic web browser (no javascript support) and pcmanfm as file manager.<br />
<br />
To gracefully shutdown just type <code>poweroff</code> into console.<br />
<br />
If you want less information being displayed during boot then add <code>quiet</code> into <code>kernel_args</code> line, e.g.: <code>console=ttyS0 ro quiet root=/dev/vda</code></div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=553999Architectures/RISC-V2019-09-30T08:57:24Z<p>Rjones: Update links to Koji</p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64GC) architecture.<br />
<br />
= News =<br />
<br />
'''May 2018''' [http://fedora.riscv.rocks/koji/ A Koji build system instance is now building Fedora packages].<br />
<br />
'''February/March 2018''' [https://fedorapeople.org/groups/risc-v/disk-images/ Stage4 disk images are available]. These are bootable in qemu and let you try out Fedora/RISC-V. Make sure you read the [https://fedorapeople.org/groups/risc-v/disk-images/readme.txt readme.txt file] first. The development environment is quite complete with GCC 7.3.1, Perl 5.26, Python 2 and 3, git, systemd, various editors including vi and emacs, many <code>-devel</code> packages, and some X11 packages. It will be enough for most developers to start porting their software to RISC-V. The main missing things at the moment are Ruby, Java and Gtk 3.<br />
<br />
'''Status January/February 2018''' The third and hopefully final bootstrap of Fedora 27 has started. Please follow progress or try building it yourself via [https://github.com/rwmjones/fedora-riscv-bootstrap this git repository]. Expected timelines are: 1-2 weeks until stage 3 disk images are available, 1-2 months until stage 4 pristine RPM-built disk images are available, 2 months until we are autobuilding regular Fedora packages, 3-6 months until we have koji-shadow functionality.<br />
<br />
= Communications =<br />
<br />
Find us on FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Installing]] - How to download, install and run Fedora/RISC-V.<br />
* <s>[[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.</s><br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.</s><br />
<br />
= Downloads =<br />
<br />
; http://fedora.riscv.rocks/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id<br />
: Latest disk images<br />
; http://fedora.riscv.rocks/koji/<br />
: Koji build system<br />
; http://fedora.riscv.rocks/repos/ http://fedora.riscv.rocks/repos-dist/<br />
: Packages built by Koji<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; https://bugzilla.redhat.com/show_bug.cgi?id=1553405<br />
: Tracker bug for all issues which affect Fedora on RISC-V<br />
<br />
The following links are now obsolete:<br />
<br />
; <s>https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. (old)</s><br />
; <s>https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.</s><br />
; <s>http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 27/x86_64) containing QEMU</s><br />
; <s>https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.</s><br />
; <s>https://github.com/rwmjones/fedora-riscv-bootstrap</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s></div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Installing&diff=529218Architectures/RISC-V/Installing2018-11-23T10:03:38Z<p>Rjones: Use IP address for link until we can fix certificate issues.</p>
<hr />
<div>= Download the latest disk image =<br />
<br />
<!-- http://fedora-riscv.tranquillity.se/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id --><br />
Go [http://185.97.32.145/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id to this link for the nightly builds] and select the most recent (top) build. Look for the <code>-sda.raw.xz</code> file and download it. It will usually be quite large, around 200-300 MB.<br />
<br />
Uncompress it:<br />
<br />
<pre><br />
$ unxz Fedora-Developer-Rawhide-xxxx.n.0-sda.raw.xz<br />
</pre><br />
<br />
== Root password ==<br />
<br />
<code>riscv</code><br />
<br />
= Boot under TinyEMU (RISCVEMU) =<br />
<br />
RISCVEMU recently (2018-09-23) was renamed to TinyEMU (https://bellard.org/tinyemu/).<br />
<br />
TinyEMU allow booting Fedora disk images in TUI and GUI modes. You can experiment using JSLinux (no need to download/compile/etc) here: https://bellard.org/jslinux/<br />
<br />
Below are instructions how to boot Fedora into X11/Fluxbox GUI mode.<br />
<br />
'''Step 1'''. Compile TinyEMU:<br />
<br />
<pre><br />
wget https://bellard.org/tinyemu/tinyemu-2018-09-23.tar.gz<br />
tar xvf tinyemu-2018-09-23.tar.gz<br />
cd tinyemu-2018-09-23<br />
make<br />
</pre><br />
<br />
'''Step 2'''. Setup for booting Fedora:<br />
<pre><br />
mkdir fedora<br />
cd fedora<br />
cp ../temu .<br />
<br />
# Download pre-built BBL with embedded kernel<br />
wget https://bellard.org/jslinux/bbl64-4.15.bin<br />
<br />
# Create configuration file for TinyEMU<br />
cat <<EOF > root-riscv64.cfg<br />
/* VM configuration file */<br />
{<br />
version: 1,<br />
machine: "riscv64",<br />
memory_size: 1400,<br />
bios: "bbl64-4.15.bin",<br />
cmdline: "loglevel=3 console=tty0 root=/dev/vda1 rw TZ=${TZ}",<br />
drive0: { file: "Fedora-Developer-Rawhide-xxxx.n.0-sda.raw" },<br />
eth0: { driver: "user" },<br />
display0: {<br />
device: "simplefb",<br />
width: 1920,<br />
height: 1080,<br />
},<br />
input_device: "virtio",<br />
}<br />
EOF<br />
<br />
# Download disk image and unpack in the same directory<br />
</pre><br />
<br />
'''Step 3'''. Boot it.<br />
<pre><br />
./temu -rw root-riscv64.cfg<br />
</pre><br />
<br />
We need to use <code>-rw</code> if we want our changes to persist in disk image. Otherwise disk image will be loaded as read-only and all changes will not persist after reboot.<br />
<br />
Once the system is booted login as <code>root</code> with <code>riscv</code> as password. Finally start X11 with Fluxbox: <code>startx /usr/bin/startfluxbox</code>. To gratefully shutdown just type <code>poweroff</code> into console.<br />
<br />
The disk image also incl. awesome and i3 for testing. Dillo is available as a basic web browser (no javascript support) and pcmanfm as file manager.<br />
<br />
= Boot under qemu =<br />
<br />
You will need a very recent version of qemu. If in doubt, compile from upstream qemu sources.<br />
<br />
Get [https://fedorapeople.org/groups/risc-v/disk-images/bbl bbl from here] or [https://github.com/rwmjones/fedora-riscv-kernel compile it from source].<br />
<br />
<pre><br />
qemu-system-riscv64 \<br />
-nographic \<br />
-machine virt \<br />
-smp 4 \<br />
-m 2G \<br />
-kernel bbl \<br />
-object rng-random,filename=/dev/urandom,id=rng0 \<br />
-device virtio-rng-device,rng=rng0 \<br />
-append "console=ttyS0 ro root=/dev/vda1" \<br />
-device virtio-blk-device,drive=hd0 \<br />
-drive file=Fedora-Developer-Rawhide-xxxx.n.0-sda.raw,format=raw,id=hd0 \<br />
-device virtio-net-device,netdev=usernet \<br />
-netdev user,id=usernet,hostfwd=tcp::10000-:22<br />
</pre><br />
<br />
You can also create <code>qcow2</code> disk image with <code>raw</code> Fedora disk as backing one. This way Fedora <code>raw</code> is unmodified and all changes are written to <code>qcow2</code> layer. You will need to install <code>libguestfs-tools-c</code>.<br />
<br />
<pre><br />
qemu-img create -f qcow2 -F raw -b Fedora-Developer-Rawhide-xxxx.n.0-sda.raw tmp.qcow2 20G<br />
virt-resize -v -x --expand /dev/sda1 Fedora-Developer-Rawhide-xxxx.n.0-sda.raw tmp.qcow2 <br />
virt-filesystems --long -h --all -a tmp.qcow2<br />
</pre><br />
<br />
Then modify above QEMU invocation by changing <code>-drive</code> option to:<br />
<pre><br />
-drive file=tmp.qcow2,id=hd0<br />
</pre><br />
<br />
You can use up to <code>-smp 8</code>, which is helpful for building large projects.<br />
<br />
Once machine is booted you can connect via SSH:<br />
<pre><br />
ssh -p 10000 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost<br />
</pre><br />
<br />
= Boot with libvirt =<br />
<br />
Detailed instructions how to install libvirt: https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-virtualization/<br />
<br />
Quick instructions for libvirt installation (tested on Fedora 29):<br />
<pre><br />
dnf group install --with-optional virtualization<br />
systemctl start libvirtd<br />
systemctl enable libvirtd<br />
</pre><br />
<br />
Needs <b>libvirt &ge; 4.7.0</b> which is the first version with upstream RISC-V support. This is available in Fedora 29. You should be able to boot the disk image using a command similar to this:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--machine virt \<br />
--vcpus 4 \<br />
--memory 2048 \<br />
--import \<br />
--disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-xxxx.n.0-sda.raw,bus=virtio \<br />
--boot kernel=/var/lib/libvirt/images/bbl,kernel_args="console=ttyS0 ro root=/dev/vda1" \<br />
--network network=default,model=virtio \<br />
--rng device=/dev/urandom,model=virtio \<br />
--graphics none<br />
</pre><br />
<br />
Note that will automatically boot you into the console. If you don't want that add <code>--noautoconsole</code> option. You can later use <code>virsh</code> tool to manage your VM and get to console.<br />
<br />
You can use up to <code>--vcpus 8</code>, which is helpful for large projects.<br />
<br />
Add <code>--channel name=org.qemu.guest_agent.0</code> option if you want <code>virsh shutdown <name></code> to work. This requires <code>qemu-guest-agent</code> to be installed in disk image (available in Developer, GNOME and Minimal disk images starting Oct 15, 2018, but not in Nano disk images).<br />
<br />
If you want to change hostname before 1st boot install <code>libguestfs-tools-c</code> and then:<br />
<pre><br />
virt-customize -a Fedora-Developer-Rawhide-xxxx.n.0-sda.raw --hostname fedora-riscv-mymagicbox<br />
</pre><br />
<br />
A quick reference of <code>virsh</code> commands:<br />
* <code>virsh list --all</code> - list all VMs and their states<br />
* <code>virsh console <name></code> - connect to serial console (remember: <code>Escape character is ^]</code>)<br />
* <code>virsh shutdown <name></code> - power down VM (see above for more details)<br />
* <code>virsh start <name></code> - power up VM<br />
* <code>virsh undefine <name></code> - remove VM<br />
* <code>virsh net-list</code> - list network (useful for the next command)<br />
* <code>virsh net-dhcp-leases <network_name></code> - list DHCP leases, <code><network_name></code> most likely will be <code>default</code>. This is useful when you want to get IPv4 and SSH to the VM.<br />
* <code>virsh domifaddr <name></code> - alternative for the above two commands, only shows IPv4 for one VM<br />
* <code>virsh reset <name></code> - hard reset VM<br />
* <code>virsh destroy <name></code> hard power down of VM<br />
<br />
If you want to use <code>ssh user@virtualMachine</code> you can setup libvirt NSS module. See: https://wiki.libvirt.org/page/NSS_module<br />
<br />
You might want to expand <code>raw</code> Fedora disk image before setting up VM. Here is one example:<br />
<br />
<pre><br />
truncate -r Fedora-Developer-Rawhide-xxxx.n.0-sda.raw xxxx.n.0-sda.raw<br />
truncate -s 40G xxxx.n.0-sda.raw<br />
virt-resize -v -x --expand /dev/sda1 Fedora-Developer-Rawhide-xxxx.n.0-sda.raw xxxx.n.0-sda.raw<br />
virt-filesystems --long -h --all -a xxxx.n.0-sda.raw<br />
virt-df -h -a xxxx.n.0-sda.raw<br />
</pre><br />
<br />
Then adjust <code>--disk path=</code> option in libvirt invocation.<br />
<br />
You might want also to setup logging for serial console (in case kernel panics or something else).<br />
<br />
For this we will be using two commands: <code>virsh edit <name></code> (modifying VM XML) and <code>virsh dumpxml <name></code> (dump VM XML for backup). You need to modify <code><serial></code> node by adding <code><log file='/var/log/libvirt/qemu/fedora-riscv-mymagicbox.serial.log'/></code>. Then power down and power up the VM.<br />
<br />
= Install on the HiFive Unleashed SD card =<br />
<br />
These are instructions for the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].<br />
<br />
The disk image (above) is partitioned, but usually we need an unpartitioned ("naked") filesystem. There are several ways to get this, but the easiest is:<br />
<br />
<pre><br />
$ guestfish -a Fedora-Developer-Rawhide-xxxx.n.0-sda.raw \<br />
run : download /dev/sda1 Fedora-Developer-Rawhide-xxxx.n.0-sda1.raw<br />
</pre><br />
<br />
This creates a naked ext4 filesystem called <code>*-sda1.raw</code>. The naked ext4 filesystem can be copied over the second partition of the SD card.<br />
<br />
You can also build a custom bbl+kernel+initramfs to boot directly into the SD card using [https://github.com/rwmjones/fedora-riscv-kernel these sources].<br />
<br />
= Install on the HiFive Unleashed using NBD server =<br />
<br />
Look at https://github.com/rwmjones/fedora-riscv-kernel in the <code>sifive_u540</code> branch. This is quite complex to set up so it's best to ask on the <code>#fedora-riscv</code> IRC channel.<br />
<br />
= Install Fedora GNOME Desktop on SiFive HiFive Unleashed + Microsemi HiFive Unleashed Expansion board =<br />
<br />
Detailed instructions are provided by Atish Patra from Western Digital Corporation (WDC). See their GitHub page for details and pictures: https://github.com/westerndigitalcorporation/RISC-V-Linux<br />
<br />
So far two GPUs are confirmed to be working: Radeon HD 6450 and Radeon HD 5450.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Installing&diff=524546Architectures/RISC-V/Installing2018-09-11T09:57:37Z<p>Rjones: </p>
<hr />
<div>= Download the latest disk image =<br />
<br />
Go [http://fedora-riscv.tranquillity.se/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id to this link for the nightly builds] and select the most recent (top) build. Look for the <code>-sda.raw.xz</code> file and download it. It will usually be quite large, around 200-300 MB.<br />
<br />
Uncompress it:<br />
<br />
<pre><br />
$ unxz Fedora-Developer-Rawhide-xxxx.n.0-sda.raw.xz<br />
</pre><br />
<br />
== Root password ==<br />
<br />
<code>riscv</code><br />
<br />
= Boot under qemu =<br />
<br />
You will need a very recent version of qemu. If in doubt, compile from upstream qemu sources.<br />
<br />
Get [https://fedorapeople.org/groups/risc-v/disk-images/bbl bbl from here] or [https://github.com/rwmjones/fedora-riscv-kernel compile it from source].<br />
<br />
<pre><br />
qemu-system-riscv64 \<br />
-nographic \<br />
-machine virt \<br />
-smp 4 \<br />
-m 2G \<br />
-kernel bbl \<br />
-object rng-random,filename=/dev/urandom,id=rng0 \<br />
-device virtio-rng-device,rng=rng0 \<br />
-append "console=ttyS0 ro root=/dev/vda1" \<br />
-device virtio-blk-device,drive=hd0 \<br />
-drive file=Fedora-Developer-Rawhide-xxxx.n.0-sda.raw,format=raw,id=hd0 \<br />
-device virtio-net-device,netdev=usernet \<br />
-netdev user,id=usernet,hostfwd=tcp::10000-:22<br />
</pre><br />
<br />
= Boot with libvirt =<br />
<br />
Needs <b>libvirt &ge; 4.7.0</b> which is the first version with upstream RISC-V support. You should be able to boot the disk image using a command similar to this:<br />
<br />
<pre><br />
# virt-install \<br />
--name fedora-riscv \<br />
--arch riscv64 \<br />
--machine virt \<br />
--vcpus 4 \<br />
--memory 2048 \<br />
--import \<br />
--disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-xxxx.n.0-sda.raw,bus=virtio \<br />
--boot kernel=/var/lib/libvirt/images/bbl,kernel_args="console=ttyS0 ro root=/dev/vda1" \<br />
--network network=default,model=virtio \<br />
--rng device=/dev/urandom,model=virtio \<br />
--graphics none<br />
</pre><br />
<br />
= Install on the HiFive Unleashed SD card =<br />
<br />
These are instructions for the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].<br />
<br />
The disk image (above) is partitioned, but usually we need an unpartitioned ("naked") filesystem. There are several ways to get this, but the easiest is:<br />
<br />
<pre><br />
$ guestfish -a Fedora-Developer-Rawhide-xxxx.n.0-sda.raw \<br />
run : download /dev/sda1 Fedora-Developer-Rawhide-xxxx.n.0-sda1.raw<br />
</pre><br />
<br />
This creates a naked ext4 filesystem called <code>*-sda1.raw</code>. The naked ext4 filesystem can be copied over the second partition of the SD card.<br />
<br />
You can also build a custom bbl+kernel+initramfs to boot directly into the SD card using [https://github.com/rwmjones/fedora-riscv-kernel these sources].<br />
<br />
= Install on the HiFive Unleashed using NBD server =<br />
<br />
Look at https://github.com/rwmjones/fedora-riscv-kernel in the <code>sifive_u540</code> branch. This is quite complex to set up so it's best to ask on the <code>#fedora-riscv</code> IRC channel.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Installing&diff=523952Architectures/RISC-V/Installing2018-08-24T14:08:53Z<p>Rjones: </p>
<hr />
<div>= Download the latest disk image =<br />
<br />
Go [http://fedora-riscv.tranquillity.se/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id to this link for the nightly builds] and select the most recent (top) build. Look for the <code>-sda.raw.xz</code> file and download it. It will usually be quite large, around 200-300 MB.<br />
<br />
Uncompress it:<br />
<br />
<pre><br />
$ unxz Fedora-Developer-Rawhide-xxxx.n.0-sda.raw.xz<br />
</pre><br />
<br />
== Root password ==<br />
<br />
<code>riscv</code><br />
<br />
= Boot under qemu =<br />
<br />
You will need a very recent version of qemu. If in doubt, compile from upstream qemu sources.<br />
<br />
Get [https://fedorapeople.org/groups/risc-v/disk-images/bbl bbl from here] or [https://github.com/rwmjones/fedora-riscv-kernel compile it from source].<br />
<br />
<pre><br />
qemu-system-riscv64 \<br />
-nographic \<br />
-machine virt \<br />
-smp 4 \<br />
-m 2G \<br />
-kernel bbl \<br />
-object rng-random,filename=/dev/urandom,id=rng0 \<br />
-device virtio-rng-device,rng=rng0 \<br />
-append "console=ttyS0 ro root=/dev/vda1" \<br />
-device virtio-blk-device,drive=hd0 \<br />
-drive file=Fedora-Developer-Rawhide-xxxx.n.0-sda.raw,format=raw,id=hd0 \<br />
-device virtio-net-device,netdev=usernet \<br />
-netdev user,id=usernet,hostfwd=tcp::10000-:22<br />
</pre><br />
<br />
= Install on the HiFive Unleashed SD card =<br />
<br />
These are instructions for the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].<br />
<br />
The disk image (above) is partitioned, but usually we need an unpartitioned ("naked") filesystem. There are several ways to get this, but the easiest is:<br />
<br />
<pre><br />
$ guestfish -a Fedora-Developer-Rawhide-xxxx.n.0-sda.raw \<br />
run : download /dev/sda1 Fedora-Developer-Rawhide-xxxx.n.0-sda1.raw<br />
</pre><br />
<br />
This creates a naked ext4 filesystem called <code>*-sda1.raw</code>. The naked ext4 filesystem can be copied over the second partition of the SD card.<br />
<br />
You can also build a custom bbl+kernel+initramfs to boot directly into the SD card using [https://github.com/rwmjones/fedora-riscv-kernel these sources].<br />
<br />
= Install on the HiFive Unleashed using NBD server =<br />
<br />
Look at https://github.com/rwmjones/fedora-riscv-kernel in the <code>sifive_u540</code> branch. This is quite complex to set up so it's best to ask on the <code>#fedora-riscv</code> IRC channel.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Installing&diff=523951Architectures/RISC-V/Installing2018-08-24T14:05:49Z<p>Rjones: </p>
<hr />
<div>= Download the latest disk image =<br />
<br />
Go [http://fedora-riscv.tranquillity.se/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id to this link for the nightly builds] and select the most recent (top) build. Look for the <code>-sda.raw.xz</code> file and download it. It will usually be quite large, around 200-300 MB.<br />
<br />
== Root password ==<br />
<br />
<code>riscv</code><br />
<br />
= Boot under qemu =<br />
<br />
You will need a very recent version of qemu. If in doubt, compile from upstream qemu sources.<br />
<br />
Get [https://fedorapeople.org/groups/risc-v/disk-images/bbl bbl from here] or [https://github.com/rwmjones/fedora-riscv-kernel compile it from source].<br />
<br />
You will need to uncompress the disk image.<br />
<br />
<pre><br />
qemu-system-riscv64 \<br />
-nographic \<br />
-machine virt \<br />
-smp 4 \<br />
-m 2G \<br />
-kernel bbl \<br />
-object rng-random,filename=/dev/urandom,id=rng0 \<br />
-device virtio-rng-device,rng=rng0 \<br />
-append "console=ttyS0 ro root=/dev/vda1" \<br />
-device virtio-blk-device,drive=hd0 \<br />
-drive file=Fedora-Developer-Rawhide-xxxx.n.0-sda.raw,format=raw,id=hd0 \<br />
-device virtio-net-device,netdev=usernet \<br />
-netdev user,id=usernet,hostfwd=tcp::10000-:22<br />
</pre><br />
<br />
= Install on the HiFive Unleashed SD card =<br />
<br />
These are instructions for the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].<br />
<br />
The disk image (above) is compressed and partitioned, but usually we need an uncompressed, unpartitioned ("naked") filesystem. There are several ways to get this, but the easiest is:<br />
<br />
<pre><br />
$ unxz Fedora-Developer-Rawhide-xxxx.n.0-sda.raw.xz<br />
$ guestfish -a Fedora-Developer-Rawhide-xxxx.n.0-sda.raw \<br />
run : download /dev/sda1 Fedora-Developer-Rawhide-xxxx.n.0-sda1.raw<br />
</pre><br />
<br />
This creates a naked ext4 filesystem called <code>*-sda1.raw</code>. The naked ext4 filesystem can be copied over the second partition of the SD card.<br />
<br />
You can also build a custom bbl+kernel+initramfs to boot directly into the SD card using [https://github.com/rwmjones/fedora-riscv-kernel these sources].<br />
<br />
= Install on the HiFive Unleashed using NBD server =<br />
<br />
Look at https://github.com/rwmjones/fedora-riscv-kernel in the <code>sifive_u540</code> branch. This is quite complex to set up so it's best to ask on the <code>#fedora-riscv</code> IRC channel.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Installing&diff=523950Architectures/RISC-V/Installing2018-08-24T14:05:10Z<p>Rjones: </p>
<hr />
<div>= Download the latest disk image =<br />
<br />
Go [http://fedora-riscv.tranquillity.se/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id to this link for the nightly builds] and select the most recent (top) build. Look for the <code>-sda.raw.xz</code> file and download it. It will usually be quite large, around 200-300 MB.<br />
<br />
== Root password ==<br />
<br />
<code>riscv</code><br />
<br />
= Boot under qemu =<br />
<br />
You will need a very recent version of qemu. If in doubt, compile from upstream qemu sources.<br />
<br />
Get [https://fedorapeople.org/groups/risc-v/disk-images/bbl bbl from here] or [https://github.com/rwmjones/fedora-riscv-kernel compile it from source].<br />
<br />
You will need to uncompress the disk image.<br />
<br />
<pre><br />
qemu-system-riscv64 \<br />
-nographic \<br />
-machine virt \<br />
-smp 4 \<br />
-m 2G \<br />
-kernel bbl \<br />
-object rng-random,filename=/dev/urandom,id=rng0 \<br />
-device virtio-rng-device,rng=rng0 \<br />
-append "console=ttyS0 ro root=/dev/vda1" \<br />
-device virtio-blk-device,drive=hd0 \<br />
-drive file=Fedora-Developer-Rawhide-xxxx.n.0-sda1.raw,format=raw,id=hd0 \<br />
-device virtio-net-device,netdev=usernet \<br />
-netdev user,id=usernet,hostfwd=tcp::10000-:22<br />
</pre><br />
<br />
= Install on the HiFive Unleashed SD card =<br />
<br />
These are instructions for the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].<br />
<br />
The disk image (above) is compressed and partitioned, but usually we need an uncompressed, unpartitioned ("naked") filesystem. There are several ways to get this, but the easiest is:<br />
<br />
<pre><br />
$ unxz Fedora-Developer-Rawhide-xxxx.n.0-sda.raw.xz<br />
$ guestfish -a Fedora-Developer-Rawhide-xxxx.n.0-sda.raw \<br />
run : download /dev/sda1 Fedora-Developer-Rawhide-xxxx.n.0-sda1.raw<br />
</pre><br />
<br />
This creates a naked ext4 filesystem called <code>*-sda1.raw</code>. The naked ext4 filesystem can be copied over the second partition of the SD card.<br />
<br />
You can also build a custom bbl+kernel+initramfs to boot directly into the SD card using [https://github.com/rwmjones/fedora-riscv-kernel these sources].<br />
<br />
= Install on the HiFive Unleashed using NBD server =<br />
<br />
Look at https://github.com/rwmjones/fedora-riscv-kernel in the <code>sifive_u540</code> branch. This is quite complex to set up so it's best to ask on the <code>#fedora-riscv</code> IRC channel.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=523764Architectures/RISC-V2018-08-18T10:34:04Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64GC) architecture.<br />
<br />
= News =<br />
<br />
'''May 2018''' [http://fedora-riscv.tranquillity.se/koji/ A Koji build system instance is now building Fedora packages].<br />
<br />
'''February/March 2018''' [https://fedorapeople.org/groups/risc-v/disk-images/ Stage4 disk images are available]. These are bootable in qemu and let you try out Fedora/RISC-V. Make sure you read the [https://fedorapeople.org/groups/risc-v/disk-images/readme.txt readme.txt file] first. The development environment is quite complete with GCC 7.3.1, Perl 5.26, Python 2 and 3, git, systemd, various editors including vi and emacs, many <code>-devel</code> packages, and some X11 packages. It will be enough for most developers to start porting their software to RISC-V. The main missing things at the moment are Ruby, Java and Gtk 3.<br />
<br />
'''Status January/February 2018''' The third and hopefully final bootstrap of Fedora 27 has started. Please follow progress or try building it yourself via [https://github.com/rwmjones/fedora-riscv-bootstrap this git repository]. Expected timelines are: 1-2 weeks until stage 3 disk images are available, 1-2 months until stage 4 pristine RPM-built disk images are available, 2 months until we are autobuilding regular Fedora packages, 3-6 months until we have koji-shadow functionality.<br />
<br />
= Communications =<br />
<br />
Find us on FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Installing]] - How to download, install and run Fedora/RISC-V.<br />
* <s>[[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.</s><br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.</s><br />
<br />
= Downloads =<br />
<br />
; http://fedora-riscv.tranquillity.se/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id<br />
: Latest disk images<br />
; http://fedora-riscv.tranquillity.se/koji/<br />
: Koji build system<br />
; http://fedora-riscv.tranquillity.se/repos/ http://fedora-riscv.tranquillity.se/repos-dist/<br />
: Packages built by Koji<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; https://bugzilla.redhat.com/show_bug.cgi?id=1553405<br />
: Tracker bug for all issues which affect Fedora on RISC-V<br />
<br />
The following links are now obsolete:<br />
<br />
; <s>https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. (old)</s><br />
; <s>https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.</s><br />
; <s>http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 27/x86_64) containing QEMU</s><br />
; <s>https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.</s><br />
; <s>https://github.com/rwmjones/fedora-riscv-bootstrap</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s></div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=523715Architectures/RISC-V2018-08-16T12:05:11Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64GC) architecture.<br />
<br />
= News =<br />
<br />
'''May 2018''' [http://fedora-riscv.tranquillity.se/koji/ A Koji build system instance is now building Fedora packages].<br />
<br />
'''February/March 2018''' [https://fedorapeople.org/groups/risc-v/disk-images/ Stage4 disk images are available]. These are bootable in qemu and let you try out Fedora/RISC-V. Make sure you read the [https://fedorapeople.org/groups/risc-v/disk-images/readme.txt readme.txt file] first. The development environment is quite complete with GCC 7.3.1, Perl 5.26, Python 2 and 3, git, systemd, various editors including vi and emacs, many <code>-devel</code> packages, and some X11 packages. It will be enough for most developers to start porting their software to RISC-V. The main missing things at the moment are Ruby, Java and Gtk 3.<br />
<br />
'''Status January/February 2018''' The third and hopefully final bootstrap of Fedora 27 has started. Please follow progress or try building it yourself via [https://github.com/rwmjones/fedora-riscv-bootstrap this git repository]. Expected timelines are: 1-2 weeks until stage 3 disk images are available, 1-2 months until stage 4 pristine RPM-built disk images are available, 2 months until we are autobuilding regular Fedora packages, 3-6 months until we have koji-shadow functionality.<br />
<br />
= Communications =<br />
<br />
Find us on FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Installing]] - How to download, install and run Fedora/RISC-V.<br />
* <s>[[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.</s><br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.</s><br />
<br />
= Downloads =<br />
<br />
; http://fedora-riscv.tranquillity.se/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id<br />
: Latest disk images<br />
; http://fedora-riscv.tranquillity.se/koji/<br />
: Koji build system<br />
; http://fedora-riscv.tranquillity.se/repos/<br />
: Packages built by Koji<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; https://bugzilla.redhat.com/show_bug.cgi?id=1553405<br />
: Tracker bug for all issues which affect Fedora on RISC-V<br />
<br />
The following links are now obsolete:<br />
<br />
; <s>https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. (old)</s><br />
; <s>https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.</s><br />
; <s>http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 27/x86_64) containing QEMU</s><br />
; <s>https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.</s><br />
; <s>https://github.com/rwmjones/fedora-riscv-bootstrap</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s></div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Installing&diff=521207Architectures/RISC-V/Installing2018-06-26T12:12:13Z<p>Rjones: </p>
<hr />
<div>= Download the latest disk image =<br />
<br />
Go [http://fedora-riscv.tranquillity.se/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id to this link for the nightly builds] and select the most recent (top) build. Look for the <code>-sda.raw.xz</code> file and download it. It will usually be quite large, around 200-300 MB.<br />
<br />
The disk image is compressed and partitioned, but usually we need an uncompressed, unpartitioned ("naked") filesystem. There are several ways to get this, but the easiest is:<br />
<br />
<pre><br />
$ unxz Fedora-Developer-Rawhide-xxxx.n.0-sda.raw.xz<br />
$ guestfish -a Fedora-Developer-Rawhide-xxxx.n.0-sda.raw \<br />
run : download /dev/sda1 Fedora-Developer-Rawhide-xxxx.n.0-sda1.raw<br />
</pre><br />
<br />
This creates a naked ext4 filesystem called <code>*-sda1.raw</code> which can be used in qemu or booted on the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].<br />
<br />
== Root password ==<br />
<br />
<code>riscv</code><br />
<br />
= Boot under qemu =<br />
<br />
You will need a very recent version of qemu. If in doubt, compile from upstream qemu sources.<br />
<br />
Get [https://fedorapeople.org/groups/risc-v/disk-images/bbl bbl from here] or [https://github.com/rwmjones/fedora-riscv-kernel compile it from source].<br />
<br />
<pre><br />
qemu-system-riscv64 \<br />
-nographic \<br />
-machine virt \<br />
-smp 4 \<br />
-m 2G \<br />
-kernel bbl \<br />
-object rng-random,filename=/dev/urandom,id=rng0 \<br />
-device virtio-rng-device,rng=rng0 \<br />
-append "console=ttyS0 ro root=/dev/vda" \<br />
-device virtio-blk-device,drive=hd0 \<br />
-drive file=Fedora-Developer-Rawhide-xxxx.n.0-sda1.raw,format=raw,id=hd0 \<br />
-device virtio-net-device,netdev=usernet \<br />
-netdev user,id=usernet,hostfwd=tcp::10000-:22<br />
</pre><br />
<br />
= Install on the HiFive Unleashed SD card =<br />
<br />
The naked ext4 filesystem can be copied over the second partition of the SD card.<br />
<br />
You can also build a custom bbl+kernel+initramfs to boot directly into the SD card using [https://github.com/rwmjones/fedora-riscv-kernel these sources].<br />
<br />
= Install on the HiFive Unleashed using NBD server =<br />
<br />
Look at https://github.com/rwmjones/fedora-riscv-kernel in the <code>sifive_u540</code> branch. This is quite complex to set up so it's best to ask on the <code>#fedora-riscv</code> IRC channel.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Installing&diff=521206Architectures/RISC-V/Installing2018-06-26T12:03:51Z<p>Rjones: </p>
<hr />
<div>= Download the latest disk image =<br />
<br />
Go [http://fedora-riscv.tranquillity.se/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id to this link for the nightly builds] and select the most recent (top) build. Look for the <code>-sda.raw.xz</code> file and download it. It will usually be quite large, around 200-300 MB.<br />
<br />
<pre><br />
unxz Fedora-Developer-Rawhide-xxxx.n.0-sda.raw.xz<br />
</pre><br />
<br />
The disk image is partitioned, but usually we need a "naked" filesystem. There are several ways to get this, but the easiest is:<br />
<br />
<pre><br />
guestfish -a Fedora-Developer-Rawhide-xxxx.n.0-sda.raw \<br />
run : download /dev/sda1 Fedora-Developer-Rawhide-xxxx.n.0-sda1.raw<br />
</pre><br />
<br />
This creates a naked ext4 filesystem called <code>*-sda1.raw</code> which can be used in qemu or booted on the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].<br />
<br />
= Root password =<br />
<br />
<code>riscv</code><br />
<br />
= Boot under qemu =<br />
<br />
You will need a very recent version of qemu. If in doubt, compile from upstream qemu sources.<br />
<br />
Get [https://fedorapeople.org/groups/risc-v/disk-images/bbl bbl from here] or [https://github.com/rwmjones/fedora-riscv-kernel compile it from source].<br />
<br />
<pre><br />
qemu-system-riscv64 \<br />
-nographic \<br />
-machine virt \<br />
-smp 4 \<br />
-m 2G \<br />
-kernel bbl \<br />
-object rng-random,filename=/dev/urandom,id=rng0 \<br />
-device virtio-rng-device,rng=rng0 \<br />
-append "console=ttyS0 ro root=/dev/vda" \<br />
-device virtio-blk-device,drive=hd0 \<br />
-drive file=Fedora-Developer-Rawhide-xxxx.n.0-sda1.raw,format=raw,id=hd0 \<br />
-device virtio-net-device,netdev=usernet \<br />
-netdev user,id=usernet,hostfwd=tcp::10000-:22<br />
</pre><br />
<br />
= Install on the HiFive Unleashed SD card =<br />
<br />
The naked ext4 filesystem can be copied over the second partition of the SD card.<br />
<br />
You can also build a custom bbl+kernel+initramfs to boot directly into the SD card using [https://github.com/rwmjones/fedora-riscv-kernel these sources].<br />
<br />
= Install on the HiFive Unleashed using NBD server =<br />
<br />
Look at https://github.com/rwmjones/fedora-riscv-kernel in the <code>sifive_u540</code> branch. This is quite complex to set up so it's best to ask on the <code>#fedora-riscv</code> IRC channel.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Installing&diff=521205Architectures/RISC-V/Installing2018-06-26T11:59:52Z<p>Rjones: Created page with "= Download the latest disk image = Go [http://fedora-riscv.tranquillity.se/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id to this link for the nightly bui..."</p>
<hr />
<div>= Download the latest disk image =<br />
<br />
Go [http://fedora-riscv.tranquillity.se/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id to this link for the nightly builds] and select the most recent (top) build. Look for the <code>-sda.raw.xz</code> file and download it. It will usually be quite large, around 200-300 MB.<br />
<br />
<pre><br />
unxz Fedora-Developer-Rawhide-xxxx.n.0-sda.raw.xz<br />
</pre><br />
<br />
The disk image is partitioned, but usually we need a "naked" filesystem. There are several ways to get this, but the easiest is:<br />
<br />
<pre><br />
guestfish -a Fedora-Developer-Rawhide-xxxx.n.0-sda.raw \<br />
run : download /dev/sda1 Fedora-Developer-Rawhide-xxxx.n.0-sda1.raw<br />
</pre><br />
<br />
This creates a naked ext4 filesystem called <code>*-sda1.raw</code> which can be used in qemu or booted on the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].<br />
<br />
= Boot under qemu =<br />
<br />
You will need a very recent version of qemu. If in doubt, compile from upstream qemu sources.<br />
<br />
Get [https://fedorapeople.org/groups/risc-v/disk-images/bbl bbl from here] or [https://github.com/rwmjones/fedora-riscv-kernel compile it from source].<br />
<br />
<pre><br />
qemu-system-riscv64 \<br />
-nographic \<br />
-machine virt \<br />
-smp 4 \<br />
-m 2G \<br />
-kernel bbl \<br />
-object rng-random,filename=/dev/urandom,id=rng0 \<br />
-device virtio-rng-device,rng=rng0 \<br />
-append "console=ttyS0 ro root=/dev/vda" \<br />
-device virtio-blk-device,drive=hd0 \<br />
-drive file=Fedora-Developer-Rawhide-xxxx.n.0-sda1.raw,format=raw,id=hd0 \<br />
-device virtio-net-device,netdev=usernet \<br />
-netdev user,id=usernet,hostfwd=tcp::10000-:22<br />
</pre><br />
<br />
= Install on the HiFive Unleashed SD card =<br />
<br />
<br />
<br />
= Install on the HiFive Unleashed using NBD server =</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=521204Architectures/RISC-V2018-06-26T11:46:12Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64GC) architecture.<br />
<br />
= News =<br />
<br />
'''May 2018''' [http://fedora-riscv.tranquillity.se/koji/ A Koji build system instance is now building Fedora packages].<br />
<br />
'''February/March 2018''' [https://fedorapeople.org/groups/risc-v/disk-images/ Stage4 disk images are available]. These are bootable in qemu and let you try out Fedora/RISC-V. Make sure you read the [https://fedorapeople.org/groups/risc-v/disk-images/readme.txt readme.txt file] first. The development environment is quite complete with GCC 7.3.1, Perl 5.26, Python 2 and 3, git, systemd, various editors including vi and emacs, many <code>-devel</code> packages, and some X11 packages. It will be enough for most developers to start porting their software to RISC-V. The main missing things at the moment are Ruby, Java and Gtk 3.<br />
<br />
'''Status January/February 2018''' The third and hopefully final bootstrap of Fedora 27 has started. Please follow progress or try building it yourself via [https://github.com/rwmjones/fedora-riscv-bootstrap this git repository]. Expected timelines are: 1-2 weeks until stage 3 disk images are available, 1-2 months until stage 4 pristine RPM-built disk images are available, 2 months until we are autobuilding regular Fedora packages, 3-6 months until we have koji-shadow functionality.<br />
<br />
= Communications =<br />
<br />
Find us on FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Installing]] - How to download, install and run Fedora/RISC-V.<br />
* <s>[[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.</s><br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.</s><br />
<br />
= Downloads =<br />
<br />
; http://fedora-riscv.tranquillity.se/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id<br />
: Latest disk images<br />
; http://fedora-riscv.tranquillity.se/koji/<br />
: Koji build system<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; https://bugzilla.redhat.com/show_bug.cgi?id=1553405<br />
: Tracker bug for all issues which affect Fedora on RISC-V<br />
<br />
The following links are now obsolete:<br />
<br />
; <s>https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. (old)</s><br />
; <s>https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.</s><br />
; <s>http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 27/x86_64) containing QEMU</s><br />
; <s>https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.</s><br />
; <s>https://github.com/rwmjones/fedora-riscv-bootstrap</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s></div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=521203Architectures/RISC-V2018-06-26T11:44:42Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64GC) architecture.<br />
<br />
= News =<br />
<br />
'''May 2018''' [http://fedora-riscv.tranquillity.se/koji/ A Koji build system instance is now building Fedora packages].<br />
<br />
'''February/March 2018''' [https://fedorapeople.org/groups/risc-v/disk-images/ Stage4 disk images are available]. These are bootable in qemu and let you try out Fedora/RISC-V. Make sure you read the [https://fedorapeople.org/groups/risc-v/disk-images/readme.txt readme.txt file] first. The development environment is quite complete with GCC 7.3.1, Perl 5.26, Python 2 and 3, git, systemd, various editors including vi and emacs, many <code>-devel</code> packages, and some X11 packages. It will be enough for most developers to start porting their software to RISC-V. The main missing things at the moment are Ruby, Java and Gtk 3.<br />
<br />
'''Status January/February 2018''' The third and hopefully final bootstrap of Fedora 27 has started. Please follow progress or try building it yourself via [https://github.com/rwmjones/fedora-riscv-bootstrap this git repository]. Expected timelines are: 1-2 weeks until stage 3 disk images are available, 1-2 months until stage 4 pristine RPM-built disk images are available, 2 months until we are autobuilding regular Fedora packages, 3-6 months until we have koji-shadow functionality.<br />
<br />
= Communications =<br />
<br />
Find us on FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Installing]] - How to download, install and run Fedora/RISC-V.<br />
* <s>[[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.</s><br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.</s><br />
<br />
= Downloads =<br />
<br />
; http://fedora-riscv.tranquillity.se/koji/tasks?state=closed&view=flat&method=createAppliance&order=-id<br />
: Latest disk images<br />
; <s>https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. (old)</s><br />
; http://fedora-riscv.tranquillity.se/koji/<br />
: Koji build system<br />
; <s>https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.</s><br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; <s>http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 27/x86_64) containing QEMU</s><br />
; https://bugzilla.redhat.com/show_bug.cgi?id=1553405<br />
: Tracker bug for all issues which affect Fedora on RISC-V<br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv-bootstrap</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s></div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=521202Architectures/RISC-V2018-06-26T11:43:32Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64GC) architecture.<br />
<br />
= News =<br />
<br />
'''May 2018''' [http://fedora-riscv.tranquillity.se/koji/ A Koji build system instance is now building Fedora packages].<br />
<br />
'''February/March 2018''' [https://fedorapeople.org/groups/risc-v/disk-images/ Stage4 disk images are available]. These are bootable in qemu and let you try out Fedora/RISC-V. Make sure you read the [https://fedorapeople.org/groups/risc-v/disk-images/readme.txt readme.txt file] first. The development environment is quite complete with GCC 7.3.1, Perl 5.26, Python 2 and 3, git, systemd, various editors including vi and emacs, many <code>-devel</code> packages, and some X11 packages. It will be enough for most developers to start porting their software to RISC-V. The main missing things at the moment are Ruby, Java and Gtk 3.<br />
<br />
'''Status January/February 2018''' The third and hopefully final bootstrap of Fedora 27 has started. Please follow progress or try building it yourself via [https://github.com/rwmjones/fedora-riscv-bootstrap this git repository]. Expected timelines are: 1-2 weeks until stage 3 disk images are available, 1-2 months until stage 4 pristine RPM-built disk images are available, 2 months until we are autobuilding regular Fedora packages, 3-6 months until we have koji-shadow functionality.<br />
<br />
= Communications =<br />
<br />
Find us on FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Installing]] - How to download, install and run Fedora/RISC-V.<br />
* <s>[[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.</s><br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.</s><br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs.<br />
; http://fedora-riscv.tranquillity.se/koji/<br />
: Koji build system<br />
; <s>https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.</s><br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; <s>http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 27/x86_64) containing QEMU</s><br />
; https://bugzilla.redhat.com/show_bug.cgi?id=1553405<br />
: Tracker bug for all issues which affect Fedora on RISC-V<br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv-bootstrap</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s></div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=517932Architectures/RISC-V2018-05-07T10:52:23Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64GC) architecture.<br />
<br />
= News =<br />
<br />
'''May 2018''' [http://fedora-riscv.tranquillity.se/koji/ A Koji build system instance is now building Fedora packages].<br />
<br />
'''February/March 2018''' [https://fedorapeople.org/groups/risc-v/disk-images/ Stage4 disk images are available]. These are bootable in qemu and let you try out Fedora/RISC-V. Make sure you read the [https://fedorapeople.org/groups/risc-v/disk-images/readme.txt readme.txt file] first. The development environment is quite complete with GCC 7.3.1, Perl 5.26, Python 2 and 3, git, systemd, various editors including vi and emacs, many <code>-devel</code> packages, and some X11 packages. It will be enough for most developers to start porting their software to RISC-V. The main missing things at the moment are Ruby, Java and Gtk 3.<br />
<br />
'''Status January/February 2018''' The third and hopefully final bootstrap of Fedora 27 has started. Please follow progress or try building it yourself via [https://github.com/rwmjones/fedora-riscv-bootstrap this git repository]. Expected timelines are: 1-2 weeks until stage 3 disk images are available, 1-2 months until stage 4 pristine RPM-built disk images are available, 2 months until we are autobuilding regular Fedora packages, 3-6 months until we have koji-shadow functionality.<br />
<br />
= Communications =<br />
<br />
Find us on FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.</s><br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs.<br />
; http://fedora-riscv.tranquillity.se/koji/<br />
: Koji build system<br />
; <s>https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.</s><br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; <s>http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 27/x86_64) containing QEMU</s><br />
; https://bugzilla.redhat.com/show_bug.cgi?id=1553405<br />
: Tracker bug for all issues which affect Fedora on RISC-V<br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv-bootstrap</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s></div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Building&diff=512374Architectures/RISC-V/Building2018-03-08T22:25:51Z<p>Rjones: </p>
<hr />
<div>{{shortcut|Arch:RISC-V}}<br />
{{autolang|base=yes}}<br />
<br />
All about building Fedora packages for [[Architectures/RISC-V|RISC-V]]. If you want to help build packages or fix broken packages, you've come to the right place.<br />
<br />
= Autobuilder =<br />
<br />
All packages are now built with an [https://github.com/rwmjones/fedora-riscv-autobuild autobuilder] which picks up packages as they are built in [http://koji.fedoraproject.org/koji/ Fedora Koji build system] and tries to rebuild them for RISC-V. [https://fedorapeople.org/groups/risc-v/ The status of builds, build logs, RPMs and SRPMs can be found here].<br />
<br />
The autobuilder can also be manually told to build a particular package, or to do a mass rebuild of every package in Fedora. If you need a particular package rebuilt, please ping <code>rwmjones</code> in the <code>#fedora-riscv</code> IRC channel on FreeNode.<br />
<br />
We are currently only building Fedora 27 and 28 packages, but expect to move to Rawhide in the near future.<br />
<br />
= Fixing broken builds =<br />
<br />
Fedora has an [[Staying close to upstream projects|upstream first policy]] and Fedora/RISC-V tries to stay as close as possible to this rule. Please send all your riscv64 changes to the upstream project. From there they will trickle down into Fedora.<br />
<br />
If your package needs specfile changes, then you can ask the Fedora package maintainer to add those changes for you. However you should '''not''' do this for hacks, for patches which should go upstream, or for missing dependencies. If there are missing dependencies, work on the dependencies first. [https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/EEGFAY6XH5JIMOMIZUF7TALKVLBBJVCW/#EEGFAY6XH5JIMOMIZUF7TALKVLBBJVCW More information on this point.]<br />
<br />
If you have fixed a build, then there are two ways to get it into Fedora/RISC-V. Either do a primary arch build in Koji, which (if successful) the autobuilder will pick up automatically. Or ping <code>rwmjones</code> on <code>#fedora-riscv</code> and he will kick off a manual build.<br />
<br />
= Testing builds locally =<br />
<br />
Download the [https://fedorapeople.org/groups/risc-v/disk-images/ stage4 disk image] and follow the instructions in the README file.<br />
<br />
= How stage4 is built =<br />
<br />
See [https://github.com/rwmjones/fedora-riscv-stage4 this repository].</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=512373Architectures/RISC-V2018-03-08T22:24:45Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64GC) architecture.<br />
<br />
= News =<br />
<br />
'''February/March 2018''' [https://fedorapeople.org/groups/risc-v/disk-images/ Stage4 disk images are available]. These are bootable in qemu and let you try out Fedora/RISC-V. Make sure you read the [https://fedorapeople.org/groups/risc-v/disk-images/readme.txt readme.txt file] first. The development environment is quite complete with GCC 7.3.1, Perl 5.26, Python 2 and 3, git, systemd, various editors including vi and emacs, many <code>-devel</code> packages, and some X11 packages. It will be enough for most developers to start porting their software to RISC-V. The main missing things at the moment are Ruby, Java and Gtk 3.<br />
<br />
'''Status January/February 2018''' The third and hopefully final bootstrap of Fedora 27 has started. Please follow progress or try building it yourself via [https://github.com/rwmjones/fedora-riscv-bootstrap this git repository]. Expected timelines are: 1-2 weeks until stage 3 disk images are available, 1-2 months until stage 4 pristine RPM-built disk images are available, 2 months until we are autobuilding regular Fedora packages, 3-6 months until we have koji-shadow functionality.<br />
<br />
= Communications =<br />
<br />
Find us on FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.</s><br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. Log files and status from the autobuilder.<br />
; https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 27/x86_64) containing QEMU<br />
; https://bugzilla.redhat.com/show_bug.cgi?id=1553405<br />
: Tracker bug for all issues which affect Fedora on RISC-V<br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv-bootstrap</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s></div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=512036Architectures/RISC-V2018-03-02T17:15:14Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64GC) architecture.<br />
<br />
= News =<br />
<br />
'''February/March 2018''' [https://fedorapeople.org/groups/risc-v/disk-images/ Stage4 disk images are available]. These are bootable in qemu and let you try out Fedora/RISC-V. Make sure you read the [https://fedorapeople.org/groups/risc-v/disk-images/readme.txt readme.txt file] first. The development environment is quite complete with GCC 7.3.1, Perl 5.26, Python 2 and 3, git, systemd, various editors including vi and emacs, many <code>-devel</code> packages, and some X11 packages. It will be enough for most developers to start porting their software to RISC-V. The main missing things at the moment are Ruby, Java and Gtk 3.<br />
<br />
'''Status January/February 2018''' The third and hopefully final bootstrap of Fedora 27 has started. Please follow progress or try building it yourself via [https://github.com/rwmjones/fedora-riscv-bootstrap this git repository]. Expected timelines are: 1-2 weeks until stage 3 disk images are available, 1-2 months until stage 4 pristine RPM-built disk images are available, 2 months until we are autobuilding regular Fedora packages, 3-6 months until we have koji-shadow functionality.<br />
<br />
= Communications =<br />
<br />
Find us on FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.</s><br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. Log files and status from the autobuilder.<br />
; https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 27/x86_64) containing QEMU<br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv-bootstrap</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s></div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=511235Architectures/RISC-V2018-02-17T17:10:00Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64GC) architecture.<br />
<br />
= News =<br />
<br />
'''Feb 2018''' [https://fedorapeople.org/groups/risc-v/disk-images/ Stage4 disk images are available]. These are bootable in qemu and let you try out a minimal Fedora/RISC-V.<br />
<br />
'''Status January/February 2018''' The third and hopefully final bootstrap of Fedora 27 has started. Please follow progress or try building it yourself via [https://github.com/rwmjones/fedora-riscv-bootstrap this git repository]. Expected timelines are: 1-2 weeks until stage 3 disk images are available, 1-2 months until stage 4 pristine RPM-built disk images are available, 2 months until we are autobuilding regular Fedora packages, 3-6 months until we have koji-shadow functionality.<br />
<br />
= Communications =<br />
<br />
Find us on FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.</s><br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. Log files and status from the autobuilder.<br />
; https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 27/x86_64) containing QEMU<br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv-bootstrap</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s></div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Building&diff=511234Architectures/RISC-V/Building2018-02-17T17:09:12Z<p>Rjones: </p>
<hr />
<div>{{shortcut|Arch:RISC-V}}<br />
{{autolang|base=yes}}<br />
<br />
All about building Fedora packages for [[Architectures/RISC-V|RISC-V]]. If you want to help build packages or fix broken packages, you've come to the right place.<br />
<br />
= Autobuilder =<br />
<br />
All packages are now built with an [https://github.com/rwmjones/fedora-riscv-autobuild autobuilder] which picks up packages as they are built in [http://koji.fedoraproject.org/koji/ Fedora Koji build system] and tries to rebuild them for RISC-V. [https://fedorapeople.org/groups/risc-v/ The status of builds, build logs, RPMs and SRPMs can be found here].<br />
<br />
The autobuilder can also be manually told to build a particular package, or to do a mass rebuild of every package in Fedora. If you need a particular package rebuilt, please ping <code>rwmjones</code> in the <code>#fedora-riscv</code> IRC channel on FreeNode.<br />
<br />
We are currently only building Fedora 27 packages, but expect to move to Rawhide in the near future.<br />
<br />
= Fixing broken builds =<br />
<br />
Fedora has an [[Staying close to upstream projects|upstream first policy]] and Fedora/RISC-V tries to stay as close as possible to this rule. Please send all your riscv64 changes to the upstream project. From there they will trickle down into Fedora.<br />
<br />
If your package needs specfile changes, then you can ask the Fedora package maintainer to add those changes for you. However you should '''not''' do this for hacks, for patches which should go upstream, or for missing dependencies. If there are missing dependencies, work on the dependencies first. [https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/EEGFAY6XH5JIMOMIZUF7TALKVLBBJVCW/#EEGFAY6XH5JIMOMIZUF7TALKVLBBJVCW More information on this point.]<br />
<br />
If you have fixed a build, then there are two ways to get it into Fedora/RISC-V. Either do a primary arch build in Koji, which (if successful) the autobuilder will pick up automatically. Or ping <code>rwmjones</code> on <code>#fedora-riscv</code> and he will kick off a manual build.<br />
<br />
= Testing builds locally =<br />
<br />
Download the [https://fedorapeople.org/groups/risc-v/disk-images/ stage4 disk image] and follow the instructions in the README file.<br />
<br />
= How stage4 is built =<br />
<br />
See [https://github.com/rwmjones/fedora-riscv-stage4 this repository].</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=511233Architectures/RISC-V2018-02-17T17:07:36Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64GC) architecture.<br />
<br />
= News =<br />
<br />
'''Feb 2018''' [https://fedorapeople.org/groups/risc-v/disk-images/ Stage4 disk images are available]. These are bootable in qemu and let you try out a minimal Fedora/RISC-V.<br />
<br />
'''Status January/February 2018''' The third and hopefully final bootstrap of Fedora 27 has started. Please follow progress or try building it yourself via [https://github.com/rwmjones/fedora-riscv-bootstrap this git repository]. Expected timelines are: 1-2 weeks until stage 3 disk images are available, 1-2 months until stage 4 pristine RPM-built disk images are available, 2 months until we are autobuilding regular Fedora packages, 3-6 months until we have koji-shadow functionality.<br />
<br />
= Communications =<br />
<br />
Find us on FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.</s><br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. Log files and status from the autobuilder.<br />
; https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 24/x86_64) containing QEMU<br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv-bootstrap</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s></div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=511232Architectures/RISC-V2018-02-17T17:06:56Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64GC) architecture.<br />
<br />
= News =<br />
<br />
'''Feb 2018''' [https://fedorapeople.org/groups/risc-v/disk-images/ Stage4 disk images are available]. These are bootable in qemu and let you try out a minimal Fedora/RISC-V.<br />
<br />
'''Status January/February 2018''' The third and hopefully final bootstrap of Fedora 27 has started. Please follow progress or try building it yourself via [https://github.com/rwmjones/fedora-riscv-bootstrap this git repository]. Expected timelines are: 1-2 weeks until stage 3 disk images are available, 1-2 months until stage 4 pristine RPM-built disk images are available, 2 months until we are autobuilding regular Fedora packages, 3-6 months until we have koji-shadow functionality.<br />
<br />
= Communications =<br />
<br />
Find us on FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* [[Architectures/RISC-V/Disk images]] - How to use the Fedora/RISC-V disk images.<br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.</s><br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. Log files and status from the autobuilder.<br />
; https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 24/x86_64) containing QEMU<br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv-bootstrap</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s></div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=510405Architectures/RISC-V2018-01-30T11:02:15Z<p>Rjones: RV64G -> RV64GC</p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64GC) architecture.<br />
<br />
'''Status January/February 2018''' The third and hopefully final bootstrap of Fedora 27 has started. Please follow progress or try building it yourself via [https://github.com/rwmjones/fedora-riscv-bootstrap this git repository]. Expected timelines are: 1-2 weeks until stage 3 disk images are available, 1-2 months until stage 4 pristine RPM-built disk images are available, 2 months until we are autobuilding regular Fedora packages, 3-6 months until we have koji-shadow functionality.<br />
<br />
'''Status January 2018''' The second (interim) bootstrap of Fedora 27 was completed successfully. We are now waiting for glibc changes to go upstream before proceeding with the third/final bootstrap.<br />
<br />
'''Status December 2017''' We are currently doing an "interim bootstrap" of Fedora 27. This is practice for the third and hopefully final bootstrap in Feb 2018. Please read [[Architectures/RISC-V/Bootstrapping]] for more information about bootstrapping.<br />
<br />
'''Status November 2017''' Linux has support since 4.15. We are waiting for glibc to go upstream which is expected to happen in February 2018. At that point we will be re-bootstrapping the whole project using the final ABIs.<br />
<br />
'''Status November 2016''' The port supports about two thirds of the packages in Fedora 25, so it is quite complete and ready to use. Most important command-line programs just work (and even a few graphical ones). However if you are using your own hardware then you will need to supply a compatible kernel and bootloader and just use the Fedora userspace. Fedora/RISC-V does <i>not</i> support 32 bit or embedded hardware.<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* [[Architectures/RISC-V/Disk images]] - How to use the Fedora/RISC-V disk images.<br />
* [[Architectures/RISC-V/FPGA]] - How to run Fedora/RISC-V on real hardware (well, an FPGA).<br />
* [[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.<br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. Log files and status from the autobuilder.<br />
; https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 24/x86_64) containing: QEMU, Spike, <s>cross-compiler toolchain (obsolete)</s><br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s><br />
<br />
= Communications =<br />
<br />
On FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=510404Architectures/RISC-V2018-01-30T11:00:48Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64G) architecture.<br />
<br />
'''Status January/February 2018''' The third and hopefully final bootstrap of Fedora 27 has started. Please follow progress or try building it yourself via [https://github.com/rwmjones/fedora-riscv-bootstrap this git repository]. Expected timelines are: 1-2 weeks until stage 3 disk images are available, 1-2 months until stage 4 pristine RPM-built disk images are available, 2 months until we are autobuilding regular Fedora packages, 3-6 months until we have koji-shadow functionality.<br />
<br />
'''Status January 2018''' The second (interim) bootstrap of Fedora 27 was completed successfully. We are now waiting for glibc changes to go upstream before proceeding with the third/final bootstrap.<br />
<br />
'''Status December 2017''' We are currently doing an "interim bootstrap" of Fedora 27. This is practice for the third and hopefully final bootstrap in Feb 2018. Please read [[Architectures/RISC-V/Bootstrapping]] for more information about bootstrapping.<br />
<br />
'''Status November 2017''' Linux has support since 4.15. We are waiting for glibc to go upstream which is expected to happen in February 2018. At that point we will be re-bootstrapping the whole project using the final ABIs.<br />
<br />
'''Status November 2016''' The port supports about two thirds of the packages in Fedora 25, so it is quite complete and ready to use. Most important command-line programs just work (and even a few graphical ones). However if you are using your own hardware then you will need to supply a compatible kernel and bootloader and just use the Fedora userspace. Fedora/RISC-V does <i>not</i> support 32 bit or embedded hardware.<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* [[Architectures/RISC-V/Disk images]] - How to use the Fedora/RISC-V disk images.<br />
* [[Architectures/RISC-V/FPGA]] - How to run Fedora/RISC-V on real hardware (well, an FPGA).<br />
* [[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.<br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. Log files and status from the autobuilder.<br />
; https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 24/x86_64) containing: QEMU, Spike, <s>cross-compiler toolchain (obsolete)</s><br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s><br />
<br />
= Communications =<br />
<br />
On FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=509709Architectures/RISC-V2018-01-20T22:30:38Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64G) architecture.<br />
<br />
'''Status January 2018''' The second (interim) bootstrap of Fedora 27 was completed successfully. We are now waiting for glibc changes to go upstream before proceeding with the third/final bootstrap.<br />
<br />
'''Status December 2017''' We are currently doing an "interim bootstrap" of Fedora 27. This is practice for the third and hopefully final bootstrap in Feb 2018. Please read [[Architectures/RISC-V/Bootstrapping]] for more information about bootstrapping.<br />
<br />
'''Status November 2017''' Linux has support since 4.15. We are waiting for glibc to go upstream which is expected to happen in February 2018. At that point we will be re-bootstrapping the whole project using the final ABIs.<br />
<br />
'''Status November 2016''' The port supports about two thirds of the packages in Fedora 25, so it is quite complete and ready to use. Most important command-line programs just work (and even a few graphical ones). However if you are using your own hardware then you will need to supply a compatible kernel and bootloader and just use the Fedora userspace. Fedora/RISC-V does <i>not</i> support 32 bit or embedded hardware.<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* [[Architectures/RISC-V/Disk images]] - How to use the Fedora/RISC-V disk images.<br />
* [[Architectures/RISC-V/FPGA]] - How to run Fedora/RISC-V on real hardware (well, an FPGA).<br />
* [[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.<br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. Log files and status from the autobuilder.<br />
; https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 24/x86_64) containing: QEMU, Spike, <s>cross-compiler toolchain (obsolete)</s><br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s><br />
<br />
= Communications =<br />
<br />
On FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Bootstrapping&diff=509076Architectures/RISC-V/Bootstrapping2018-01-11T09:04:56Z<p>Rjones: </p>
<hr />
<div>All about bootstrapping Fedora on [[Architectures/RISC-V|RISC-V]].<br />
<br />
= Introduction =<br />
<br />
Bootstrapping happens in several stages which are outlined in detail in the <code>README</code> and <code>Makefile</code> in [https://github.com/rwmjones/fedora-riscv-bootstrap this repository].<br />
<br />
The general idea is that we go in stages (numbered for historical reasons):<br />
<br />
== Stage 3 ==<br />
<br />
Build an <code>x86_64</code> disk image, but remove all the binaries and libraries from it. The binaries and libraries are cross-compiled from the host using the [https://github.com/riscv/riscv-tools riscv64-unknown-linux-gnu-gcc compiler].<br />
<br />
After building the stage 3 disk image in this way, it is bootable under [http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/ qemu-system-riscv64] and has working gcc and rpmbuild:<br />
<br />
<pre><br />
Tue Dec 19 22:47:00 UTC 2017<br />
<br />
Welcome to the Fedora/RISC-V stage3 disk image<br />
https://fedoraproject.org/wiki/Architectures/RISC-V<br />
<br />
stage3:/# ls<br />
bin dev home lib lost+found mnt proc rpmbuild sbin sys usr<br />
boot etc init lib64 media opt root run srv tmp var<br />
stage3:/# uname -a<br />
Linux stage3 4.15.0-rc3-01064-g418457520fbb #2 Tue Dec 19 22:31:06 GMT 2017 riscv64 GNU/Linux<br />
stage3:/# gcc --version<br />
gcc (GCC) 7.2.0<br />
Copyright (C) 2017 Free Software Foundation, Inc.<br />
This is free software; see the source for copying conditions. There is NO<br />
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.<br />
stage3:/# rpmbuild --version<br />
RPM version 4.12.90<br />
</pre><br />
<br />
=== Status of stage 3 packages (2018-01-11) ===<br />
<br />
<code>python3</code>: Builds OK but lots of missing files, indicating we don't have sufficient dependencies compiled.<br />
<br />
<code>python2</code>: Peculiar build failures to do with missing built files. Something to do with libffi?<br />
<br />
<code>cmake</code>: Circular dependency cmake - jsoncpp. Possibly could be solved by cross-compiling jsoncpp.<br />
<br />
Packages requiring python2 or python3: <code>glib2</code>, <code>itstool</code>, <code>fontconfig</code>, <code>rpm</code>, <code>librepo</code>, <code>libpsl</code><br />
<br />
Packages requiring glib2: <code>libcroco</code>, <code>gettext</code>, <code>shared-mime</code>, <code>tdnf</code><br />
<br />
Packages requiring cmake: <code>jsoncpp</code>, <code>doxygen</code>, <code>beecrypt</code>, <code>hawkey</code>, <code>nss-pem</code>, <code>libsolv</code><br />
<br />
<code>openssh</code>: Unable to make it <i>not</i> use ldap, and something is broken about openldap.<br />
<br />
== Stage 4 ==<br />
<br />
Using the stage 3 disk image, running under qemu, [https://github.com/rwmjones/fedora-riscv-bootstrap/tree/master/stage3-built-rpms we build RPMs for many core packages].<br />
<br />
Eventually we have built enough RPMs that we can build a clean stage 4 disk image entirely from RPMs.<br />
<br />
== After stage 4 ==<br />
<br />
Using the clean stage 4 disk image we now go on to build the remaining packages from Fedora. This is a very long, incremental task aided by an autobuilder which picks up new packages from real Fedora and tries to build them for RISC-V. In addition we build and fix packages by hand.<br />
<br />
= How to take part =<br />
<br />
Join the <code>#fedora-riscv</code> IRC channel on FreeNode and say hello.<br />
<br />
Enable [http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/ Richard Jones's riscv copr] and install <code>riscv-qemu</code>. Alternately you can build it from source in the fedora-riscv-bootstrap repo.<br />
<br />
Check out the [https://github.com/rwmjones/fedora-riscv-bootstrap fedora-riscv-bootstrap] repository, read the <code>README</code> and <code>Makefile</code> files, and then attempt to build it using:<br />
<br />
<pre><br />
make stage1<br />
make stage2<br />
make stage3<br />
make boot-stage3-in-qemu<br />
</pre><br />
<br />
= Semi-automatically building packages in stage3 =<br />
<br />
This basically automates the process described in the next section.<br />
<br />
fedpkg clone -B the_package<br />
cd the_package/f25<br />
# make changes to spec file if you want<br />
fedpkg srpm<br />
<br />
make stage3-build SRPM=/path/to/the_package.src.rpm<br />
<br />
= Manually building packages in stage3 =<br />
<br />
The stage3 environment can be built from source or you can download a snapshot binary image. See above for links to git etc.<br />
<br />
Pick a package which:<br />
* has very few dependencies<br />
* is written in C or C++<br />
* is part of Fedora [https://github.com/rwmjones/fedora-riscv/blob/master/packages-in-core @Core]<br />
<br />
Grab the source RPM from [http://koji.fedoraproject.org/koji/ the F25 branch in Koji] or dist-git. Note you must use the F25 branch, because otherwise Perl doesn't work.<br />
<br />
fedpkg clone -B the_package<br />
cd the_package/f25<br />
# make changes to spec file if you want<br />
fedpkg srpm<br />
<br />
Copy the source RPM into the stage3 disk image. The disk image <b>must not</b> be running when you do this:<br />
<br />
virt-copy-in -a stage3-disk.img the_package.src.rpm /var/tmp/<br />
<br />
Boot the disk image in qemu:<br />
<br />
make boot-stage3-in-qemu<br />
<br />
Inside the VM you may need to install some of the RPMs we have already built. Almost certainly you'll need make and bash:<br />
<br />
rpm -Uvh /rpmbuild/RPMS/riscv64/{bash,make}-*.rpm --nodeps<br />
<br />
Inside the VM you can now "install" the source RPM, which makes it available under <code>/rpmbuild</code>:<br />
<br />
rpm -i /var/tmp/the_package.src.rpm<br />
cd /rpmbuild/SPECS<br />
<br />
You may need to disable hardened build and debuginfo by adding:<br />
<br />
%global debug_package %{nil}<br />
%undefine _hardened_build<br />
<br />
to the spec file. Use <code>vim</code> to edit files.<br />
<br />
You can now try building the package:<br />
<br />
rpmbuild -ba the_package.spec --nodeps<br />
<br />
If it builds successfully, brilliant! More usually this will require many cycles of debugging and fixing things. Removing dependencies or parts of the spec file is an option for these stage3 builds.<br />
<br />
If you get a build, it will be in <code>/rpmbuild</code> inside the VM. sync and shut down the VM, then do:<br />
<br />
virt-copy-out -a stage3-disk.img /rpmbuild ./<br />
<br />
and the files will be downloaded to ./SRPMS and ./RPMS in the current directory. Note: Keep the source RPM too, especially if you modified it.<br />
<br />
Add notes to the section below. Also come to <code>#fedora-riscv</code> and discuss where to put your built packages.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Bootstrapping&diff=507976Architectures/RISC-V/Bootstrapping2017-12-21T15:11:22Z<p>Rjones: Copy back (from older revision) some useful info about building stage3 packages</p>
<hr />
<div>All about bootstrapping Fedora on [[Architectures/RISC-V|RISC-V]].<br />
<br />
= Introduction =<br />
<br />
Bootstrapping happens in several stages which are outlined in detail in the <code>README</code> and <code>Makefile</code> in [https://github.com/rwmjones/fedora-riscv-bootstrap this repository].<br />
<br />
The general idea is that we go in stages (numbered for historical reasons):<br />
<br />
== Stage 3 ==<br />
<br />
Build an <code>x86_64</code> disk image, but remove all the binaries and libraries from it. The binaries and libraries are cross-compiled from the host using the [https://github.com/riscv/riscv-tools riscv64-unknown-linux-gnu-gcc compiler].<br />
<br />
After building the stage 3 disk image in this way, it is bootable under [http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/ qemu-system-riscv64] and has working gcc and rpmbuild:<br />
<br />
<pre><br />
Tue Dec 19 22:47:00 UTC 2017<br />
<br />
Welcome to the Fedora/RISC-V stage3 disk image<br />
https://fedoraproject.org/wiki/Architectures/RISC-V<br />
<br />
stage3:/# ls<br />
bin dev home lib lost+found mnt proc rpmbuild sbin sys usr<br />
boot etc init lib64 media opt root run srv tmp var<br />
stage3:/# uname -a<br />
Linux stage3 4.15.0-rc3-01064-g418457520fbb #2 Tue Dec 19 22:31:06 GMT 2017 riscv64 GNU/Linux<br />
stage3:/# gcc --version<br />
gcc (GCC) 7.2.0<br />
Copyright (C) 2017 Free Software Foundation, Inc.<br />
This is free software; see the source for copying conditions. There is NO<br />
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.<br />
stage3:/# rpmbuild --version<br />
RPM version 4.12.90<br />
</pre><br />
<br />
== Stage 4 ==<br />
<br />
Using the stage 3 disk image, running under qemu, [https://github.com/rwmjones/fedora-riscv-bootstrap/tree/master/stage3-built-rpms we build RPMs for many core packages].<br />
<br />
Eventually we have built enough RPMs that we can build a clean stage 4 disk image entirely from RPMs.<br />
<br />
== After stage 4 ==<br />
<br />
Using the clean stage 4 disk image we now go on to build the remaining packages from Fedora. This is a very long, incremental task aided by an autobuilder which picks up new packages from real Fedora and tries to build them for RISC-V. In addition we build and fix packages by hand.<br />
<br />
= How to take part =<br />
<br />
Join the <code>#fedora-riscv</code> IRC channel on FreeNode and say hello.<br />
<br />
Enable [http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/ Richard Jones's riscv copr] and install <code>riscv-qemu</code>. Alternately you can build it from source in the fedora-riscv-bootstrap repo.<br />
<br />
Check out the [https://github.com/rwmjones/fedora-riscv-bootstrap fedora-riscv-bootstrap] repository, read the <code>README</code> and <code>Makefile</code> files, and then attempt to build it using:<br />
<br />
<pre><br />
make stage1<br />
make stage2<br />
make stage3<br />
make boot-stage3-in-qemu<br />
</pre><br />
<br />
= Semi-automatically building packages in stage3 =<br />
<br />
This basically automates the process described in the next section.<br />
<br />
fedpkg clone -B the_package<br />
cd the_package/f25<br />
# make changes to spec file if you want<br />
fedpkg srpm<br />
<br />
make stage3-build SRPM=/path/to/the_package.src.rpm<br />
<br />
= Manually building packages in stage3 =<br />
<br />
The stage3 environment can be built from source or you can download a snapshot binary image. See above for links to git etc.<br />
<br />
Pick a package which:<br />
* has very few dependencies<br />
* is written in C or C++<br />
* is part of Fedora [https://github.com/rwmjones/fedora-riscv/blob/master/packages-in-core @Core]<br />
<br />
Grab the source RPM from [http://koji.fedoraproject.org/koji/ the F25 branch in Koji] or dist-git. Note you must use the F25 branch, because otherwise Perl doesn't work.<br />
<br />
fedpkg clone -B the_package<br />
cd the_package/f25<br />
# make changes to spec file if you want<br />
fedpkg srpm<br />
<br />
Copy the source RPM into the stage3 disk image. The disk image <b>must not</b> be running when you do this:<br />
<br />
virt-copy-in -a stage3-disk.img the_package.src.rpm /var/tmp/<br />
<br />
Boot the disk image in qemu:<br />
<br />
make boot-stage3-in-qemu<br />
<br />
Inside the VM you may need to install some of the RPMs we have already built. Almost certainly you'll need make and bash:<br />
<br />
rpm -Uvh /rpmbuild/RPMS/riscv64/{bash,make}-*.rpm --nodeps<br />
<br />
Inside the VM you can now "install" the source RPM, which makes it available under <code>/rpmbuild</code>:<br />
<br />
rpm -i /var/tmp/the_package.src.rpm<br />
cd /rpmbuild/SPECS<br />
<br />
You may need to disable hardened build and debuginfo by adding:<br />
<br />
%global debug_package %{nil}<br />
%undefine _hardened_build<br />
<br />
to the spec file. Use <code>vim</code> to edit files.<br />
<br />
You can now try building the package:<br />
<br />
rpmbuild -ba the_package.spec --nodeps<br />
<br />
If it builds successfully, brilliant! More usually this will require many cycles of debugging and fixing things. Removing dependencies or parts of the spec file is an option for these stage3 builds.<br />
<br />
If you get a build, it will be in <code>/rpmbuild</code> inside the VM. sync and shut down the VM, then do:<br />
<br />
virt-copy-out -a stage3-disk.img /rpmbuild ./<br />
<br />
and the files will be downloaded to ./SRPMS and ./RPMS in the current directory. Note: Keep the source RPM too, especially if you modified it.<br />
<br />
Add notes to the section below. Also come to <code>#fedora-riscv</code> and discuss where to put your built packages.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=507903Architectures/RISC-V2017-12-20T16:16:38Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64G) architecture.<br />
<br />
'''Status December 2017''' We are currently doing an "interim bootstrap" of Fedora 27. This is practice for the third and hopefully final bootstrap in Feb 2018. Please read [[Architectures/RISC-V/Bootstrapping]] for more information about bootstrapping.<br />
<br />
'''Status November 2017''' Linux has support since 4.15. We are waiting for glibc to go upstream which is expected to happen in February 2018. At that point we will be re-bootstrapping the whole project using the final ABIs.<br />
<br />
'''Status November 2016''' The port supports about two thirds of the packages in Fedora 25, so it is quite complete and ready to use. Most important command-line programs just work (and even a few graphical ones). However if you are using your own hardware then you will need to supply a compatible kernel and bootloader and just use the Fedora userspace. Fedora/RISC-V does <i>not</i> support 32 bit or embedded hardware.<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* [[Architectures/RISC-V/Disk images]] - How to use the Fedora/RISC-V disk images.<br />
* [[Architectures/RISC-V/FPGA]] - How to run Fedora/RISC-V on real hardware (well, an FPGA).<br />
* [[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.<br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. Log files and status from the autobuilder.<br />
; https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 24/x86_64) containing: QEMU, Spike, <s>cross-compiler toolchain (obsolete)</s><br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s><br />
<br />
= Communications =<br />
<br />
On FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Bootstrapping&diff=507902Architectures/RISC-V/Bootstrapping2017-12-20T16:15:59Z<p>Rjones: </p>
<hr />
<div>All about bootstrapping Fedora on [[Architectures/RISC-V|RISC-V]].<br />
<br />
= Introduction =<br />
<br />
Bootstrapping happens in several stages which are outlined in detail in the <code>README</code> and <code>Makefile</code> in [https://github.com/rwmjones/fedora-riscv-bootstrap this repository].<br />
<br />
The general idea is that we go in stages (numbered for historical reasons):<br />
<br />
== Stage 3 ==<br />
<br />
Build an <code>x86_64</code> disk image, but remove all the binaries and libraries from it. The binaries and libraries are cross-compiled from the host using the [https://github.com/riscv/riscv-tools riscv64-unknown-linux-gnu-gcc compiler].<br />
<br />
After building the stage 3 disk image in this way, it is bootable under [http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/ qemu-system-riscv64] and has working gcc and rpmbuild:<br />
<br />
<pre><br />
Tue Dec 19 22:47:00 UTC 2017<br />
<br />
Welcome to the Fedora/RISC-V stage3 disk image<br />
https://fedoraproject.org/wiki/Architectures/RISC-V<br />
<br />
stage3:/# ls<br />
bin dev home lib lost+found mnt proc rpmbuild sbin sys usr<br />
boot etc init lib64 media opt root run srv tmp var<br />
stage3:/# uname -a<br />
Linux stage3 4.15.0-rc3-01064-g418457520fbb #2 Tue Dec 19 22:31:06 GMT 2017 riscv64 GNU/Linux<br />
stage3:/# gcc --version<br />
gcc (GCC) 7.2.0<br />
Copyright (C) 2017 Free Software Foundation, Inc.<br />
This is free software; see the source for copying conditions. There is NO<br />
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.<br />
stage3:/# rpmbuild --version<br />
RPM version 4.12.90<br />
</pre><br />
<br />
== Stage 4 ==<br />
<br />
Using the stage 3 disk image, running under qemu, [https://github.com/rwmjones/fedora-riscv-bootstrap/tree/master/stage3-built-rpms we build RPMs for many core packages].<br />
<br />
Eventually we have built enough RPMs that we can build a clean stage 4 disk image entirely from RPMs.<br />
<br />
== After stage 4 ==<br />
<br />
Using the clean stage 4 disk image we now go on to build the remaining packages from Fedora. This is a very long, incremental task aided by an autobuilder which picks up new packages from real Fedora and tries to build them for RISC-V. In addition we build and fix packages by hand.<br />
<br />
= How to take part =<br />
<br />
Join the <code>#fedora-riscv</code> IRC channel on FreeNode and say hello.<br />
<br />
Enable [http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/ Richard Jones's riscv copr] and install <code>riscv-qemu</code>. Alternately you can build it from source in the fedora-riscv-bootstrap repo.<br />
<br />
Check out the [https://github.com/rwmjones/fedora-riscv-bootstrap fedora-riscv-bootstrap] repository, read the <code>README</code> and <code>Makefile</code> files, and then attempt to build it using:<br />
<br />
<pre><br />
make stage1<br />
make stage2<br />
make stage3<br />
make boot-stage3-in-qemu<br />
</pre></div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Bootstrapping&diff=507901Architectures/RISC-V/Bootstrapping2017-12-20T16:12:39Z<p>Rjones: </p>
<hr />
<div>All about bootstrapping Fedora on [[Architectures/RISC-V|RISC-V]].<br />
<br />
= Introduction =<br />
<br />
Bootstrapping happens in several stages which are outlined in detail in the <code>README</code> and <code>Makefile</code> in [https://github.com/rwmjones/fedora-riscv-bootstrap this repository].<br />
<br />
The general idea is that we go in stages (numbered for historical reasons):<br />
<br />
== Stage 3 ==<br />
<br />
Build an <code>x86_64</code> disk image, but remove all the binaries and libraries from it. The binaries and libraries are cross-compiled from the host using the [https://github.com/riscv/riscv-tools riscv64-unknown-linux-gnu-gcc compiler].<br />
<br />
After building the stage 3 disk image in this way, it is bootable under [http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/ qemu-system-riscv64] and has working gcc and rpmbuild:<br />
<br />
<pre><br />
Tue Dec 19 22:47:00 UTC 2017<br />
<br />
Welcome to the Fedora/RISC-V stage3 disk image<br />
https://fedoraproject.org/wiki/Architectures/RISC-V<br />
<br />
stage3:/# ls<br />
bin dev home lib lost+found mnt proc rpmbuild sbin sys usr<br />
boot etc init lib64 media opt root run srv tmp var<br />
stage3:/# uname -a<br />
Linux stage3 4.15.0-rc3-01064-g418457520fbb #2 Tue Dec 19 22:31:06 GMT 2017 riscv64 GNU/Linux<br />
stage3:/# gcc --version<br />
gcc (GCC) 7.2.0<br />
Copyright (C) 2017 Free Software Foundation, Inc.<br />
This is free software; see the source for copying conditions. There is NO<br />
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.<br />
stage3:/# rpmbuild --version<br />
RPM version 4.12.90<br />
</pre><br />
<br />
== Stage 4 ==<br />
<br />
Using the stage 3 disk image, running under qemu, [https://github.com/rwmjones/fedora-riscv-bootstrap/tree/master/stage3-built-rpms we build RPMs for many core packages].<br />
<br />
Eventually we have built enough RPMs that we can build a clean stage 4 disk image entirely from RPMs.<br />
<br />
== After stage 4 ==<br />
<br />
Using the clean stage 4 disk image we now go on to build the remaining packages from Fedora. This is a very long, incremental task aided by an autobuilder which picks up new packages from real Fedora and tries to build them for RISC-V. In addition we build and fix packages by hand.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Bootstrapping&diff=507900Architectures/RISC-V/Bootstrapping2017-12-20T16:12:08Z<p>Rjones: /* Introduction */</p>
<hr />
<div>All about bootstrapping Fedora on [[Architectures/RISC-V|RISC-V]].<br />
<br />
= Introduction =<br />
<br />
Bootstrapping happens in several stages which are outlined in detail in the <code>README</code> and <code>Makefile</code> in [https://github.com/rwmjones/fedora-riscv-bootstrap this repository].<br />
<br />
The general idea is that we go in stages (numbered for historical reasons):<br />
<br />
== Stage 3 ==<br />
<br />
Build an <code>x86_64</code> disk image, but remove all the binaries and libraries from it. The binaries and libraries are cross-compiled from the host using the [https://github.com/riscv/riscv-tools riscv64-unknown-linux-gnu-gcc compiler].<br />
<br />
After building the stage 3 disk image in this way, it is bootable under [http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/ qemu-system-riscv64] and has working gcc and rpmbuild:<br />
<br />
<pre><br />
Tue Dec 19 22:47:00 UTC 2017<br />
<br />
Welcome to the Fedora/RISC-V stage3 disk image<br />
https://fedoraproject.org/wiki/Architectures/RISC-V<br />
<br />
stage3:/# ls<br />
bin dev home lib lost+found mnt proc rpmbuild sbin sys usr<br />
boot etc init lib64 media opt root run srv tmp var<br />
stage3:/# uname -a<br />
Linux stage3 4.15.0-rc3-01064-g418457520fbb #2 Tue Dec 19 22:31:06 GMT 2017 riscv64 GNU/Linux<br />
stage3:/# gcc --version<br />
gcc (GCC) 7.2.0<br />
Copyright (C) 2017 Free Software Foundation, Inc.<br />
This is free software; see the source for copying conditions. There is NO<br />
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.<br />
stage3:/# rpmbuild --version<br />
RPM version 4.12.90<br />
</pre><br />
<br />
== Stage 4 ==<br />
<br />
Using the stage 3 disk image, running under qemu, [https://github.com/rwmjones/fedora-riscv-bootstrap/tree/master/stage3-built-rpms we build RPMs for many core packages].<br />
<br />
Eventually we have built enough RPMs that we can build a clean stage 4 disk image entirely from RPMs.<br />
<br />
== After stage 4 ==<br />
<br />
Using the clean stage 4 disk image we now go on to build the remaining packages from Fedora. This is a very long, incremental processes aided by an autobuilder which picks up new packages from real Fedora and tries to build them for RISC-V. In addition we build and fix packages by hand.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Bootstrapping&diff=507863Architectures/RISC-V/Bootstrapping2017-12-19T22:13:32Z<p>Rjones: Remove old stuff and add pointer to repo.</p>
<hr />
<div>All about bootstrapping Fedora on [[Architectures/RISC-V|RISC-V]].<br />
<br />
= Introduction =<br />
<br />
Bootstrapping happens in several stages which are outlined in the README and Makefile in [https://github.com/rwmjones/fedora-riscv-bootstrap this repository].</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=507862Architectures/RISC-V2017-12-19T22:11:46Z<p>Rjones: Update status Dec 2017</p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64G) architecture.<br />
<br />
'''Status December 2017''' We are currently doing an "interim bootstrap" of Fedora 27. This is practice for the third and hopefully final bootstrap in Feb 2018. You can follow progress in [https://github.com/rwmjones/fedora-riscv-bootstrap this repository].<br />
<br />
'''Status November 2017''' Linux has support since 4.15. We are waiting for glibc to go upstream which is expected to happen in February 2018. At that point we will be re-bootstrapping the whole project using the final ABIs.<br />
<br />
'''Status November 2016''' The port supports about two thirds of the packages in Fedora 25, so it is quite complete and ready to use. Most important command-line programs just work (and even a few graphical ones). However if you are using your own hardware then you will need to supply a compatible kernel and bootloader and just use the Fedora userspace. Fedora/RISC-V does <i>not</i> support 32 bit or embedded hardware.<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* [[Architectures/RISC-V/Disk images]] - How to use the Fedora/RISC-V disk images.<br />
* [[Architectures/RISC-V/FPGA]] - How to run Fedora/RISC-V on real hardware (well, an FPGA).<br />
* [[Architectures/RISC-V/Bootstrapping]] - Bootstrapping Fedora on RISC-V.<br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. Log files and status from the autobuilder.<br />
; https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 24/x86_64) containing: QEMU, Spike, <s>cross-compiler toolchain (obsolete)</s><br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s><br />
<br />
= Communications =<br />
<br />
On FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=505899Architectures/RISC-V2017-11-16T11:41:30Z<p>Rjones: Update status.</p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64G) architecture.<br />
<br />
'''Status November 2017''' Linux has support since 4.15. We are waiting for glibc to go upstream which is expected to happen in February 2018. At that point we will be re-bootstrapping the whole project using the final ABIs.<br />
<br />
'''Status November 2016''' The port supports about two thirds of the packages in Fedora 25, so it is quite complete and ready to use. Most important command-line programs just work (and even a few graphical ones). However if you are using your own hardware then you will need to supply a compatible kernel and bootloader and just use the Fedora userspace. Fedora/RISC-V does <i>not</i> support 32 bit or embedded hardware.<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* [[Architectures/RISC-V/Disk images]] - How to use the Fedora/RISC-V disk images.<br />
* [[Architectures/RISC-V/FPGA]] - How to run Fedora/RISC-V on real hardware (well, an FPGA).<br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - We have finished bootstrapping, this section is obsolete</s><br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. Log files and status from the autobuilder.<br />
; https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 24/x86_64) containing: QEMU, Spike, <s>cross-compiler toolchain (obsolete)</s><br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s><br />
<br />
= Communications =<br />
<br />
On FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=491580Architectures/RISC-V2017-04-23T12:32:42Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64G) architecture.<br />
<br />
'''Status April 2017''' The port is usable as-is. But we are waiting for glibc and the kernel support to go upstream. At that point we will re-bootstrap the whole project using the final ABIs. This is expected to happen in the next few months.<br />
<br />
'''Status November 2016''' The port supports about two thirds of the packages in Fedora 25, so it is quite complete and ready to use. Most important command-line programs just work (and even a few graphical ones). However if you are using your own hardware then you will need to supply a compatible kernel and bootloader and just use the Fedora userspace. Fedora/RISC-V does <i>not</i> support 32 bit or embedded hardware.<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* [[Architectures/RISC-V/Disk images]] - How to use the Fedora/RISC-V disk images.<br />
* [[Architectures/RISC-V/FPGA]] - How to run Fedora/RISC-V on real hardware (well, an FPGA).<br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - We have finished bootstrapping, this section is obsolete</s><br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. Log files and status from the autobuilder.<br />
; https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 24/x86_64) containing: QEMU, Spike, <s>cross-compiler toolchain (obsolete)</s><br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s><br />
<br />
= Communications =<br />
<br />
On FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=480599Architectures/RISC-V2016-11-20T17:45:27Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64G) architecture.<br />
<br />
As of November 2016 the port supports about two thirds of the packages in Fedora 25, so it is quite complete and ready to use. Most important command-line programs just work (and even a few graphical ones). However if you are using your own hardware then you will need to supply a compatible kernel and bootloader and just use the Fedora userspace. Fedora/RISC-V does <i>not</i> support 32 bit or embedded hardware.<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* [[Architectures/RISC-V/Disk images]] - How to use the Fedora/RISC-V disk images.<br />
* [[Architectures/RISC-V/FPGA]] - How to run Fedora/RISC-V on real hardware (well, an FPGA).<br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - We have finished bootstrapping, this section is obsolete</s><br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. Log files and status from the autobuilder.<br />
; https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 24/x86_64) containing: QEMU, Spike, <s>cross-compiler toolchain (obsolete)</s><br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s><br />
<br />
= Communications =<br />
<br />
On FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=480598Architectures/RISC-V2016-11-20T17:44:38Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64G) architecture.<br />
<br />
As of November 2016 the port supports about two thirds of the packages in Fedora 25, so it is quite complete and ready to use. Most important non-graphical programs just work (and even a few graphical ones). However if you are using your own hardware then you will need to supply a compatible kernel and bootloader and just use the Fedora userspace. Fedora/RISC-V does <i>not</i> support 32 bit or embedded hardware.<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* [[Architectures/RISC-V/Disk images]] - How to use the Fedora/RISC-V disk images.<br />
* [[Architectures/RISC-V/FPGA]] - How to run Fedora/RISC-V on real hardware (well, an FPGA).<br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - We have finished bootstrapping, this section is obsolete</s><br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. Log files and status from the autobuilder.<br />
; https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 24/x86_64) containing: QEMU, Spike, <s>cross-compiler toolchain (obsolete)</s><br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s><br />
<br />
= Communications =<br />
<br />
On FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=480597Architectures/RISC-V2016-11-20T17:43:57Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64G) architecture.<br />
<br />
As of November 2016 the port supports about two thirds of the packages in Fedora 25, so it is quite complete and ready to use. Most important non-graphical programs just work (and even a few graphical ones). However if you are using your own hardware then you will need to supply a compatible kernel and bootloader and just use the Fedora userspace.<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* [[Architectures/RISC-V/Disk images]] - How to use the Fedora/RISC-V disk images.<br />
* [[Architectures/RISC-V/FPGA]] - How to run Fedora/RISC-V on real hardware (well, an FPGA).<br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - We have finished bootstrapping, this section is obsolete</s><br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. Log files and status from the autobuilder.<br />
; https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 24/x86_64) containing: QEMU, Spike, <s>cross-compiler toolchain (obsolete)</s><br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s><br />
<br />
= Communications =<br />
<br />
On FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V&diff=480596Architectures/RISC-V2016-11-20T17:43:37Z<p>Rjones: </p>
<hr />
<div>[https://riscv.org/ RISC-V] (pronounced "RISC Five") is an [https://en.wikipedia.org/wiki/RISC-V open source instruction set architecture (ISA)]. This project, informally called '''Fedora/RISC-V''', aims to provide a complete Fedora experience on the RISC-V (64 bit, RV64G) architecture.<br />
<br />
As of November 2016 the port supports about two thirds of the packages in Fedora, so it is quite complete and ready to use. Most important non-graphical programs just work (and even a few graphical ones). However if you are using your own hardware then you will need to supply a compatible kernel and bootloader and just use the Fedora userspace.<br />
<br />
= Topics =<br />
<br />
* [[Architectures/RISC-V/Building]] - Help to build packages for Fedora/RISC-V.<br />
* [[Architectures/RISC-V/Disk images]] - How to use the Fedora/RISC-V disk images.<br />
* [[Architectures/RISC-V/FPGA]] - How to run Fedora/RISC-V on real hardware (well, an FPGA).<br />
* <s>[[Architectures/RISC-V/Bootstrapping]] - We have finished bootstrapping, this section is obsolete</s><br />
<br />
= Downloads =<br />
<br />
; https://fedorapeople.org/groups/risc-v/<br />
: Disk images, RPMs, SRPMs. Log files and status from the autobuilder.<br />
; https://github.com/rwmjones/fedora-riscv-autobuild<br />
: The autobuilder source.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Linux kernel build scripts and patches<br />
; http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/<br />
: The COPR repository (for Fedora 24/x86_64) containing: QEMU, Spike, <s>cross-compiler toolchain (obsolete)</s><br />
<br />
Bootstrapping is over so the following links are now obsolete:<br />
<br />
; <s>https://github.com/rwmjones/fedora-riscv</s><br />
: <s>Git repository containing the bootstrapping work. Read the README file!</s><br />
; <s>http://oirase.annexia.org/riscv/</s><br />
: <s>Interim stage3 disk images built by rwmj</s><br />
; <s>http://davidlt.web.cern.ch/davidlt/riscv/</s><br />
: <s>Interim stage3 disk and kernel images built by davidlt.</s><br />
<br />
= Communications =<br />
<br />
On FreeNode IRC: <code>#fedora-riscv</code><br />
<br />
There is no specific mailing list, use [https://lists.fedoraproject.org/admin/lists/devel.lists.fedoraproject.org/ the general Fedora developers' mailing list].</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Disk_images&diff=477744Architectures/RISC-V/Disk images2016-10-23T10:06:22Z<p>Rjones: /* Common tasks */</p>
<hr />
<div>All about the [[Architectures/RISC-V|RISC-V]] disk images.<br />
<br />
= Latest image =<br />
<br />
The stage4 disk image is built cleanly from RPMs with no broken dependencies and [[#Sources|only a tiny number of modifications]].<br />
<br />
<b>https://fedorapeople.org/groups/risc-v/disk-images/</b><br />
<br />
The disk image does not include a bootloader, kernel or emulator.<br />
<br />
= Booting on Fedora QEMU =<br />
<br />
Download the vmlinux (kernel) from the same directory. Install the bootloader and QEMU:<br />
<br />
# dnf copr enable rjones/riscv<br />
# dnf install riscv-qemu riscv-pk<br />
<br />
Boot the disk image:<br />
<br />
$ qemu-system-riscv -m 4G -kernel /usr/bin/bbl \<br />
-append vmlinux \<br />
-drive file=stage4-disk.img,format=raw -nographic<br />
<br />
= Booting in other places =<br />
<br />
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 [https://github.com/rwmjones/fedora-riscv-kernel/blob/master/config this file].<br />
<br />
= Installing extra packages inside the VM =<br />
<br />
The disk image only has a basic set of packages installed. We build [https://fedorapeople.org/groups/risc-v/RPMS/ many more]. To install them you will need to use the [https://en.wikipedia.org/wiki/DNF_(software) <code>dnf</code>] command. However you will need to configure it, and configuration is different depending on whether your RISC-V machine has network access or not.<br />
<br />
== Installing packages with a working network ==<br />
<br />
Edit <code>/etc/yum.repos.d/local.repo</code>, uncomment the https <code>baseurl</code> and comment out the file <code>baseurl</code>. DNF should be able to download packages from [https://fedorapeople.org/groups/risc-v/RPMS/ our public repo].<br />
<br />
== Installing packages without a working network ==<br />
<br />
Fedora's QEMU does <b>not</b> 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 <code>/var/tmp</code> will work:<br />
<br />
$ virt-copy-in -a stage4-disk.img /your/copy/of/RPMS /var/tmp<br />
<br />
== Note about DNF caching ==<br />
<br />
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:<br />
<br />
# dnf clean all<br />
<br />
== Common tasks ==<br />
<br />
{|<br />
! Task !! Package<br />
|-<br />
| Editing (vi) || vim-minimal <br/> <small><i>(Included in base image)</i></small><br />
|-<br />
| Editing (emacs) || xemacs-nox<br />
|-<br />
| Compiling || @buildsys-build<br />
|-<br />
|}<br />
<br />
To install a package use: <code>dnf install packagename</code><br />
<br />
= Using systemd or not using systemd =<br />
<br />
The disk image boots using systemd as the init system. <code>/init</code> inside the disk image is a symlink to systemd.<br />
<br />
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 [https://www.freedesktop.org/software/systemd/man/systemd.unit.html add systemd units].<br />
<br />
If you prefer not to use systemd, then modify the disk image:<br />
<br />
* Remove the <code>/init</code> symlink.<br />
* Add your own <code>/init</code> shell script (or binary).<br />
* Ensure the <code>/init</code> script is executable.<br />
<br />
The <code>/init</code> script needs to remount the root filesystem as <code>rw</code> and a few other things. Look at [https://github.com/rwmjones/fedora-riscv-autobuild the code of the Fedora autobuilder] for an example.<br />
<br />
= Power off =<br />
<br />
If you are using systemd, run:<br />
<br />
# poweroff<br />
<br />
If you are <b>not</b> using systemd, run:<br />
<br />
# sync<br />
# poweroff -f<br />
<br />
= Disk image is too large/too small =<br />
<br />
The disk image has a large <b>virtual</b> size. It is shipped as a [https://en.wikipedia.org/wiki/Sparse_file 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 <code>tar</code>, <code>xz</code>, <code>cp --sparse=always</code>, and the common Linux filesystems.<br />
<br />
If the image is too large (or too small) to fit on external media, use the [https://linux.die.net/man/8/resize2fs resize2fs] command to resize it.<br />
<br />
= Customizing the disk image =<br />
<br />
To produce your own customized disk images, fork [https://github.com/rwmjones/fedora-riscv-stage4 the stage4 repository] and use it to build your own stage4 disk images.<br />
<br />
= Sources =<br />
<br />
; https://fedorapeople.org/groups/risc-v/SRPMS/<br />
: Fedora sources.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Kernel build scripts, kernel config, and a link to the kernel sources we use.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-stage4/blob/master/stage4-build-init.sh<br />
: How the RPMs were installed in the stage4, and any subsequent modifications made.<br />
; https://fedoraproject.org/wiki/Architectures/RISC-V<br />
: Links to all other documentation.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Disk_images&diff=477743Architectures/RISC-V/Disk images2016-10-23T09:55:23Z<p>Rjones: </p>
<hr />
<div>All about the [[Architectures/RISC-V|RISC-V]] disk images.<br />
<br />
= Latest image =<br />
<br />
The stage4 disk image is built cleanly from RPMs with no broken dependencies and [[#Sources|only a tiny number of modifications]].<br />
<br />
<b>https://fedorapeople.org/groups/risc-v/disk-images/</b><br />
<br />
The disk image does not include a bootloader, kernel or emulator.<br />
<br />
= Booting on Fedora QEMU =<br />
<br />
Download the vmlinux (kernel) from the same directory. Install the bootloader and QEMU:<br />
<br />
# dnf copr enable rjones/riscv<br />
# dnf install riscv-qemu riscv-pk<br />
<br />
Boot the disk image:<br />
<br />
$ qemu-system-riscv -m 4G -kernel /usr/bin/bbl \<br />
-append vmlinux \<br />
-drive file=stage4-disk.img,format=raw -nographic<br />
<br />
= Booting in other places =<br />
<br />
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 [https://github.com/rwmjones/fedora-riscv-kernel/blob/master/config this file].<br />
<br />
= Installing extra packages inside the VM =<br />
<br />
The disk image only has a basic set of packages installed. We build [https://fedorapeople.org/groups/risc-v/RPMS/ many more]. To install them you will need to use the [https://en.wikipedia.org/wiki/DNF_(software) <code>dnf</code>] command. However you will need to configure it, and configuration is different depending on whether your RISC-V machine has network access or not.<br />
<br />
== Installing packages with a working network ==<br />
<br />
Edit <code>/etc/yum.repos.d/local.repo</code>, uncomment the https <code>baseurl</code> and comment out the file <code>baseurl</code>. DNF should be able to download packages from [https://fedorapeople.org/groups/risc-v/RPMS/ our public repo].<br />
<br />
== Installing packages without a working network ==<br />
<br />
Fedora's QEMU does <b>not</b> 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 <code>/var/tmp</code> will work:<br />
<br />
$ virt-copy-in -a stage4-disk.img /your/copy/of/RPMS /var/tmp<br />
<br />
== Note about DNF caching ==<br />
<br />
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:<br />
<br />
# dnf clean all<br />
<br />
== Common tasks ==<br />
<br />
{|<br />
! Task !! Package<br />
|-<br />
| Editing (vi) || vim-minimal<br />
|-<br />
| Editing (emacs) || xemacs-nox<br />
|-<br />
| Compiling || @buildsys-build<br />
|-<br />
|}<br />
<br />
To install a package use: <code>dnf install packagename</code><br />
<br />
= Using systemd or not using systemd =<br />
<br />
The disk image boots using systemd as the init system. <code>/init</code> inside the disk image is a symlink to systemd.<br />
<br />
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 [https://www.freedesktop.org/software/systemd/man/systemd.unit.html add systemd units].<br />
<br />
If you prefer not to use systemd, then modify the disk image:<br />
<br />
* Remove the <code>/init</code> symlink.<br />
* Add your own <code>/init</code> shell script (or binary).<br />
* Ensure the <code>/init</code> script is executable.<br />
<br />
The <code>/init</code> script needs to remount the root filesystem as <code>rw</code> and a few other things. Look at [https://github.com/rwmjones/fedora-riscv-autobuild the code of the Fedora autobuilder] for an example.<br />
<br />
= Power off =<br />
<br />
If you are using systemd, run:<br />
<br />
# poweroff<br />
<br />
If you are <b>not</b> using systemd, run:<br />
<br />
# sync<br />
# poweroff -f<br />
<br />
= Disk image is too large/too small =<br />
<br />
The disk image has a large <b>virtual</b> size. It is shipped as a [https://en.wikipedia.org/wiki/Sparse_file 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 <code>tar</code>, <code>xz</code>, <code>cp --sparse=always</code>, and the common Linux filesystems.<br />
<br />
If the image is too large (or too small) to fit on external media, use the [https://linux.die.net/man/8/resize2fs resize2fs] command to resize it.<br />
<br />
= Customizing the disk image =<br />
<br />
To produce your own customized disk images, fork [https://github.com/rwmjones/fedora-riscv-stage4 the stage4 repository] and use it to build your own stage4 disk images.<br />
<br />
= Sources =<br />
<br />
; https://fedorapeople.org/groups/risc-v/SRPMS/<br />
: Fedora sources.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Kernel build scripts, kernel config, and a link to the kernel sources we use.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-stage4/blob/master/stage4-build-init.sh<br />
: How the RPMs were installed in the stage4, and any subsequent modifications made.<br />
; https://fedoraproject.org/wiki/Architectures/RISC-V<br />
: Links to all other documentation.</div>Rjoneshttps://fedoraproject.org/w/index.php?title=Architectures/RISC-V/Disk_images&diff=477742Architectures/RISC-V/Disk images2016-10-23T09:54:41Z<p>Rjones: </p>
<hr />
<div>All about the [[Architectures/RISC-V|RISC-V]] disk images.<br />
<br />
= Latest image =<br />
<br />
The stage4 disk image is built cleanly from RPMs with no broken dependencies and [[#Sources|only a tiny number of modifications]].<br />
<br />
<b>https://fedorapeople.org/groups/risc-v/disk-images/</b><br />
<br />
The disk image does not include a bootloader, kernel or emulator.<br />
<br />
= Booting on Fedora QEMU =<br />
<br />
Download the vmlinux (kernel) from the same directory. Install the bootloader and QEMU:<br />
<br />
# dnf copr enable rjones/riscv<br />
# dnf install riscv-qemu riscv-pk<br />
<br />
Boot the disk image:<br />
<br />
$ qemu-system-riscv -m 4G -kernel /usr/bin/bbl \<br />
-append vmlinux \<br />
-drive file=stage4-disk.img,format=raw -nographic<br />
<br />
= Booting in other places =<br />
<br />
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 [https://github.com/rwmjones/fedora-riscv-kernel/blob/master/config this file].<br />
<br />
= Installing extra packages inside the VM =<br />
<br />
The disk image only has a basic set of packages installed. We build [https://fedorapeople.org/groups/risc-v/RPMS/ many more]. To install them you will need to use the [https://en.wikipedia.org/wiki/DNF_(software) <code>dnf</code>] command. However you will need to configure it, and configuration is different depending on whether your RISC-V machine has network access or not.<br />
<br />
== Installing packages with a working network ==<br />
<br />
Edit <code>/etc/yum.repos.d/local.repo</code>, uncomment the https <code>baseurl</code> and comment out the file <code>baseurl</code>. DNF should be able to download packages from [https://fedorapeople.org/groups/risc-v/RPMS/ our public repo].<br />
<br />
== Installing packages without a working network ==<br />
<br />
Fedora's QEMU does <b>not</b> 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 <code>/var/tmp</code> will work:<br />
<br />
$ virt-copy-in -a stage4-disk.img /your/copy/of/RPMS /var/tmp<br />
<br />
== DNF groups ==<br />
<br />
DNF groups should work, eg:<br />
<br />
# dnf install @buildsys-build<br />
<br />
== Note about DNF caching ==<br />
<br />
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:<br />
<br />
# dnf clean all<br />
<br />
= Common tasks =<br />
<br />
{|<br />
! Task !! Package<br />
|-<br />
| Editing (vi) || vim-minimal<br />
|-<br />
| Editing (emacs) || xemacs-nox<br />
|-<br />
| Compiling || @buildsys-build<br />
|-<br />
|}<br />
<br />
To install a package use: <code>dnf install packagename</code><br />
<br />
= Using systemd or not using systemd =<br />
<br />
The disk image boots using systemd as the init system. <code>/init</code> inside the disk image is a symlink to systemd.<br />
<br />
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 [https://www.freedesktop.org/software/systemd/man/systemd.unit.html add systemd units].<br />
<br />
If you prefer not to use systemd, then modify the disk image:<br />
<br />
* Remove the <code>/init</code> symlink.<br />
* Add your own <code>/init</code> shell script (or binary).<br />
* Ensure the <code>/init</code> script is executable.<br />
<br />
The <code>/init</code> script needs to remount the root filesystem as <code>rw</code> and a few other things. Look at [https://github.com/rwmjones/fedora-riscv-autobuild the code of the Fedora autobuilder] for an example.<br />
<br />
= Power off =<br />
<br />
If you are using systemd, run:<br />
<br />
# poweroff<br />
<br />
If you are <b>not</b> using systemd, run:<br />
<br />
# sync<br />
# poweroff -f<br />
<br />
= Disk image is too large/too small =<br />
<br />
The disk image has a large <b>virtual</b> size. It is shipped as a [https://en.wikipedia.org/wiki/Sparse_file 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 <code>tar</code>, <code>xz</code>, <code>cp --sparse=always</code>, and the common Linux filesystems.<br />
<br />
If the image is too large (or too small) to fit on external media, use the [https://linux.die.net/man/8/resize2fs resize2fs] command to resize it.<br />
<br />
= Customizing the disk image =<br />
<br />
To produce your own customized disk images, fork [https://github.com/rwmjones/fedora-riscv-stage4 the stage4 repository] and use it to build your own stage4 disk images.<br />
<br />
= Sources =<br />
<br />
; https://fedorapeople.org/groups/risc-v/SRPMS/<br />
: Fedora sources.<br />
; https://github.com/rwmjones/fedora-riscv-kernel<br />
: Kernel build scripts, kernel config, and a link to the kernel sources we use.<br />
; https://github.com/rwmjones/fedora-riscv-stage4<br />
: Scripts used to build the stage4 disk image.<br />
; https://github.com/rwmjones/fedora-riscv-stage4/blob/master/stage4-build-init.sh<br />
: How the RPMs were installed in the stage4, and any subsequent modifications made.<br />
; https://fedoraproject.org/wiki/Architectures/RISC-V<br />
: Links to all other documentation.</div>Rjones