Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Device Tree?Advantages & Disadvantages? [closed]

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 .

like image 720
EnterKEY Avatar asked Jul 03 '13 05:07

EnterKEY


People also ask

What is the purpose of device tree?

A device tree is a tree-structured data format that represents information about the devices on a board. For developing a product with the platform, the device tree data is automatically included in the flashed image.

What is device tree source?

The device tree is a set of text files in the Linux kernel source tree that describe the hardware of a certain platform. They are located at arch/arm/boot/dts/ and can have two extensions: *. dtsi files are device tree source include files.

How does Linux device tree work?

A device tree is a tree data structure that describes the hardware configuration of the system to the Linux operating system. During boot, the Linux kernel will use the information in the device tree to recognize, load appropriate drivers and manage the hardware devices in the system.

What is device tree compiler?

A utility called device tree compiler (DTC) is used to compile the DTS file into a DTB file. DTC is part of the Linux source directory. linux-xlnx/scripts/dtc/ contains the source code for DTC and needs to be compiled in order to be used. One way to compile the DTC is to build the Linux tree.


1 Answers

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.

like image 120
Chris Desjardins Avatar answered Sep 27 '22 21:09

Chris Desjardins