Booting Ubuntu 24 from SATA

The HiFive Premier 550 Image Update Procedure seems to state in Chapter 6 that it’s possible to boot Ubuntu 24 from SATA. However after following the all the steps in both Chapter 2 (updating bootchain via u-boot) and Chapter 6, our board is still stopping in u-boot after trying and failing to boot from mmc only.

Any advice on making this work?

Default value of “boot_targets” variable:

=> env print boot_targets
boot_targets=mmc1 usb sata mmc0

So far I have tried:
boot_targets=mmc1 usb sata0 mmc0
boot_targets=mmc1 usb sata0:3 mmc0

“ls sata 0:1” shows an EFI partition.
“ls sata 0:2” appears to show a “CIDATA” partition.
“ls sata 0:3” shows the contents of a standard Ubuntu root file system (/bin, /boot, /etc and so on.)

Ubuntu 24 image: 2025.02.00
Bootchain image: 2024.11.00-HFP550

Try to set the “boot_targets”
boot_targes=sata0 mmc1 usb mmc0

Because the boot mode is bootflow scan, it will search according to the device order of boot_targets. If the current device is found to be bootable, it will enter the device to complete the boot, otherwise it will continue to search.

I tried setting boot_targets to “sata0 mmc1 usb mmc0”, but I’m still getting stuck in u-boot.

I’ll paste my u-boot messages and printenv results below.

U-Boot 2024.01 (Nov 06 2024 - 05:26:46 +0000)

CPU:   rv64imafdc_zba_zbb
Model: SiFive HiFive Premier P550
DRAM:  32 GiB (effective 16 GiB)
Core:  113 devices, 30 uclasses, devicetree: separate
Warning: Device tree includes old 'u-boot,dm-' tags: please fix by 2023.07!
MMC:   sdhci@50450000: 0, sd@50460000: 1
Loading Environment from SPIFlash... SF: Detected w25q128fw with page size 256 Bytes, erase size 4 KiB, total 16                                             MiB
OK
eswin_pcie_wait_link_up: error: wait linkup timeout
PCIE-0: Link up (Gen1-x1, Bus0)
[display_init]Eswin UBOOT DRM driver version: v1.0.1
xfer: num: 2, addr: 0x50
can't find valid hdmi mode
[display_init]init failed.
In:    serial,usbkbd
Out:   vidconsole,serial
Err:   vidconsole,serial
Bootspi flash write protection enabled
Get som info from flash
Cpu volatge need boost above 1.6 Ghz!
Could not find "root" partition
Low power features will not be supported!
Net:   eth0: ethernet@50400000
Working FDT set to ed51c710
starting USB...
Bus usb1@50490000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb1@50490000 for devices... 5 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
flags: 64bit ncq stag pm led clo only pmp pio slum part
scanning bus for devices...
Rescanning SATA bus for devices...
SATA Device Info:
S/N: 24506J800980
Product model number: WDC  WDS100T1R0A-68A4W0
Firmware version: 411010WR
Capacity: 1953525168 sectors
Hit any key to stop autoboot:  0
MMC: no card present
MMC: no card present
MMC: no card present

printenv:

arch=riscv
baudrate=115200
board=hifive_premier_p550
board_info=SF106SKB2451000092
board_name=hifive_premier_p550
boot_targets=sata0 mmc1 usb mmc0
bootcmd=bootflow scan;
bootdelay=2
cpu=eic770x
emmc_dev=0
eth1addr=8c:00:00:00:00:00
ethaddr=8c:00:00:00:00:00
fdt_addr=ed51c710
fdt_addr_r=0x88000000
fdt_high=0xffffffffffffffff
fdtaddr=ed51c710
fdtcontroladdr=ed51c710
fdtfile=eswin/eic7700-hifive-premier-p550.dtb
gpt_partition=gpt write mmc ${emmc_dev} $partitions
initrd_high=0xffffffffffffffff
kernel_addr_r=0x84000000
kernel_comp_addr_r=0xa0000000
kernel_comp_size=0x4000000
loadaddr=0x80200000
partitions=name=boot,start=1MiB,size=512MiB,type=${typeid_efi},uuid=${uuid_boot};name=swap,size=4096MiB,type=${typeid_swap},uuid=${uuid_swap};name=root,size=30GiB,type=${typeid_filesystem},uuid=${uuid_root};name=userdata,type=${typeid_filesystem},size=-;
preboot=setenv fdt_addr ${fdtcontroladdr};fdt addr ${fdtcontroladdr};usb start;sata init;nvme scan
pxefile_addr_r=0x88200000
ram_size=32
ramdisk_addr_r=0x88300000
scriptaddr=0x88100000
sdupdate=ext4load mmc 1:1 0x90000000 sdupdate.scr;source 0x90000000
stderr=vidconsole,serial
stdin=serial,usbkbd
stdout=vidconsole,serial
typeid_efi=C12A7328-F81F-11D2-BA4B-00A0C93EC93B
typeid_filesystem=0FC63DAF-8483-4772-8E79-3D69D8477DE4
typeid_swap=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F
usbupdate=ext4load usb 0 0x90000000 usbupdate.scr;source 0x90000000
uuid_boot=44b7cb94-f58c-4ba6-bfa4-7d2dce09a3a5
uuid_root=b0f77ad6-36cd-4a99-a8c0-31d73649aa08
uuid_swap=5ebcaaf0-e098-43b9-beef-1f8deedd135e
vendor=eswin

