[Raspberry-Pi-3b][aarch64]DTB from Firmware or Uboot?

Discussion about U-Boot and the kernel.

[Raspberry-Pi-3b][aarch64]DTB from Firmware or Uboot?

Postby apokalypz » Sat Jun 13, 2020 12:22 am

What is the recommended way to pull in the DTB device-tree (and overlays) while using uboot for loading the aarch64 kernel:
1. Have the Raspberry Pi firmware pass it to uboot (via the uboot variable "fdt_addr") then pass that to the kernel via the booti line.
2. The way it's currently set up: Have uboot load the DTB file itself (into the uboot variable " fdt_addr_r") which is then passed to the kernel via booti line.

The reason I ask is because with the way it currently is, you can't use config.txt to load overlays and set dtparams. This is because uboot is ignoring the resulting DTB that the Pi firmware makes from the config.txt (with the dtparams and overlays and such). Because of this, you can't load overlays or set dtparams. If anyone has an explanation, I'd appreciate it, thanks.

EDIT: I guess you can technically load overlays via uboot, but it's a little more messy than using config.txt. it involves loading both the base DTB and the overlay into different variables and applying the overlay over the base and passing it to the kernel. You have to be careful with sizing and the offset and stuff. It is much easier to use config.txt
apokalypz
 
Posts: 41
Joined: Sun Apr 06, 2014 6:13 pm

Re: [Raspberry-Pi-3b][aarch64]DTB from Firmware or Uboot?

Postby sdrik » Wed Jun 17, 2020 7:17 pm

As the author of the fdt_addr code in uboot I'm most probably biased, but I would definitely recommend on passing the dtb from the firmware to uboot and then to the kernel. The whole point of this feature is precisely to allow configuring overlays in config.txt and kernel options in cmdline.txt.

Here is a minimal example uboot script that makes use of it:

fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs && fatload mmc 0:1 ${kernel_addr_r} ${kernel_file} && fatload mmc 0:1 ${ramdisk_addr_r} initramfs-linux.img && bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr}
sdrik
 
Posts: 4
Joined: Wed Jun 17, 2020 6:57 pm

Re: [Raspberry-Pi-3b][aarch64]DTB from Firmware or Uboot?

Postby apokalypz » Wed Jun 24, 2020 11:34 pm

@sdrik: I definitely agree, this way uboot is just another link in the chain as ALL DT info would come exclusively from the firmware. It keeps things nice and neat. Also, thank you for the work you put into the project. I, for one, am getting a lot of use out of that particular feature.

So, assuming The Powers that Be visit this particular subforum, may I recommend a change to the raspberry pi uboot package to omit the DTB line and instead use fdt_addr instead of fdt_addr_r on the boot line(s) in boot.txt. Or, just add this info to the wiki so people know why their overlays won't load with the raspberry pi chained with uboot. Thank you.
apokalypz
 
Posts: 41
Joined: Sun Apr 06, 2014 6:13 pm

Re: [Raspberry-Pi-3b][aarch64]DTB from Firmware or Uboot?

Postby skinkie » Thu Aug 06, 2020 6:38 pm

Would any of you be able to show a trivial example to apply a disable-bt or disable-wifi?
skinkie
 
Posts: 4
Joined: Fri Jul 24, 2020 9:49 pm

Re: [Raspberry-Pi-3b][aarch64]DTB from Firmware or Uboot?

Postby sdrik » Sat Aug 22, 2020 11:47 am

@skinkie: with the above mentioned line in boot.txt, you can use config.txt for loading overlays the standard way. If your kernel is an upstream kernel instead of a rpi one, you should also include the upstream overlay.

boot.txt:
fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs && fatload mmc 0:1 ${kernel_addr_r} ${kernel_file} && fatload mmc 0:1 ${ramdisk_addr_r} initramfs-linux.img && bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr}

config.txt:
dtoverlay=upstream
dtoverlay=disable-bt
dtoverlay=disable-wifi
sdrik
 
Posts: 4
Joined: Wed Jun 17, 2020 6:57 pm


Return to U-Boot/Kernel

Who is online

Users browsing this forum: No registered users and 11 guests