
Hi E Shattow,
Thanks for the quick response.
On Thu, 13 Jun 2024 at 01:12, E Shattow lucent@gmail.com wrote:
Correct, this is a limitation and the fix is not yet released with U-Boot; It is now queued up for U-Boot -next, but only for EFI bootmanager (not the global EFI boot).
Do you have a link to the relevant commit/patches for me to try?
What is the correct location for the .dtb file when using UEFI?
In theory you could just load it from the target Linux OS root filesystem at /usr/lib/linux-image-... but when I try this there's no support to read that filesystem within EFI bootmanager; the files referenced by EFI bootmanager are however accessible if on the EFI System Partition. Perhaps I am missing some option to support loading from partitions other than the EFI System Partition but I don't know how.
That is actually a useful suggestion. With the Ubuntu I have booting the ESP is mounted at /boot/efi so it should be possible to get it to place the DTB files on the FAT partition. However I don't think this will work with the "off the shelf" USB Ubuntu/Debian installer images as I think the DTBs are only in the rootfs not the ESP.
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.
U-Boot has its own internal FDT (firmware devicetree) which you note may or may not work well enough to boot Linux kernel and have a working OS userspace. It is ambiguous if a Linux OS kernel dtb of a specific board hardware target belongs in any of NAND or NOR flash since they tend to be tied to specific versions of the Linux kernel, as things are today. There's no consensus that I've read anywhere on how this should be done - again not specific to U-Boot.
I can just say from experience that if it would be able to be loaded from the same rootfs that the Linux kernel resides then there is still the trouble of not knowing which exact Linux kernel version that the user will decide to load that boot cycle.
This does seem like a sensible idea as the DTS files do seem to be very specific to the kernels/drivers they are built against, which is noticeable when comparing the DTS files from the Mediatek SDK or OpenWRT to the in-tree Linux file. I guess in the x86 world with ACPI things are far more standardised.
The reason I had thought about bundling the DTS with the boot loader was due to my familiarity of that x86 way of thinking where one firmware image can boot multiple OS no problem.
I did some more reading up on FIT files and realised that it provides a way to tell U-boot where to load the files. I wonder if it can be used for just loading the device tree (and potentially any overlays) to the right place for the EFI boot manager to find it.
So it seems like these are my potential options: - put DTB file on EFS FAT partition - needs U-boot next patches and might not work with USB installer stick, but should work once OS is installed. However I am not sure if the partition should be pre-provisioned or if the Ubuntu/Debian installers will reformat the partition or leave it alone. - get U-boot EFI manager to read DTB file from rootfs or add script to do that - might work with USB installer stick if this board's DTB is included - put DTB file somewhere else and possibly use FIT to auto-load it. It could be placed in NOR/NAND chip if that is used to boot, or maybe even one of the eMMC boot partitions so that it is safe from installer reformatting
Thanks, Leith
On Thu, 13 Jun 2024 at 01:12, E Shattow lucent@gmail.com wrote:
Hi Leith,
On Wed, Jun 12, 2024 at 5:50 AM Leith Bade leith@bade.nz wrote:
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.
Correct, this is a limitation and the fix is not yet released with U-Boot; It is now queued up for U-Boot -next, but only for EFI bootmanager (not the global EFI boot).
What is the correct location for the .dtb file when using UEFI?
In theory you could just load it from the target Linux OS root filesystem at /usr/lib/linux-image-... but when I try this there's no support to read that filesystem within EFI bootmanager; the files referenced by EFI bootmanager are however accessible if on the EFI System Partition. Perhaps I am missing some option to support loading from partitions other than the EFI System Partition but I don't know how.
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.
U-Boot has its own internal FDT (firmware devicetree) which you note may or may not work well enough to boot Linux kernel and have a working OS userspace. It is ambiguous if a Linux OS kernel dtb of a specific board hardware target belongs in any of NAND or NOR flash since they tend to be tied to specific versions of the Linux kernel, as things are today. There's no consensus that I've read anywhere on how this should be done - again not specific to U-Boot.
I can just say from experience that if it would be able to be loaded from the same rootfs that the Linux kernel resides then there is still the trouble of not knowing which exact Linux kernel version that the user will decide to load that boot cycle.
Thanks, Leith Bade leith@bade.nz
-E Shattow