Environment size: 1551/524284 bytes

sata part

=> sata part

Partition Map for SATA device 0  --   Partition Type: EFI

Part    Start LBA       End LBA         Name
        Attributes
        Type GUID
        Partition GUID
  1     0x00000800      0x000327ff      "EFI System"
        attrs:  0x0000000000000000
        type:   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
                (system)
        guid:   d354df82-7955-4dbb-995f-4891130946a6
  2     0x00032800      0x000347ff      "CIDATA"
        attrs:  0x0000000000000000
        type:   0fc63daf-8483-4772-8e79-3d69d8477de4
                (linux)
        guid:   f7808082-443d-457b-b4c6-745a0a22d1a6
  3     0x00034800      0x00f209eb      "Root Partition"
        attrs:  0x0000000000000000
        type:   0fc63daf-8483-4772-8e79-3d69d8477de4
                (linux)
        guid:   4f3bdfba-3260-436b-9968-702fbe052882

Hello ESWIN support, I posted more details from the booting board a few days ago. It’s still not booting from SATA. Can you take a look again and see what other settings I might need to change? Does the SATA partition have to be marked bootable, like a PC running MS-DOS or Windows? Thanks!

SATA booting issue is solved … sort of. Here’s what we did to make it work with our board.

  1. Copy files ‘bootloader_ddr5_secboot.bin’ and ‘ubuntu-24.04-preinstalled-server-riscv64.img’ to ext4fs formatted USB hard drive.
  2. Connect USB drive to bottom USB 3.0 port at rear of motherboard.
  3. Connect to USB-C serial console from another computer (we used Putty on a Windows laptop).
  4. Boot the board and stop autoboot in the serial console.
  5. In the serial console, type usb reset
  6. Type ls usb 0 to make sure the two files listed above are shown as available.
  7. Flash the bootchain image with the following commands.
  8. ext4load usb 0 0x90000000 bootloader_ddr5_secboot.bin
  9. es_burn write 0x90000000 flash
  10. Flash the Ubuntu image to the MMC card.
  11. es_fs write usb 0 ubuntu-24.04-preinstalled-server-riscv64.img mmc 0
  12. Flash the Ubuntu image again, this time to the SATA drive.
  13. es_fs write usb 0 ubuntu-24.04-preinstalled-server-riscv64.img sata 0
  14. reset to reboot the board.

At this point mmc0 and sata0 both have three partitions:

  • p1 /boot/efi
  • p2 CIDATA
  • p3 / (root file system with UUID “a8d93d57-5214-430a-8179-efc4f310aef3”

Chapter 6 of the Image Update Procedure warns that there should not be two file systems with the same UUID, and provides instructions for erase, but when we tried those instructions, the whole MMC card was wiped, not just the root file system. So the following is a kind of workaround.

When the board starts up, seems like it will always start with mmc0 partition 0, but then when the kernel loads, it will pick one or the other of the root file systems to mount as /. By good luck, the first time we booted the board it mounted the root file system on /dev/sda3 (third partition on SATA drive). Once Ubuntu was fully loaded to where we could start a terminal, we were able to use parted to remove the duplicate unneeded root file system on /dev/mmcblk0p3 .
After that the board would always start up with the root file system on /dev/sda3.

NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda            8:0    0 931.5G  0 disk 
├─sda1         8:1    0   100M  0 part /boot/efi
├─sda2         8:2    0     4M  0 part 
└─sda3         8:3    0 931.4G  0 part /
mmcblk0      179:0    0 116.5G  0 disk 
├─mmcblk0p1  179:1    0   100M  0 part 
└─mmcblk0p2  179:2    0     4M  0 part 
mmcblk0boot0 179:8    0     4M  1 disk 
mmcblk0boot1 179:16   0     4M  1 disk

Hope this helps. If anyone has a more elegant way to do this, please do add a reply!

Last followup: by doing a one-time change of the entry for root= in the active kernel boot line in GRUB, I think it will direct the kernel to mount the root filesystem only from the SATA drive partition 3.

i.e. when the board boots and the GRUB menu comes up, hit ‘e’ to edit and then change this line:

 linux   /boot/vmlinuz-6.6.21-10-premier root=UUID=a8d93d57-5214-430a-8179-efc4f310aef3 ro  efi=debug earlycon=sbi

to this:

 linux   /boot/vmlinuz-6.6.21-10-premier root=/dev/sda3 ro  efi=debug earlycon=sbi

I found the grub editor very slow but eventually was able to make this change, and the board then mounted /dev/sda3 as / .