2

We have got armv7 (freescale IMx6DL) board, for which we have ported arch Linux. after building iuf we see our .dts file it doesn't include all peripheral, buses etc.

Can anybody tell us how to generate .dtb (device tree blob) if we have dts(source) file. Makefile given is not working separately. the dtb files are generated while building.

can we generate dtb file separately if we have dts file.

4

Yes, anything the Makefile does you can do by hand. In the case of kernel device tree sources, they use C preprocessor commands even though the device tree language and compiler don't support them.

What the kernel does, and you must do also, is to pass the device tree source through the C preprocessor and device tree compiler in sequence, like this:

cpp -Iinclude -E -P -x assembler-with-cpp imx6dl-boardname.dts | dtc -I dts -O dtb -o imx6dl-boardname.dtb -

(This is the command I use myself, with the obvious note that boardname is changed to reflect my hardware -- I pieced it together from Makefile rules and preprocessor error messages)

Preprocessor arguments:

  • -Iinclude The kernel device tree sources mostly #include <dt-bindings/interrupt-controller/irq.h> which is a path relative to arch/arm/boot/dts/include.

  • -E means preprocess only, not sure if that's needed when using the cpp command

  • -P disables source line number comments, which confuse the device tree compiler

  • -x assembler-with-cpp forces the preprocessor to run in a certain language mode, which I suppose helps it not get confused by device tree syntax in the same file as the preprocessor directives. I use it because it was in the kernel Makefiles.

  • imx6dl-boardname.dts is a placeholder, you must change this to the name of your toplevel device tree source file

Device tree compiler arguments:

  • -I dts specifies that the input format is textual device tree source
  • -O dtb specifies to create a device tree binary blob
  • -o imx6dl-boardname.dtb defines the filename where the output goes, you should replace it with the DTB filename you want.
  • - indicates that the input file is stdin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.