# Stuck loading device tree

**URL:** https://forums.sifive.com/t/stuck-loading-device-tree/5022
**Category:** HiFive Unmatched
**Created:** [July 29, 2021, 12:01am UTC](https://forums.sifive.com/t/stuck-loading-device-tree/5022 "2021-07-29T00:01:05Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![mikedilger](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/mikedilger/32/1321_2.png) [@mikedilger](https://forums.sifive.com/u/mikedilger)
#### Post date: [July 29, 2021, 12:01am UTC](https://forums.sifive.com/t/stuck-loading-device-tree/5022/1 "2021-07-29T00:01:05Z")

</div>

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:

```auto
	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!):

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

```

Get the PCI going:

```auto
=> pci enum

```

Get the NVME going:

```auto
=> nvme scan

```

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

```auto
=> 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)

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

```

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

```auto
=> booti 0x84000000 - 0x88000000

```

I get this output, then it freezes:

```auto
   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?

---

<div class="post-metadata">

### Author: ![vmedea](https://avatars.discourse-cdn.com/v4/letter/v/3be4f8/32.png) [@vmedea](https://forums.sifive.com/u/vmedea)
#### Post date: [July 29, 2021, 4:30pm UTC](https://forums.sifive.com/t/stuck-loading-device-tree/5022/2 "2021-07-29T16:30:28Z")

</div>

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:

```auto
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.)

---

<div class="post-metadata">

### Author: ![mikedilger](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/mikedilger/32/1321_2.png) [@mikedilger](https://forums.sifive.com/u/mikedilger)
#### Post date: [July 29, 2021, 8:01pm UTC](https://forums.sifive.com/t/stuck-loading-device-tree/5022/3 "2021-07-29T20:01:45Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mikedilger](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/mikedilger/32/1321_2.png) [@mikedilger](https://forums.sifive.com/u/mikedilger)
#### Post date: [July 29, 2021, 8:43pm UTC](https://forums.sifive.com/t/stuck-loading-device-tree/5022/4 "2021-07-29T20:43:01Z")

</div>

Got it working by adding this line:

```auto
setenv fdt_high 0xffffffffffffffff

```

Thanks.

---

<div class="post-metadata">

### Author: ![pa4wdh](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@pa4wdh](https://forums.sifive.com/u/pa4wdh)
#### Post date: [July 31, 2021, 3:12pm UTC](https://forums.sifive.com/t/stuck-loading-device-tree/5022/5 "2021-07-31T15:12:15Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![drmpeg](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/drmpeg/32/1301_2.png) [@drmpeg](https://forums.sifive.com/u/drmpeg)
#### Post date: [July 31, 2021, 4:16pm UTC](https://forums.sifive.com/t/stuck-loading-device-tree/5022/6 "2021-07-31T16:16:54Z")

</div>

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.

```nohighlight
 	"fdt_high=0xffffffffffffffff\0" \
 	"initrd_high=0xffffffffffffffff\0" \

```

@davidlt Is this a bug or intentional?

---

<div class="post-metadata">

### Author: ![pa4wdh](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@pa4wdh](https://forums.sifive.com/u/pa4wdh)
#### Post date: [August 1, 2021, 9:31am UTC](https://forums.sifive.com/t/stuck-loading-device-tree/5022/7 "2021-08-01T09:31:10Z")

</div>

Thanks @drmpeg, i added the lines and it works 🙂
