How to build custom device tree in i.MX android BSP

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

How to build custom device tree in i.MX android BSP

4,326 Views
trongthinh
Contributor IV

I followed user guide (attached bellow) to build android 6.0.1 for sabresd dev board. Now I would like to add my custom device tree. It is named "imx6s-weekend-project.dts".

I found a variable TARGET_BOARD_DTS_CONFIG in "device/fsl/sabresd_6dq/BoardConfig.mk", then I changed it to

TARGET_BOARD_DTS_CONFIG := imx6s-weekend-project.dtb

I built again. Unfortunately, My custom device tree was not built.

My built step as below:

$ source build/envsetup.sh

$ lunch sabresd_6dq-user

$ make -j 8

Please give advice how to build custom device tree! Many thank.

0 Kudos
4 Replies

2,380 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Thinh,

actually you don´t have to change a .mk to .dts. It is necessary to go to your build directory in <Kernel_source>/arch/arm/boot/dts and here you will find all the dtb sources (.dts and .dtsi). Here you can place your new .dts file (E.g. myfile.dts) and make your new .dtb with following istruction

cd <Kernel_source>

make myfile.dtb

And then you will find your dtb file in <Kernel_source>/arch/arm/boot/dts/myfile.dtb

Another way to build it is using the dtc directly.

cd <Kernel_source>/scripts/dtc

dtc -I dts -O dtb -o <output_folder>/myfile.dtb ../../arch/arm/boot/dts/myfile.dts

You can find an example that shows how to develop a custom device tree here: Basic Device Tree for the Udoo Board 


Regards,
Carlos
NXP Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

2,380 Views
sevenlin
Contributor II

Hi,

I also have a question that is about creating the custom device tree:

Currently, we already had a device tree that is for our EVT board use (named evt.dts & evt.dtsi), and we want to create another device tree that is for DVT board use.

We need to add a new .dts & .dtsi (dvt.dts & dvt.dtsi) in <Kernel_source>/arch/arm/boot/dts/, right?

We will have different board id for EVT and DVT board, and we would like to use board id to load different device tree.
For the next step, where we could load the device tree by reading the board id?
Do you have any suggestion for doing it?

Thanks.

0 Kudos

2,380 Views
trongthinh
Contributor IV

Hi Seven Lin,

We need to add a new .dts & .dtsi (dvt.dts & dvt.dtsi) in <Kernel_source>/arch/arm/boot/dts/, right?

=> Correct! you also need to edit Makefile.

For the next step, where we could load the device tree by reading the board id?

=> I suggest that you read board ID in u-boot (boot script) then choose suitable device tree.

0 Kudos

2,380 Views
trongthinh
Contributor IV

Dear Carlos,

Thank for your answer! I have found the solution. I need to edit make file in arch/arm/boot/dts. I added my device tree to this Makefile => it was built.

0 Kudos