dts with #include ".dtsi" will not compile

Hi All

I have a flat dts file taken from the dtb file and it will re-compile just fine with a command like

dtc -I dts -O dtb bb.dts > test.dtb

however if I edit the bb.dts file to use an include line like

#include “foo.dtsi”

I get an error “FATAL ERROR: Unable to parse input tree”. This happens no matter where I put the include line or whatever is in the .dtsi file (including only comments). The dtc version is Version: DTC 1.4.0-gf345d9e4

My understanding is that this include should work. Is there a special version of dtc for this or something else I am missing?


I am still struggling with this. If you can compile a dts file with a #include tag (for example the 3.14 kernel dts files) can you please tell me the dtc compiler version you are using (dtc -version) and the command line that works.

All I ever get is a “FATAL ERROR: Unable to parse input tree” error and I am really struggling with this.

Your assistance is much appreciated.

DTC src/arm/am335x-boneblack-base.dtb
  DTC src/arm/am335x-bone-4dcape-70t.dtb
  DTC src/arm/am437x-gp-evm.dtb
  DTC src/arm/am335x-bone-lcd7-01-00a3.dtb
  DTC src/arm/am335x-bone-can1.dtb
  DTC src/arm/am335x-bone-lcd4-01-00a1.dtb
  DTC src/arm/omap3-overo-storm-tobi.dtb
  DTC src/arm/am437x-sk-evm.dtb
  DTC src/arm/am335x-boneblack-audio-reva.dtb
  DTC src/arm/am335x-boneblack-ttyO2.dtb
  DTC src/arm/am335x-bone-audio-revb.dtb
  DTC src/arm/dra72-evm.dtb
  DTC src/arm/omap3-evm.dtb
  DTC src/arm/am335x-boneblack-rtc-01-00a1.dtb
  DTC src/arm/am3517-evm.dtb
  DTC src/arm/omap4-panda-es.dtb
  DTC src/arm/am335x-boneblack-bbb-exp-c.dtb
  DTC src/arm/dra7-evm.dtb
voodoo@hades:/opt/github/dtb-rebuilder$ cat
src/arm/am335x-boneblack-base.dts | grep include
#include "am33xx.dtsi"
#include "am335x-bone-common.dtsi"
#include "am335x-bone-common-pinmux.dtsi"
#include "am335x-boneblack-emmc.dtsi"
#include "am335x-boneblack-nxp-hdmi-audio.dtsi"
voodoo@hades:/opt/github/dtb-rebuilder$ dtc --version
Version: DTC 1.4.0-gf345d9e4


Thank you.

My dtc compiler version is exactly the same - not surprising since I am using your version installed as described on https://eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-Upgradedistro%22device-tree-compiler%22package

So it must be the command line. What is in the DTC script. Can you please “cat DTC” for me.

No doubt I am missing something simple.

Much appreciated.




Thanks. I think I now have a pretty good idea on what happens when a device tree .dts file with .dtsi includes is compiled. I am posting a summary here so others (if any) searching on this error message may find it.

The Makefile is basically running three commands - not one. To compile the dts file src/arm/am335x-boneblack.dts the following commands are generated:

cpp -Wp,-MD,src/arm/.am335x-boneblack.dtb.d.pre.tmp -nostdinc -Iinclude -Isrc/arm -Itestcase-data -undef -D__DTS__ -x assembler-with-cpp -o src/arm/.am335x-boneblack.dtb.dts.tmp src/arm/am335x-boneblack.dts ;

dtc -O dtb -o src/arm/am335x-boneblack.dtb -b 0 -i src/arm -d src/arm/.am335x-boneblack.dtb.d.dtc.tmp src/arm/.am335x-boneblack.dtb.dts.tmp ;

cat src/arm/.am335x-boneblack.dtb.d.pre.tmp src/arm/.am335x-boneblack.dtb.d.dtc.tmp > src/arm/.am335x-boneblack.dtb.d


It seems the device tree compiler has no native ability to cope with includes and so cpp is pressed into service to resolve the chains of included .dtsi files. The upshot is that the first command (cpp…) ultimately outputs a file named src/arm/.am335x-boneblack.dtb.dts.tmp which is essentially the original src/arm/am335x-boneblack.dts with all the includes recursively resolved. It also outputs a dependency file.

The second line calls dtc on the now flattened .dts source in ``src/arm``/.am335x-boneblack.dtb.dts.tmp file and creates the src/arm/am335x-boneblack.dtb device tree binary and another dependency file. The third line concatenates the dependency files from the first two steps - why it does this I do not know. Maybe just documentation. There is also a .am335x-bone-base.dtb.cmd file output by the makefile which contains the above commands and some of the dependencies.