What is the "Device Tree"? Advantages and disadvantages?

What is the Linux device tree? What are the advantages and disadvantages of the device tree?

If anyone knows the device tree in detail, please help answer the questions above.

+6
source share
1 answer

The device tree is a description of the hardware components in the system, here is a list of device tree files in linux for the hand 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

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

The tree nodes describe the parameters that linux kernel or other software systems, such as u-boot, use to initialize the hardware.

Some of the benefits include:

  • Ease of changing system configuration without recompiling any source code.
  • You can easily add support for new hardware (for example, if you have a new rev board that only changes some minor components, you can run the same software download as the previous revolutions of the board, with minor changes to the .dts file on the new board. ..)
  • You can reuse existing .dts files with include statements and can override previously defined functions. For example, if you include a dtsi file (a device tree file) that defines the hardware component, but it is disabled, you can simply create a new node in your higher-level dts file that does nothing but enable this component.
  • They (can) provide easy reading and understanding of hardware descriptions and can give descriptive names for hardware components.

Some of the disadvantages include:

  • It is not so easy to write a new .dts file because it requires a very detailed knowledge of the hardware.
  • Even if you know all the details of the hardware, it can be difficult to determine the exact syntax to use to express what you want to do ... (i.e. the documentation is lacking in many ways)

For me, creating a .dts file is almost a 100% trial and error, pulling examples from other .dts files and looking at what it does, and if it comes close to what I want ... Often examples are all that I have for work, and not many ways to explain what is happening.

+15
source

Source: https://habr.com/ru/post/948604/


All Articles