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  uint32          propCount
   4  uint32          childrenCount
   8  DTreeNodeProp[] props
????  DTreeNode[]     children
}

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