What is device tree and why does Linux use it?
A device tree is a data structure (a tree of nodes and properties) that describes the hardware on a board — which peripherals exist, what addresses and interrupts they use, how they are connected, and what compatible drivers should handle them. The device tree source (.dts) is compiled into a device tree blob (.dtb) that the bootloader passes to the kernel at boot.
Linux uses device tree because embedded hardware is not self-describing. On a PC, buses like PCI and USB support enumeration — the OS can query each device for its identity. But on an embedded SoC, most peripherals sit on non-enumerable buses (the platform bus, memory-mapped I/O). Without device tree, the kernel would need hard-coded C structures describing every board variant — the old ARM "board file" approach, which became unmaintainable as hundreds of SoCs and boards proliferated.
Device tree separates hardware description from driver code. The same UART driver works across dozens of SoCs because each board's .dts specifies the UART's register address, interrupt number, and clock. This also means a single kernel binary can boot on multiple boards by simply swapping the DTB. Device tree overlays extend this further, allowing runtime hardware description changes — for example, describing an add-on board (like a Raspberry Pi HAT) without recompiling the base DTB.
Source: Embedded Linux Q&A
