Chapter 3: Device Tree
The Device Tree is a structured data configuration that utilizes a text-based language to describe the layout and attributes of non-discoverable, static hardware systems via a hierarchical tree architecture. Originally engineered by Open Firmware, the Device Tree served as a foundational data-passing interface between the low-level Open Firmware interface and guest application software (the operating system kernel). Mainline Linux officially integrated Device Tree support starting with kernel version 3.5.7.
Prior to the adoption of the Device Tree architecture, platform-specific hardware details were hardcoded directly into the Linux kernel source code as C structures. These board files were compiled alongside the generic kernel code into a monolithic binary image, which was subsequently loaded into memory by U-BOOT during the system initialization sequence. Because Linux targets a vast taxonomy of disparate hardware platforms and vendors, managing thousands of board-specific configuration files created a massive maintenance burden for kernel developers; even a minor adjustment to a peripheral property necessitated a complete recompilation of the entire kernel binary. Furthermore, to adapt to subtle hardware variations, U-BOOT had to pass an excessively large array of parameter vectors to the Linux kernel via the bootargs variable.
The introduction of the Device Tree fundamentally revolutionized this paradigm. By decoupling the hardware abstraction layer from the operating system core, the hardware configuration and the Linux kernel executable now reside in two completely independent files. The hardware topography is compiled into a standalone binary blob file suffixed with .dtb (Device Tree Blob), while the executable kernel routines are stored within separate uImage, zImage, or FIT image structures.
Because the exhaustive layout of the platform's hardware components is encapsulated within the compiled Device Tree blob, U-BOOT no longer needs to pass a long list of hardware descriptors to the Linux kernel. Instead, the bootloader simply tracks the destination address where the .dtb payload resides in physical RAM and passes this memory reference pointer directly to the kernel upon execution. U-BOOT implements this handover by writing the blob's starting memory address into register r3 on PowerPC architectures, or register r2 on ARM and other processor architectures.
An additional architectural advantage of this dual-file decoupling occurs during hardware updates or peripheral tuning: when integrating a new device or modifying existing board parameters, a developer only needs to implement the specific device driver, update the target text file, and compile it down to a new .dtb binary. The core Linux kernel image remains entirely untouched and does not require recompilation.
The Linux kernel leverages the Device Tree abstraction layer to execute three primary system-level routines:
-
Hardware Platform Identification: Verifying the exact board vendor and SoC model.
-
Dynamic Hardware Configuration: Parsing baseline peripheral properties to initialize low-level clocks, interrupt controllers, and pin-multiplexing matrices.
-
Device Driver Binding and Loading: Matching structural device definitions to their corresponding driver modules.