Talk:HiFive Unleashed

From ALT Linux Wiki

Detailed setup instruction moved away from Regular/riscv64:

How to run on HiFive Unleashed

This instruction assumes that the user is working on the computer with ALT Sisyphus installed on it. In order to run the image on the HiFive Unleashed one need to follow these steps:

Step 1. Download minimal system image with systemd, which is a tar archive with rootfs. To install the system one could choose between two options: automatic install on ALT Sisyphus and manual.

Automatic install on ALT Sisyphus

Step 2. Install the alt-rootfs-installer.

Step 3. The alt-rootfs-installer will automatically install the system on microSD card. For example, to install regular-builder-latest-riscv64.tar.xz image on /dev/sdX with log output to /home/user/alt-rootfs-installer.log:

$ alt-rootfs-installer --rootfs=/home/user/images/regular-builder-latest-riscv64.tar.xz \
                       --media=/dev/sdX \
                       --target=HiFive-Unleashed-opensbi --log=/home/user/alt-rootfs-installer.log


After this procedure the /dev/sdX disk will contain two partitions:

  1. FSBL (First Stage Bootloader)
  2. OpenSBI + U-Boot
  3. rootfs

Now, microSD card is ready to use with HiFive Unleashed.

Manual install

Step 2. Untar two files from the archive from step 1. For example, in the case of regular-builder-latest-riscv64.tar.xz:

$ tar -xJf regular-jeos-latest-riscv64.tar.xz ./usr/share/fu540_boot/fsbl.bin ./usr/share/opensbi/sifive/fu540/firmware/fw_payload.bin

These two files ./usr/share/fu540_boot/fsbl.bin и ./usr/share/opensbi/sifive/fu540/firmware/fw_payload.bin are FSBL and OpenSBI + U-Boot, acoordingly.

Step 3. Create the GPT table with three partitions on the microSD card:

  • FSBL partition with GUID 5B193300-FC78-40CD-8002-E86C45580B47
  • OpenSBI partition with GUID 2E54B353-1271-4842-806F-E436D6AF6985
  • Linux Filesystem partition with GUID 0FC63DAF-8483-4772-8E79-3D69D8477DE4

The example command for /dev/sdX:

$ sgdisk \
 --new=1:2048:4095 --change-name=1:fsbl \
 --typecode=1:5B193300-FC78-40CD-8002-E86C45580B47 \
 --new=2:4096:32767 --change-name=2:opensbi-uboot \
 --typecode=2:2E54B353-1271-4842-806F-E436D6AF6985 \
 --new=3:32768: --change-name=3:rootfs \
 --typecode=3:0FC63DAF-8483-4772-8E79-3D69D8477DE4 \
 /dev/sdX

Step 4. Write the FSBL to the partition with FSBL GUID (first partition in the example above):

$ dd if=./usr/share/fu540_boot/fsbl.bin of=/dev/sdX1 bs=4M status=progress

Step 5. Write the OpenSBI + U-Boot to the partition with OpenSBI GUID (second partition in the example above):

$ dd if=./usr/share/opensbi/sifive/fu540/firmware/fw_payload.bin of=/dev/sdX2 bs=4M status=progress

Step 6. Create a filesystem on the third partition of the microSD. Mount it and untar the archive with rootfs:

$ mkfs.ext4 /dev/sdX3
$ mount /dev/sdX3 /mnt
$ tar -xpJvf regular-builder-latest-riscv64.tar.xz -C /mnt/
$ sync; umount /dev/sdX3

Now, the microSD is ready to use with HiFive Unleashed.