Automotive Hardware · Low-level software
Device Tree
Also known as devicetree, DT, DTS, DTB, flattened device tree (FDT)
A data structure, written as source (.dts) and compiled to a binary blob (.dtb), that describes a board's non-discoverable hardware, such as memory, buses, peripherals, interrupts and clocks, so the OS kernel can configure itself without hard-coded board details.
Explanation
The Linux kernel documentation stresses that a device tree is simply a data structure that describes hardware. It originated with Open Firmware; the flattened binary form (FDT) lets bootloaders such as U-Boot pass a device tree blob to the kernel. It is used on Arm, PowerPC and other architectures, including most Arm-based automotive SoCs running Linux. The format is defined by the Devicetree Specification published at devicetree.org (latest release v0.4, June 2023).
The tree consists of named nodes with properties. The compatible property lists strings, from most to least specific, that the kernel matches against drivers; bindings document which properties each device type expects. Board files typically include an SoC-level .dtsi and add board-specific nodes, and overlays can modify the tree for optional hardware.
A device tree describes hardware, not software policy. Errors such as wrong interrupt numbers, clocks or regulators make drivers fail or misbehave, so device trees should be checked against the documented bindings.
How it works
Developers write .dts and .dtsi files, compile them with the device tree compiler into a .dtb and install it with the kernel. The bootloader loads the blob, may patch it (memory size, boot arguments in the /chosen node) and passes its address to the kernel. Early boot code reads the memory and /chosen nodes; the kernel then unflattens the tree, creates devices and binds drivers by compatible string.
Automotive applications
- Describing custom ECU boards built on a common SoC
- Enabling camera, CAN and Ethernet peripherals in Linux
- Supporting board variants with overlays
- Passing boot arguments and memory layout
Example
An ECU board adds two CAN FD controllers and a camera deserialiser on I2C. The engineer adds nodes to the board .dts with the correct compatible strings, register addresses, interrupts, clocks and regulators; the kernel then probes the existing drivers without any driver code changes.
An illustrative example: any figures in it are worked numbers, not measurements.
References
- Linux and the Devicetree (opens in a new tab)
“The most important thing to understand is that the DT is simply a data structure that describes the hardware.”
- Devicetree Specification releases (opens in a new tab)
Definitions are original summaries. Standards text is not reproduced; follow the links for the official publications.