Menu Close

Device Tree Parsing During Kernel Boot

This article talks about the parsing of the device tree during kernel boot.

For related subjects, please refer to the SOC Table of Contents.


The parsing process of the DTB file by the kernel follows the following process and hierarchy:

  1. start_kernel()
  2. setup_arch()
  3. unflatten_device_tree()
  4. _unflatten_device_tree()
  5. unflatten_dt_node()
  6. Parse each node of the DTB file

We can see that the start_kernel function handles the parsing of the device tree nodes, and the actual function that parses it is the unflatten_dt_node() function. When the Linux kernel boots up, it would parse the information of each node, and create different folders under the root file directory /proc/device-tree, as can be seen below:

Note that each folder is a child node of the root node, such as “aliases”, “cpus”, “chosen”, and “amba”. We can see that the root node properties are expressed as individual files, such as “#address-cells”, “#size-cells”, “compatible”, and “name”. We can use the cat command to view its contents. As an example, we will look at “compatible”.

We can see that its content is “xlnx,zynq-7000”. This matches with the root node’s compatible property value in the file zynq-7000.dtsi. Recall that the /proc/device-tree directory is the device tree representation in the root file system and is organized according to the tree structure. We can see amba’s child nodes by going into /proc/device-tree/amba.


Posted in Textbook and Training Project

Related Articles

Leave a Reply

Your email address will not be published.

Leave the field below empty!