How to build dts file?

cancel
Showing results for 
Search instead for 
Did you mean: 

How to build dts file?

Jump to solution
10,624 Views
Contributor II


Hello

I complete build full source.

#MACHINE='imx6dlsabreauto'

#source setup-environment build

#bitbake fsl-image-machine-test

And then I was modify '.dts' file.

How to build dts file simply ?

: imx6, sabreauto

Labels (1)
1 Solution
352 Views
NXP TechSupport
NXP TechSupport

Hi yunbaekim

utility called device tree compiler (DTC) is used to compile the DTS file into a

DTB file. DTC is part of the Linux source directory. Examples of usage one can find

on web, like :

http://stackoverflow.com/questions/21670967/compiling-source-device-tree-file

http://xillybus.com/tutorials/device-tree-zynq-1

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
6 Replies
239 Views
Contributor II

[posted in error, deleted]

0 Kudos
352 Views
NXP TechSupport
NXP TechSupport

Hello,

Please take a look at page 20 of the Massimo's presentation

Device Tree Made Easy

Also, the following helps.

Basic Device Tree for the Udoo Board

Regards,

Yuri.

0 Kudos
353 Views
NXP TechSupport
NXP TechSupport

Hi yunbaekim

utility called device tree compiler (DTC) is used to compile the DTS file into a

DTB file. DTC is part of the Linux source directory. Examples of usage one can find

on web, like :

http://stackoverflow.com/questions/21670967/compiling-source-device-tree-file

http://xillybus.com/tutorials/device-tree-zynq-1

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
352 Views
Contributor II

hello igorpadykov

I installed dtc

#sudo apt-get install device-tree-compiler

and moved to arch/arm/boot/dts folder.

#dtc -O dtb -o imx6dl-sabreauto-gpmi-weim.dtb imx6dl-sabreauto-gpmi-weim.dts

DTC: dts->dtb  on file "imx6dl-sabreauto-gpmi-weim.dts"

Error: imx6dl-sabreauto-gpmi-weim.dts:9.1-2 syntax error

FATAL ERROR: Unable to parse input tree

what is wrong?

0 Kudos
352 Views
Contributor II

yunbaekim,

I had the same issue. I found out that the Yocto DTS files do not strictly follow the Device-Tree syntax as they include c/c++ pre-processors. The file(s) must first be "scrubbed", then run through the dtc compiler.

I found this to be useful:

https://linux-sunxi.org/Device_Tree#Compiling_the_Device_Tree

In case the link doesn't work, here's the gist:

```

$ IDE=<your-device-name>

$ SRC=$IDE.dts

$ TMP=$IDE.tmp.dts

$ DST=$IDE.dtb

$ cpp -nostdinc -I include -undef -x assembler-with-cpp $SRC > $TMP

$ dtc -O dtb -b 0 -o $DST $TMP

$ rm $TMP

```

352 Views
Contributor III

This is very helpful. For my case of building the device tree, my procedure was as follows:

$ cd ...../arch/arm/boot/dts/

$ sh compileDeviceTree.sh 

where I simply put those commands into a script

#!/bin/sh
echo "----compiling test device tree------"
# replace abc with your file name
IDE=abc
SRC=$IDE.dts
TMP=$IDE.tmp.dts
DST=$IDE.dtb
cpp -nostdinc -I include -undef -x assembler-with-cpp $SRC > $TMP
~/bsp-root/...../tmp/sysroots/x86_64-linux/usr/bin/dtc -O dtb -b 0 -o $DST $TMP
rm $TMP