What is dtb?

A Device Tree Blob (DTB) is a data structure used primarily in embedded systems, particularly those using the Linux kernel, to describe the hardware components of a system. It essentially replaces or augments traditional methods of hardware discovery. Instead of the kernel probing for devices, the DTB provides a structured, hierarchical representation of the hardware.

Key aspects of a DTB:

  • Purpose: To provide a self-describing hardware representation to the kernel at boot time, enabling a single kernel image to support various hardware configurations.

  • Structure: The DTB is a binary file containing a flattened device tree. This tree consists of nodes and properties. Each node represents a hardware component (e.g., CPU, memory controller, peripherals), and the properties are key-value pairs that describe characteristics of that component (e.g., address, interrupt number, device type).

  • Source: DTBs are typically created from a Device Tree Source (DTS) file, which is a human-readable text file defining the hardware. The DTS file is then compiled into a DTB using a device tree compiler (dtc).

  • Kernel Use: The bootloader loads the DTB into memory, and the kernel parses it during initialization to configure device drivers and manage system resources.

  • Benefits: DTBs promote code reuse and reduce the need for board-specific kernel modifications. This simplifies kernel maintenance and allows for easier support of new hardware.

  • Related Files: DTS (Device Tree Source) file and DTC (Device Tree Compiler).