Decompiling the Linux Device Tree (DTB)

One of the things I find very frustrating when working with device trees is that often the entries are split over several different files.

This is great when you want to support several different boards that are only differ slightly – you can have common blocks and just include them into the main file.

Also, there are times you want to be able to compare the DTB of a working system to see what the differences are.

So, if all you have the the DTB’s and don’t necessarily have access to the source, the Device Tree compiler can also decompile a DTB into a DTS file.

The first thing you will need is the Device Tree compiler. On Debian based systems (Debian, Ubuntu, etc) you can install it with:

sudo apt-get install device-tree-compiler

Then you can decompile the Device Tree binary with:

dtc -I dtb -O dts <your DTB> -o <dts filename>


dtc -I dtb -O dts working.dtb -o /tmp/my_device_tree.dts

Now you have access to the plain text Device Tree source.