Using Multiple DTs

Many SoC vendors and ODMs support the use of multiple DTs on a device, enabling one image to power multiple SKUs/configurations. In such cases, the bootloader identifies the hardware and loads the corresponding DT at runtime:

Figure 1. Multiple device trees overlay in bootloader.

Note: Using multiple DTs is not mandatory.

Setting up

To add support for multiple DTs to the DTO model, set up a list of main DTs and another list of overlay DTs.

Figure 2. Runtime DTO implementation for multiple DTs.

The bootloader should be able to:

  • read the SoC ID and select the main DT correspondingly, and
  • read the board ID and select the overlay DT accordingly.

Only one main DT and one overlay DT are selected for use at runtime, and the selected pair must be compatible.

Partitioning

To partition, determine a bootloader runtime-accessible and trusted location in flash memory to store the DTBs and DTBOs (bootloader must be able to locate these files in the matching process). Keep in mind that DTBs and DTBOs can not exist in the same partition. If your DTBs/DTBOs are in the dtb/dtbo partition, use the table structure and header format detailed in DTB/DTBO Partition Format.

Running in bootloader

To run:

  1. Identify the SoC and load the corresponding .dtb from storage into memory.
  2. Identify the board and load the corresponding .dtbo from storage into memory.
  3. Overlay the .dtb with the .dtbo to be a merged DT.
  4. Start kernel given the memory address of the merged DT.