How to build dts file?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to build dts file?

跳至解决方案
18,033 次查看
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

标签 (1)
1 解答
7,761 次查看
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 项奖励
回复
6 回复数
7,648 次查看
et0
Contributor II

[posted in error, deleted]

0 项奖励
回复
7,761 次查看
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 项奖励
回复
7,762 次查看
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 项奖励
回复
7,761 次查看
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 项奖励
回复
7,761 次查看
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,761 次查看
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