Linux Device Tree in my eyes (Basic specification overview)

Source: Internet
Author: User

Linux Device Tree in my eyes (Basic specification overview)

Overview of basic specifications

Data transmission (Device tree syntax) is the Device tree source file. To facilitate reading and modification, data transmission uses the text format. DTC (Device tree compiler) is a small tool responsible for converting DTS to DTB (Device tree blob ). DTB is the binary form of DTS for machines. In use, we first modify the DTS file according to the hardware, then convert the DTS file to the DTB file through the DTC tool during compilation, and then burn the DTB file to the machine (such as emmc, disks and other storage media ). During system startup, fastboot (or similar boot program, such as Uboot) reads the DTB file into the memory before starting the kernel, jumps to the kernel execution, and transmits the DTB start address to the kernel. The kernel uses the starting address to parse the entire Device Tree Based on the DTB structure. In the overview section, I said that the specification of the device tree can be divided into two types, that is, the specification of data transmission can be divided into two types. The DTB structure is not in this scope. DTB is only for the convenience of machine use and DTS conversion (it can also be said that DTS is only for the convenience of human use and a description of DTB, because this document is for people to see, so our focus is on DTS ). The content of this chapter is about the first type of norms. I gave him the Basic specification.

The Device Tree is a tree structure and a tree. Each child node except the root node has a unique parent node, which can have subnodes and attributes (child nodes can be regarded as branches and attributes can be regarded as leaves ). An Attribute consists of a name and a value (the name is required, but the value is not required. If the attribute can represent the desired function based on whether the attribute exists, no value is required ). Below is a DTS segment we captured from the kernel code. "/" Indicates the root node. "Model =" Newflow AM335x NanoBone "" is the attribute under the root node. "Cpus" is a subnode of the root node. "Cpu0-supply = <& dcdc2_reg>" is the property under the "cpu @ 0" subnode. Attributes under a node are used to indicate the characteristics of the node. The child node and the parent node have a certain degree of subordination. The real hardware cannot be the tree structure of such a rule. Therefore, the device tree is only an approximate representation made by software developers to describe the hardware, and cannot even be abstracted.

/{
Model = "Newflow AM335x NanoBone ";
Compatible = "ti, am33xx ";

Cpus {
Cpu @ 0 {
Cpu0-supply = <& dcdc2_reg>;
};
};

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

Leds {
Compatible = "gpio-leds ";

Led @ 0 {
Label = "nanobone: green: usr1 ";
Gpios = <& gpio1 5 0>;
Default-state = "off ";
};
};
};

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.