what is Device Tree in Linux ? what is the Advantages and Disadvantages of Device Tree?
什么是Linux中的设备树?设备树的优点和缺点是什么?
If anyone know Device Tree in details ,Please help answering above questions .
如果有人详细了解设备树,请帮助回答上述问题。
1 个解决方案
#1
15
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:
设备树是系统中硬件组件的描述,这里是linux中用于arm arch的设备树文件列表:
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.
树的节点描述了linux内核或其他软件系统(如u-boot)用于初始化硬件的参数。
Some of the advantages include:
一些优点包括:
- Simple to change the configuration of the system without having to recompile any source code.
- 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...)
- 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.
- They (can) provide easy to read and understand descriptions of the hardware, and can give hardware components descriptive names.
无需重新编译任何源代码即可轻松更改系统配置。
可以轻松添加对新硬件的支持(例如,如果你有一个只更换一些次要组件的电路板的新版本,你可能能够运行与以前的电路板转速相同的软件负载,只需对其进行少量更改。新板上的dts文件......)
可以使用include语句重用现有的.dts文件,并可以覆盖以前定义的功能。例如,如果您包含定义硬件组件但已禁用硬件组件的dtsi(设备树包含文件),那么您可以在更高级别的dts文件中创建一个除了启用该组件之外什么都不做的新节点。
它们(可以)提供易于阅读和理解的硬件描述,并且可以为硬件组件提供描述性名称。
Some of the disadvantages includes:
一些缺点包括:
- Not so easy to write a new .dts file, because it requires very detailed knowledge of the hardware.
- 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)
编写新的.dts文件并不容易,因为它需要非常详细的硬件知识。
即使您知道硬件的所有细节,也可能很难弄清楚用于表达您想要做的事情的确切语法...(即文档缺乏许多方面)
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.
对我来说,编写一个.dts文件几乎是100%的试验和错误,从其他.dts文件中提取示例,看看它做了什么以及它是否接近我想要的...通常这些例子都是我必须使用的,并没有太多的解释正在发生的事情。
#1
15
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:
设备树是系统中硬件组件的描述,这里是linux中用于arm arch的设备树文件列表:
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.
树的节点描述了linux内核或其他软件系统(如u-boot)用于初始化硬件的参数。
Some of the advantages include:
一些优点包括:
- Simple to change the configuration of the system without having to recompile any source code.
- 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...)
- 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.
- They (can) provide easy to read and understand descriptions of the hardware, and can give hardware components descriptive names.
无需重新编译任何源代码即可轻松更改系统配置。
可以轻松添加对新硬件的支持(例如,如果你有一个只更换一些次要组件的电路板的新版本,你可能能够运行与以前的电路板转速相同的软件负载,只需对其进行少量更改。新板上的dts文件......)
可以使用include语句重用现有的.dts文件,并可以覆盖以前定义的功能。例如,如果您包含定义硬件组件但已禁用硬件组件的dtsi(设备树包含文件),那么您可以在更高级别的dts文件中创建一个除了启用该组件之外什么都不做的新节点。
它们(可以)提供易于阅读和理解的硬件描述,并且可以为硬件组件提供描述性名称。
Some of the disadvantages includes:
一些缺点包括:
- Not so easy to write a new .dts file, because it requires very detailed knowledge of the hardware.
- 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)
编写新的.dts文件并不容易,因为它需要非常详细的硬件知识。
即使您知道硬件的所有细节,也可能很难弄清楚用于表达您想要做的事情的确切语法...(即文档缺乏许多方面)
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.
对我来说,编写一个.dts文件几乎是100%的试验和错误,从其他.dts文件中提取示例,看看它做了什么以及它是否接近我想要的...通常这些例子都是我必须使用的,并没有太多的解释正在发生的事情。