Jetson/Device Tree

From eLinux.org
< Jetson
Revision as of 05:01, 9 April 2021 by Mike nv (talk | contribs) (Decompiling and compiling the device tree)
Jump to: navigation, search

Testing

Downloading the Device Tree Compiler (DTC)

Considering that you are working on a Ubuntu machine, issue the following commands to set up DTC on the host machine.

    $ sudo apt update
    $ sudo apt install device-tree-compiler

Kernel Device Tree in L4T

You can download the L4T Driver Package (BSP) as well as the Sample Root Filesystem from the L4T Archive. Please select the BSP that matches your device.

More instructions on how to set up L4T can be found in the Quick Start Guide.

The Device Tree Binaries (DTBs) that are presented here are the ones meant for the respective Jetson Developer Kits. For customized carrier boards, these might offer a great starting point and reference.

The referred DTBs can be found under the following path (after uncompressing

    <path_to_L4T>/kernel/dtb

Kernel DTB for Jetson Nano Devkit

[TODO]

Kernel DTB for Jetson Xavier NX Devkit

    tegra194-p3668-all-p3509-0000.dtb

Kernel DTB for Jetson TX2 Devkit

    tegra186-quill-p3310-1000-a00-00-base.dtb

Kernel DTB for Jetson Xavier AGX Devkit

    tegra194-p2888-0001-p2822-0000.dtb

Kernel DTB in the Filesystem

Alternatively, the DTBs can be found under the following paths in the Jetson Filesystem after flashing the device.

    /boot
    /boot/dtb

Jetson bootloader resorts the the extlinux.conf file to determine where to load the DTB from. The file can be found under the following path.

    /boot/extlinux/extlinux.conf

The bootload first looks into the extlinux.conf file for the FDT property. This property determines the location of the DTB in the file system, for example:

    FDT /boot/dtb/tegra194-p3668-all-p3509-0000.dtb

By placing the device tree under the path assigned to the FDT property, the bootloader prioritize the DTB located in the filesystem.

Otherwise, in case the FDT property is not defined in the extlinux.conf file, the bootloader loads the DTB directly from the dedicated partition. For more information, please check the Partition Configuration.

Decompiling and compiling the device tree

To be able to modify and edit the device tree, the DTB need to be decompiled into a source file. For that, you can use the Device Tree Compiler issuing the following command (as an example with the Jetson Xavier NX Devkit DTB file. For other devices, please use the appropriate names)

    $ dtc -I dtb -O dts -o output.dts tegra194-p3668-all-p3509-0000.dtb 

The output.dts file has the source information of the device tree. Open it with your preferred text editor to modify its contents.

    $ gedit output.dts

After modifying the source, you need to recompile the source into binary to be able to flash/load the device tree.

    $ dtc -I dts -O dtb -o tegra194-p3668-all-p3509-0000.dtb output.dts

Flashing the DTB to its partition

For devices equipped with an eMMC, you can flash the device tree directly to its partition by issuing the following command.

    $ sudo ./flash.sh -k <partition_name> [--image <image_name>] <board> <rootdev>

For example on the Jetson Xavier AGX, the kernel DTB can be flashed with the following command (having the newly modified DTB in the default path in L4T, as described previously).

    $ sudo ./flash.sh -k kernel-dtb jetson-xavier mmcblk0p1

Flashing the DTB with DD utility

TODO