Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Flattened device tree

From ReverseEngineering.wiki
Format
Magic D0 0D FE ED
Extensions .dtb, .dtbo, .itb
Endianness big
License GPL-2.0+ / BSD-2-Clause (dtc, libfdt)
On this wiki Facts · Code · Notes · Topics

The binary device tree (.dtb, magic D0 0D FE ED, big-endian) that firmware passes to Linux and U-Boot: a 40-byte header, memory reservation map, structure block of BEGIN_NODE/PROP/END_NODE tokens and a strings block.

Header (struct fdt_header, all u32 big-endian)

Offset Field
0 magic 0xd00dfeed
4 totalsize
8 off_dt_struct
12 off_dt_strings
16 off_mem_rsvmap
20 version (17 current)
24 last_comp_version (16)
28 boot_cpuid_phys (version >= 2)
32 size_dt_strings (version >= 3)
36 size_dt_struct (version >= 17)

Header sizes: v1 28 bytes, v2 32, v3 and v16 36, v17 40.

Blocks

  • Memory reservation map at off_mem_rsvmap: pairs of u64 (address, size), ended by a (0,0) pair; 8-byte aligned.
  • Structure block: 4-byte tokens: FDT_BEGIN_NODE 1 (followed by the NUL-terminated node name, padded to 4), FDT_END_NODE 2, FDT_PROP 3 (len u32, nameoff u32 into the strings block, then len bytes of value padded to 4), FDT_NOP 4, FDT_END 9.
  • Strings block: NUL-terminated property names shared by offset.

Property values are untyped bytes: integers are big-endian cells, strings are NUL-terminated, lists (compatible, reg) are concatenations. compatible strings (vendor,model) are the best identification of a board or SoC; reg plus #address-cells/#size-cells give MMIO addresses of peripherals, which is valuable when reversing a firmware or kernel driver.

Tools and containers

dtc -I dtb -O dts file.dtb decompiles, dtc -I dts -O dtb compiles; fdtdump prints. DTBs are embedded appended to kernels (Android Format:Android boot image, some uImage legacy kernels), as the /images of a Format:FIT image, in a legacy Format:U-Boot legacy uImage of type 8, or concatenated in a multi-DTB table. Overlays (.dtbo) have the same header and fragment@N nodes. Scan raw dumps for D0 0D FE ED and check totalsize is plausible.

Sources: dtc libfdt/fdt.h.

Code & repositories

  • https://github.com/dgibson/dtc @ a0335ea04e22f3aa6bfe2dc164960a9d09fe745b · license: GPL-2.0-or-later OR BSD-2-Clause (declared by the contributor; GitHub's detector did not recognize a license file)
    dtc and libfdt: fdt.h defines the binary header and tokens
    Tested on: source read, not run: source read · checked 2026-10-18; last activity 2026-10-14