Bugs in latest master u-boot code

Think there’s some ongoing bugs in the latest master u-boot code. Trying to build a Debian bootable SD card (debootstrapped rootfs), and getting this:

U-Boot SPL 2021.07-rc4-00022-gcf066a20c3 (Jun 12 2021 - 11:24:00 -0500)
Trying to boot from MMC1


U-Boot 2021.07-rc4-00022-gcf066a20c3 (Jun 12 2021 - 11:24:00 -0500)

CPU:   rv64imafdc
Model: SiFive HiFive Unmatched A00
DRAM:  16 GiB
MMC:   spi@10050000:mmc@0: 0
Loading Environment from nowhere... OK
In:    serial@10010000
Out:   serial@10010000
Err:   serial@10010000
Model: SiFive HiFive Unmatched A00
Net:   
Error: ethernet@10090000 address not set.
No ethernet found.

Hit any key to stop autoboot:  0 
PCIE-0: Link up (Gen1-x8, Bus0)

Device 0: Vendor: 0x1987 Rev: RKT303.3 Prod: DC4E070C08D300001862
            Type: Hard Disk
            Capacity: 244198.3 MB = 238.4 GB (500118192 x 512)
... is now current device
Scanning nvme 0:1...
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Scanning disk mmc@0.blk...
** Unrecognized filesystem type **
** Unrecognized filesystem type **
Scanning disk nvme#0.blk#0...
Found 6 disks
No EFI system partition

Error: ethernet@10090000 address not set.
BootOrder not defined
EFI boot manager: Cannot load any image
starting USB...
Bus xhci_pci: Register 4000840 NbrPorts 4
Starting the controller
USB XHCI 1.00
scanning bus xhci_pci for devices... 3 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

Device 0: unknown device
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:3...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
760 bytes read in 6 ms (123 KiB/s)
SiFive Unmatched Boot Options
1:      Linux kernel-5.11.12
2:      Linux kernel-5.11.12 (recovery mode)
Enter choice: 1
1:      Linux kernel-5.11.12
Retrieving file: /boot/initrd.img-5.11.12
9285806 bytes read in 8055 ms (1.1 MiB/s)
Retrieving file: /boot/vmlinuz-5.11.12
8757026 bytes read in 7590 ms (1.1 MiB/s)
append: earlyprintk rw root=/dev/mmcblk0p3 rootfstype=ext4 rootwait console=ttySIF0,115200 LANG=en_US.UTF-8 earlycon
Retrieving file: /boot/dtbs/5.11.12/sifive/hifive-unmatched-a00.dtb
10473 bytes read in 18 ms (567.4 KiB/s)
   Uncompressing Kernel Image
Moving Image from 0x84000000 to 0x80200000, end=81349000
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Loading Ramdisk to ff724000, end fffff0ae ...
  (hang)

Steps i’m following here:

U-boot binaries i’m loading into the two SiFive partitions here:

Building u-boot with OpenSBI 0.9 extracted from the release packages.

Also, no Ethernet support in u-boot… so no TFTP loading binaries :slight_smile:

The shipping SD card with the demo OpenEmbedded is working fine

Same experience here. Although it looks like everything has been upstreamed, I’ll guess there are still some missing patches. But it would be nice if the unpatched u-boot v2021.07 release worked when it’s tagged.

In the meantime, you can build a working u-boot with this recipe (on the Unmatched).

git clone https://github.com/sifive/meta-sifive.git

git clone https://github.com/riscv/opensbi.git
cd opensbi
git checkout v0.9 -b tmp
for f in ../meta-sifive/recipes-bsp/opensbi/files/*.patch; do echo $f;patch -p1 < $f;done
for f in ../meta-sifive/recipes-bsp/opensbi/files/unmatched/*.patch; do echo $f;patch -p1 < $f;done
make PLATFORM=generic
export OPENSBI=`realpath build/platform/generic/firmware/fw_dynamic.bin`
cd ..

git clone https://github.com/u-boot/u-boot.git
cd u-boot
git checkout v2021.01 -b tmp
for f in ../meta-sifive/recipes-bsp/u-boot/files/unmatched/*.patch; do echo $f;patch -p1 < $f;done
make sifive_hifive_unmatched_fu740_defconfig
make -j4
1 Like

Upstreamming U-Boot is still WIP. The basic support was merged very recently. More to come, but I don’t expect everything to be upstreamed before v2021.07 (not enough time).

2 Likes

In current upstream (commit c9204859bbdb924cda811813c545032971656480) Ethernet is working fine.

Latest master u-boot is working now and it looks like these bugs were fixed.

After config/sifive_unmatched: add preboot commands - Patchwork is merged, it should be easy to use u-boot to boot generic RV64GC EFI operating systems from USB.

I’ve been seeing an issue where u-boot is corrupting the pcie node in the dtb which causes the kernel to OOPS before the console has been enabled (unless you have earlycon setup). For some reason this isn’t affecting the SiFive yocto image

Not sure how to best fix this as first attempt has been nacked by upstream as it won’t work in all cases.

The relocation support (FDT, initrd) for RISC-V was fixed in master branch (IIRC for 2022.01 release), but not if you use UEFI method to boot.