Device Tree Cheatsheet
Quick reference for Device Tree syntax (.dts / .dtsi / .dtbo), dtc commands, and inspecting live hardware nodes on Linux.
Basic Structure (.dts / .dtsi)
/dts-v1/;
#include "soc-base.dtsi"
/ {
model = "Custom Embedded Board";
compatible = "vendor,custom-board", "vendor,soc-base";
};
&i2c1 {
status = "okay";
clock-frequency = <400000>;
sensor@48 {
compatible = "ti,tmp102";
reg = <0x48>;
};
};
.dtsi: Shared SoC-level include file..dts: Board-specific file (overrides.dtsinodes via&label { ... };)..dtb: Compiled binary blob passed to the Linux kernel at boot..dtbo: Device Tree Overlay for enabling/modifying peripherals without editing the base DTB.
Compiling & Decompiling with dtc
# Compile .dts -> .dtb
dtc -I dts -O dtb -o board.dtb board.dts
# Compile Overlay (.dtso -> .dtbo)
dtc -@ -I dts -O dtb -o overlay.dtbo overlay.dtso
# Decompile .dtb -> .dts to inspect the final tree
dtc -I dtb -O dts -o decompiled.dts board.dtb
Inspecting Device Tree on a Running Board
# Check board model and compatible strings
cat /proc/device-tree/model
tr '\0' '\n' < /proc/device-tree/compatible
# Browse active nodes
ls /proc/device-tree/
cat /proc/device-tree/soc/i2c@.../status
# Dump the live Device Tree to a .dts file
dtc -I fs -O dts /sys/firmware/devicetree/base > live.dts
Common Properties
| Property | Purpose |
|---|---|
compatible | Matches a node to its Linux kernel driver ("vendor,device") |
reg | Register base address + size, or I2C/SPI bus address |
status | "okay" (enabled) or "disabled" |
pinctrl-0, pinctrl-names | Pin multiplexing configuration for peripherals |
interrupt-parent, interrupts | IRQ line and trigger type |