Stuck loading device tree

I’m trying to bring up linux differently, from u-boot directly from nvme without extlinux, and a kernel I compiled myself (on the box itself under ubuntu). That kernel has the sifive patches and has a command line built into it like this:

	root=/dev/nvme0n1p3 append earlyprintk rw rootfstype=ext4 rootwait console=ttySIF0,115200 LANG=en_US.UTF-8 earlycon

I’m using u-boot patched and compiled with OpenSBI in 2 sdcard partitions like the recipes do (following carlosedp/riscv-bringup)

My u-boot commands are like this:

These make the LED blue (why not!):

=> mw.l 0x10020024 0x0000ffff
=> mw.l 0x10020028 0x0000ffff
=> mw.l 0x1002002c 0x0

Get the PCI going:

=> pci enum

Get the NVME going:

=> nvme scan

Load linux compressed img from partition 3 on the nvme into stated memory location

=> load nvme 0:3 0x84000000 boot/vminuz-5.12.13-sifive

(it will be moved when decompressed to 0x80200000)

Load the flattened device tree (this came from sifive u-boot patches)

=> load nvme 0:3 0x88000000 boot/hifive-unmatched-a00.dtb

Boot linux (with no initrd, specifying the kernel and the FDT):

=> booti 0x84000000 - 0x88000000

I get this output, then it freezes:

   Uncompressing Kernel Image
Moving Image from 0x84000000 to 0x80200000, end=81c76b70
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Loading Device Tree to 00000000ffff7000, end 00000000fffff590 ...

I expect it to say “OK” at the end of the Loading Device Tree line. Or maybe it’s loaded the device tree and the kernel has failed. Ideas?

In my experience when the kernel prints nothing it’s usually either a problem with the device tree, or earlycon doesn’t work (the command line doesn’t make it to the kernel, or the correct EARLYCON setting isn’t configured for the kernel build). There is no “Starting kernel…” so it might not even get that far.

What looks off to me is the “Loading Device Tree” to some high address instead of “Using Device Tree in place”, which it does for the pre-built image:

Moving Image from 0x84000000 to 0x80200000, end=810ea000
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Using Device Tree in place at 0000000088000000, end 000000008800591c
Starting kernel ...
[    0.000000] Linux version 5.12.4-00023-gacbba4528260 (…) (gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #4 SMP Thu Jul 29 15:
26:21 UTC 2021

(also append in your kernel command line looks out of place, and earlyprintk doesn’t exist for RISC-V, but I doubt it can cause this problem.)

Thanks, that’s a lot of useful information. I think I’ll have to look into the u-boot code for why it would load the device tree to a high address.

Got it working by adding this line:

setenv fdt_high 0xffffffffffffffff


1 Like

I’ve just updated my u-boot from 2021.01 to 2021.07 (both with sifive’s pactches of course) and now have the same issue.
Did you place the setenv line in extlinux.conf or should it go somewhere else?

It should be in u-boot/include/configs/sifive-unmatched.h in the CONFIG_EXTRA_ENV_SETTINGS #define.

It used to be there in the previous v2021.01 version where the file was named sifive-hifive-unmatched-fu740.h.

In fact, two lines are missing.

 	"fdt_high=0xffffffffffffffff\0" \
 	"initrd_high=0xffffffffffffffff\0" \

@davidlt Is this a bug or intentional?

Thanks @drmpeg, i added the lines and it works :slightly_smiling_face: