Linux device tree in my eyes (overview of two basic specifications)

Source: Internet
Author: User

Overview of the two basic specifications

DTS (device tree syntax, another way of saying device tree source) is a plant-based file that is used in text format for readability and modification. The DTC (device tree compiler) is a small tool that is responsible for converting DTS into a DTB (device tree blob). DTB is a binary form of DTS for use by machines. In use, we first modify the DTS file according to the hardware, and then at compile time through the DTC tool to convert the DTS file to a DTB file, and then burn the DtB file to the machine (such as EMMC, disk and other storage media). When the system starts, fastboot (or a similar startup program, such as Uboot) reads the DTB file into memory before starting the kernel, and jumps to the kernel execution while transmitting the DTB start address to the kernel. The kernel can parse the entire device tree based on the structure of the DTB using the start address. In the overview section I said that the specification of the device tree can be divided into two categories, that is, DTS writing specifications can be divided into two categories, about the DTB structure is not within this range. DtB just for the sake of machine use and the Transformation of DTS (also can be said that DTS is only for the convenience of human use and a description of the DTB, because we this document is for people to see, so our focus is DTS). The content of our chapter is about the first type of specification, and I give him a name called the basic specification.

The device tree is first a tree-shaped structure and is a tree. In addition to the root node, other child nodes have a unique parent node, which can have child nodes and attributes (child nodes can be considered as branches, attributes can be considered as leaves). A property consists of a name and a value (the name is required, but the value is not required, and if it is possible to represent the function we want based on the existence of the attribute, then there is no need to have a value). Below is a DTS fragment we intercepted from the kernel code. "/" indicates the root node. "model =" Newflow am335x nanobone "" is the property below the root node. "CPUs" is a child node of the root node. "cpu0-supply = <&dcdc2_reg>" is a property under the "[email protected]" sub-node. The properties under the node are used to represent the attributes of the node, and the child nodes and parent nodes have a certain dependency. Real hardware can't be such a regular tree structure, so the device tree is just an approximation of what software developers do to describe hardware, not even abstractions.

/ {
Model = "Newflow am335x nanobone";
compatible = "ti,am33xx";

CPUs {
[Email protected] {
Cpu0-supply = <&dcdc2_reg>;
};
};

Memory {
Device_type = "Memory";
Reg = <0x80000000 0x10000000>; /* * MB */
};

LEDs {
compatible = "Gpio-leds";

[Email protected] {
label = "NANOBONE:GREEN:USR1";
Gpios = <&gpio1 5 0>;
Default-state = "Off";
};
};
};

Linux device tree in my eyes (overview of two basic specifications)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.