From Fedora Project Wiki
(Mention Fedora 29 for libvirt and how to disable autoconsole)
(Organize physical hardware by vendor)
 
(47 intermediate revisions by 8 users not shown)
Line 1: Line 1:
= Download the latest disk image =
The process of installing Fedora RISC-V might be target-dependent. Check out the relevant page for detailed information.


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.
= Emulated hardware =


Uncompress it:
* [[Architectures/RISC-V/QEMU|QEMU]]


<pre>
= Real hardware =
$ unxz Fedora-Developer-Rawhide-xxxx.n.0-sda.raw.xz
</pre>


== Root password ==
SiFive


<code>riscv</code>
* [[Architectures/RISC-V/HiFive-Premier-P550|HiFive Premier P550]]
 
= Boot under TinyEMU (RISCVEMU) =
 
RISCVEMU recently (2018-09-23) was renamed to TinyEMU (https://bellard.org/tinyemu/).
 
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/
 
Below are instructions how to boot Fedora into X11/Fluxbox GUI mode.
 
'''Step 1'''. Compile TinyEMU:
 
<pre>
wget https://bellard.org/tinyemu/tinyemu-2018-09-23.tar.gz
tar xvf tinyemu-2018-09-23.tar.gz
cd tinyemu-2018-09-23
make
</pre>
 
'''Step 2'''. Setup for booting Fedora:
<pre>
mkdir fedora
cd fedora
cp ../temu .
 
# Download pre-built BBL with embedded kernel
wget https://bellard.org/jslinux/bbl64-4.15.bin
 
# Create configuration file for TinyEMU
cat <<EOF > root-riscv64.cfg
/* VM configuration file */
{
    version: 1,
    machine: "riscv64",
    memory_size: 1400,
    bios: "bbl64-4.15.bin",
    cmdline: "loglevel=3 console=tty0 root=/dev/vda1 rw TZ=${TZ}",
    drive0: { file: "Fedora-Developer-Rawhide-xxxx.n.0-sda.raw" },
    eth0: { driver: "user" },
    display0: {
        device: "simplefb",
        width: 1920,
        height: 1080,
    },
    input_device: "virtio",
}
EOF
 
# Download disk image and unpack in the same directory
</pre>
 
'''Step 3'''. Boot it.
<pre>
./temu -rw root-riscv64.cfg
</pre>
 
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.
 
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.
 
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.
 
= Boot under qemu =
 
You will need a very recent version of qemu.  If in doubt, compile from upstream qemu sources.
 
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].
 
<pre>
qemu-system-riscv64 \
    -nographic \
    -machine virt \
    -smp 4 \
    -m 2G \
    -kernel bbl \
    -object rng-random,filename=/dev/urandom,id=rng0 \
    -device virtio-rng-device,rng=rng0 \
    -append "console=ttyS0 ro root=/dev/vda1" \
    -device virtio-blk-device,drive=hd0 \
    -drive file=Fedora-Developer-Rawhide-xxxx.n.0-sda.raw,format=raw,id=hd0 \
    -device virtio-net-device,netdev=usernet \
    -netdev user,id=usernet,hostfwd=tcp::10000-:22
</pre>
 
= Boot with libvirt =
 
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:
 
<pre>
# virt-install \
    --name fedora-riscv \
    --arch riscv64 \
    --machine virt \
    --vcpus 4 \
    --memory 2048 \
    --import \
    --disk path=/var/lib/libvirt/images/Fedora-Developer-Rawhide-xxxx.n.0-sda.raw,bus=virtio \
    --boot kernel=/var/lib/libvirt/images/bbl,kernel_args="console=ttyS0 ro root=/dev/vda1" \
    --network network=default,model=virtio \
    --rng device=/dev/urandom,model=virtio \
    --graphics none
</pre>
 
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.
 
= Install on the HiFive Unleashed SD card =
 
These are instructions for the [https://www.sifive.com/products/hifive-unleashed/ HiFive Unleashed board].
 
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:
 
<pre>
$ guestfish -a Fedora-Developer-Rawhide-xxxx.n.0-sda.raw \
    run : download /dev/sda1 Fedora-Developer-Rawhide-xxxx.n.0-sda1.raw
</pre>
 
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.
 
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].
 
= Install on the HiFive Unleashed using NBD server =
 
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.

Latest revision as of 18:27, 8 January 2025

The process of installing Fedora RISC-V might be target-dependent. Check out the relevant page for detailed information.

Emulated hardware

Real hardware

SiFive