device tree in u-boot and kernel

Hello,

If I understand correctly, there are 2 separate device tree files:

  1. one in u-boot
  2. and one for kernel.

Is that correct ?

I see that for linux the device tree is built with make dtbs.
Is it build in u-boot as part of the u-boot build command (make) ?

Thank you,
ranran

Things change depending on release. I have not gone through all of the docs on R28.2, but it looks like there are three device trees (where one tree might or might not be merged with another as boot progresses), plus a copy for some sort of new redundancy feature. If you look at “sudo gdisk -l /dev/mmcblk0” and consider partition labels with “dtb” in their names you will see:

...
   6        60065793        60066816   512.0 KiB   0700  bootloader-dtb
   7        60066817        60067840   512.0 KiB   0700  bootloader-dtb_b
  13        60086641        60087640   500.0 KiB   0700  bpmp-fw-dtb
  14        60087641        60088640   500.0 KiB   0700  bpmp-fw-dtb_b
  26        61043009        61044032   512.0 KiB   0700  kernel-dtb
  27        61044033        61045056   512.0 KiB   0700  kernel-dtb_b

Each is filled with a signed device tree. The copies seem to be exact matches, so although six partitions are listed there are only three device trees. From a flash log for a dev kit carrier based flash I see:

Writing partition bootloader-dtb with tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb.encrypt
Writing partition bpmp-fw-dtb with tegra186-a02-bpmp-quill-p3310-1000-c01-00-te770d-ucm2_sigheader.dtb.encrypt
Writing partition kernel-dtb with tegra186-quill-p3310-1000-c03-00-base_sigheader.dtb.encrypt

I’m not positive, but I suspect these (minus the signature which added the “.encrypt” naming) would all be built in a “make dtbs” target for the kernel if the correct config is used (I can’t verify that, it could be wrong). After a make dtbs you might go to the base of the source tree and run this:

tegra186-quill-p3310-1000-c03-00-base*.dtb
tegra186-a02-bpmp-quill-p3310-1000-c01-00-te770d-ucm2*.dtb
tegra186-quill-p3310-1000-c03-00-base*.dtb

ranchu,

I guess you are asking what is the difference of dtb between bootloader and kernel.
Bootloader dtb is loaded and may be modified by cboot and uboot. After that, it is passed to kernel.