Question

what is Device Tree in Linux ? what is the Advantages and Disadvantages of Device Tree?

If anyone know Device Tree in details ,Please help answering above questions .

Was it helpful?

Solution

The device tree is a description of hardware components in a system, here is the list of device tree files in linux for the arm arch:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts?id=refs/tags/v3.10

From here:

http://devicetree.org/Device_Tree_Usage

The device tree is a simple tree structure of nodes and properties. Properties are key-value pairs, and node may contain both properties and child nodes

The nodes of the tree describe parameters that the linux kernel, or other software systems like u-boot, uses to init hardware.

Some of the advantages include:

  1. Simple to change the configuration of the system without having to recompile any source code.
  2. Can easily add support for new hardware (for example if you have a new rev of a board which only changes some minor components, you may be able to run the same software load as previous revs of the board, with only small changes to the .dts file on the new board...)
  3. Can reuse existing .dts files with include statements, and can override previously defined functionality. For example if you include a dtsi (device tree include file) that defines a hardware component, but has it disabled, then you can just create a new node in your higher level dts file that does nothing but enable that component.
  4. They (can) provide easy to read and understand descriptions of the hardware, and can give hardware components descriptive names.

Some of the disadvantages includes:

  1. Not so easy to write a new .dts file, because it requires very detailed knowledge of the hardware.
  2. Even if you know all the details of the hardware it may be hard to figure out the exact syntax to use to express what you want to do... (i.e. the documentation is lacking in many respects)

For me writing a .dts file is almost 100% trial and error, pulling examples from other .dts files and see what it does and if it gets closer to what I want... Often times the examples are all I have to work with, and there isn't much in the way of an explanation of what is going on.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top