DeviceTree

Contents

A device tree (or DeviceTree) is a tree containing information about a device's various ports and peripherals. It is used by bootloaders (iBoot in the case of iOS) to provide the kernel with a map of the hardware. In iOS' case, most nodes in the tree file are empty (null), and are instead populated by iBoot before control is passed over to the kernel (XNU). This file is present in all IPSW files.

Payload Format

Once extracted from the outer container (IMG2, IMG3, or IMG4), the device tree can be dumped. It follows a simple binary tree format that can be described in just three structures (two if you don't count the root node):

DeviceTree {
   0  DTreeNode  root
}

DTreeNode {
   0  u32              propCount
   4  u32              childrenCount
   8  DTreeNodeProp[]  props
????  DTreeNode[]      children
}

DTreeNodeProp {
   0  u8[32]  name
  20  u32     length
  24  u8[]    value    // `length` bytes
????  u8[]    padding  // to a multiple of four bytes
}