Where to put DTB file for UEFI support on ARM
Leith Bade
leith at bade.nz
Wed Jun 12 13:49:45 CEST 2024
Hi all,
I have a BananaPi BPI-R3 board that I am setting up to boot Ubuntu or
Debian. After figuring out the required config options I have managed to
get Uboot to boot the Ubuntu USB installer, and also boot off an SD card
once I installed Ubuntu there.
I set up the bootmeth/bootdev/bootflow stuff so that the auto boot menu
works nicely with SD card. For USB I have to drop to console and do manual
"usb start" etc, but good enough for running the installer. It was a bit
difficult as there seems to be a lot of older documentation or Google
results related to using UEFI before the bootflow stuff was added. Also it
took me a while to figure out that a board/mediatek/mt7986.env file is now
needed as some of the config options set #define values that are not
included in /include/configs/mt7986.h board headers - due to .env files
replacing those #defines. It would be nice to have a default .env file for
this board that sets sensible defaults for the various memory loading
addresses as it took a bit of effort to come up with all the hex values.
However I am struggling to work out where to place the device tree DTB file
for the Linux kernel. For this board I need a different DTB for
U-boot (which is included in the u-boot.bin and fip.bin) and the kernel as
U-boot's drivers do not like the Linux upstream device tree.
I can see in the UEFI bootmeth code that it searches a location /dtb/ for a
file named in the $fdtfile environment variable. I tried putting the .dtb
file at /dtb/mt7986a-bananapi-bpi-r3.dtb on the SD card's FAT32 partition
that Ubuntu created, however it doesn't seem to load this and the U-boot
boots with the u-boot.bin DTB which means kernel doesn't start If I
manually load the correct .dtb file to $fdt_addr_r then the correct DTB is
used and the kernel starts.
What is the correct location for the .dtb file when using UEFI?
Is there a recommended way of putting the kernel DTB into the NAND or NOR
chip when using UEFI? That way if the SD card gets wiped U-boot can still
boot the USB drive. I don't fully understand how the MTD partitions, FIT
files, UBI files all fit into the picture to have U-boot load the kernel
DTB from flash.
Thanks,
Leith Bade
leith at bade.nz
More information about the U-Boot
mailing list