Device tree

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

In computing, a device tree (also written devicetree) is a data structure describing the hardware components of a particular computer so that the operating system's kernel can use and manage those components, including the CPU or CPUs, the memory, the buses and the peripherals.

The device tree was derived from SPARC-based workstations and servers via the Open Firmware project. The current Devicetree specification[1] is targeted at smaller systems, but is still used with some server-class systems (for instance, those described by the Power Architecture Platform Reference including some Apple Macintoshes).

Personal computers with the x86 architecture generally do not use device trees, relying instead on various auto configuration protocols to discover hardware. Systems which use device trees usually pass a static device tree (perhaps stored in ROM) to the operating system, but can also generate a device tree in the early stages of booting. As an example, Das U-Boot and kexec can pass a device tree when launching a new operating system. On systems with a boot loader that does not support device trees, a static device tree may be installed along with the operating system; the Linux kernel supports this approach.

The Devicetree specification is currently managed by a community named devicetree.org, which is associated with, among others, Linaro and Arm.

Device Tree formats[edit]

A device tree can hold any kind of data as internally it is a tree of named nodes and properties. Nodes contain properties and child nodes, while properties are name–value pairs.

Device trees have both a binary format for operating systems to use and a textual format for convenient editing and management.[1]

Usage in Linux[edit]

Given the correct device tree, the same compiled kernel can support different hardware configurations within a wider architecture family. The Linux kernel for the Arm, x86, MicroBlaze, PowerPC, and SPARC architectures reads device tree information; on Arm, device trees have been mandatory for all new SoCs since 2012.[2] This can be seen as a remedy to the vast number of forks (of Linux and Das U-boot) that has historically been created to support (marginally) different Arm boards. The purpose is to move a significant part of the hardware description out of the kernel binary, and into the compiled device tree blob, which is handed to the kernel by the boot loader, replacing a range of board-specific C source files and compile-time options in the kernel.[3]

It has been customary for Arm-based Linux distributions to include a boot loader, that necessarily was customised for specific boards, for example Raspberry Pi or Hackberry A10. This has created problems for the creators of Linux distributions as some part of the operating system must be compiled specifically for every board variant, or updated to support new boards. However, some modern SoCs (for example, Freescale i.MX6) have a vendor-provided boot loader with device tree on a separate chip from the operating system.[4]

A proprietary configuration file format used for similar purposes, the FEX file format,[5] is a de facto standard among Allwinner SoCs.

See also[edit]

References[edit]

  1. ^ a b "Devicetree specification" (PDF). Release v0.2. devicetree.org. 20 December 2017.
  2. ^ "ARM soc Linux support checklist" (PDF).
  3. ^ "arm soc linux support checklist" (PDF).
  4. ^ "u-boot update for Boundary Devices' boards".
  5. ^ "Fex Guide". linux-sunxi.org. 2014-05-30. Retrieved 2014-06-12.

External links[edit]