How to build dts file?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to build dts file?

Jump to solution
17,886 Views
yunbaekim
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
7,614 Views
igorpadykov
NXP Employee
NXP Employee

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
Reply
6 Replies
7,501 Views
et0
Contributor II

[posted in error, deleted]

0 Kudos
Reply
7,614 Views
Yuri
NXP Employee
NXP Employee

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
Reply
7,615 Views
igorpadykov
NXP Employee
NXP Employee

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!

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

0 Kudos
Reply
7,614 Views
yunbaekim
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
Reply
7,614 Views
robertberringto
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

```

7,614 Views
danmacdonald
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