Skip to main content

Device Trees

Geoffrey Hunter Author

Converting From Binary (.dtb) To Human-Readable (.dts) Device Tree Files

Yocto normally produces .dtb (Device Tree Blob) files when you are building an image. These are in a binary format. While this format is great for loading onto your target system, it's not very good for developing/debugging. Luckily, you can convert a Device Tree Blob (.dtb) file back into a human-readable Device Tree Source (.dts) file.

The program that can do this is called dtc (Device Tree Compiler). This program is downloaded when you perform a Yocto build and should be in the /usr/bin/ folder within the host sysroot directory (e.g. build/tmp/sysroots/x86_64-linux/).

The following command converts the device tree blob file devicetree.dtb into a human-readable device tree source file (devicetree.dts):

$ build/tmp/sysroots/x86_64-linux/usr/bin/dtc -I dtb -O dts -o devicetree.dts devicetree.dtb

This .dts file is much more useful to a developer than the .dtb file, and can be inspected to make sure the Yocto build is configured correctly!

A comparison between the Yocto generated binary Device Tree Blob (.dtb) file and the human-readable Device Tree Source (.dts) file that can be created from the .dtb file using the program dtc.