Ubuntu installation on the SiFive HiFive Unmatched board using a server install image

Overview

Starting with Ubuntu 22.04 a server install image is made available. This topic describes how to use the image for an installation on the NVMe drive of an SiFive HiFive Unmatched board.

The release image will be available at https://cdimage.ubuntu.com/releases/22.04/release/.
Daily build images are provided at https://cdimage.ubuntu.com/ubuntu-server/daily-live/current/.
A general overview of the installation process is available at https://ubuntu.com/tutorials/install-ubuntu-server.

Prerequistites

Download the image either using your web browser or with

wget https://cdimage.ubuntu.com/ubuntu-server/daily-live/current/jammy-live-server-riscv64.img.gz

Extract the image.

gzip -d jammy-live-server-riscv64.img.gz

Copy the image to an SD card with

sudo dd if=jammy-live-server-riscv64.img of=/dev/sdX bs=1M conv=fsync

replacing /dev/sdX with the device-name of your SD card reader. Keep extra care not to overwrite your host system installation.

As of Ubuntu 22.04 the server install image already contains a U-Boot installation for the Unmatched board on the SD card. It may be removed in later releases. The U-Boot binaries for the Unmatched board are available in package u-boot-sifive.

Installation

Establish a serial console connection to the Unmatched board. You can use picocom for this.

sudo apt-get install picocom
sudo picocom -b 115200 /dev/ttyUSB1

Insert the SD card and power up the system.

If no prior operating system installation exists, U-Boot will start up GRUB on the SD card.

Otherwise press the enter key when seeing the Hit any key to stop autoboot: message and execute:

load mmc 0:1 $fdt_addr_r dtb/sifive/hifive-unmatched-a00.dtb
load mmc 0:1 $kernel_addr_r EFI/boot/bootriscv64.efi
bootefi $kernel_addr_r $fdt_addr_r

Reading from the SD card is very slow. Loading the installer takes several minutes. Once it is loaded follow the installation steps in https://ubuntu.com/tutorials/install-ubuntu-server.

When the installation is finished reboot the board without removing the SD card.

U-Boot does not allow the operating system to write UEFI variables. We have to do this manually. While rebooting press the enter key when seeing the Hit any key to stop autoboot: message. The following commands set up the installation on the NVMe drive as UEFI boot option 0001.

pci enum
nvme scan
efidebug boot add -b 0001 'Ubuntu Jammy' nvme 0:1 /EFI/ubuntu/grubriscv64.efi
efidebug boot order 0001

To boot into your fresh installation you can use:

bootefi bootmgr

On the next boot U-Boot will automatically start into GRUB.

3 Likes

I have jh7100-starfive-visionfive-v1
I copied my dtb file to (BOOT) dtb/sifive/jh7100-starfive-visionfive-v1.dtb also to (root) dtbs/jh7100-starfive-visionfive-v1.dtb
I use next commands for boot the image

scriptaddr=0x88100000
script_offset_f=0x1fff000
script_size_f=0x1000

kernel_addr_r=0x84000000
kernel_comp_addr_r=0x90000000
kernel_comp_size=0x10000000

fdt_addr_r=0x88000000
ramdisk_addr_r=0x88300000

load mmc 0:1 $fdt_addr_r dtb/sifive/jh7100-starfive-visionfive-v1.dtb
load mmc 0:1 $kernel_addr_r EFI/boot/bootriscv64.efi
bootefi $kernel_addr_r $fdt_addr_r

Grub success booted. But loading stop after choosing Try install ubuntu

EFI stub: Booting Linux Kernel...
EFI stub: Using DTB from configuration table
EFI stub: Loaded initrd from LINUX_EFI_INITRD_MEDIA_GUID device path
EFI stub: Exiting boot services...

I think need update kernel until 5.17, that have support my board.
How i cat do it?

1 Like

Currently only QEMU and HiFive Unmatched are supported by the installer. Currently the easiest option to prepare a Ubuntu image for the VisionFive is to use debootstrap to create a riscv64 chroot and to install your kernel within the chroot.

1 Like