Device Tree Overlay (DTO) extends
Flattened Device Tree (FDT) implementations by enabling
userspace to modify the initial devicetree data in the kernel at runtime by
loading additional overlay FDTs that amend the original data. Android doesn't
require runtime updates of DT blobs from userspace, but instead recommends
that vendors add the devicetree patching in the bootloader with the help of
Android DTO support
Android support for DTOs varies by Android release:
- Android 7.x and earlier don't require devicetree support and don't provide recommendations for how vendors pass DT blobs to the kernel or where they store them.
- Android 8.x recommends devicetree support to keep the board-specific and SoC-only parts of the kernel separate.
- Android 9 and higher require a device tree blob overlay (DTBO) partition to be present and at least one DTO to be applied.
DTO partitioning requirements
Most Android devices append the DT blob to the kernel at build time and the bootloader loads the blob from the kernel. However, because DT blobs are considered part of the system-on-chip (SoC) kernel, Android has no specific requirements for how to build or store DT blobs. Devices can append the DT blob to the kernel or store the blob in a separate partition; the only requirement is that the bootloader knows how and where to load the DT blob from.
To support DTO, devices should have:
- One DTBO partition per kernel image for a board-specific DT overlay and the bootloader must know where and how to load the SoC-specific DTB. The partition size depends on the number of changes needed to make the SoC kernel—choose a size with room to grow for future updates; typically, an 8 MB partition size is more than enough.
- DTO partitions updated for A/B devices. The recovery kernel is the same as the Android kernel, but the partition must be set up for A/B devices so it can be updated via over-the-air (OTA) updates. The partition size depends on the device and the number of changes on top of the main SoC kernel DT blob.
DTO bootloader requirements
To support DTO, bootloader should:
- Know how and where (considering the boot slot for A/B devices) to load the SoC-specific DT blob in a vendor-specific way (typically extracted from the end of the kernel image as blobs are appended to the kernel).
- Know how and where to load the overlay DT blob from in a vendor-specific way.
- Patch the main DT blob with the overlay before passing the combined device tree to the kernel.
For more details about adding support for DTO in bootloader, see Device Tree Overlays.