A device tree (also written devicetree) is a hierarchical data structure that describes the hardware of a computer, such as its processors, memory, buses and peripherals, so that an operating system kernel can find and configure devices that cannot announce themselves. In the field of drivers & devices, it is the standard way for operating systems such as Linux, FreeBSD and Zephyr to learn the layout of ARM, RISC-V and PowerPC systems without hard-coding it into the kernel.
The device tree separates the description of a board from the code that drives it. One kernel image can then boot on many different boards, because each board ships a small binary blob that tells the kernel which devices exist, where their registers live and how their interrupts are wired.
Why non-discoverable hardware needs a device tree
A device tree is needed because many buses provide no enumeration mechanism. PCI Express and USB devices report vendor and device identifiers when the system probes them, which is how plug and play works on a typical PC. Peripherals on a system on a chip, by contrast, sit at fixed memory-mapped I/O addresses on internal buses, and an I2C sensor or SPI flash chip has no standard way to announce its presence.
Before device trees became common on ARM around 2011, Linux described each board in C source files called board files. Every new board needed kernel code, the ARM tree grew rapidly, and a single kernel could not support many boards. Moving the description into data solved the problem and is the reason the device tree is now mandatory for new ARM boards in mainline Linux.
The following table compares the main ways an operating system learns about hardware.
| Method | Typical platform | How devices are found | Main strength |
|---|---|---|---|
| Device tree | ARM, RISC-V, PowerPC, embedded | Static description passed by the bootloader | Simple, compact, board-independent kernels |
| ACPI | x86 PCs, ARM servers | Firmware tables with executable AML methods | Power management and runtime methods |
| Bus enumeration | PCI Express, USB | Devices report identifiers when probed | Fully dynamic, no description needed |
| Board files | Legacy ARM Linux | Hard-coded C structures in the kernel | None today, deprecated |
Structure of a device tree
A device tree is a tree of nodes with properties. Each node represents a device or bus, and its child nodes represent devices attached to it. The root node describes the board, and typical top-level children are cpus, memory, chosen for boot parameters and the SoC bus node that contains on-chip peripherals.
Properties are name and value pairs. A small set of standard properties carries most of the information drivers need, as the table shows.
| Property | Meaning | Example value |
|---|---|---|
| compatible | Identifies the device model for driver matching | "vendor,uart-v2" |
| reg | Register address and size on the parent bus | <0x10000000 0x1000> |
| interrupts | Interrupt lines used by the device | <0 33 4> |
| status | Whether the device is enabled | Enabled or "disabled" |
| clocks | References to clock providers | <&clk 12> |
| #address-cells | Number of cells in child addresses | <1> or <2> |
Nodes refer to each other through phandles, numeric handles written with labels such as &gpio1. This is how a device names its interrupt controller, clocks, resets, regulators and pins. The compatible string is the most important property: the kernel compares it with the match tables of registered drivers and binds the first driver that declares the same string.
From source file to running kernel
A device tree passes through a defined build and boot pipeline. Developers write human-readable source, a compiler turns it into a binary, the bootloader loads it into memory and the kernel parses it early during boot.
| Format | Extension | Purpose |
|---|---|---|
| Device tree source | .dts | Board description written by developers |
| Include file | .dtsi | Shared description of an SoC or module |
| Device tree blob | .dtb | Compiled flattened binary loaded at boot |
| Overlay | .dtbo | Fragment that modifies a base tree |
The device tree compiler, dtc, converts source into a flattened device tree (FDT). A bootloader such as U-Boot loads the blob next to the kernel, may patch it with memory size or the boot command line, and passes its address in a register. The kernel then unflattens the tree into in-memory structures, creates platform devices for enabled nodes and lets the driver model match them with drivers. On Linux, the live tree is visible under /proc/device-tree.
Device tree overlays extend this model. An overlay adds or changes nodes at boot or runtime, which is how single-board computers describe add-on boards and expansion hats without editing the base tree.
Bindings and the specification
The format itself is defined by the Devicetree Specification, which grew out of the Open Firmware standard IEEE 1275. The specification fixes the syntax, the blob layout and the generic properties, but it does not say what properties a particular UART or camera needs.
That second layer is defined by bindings, documents that state which properties a given compatible value requires and what they mean. In Linux, bindings are written as YAML schemas and validated with automated tools, so a malformed tree can be caught at build time rather than at boot. A stable binding is treated as an ABI: the kernel should keep accepting older trees, although in practice this guarantee is honored unevenly across vendors.
Common problems and misconceptions
Most device tree problems show up as a driver that never probes or a device that probes with wrong settings. The table lists frequent symptoms and their usual causes.
| Symptom | Likely cause | Fix |
|---|---|---|
| Driver does not load | Mismatched compatible string | Match the string in the driver’s table |
| Device absent | Node has status disabled | Enable the node in the board file |
| No interrupts arrive | Wrong interrupt number or trigger type | Check the SoC manual and interrupt parent |
| Boot hangs early | Wrong memory node or reg values | Verify addresses against the hardware |
- The device tree is not a driver: it only describes hardware, and a driver must still exist in the kernel.
- It does not configure plug-and-play buses in detail: devices on PCI Express or USB are still enumerated dynamically.
- It should describe hardware, not policy: settings such as user preferences belong in user space, not in the tree.
The short version
Some computer parts can introduce themselves when the computer starts, but many small chips on phones and single-board computers cannot. A device tree is like a floor plan handed to the operating system: it lists every part, where it sits and how it is connected.
With this plan, the same operating system can run on many different boards. The map changes from board to board, while the software that reads it stays the same.
Where it makes a difference
An engineer designs an industrial controller around an ARM system on a chip and adds a temperature sensor on the I2C bus at address 0x48, plus a status LED on a GPIO pin. Instead of modifying kernel code, the engineer copies the vendor’s .dtsi file, writes a short .dts file with two new nodes and compiles it with dtc.
At boot, U-Boot loads the stock mainline kernel and the new blob. The kernel matches the sensor node with its existing hwmon driver and the LED node with the GPIO LED driver, and both devices appear in /sys without a single line of driver code. When a later hardware revision moves the sensor to address 0x49, the team changes one value in the tree and ships the same kernel image.