How to patch device tree? (YOCTO)

Hello everyone,

So, it has been nearly two days I struggle with these issues. Here is where I am now and what I’d like to achieve.

I followed step by step this tutorial to build my own boot to Qt Linux embedded image: https://doc.qt.io/QtForDeviceCreation/qtee-custom-embedded-linux-image.html

Next I installed it on my iMX6DL with the help of toradex easy installer via an SD card plugged in my aster carrier board.

I also built the toolchain and so far I am able to run any Qt app on my 7" capacitive touch display.

and here starts my problems… despite all my efforts I simply cannot make my touch pannel to work. I know that my pannel works because I managed to use it on easy installer using the “boot.scr” file as explained here: Downloads & Installers | Toradex Developer Center

I also followed every steps here:

Except for “Change the device tree according to the patch below

Since I simply don’t know how to do it and every research I did on the toradex forum or yocto forum did not help at all…

It is always said to go to arch/arm/boot… but I can’t find it anywhere precise on my yocto environnement (There are like dozens of these directories)

So my query would be a simple step by step tutorial on how to easily patch my device tree using yocto (since I used it with the Qt tutorial) and then recompile everithing so I can reflash it to my SD card and then to my colibri board.

Please understand that I have never used yocto or bitbake before but I also need some good advice about it because I am gonna work on this for nearly the next 6 months.

Edit: Is it possible to patch the device tree with the help of a meta-layer? For instance could someone provides me a *.bb file?

PS: here is a log file containing dmesg link text

And here are a small list of all the cmd I ran in U-Boot and as root link text

I really hope someone can help me!

Romain

Greetings @Romain.Donze,

Allow me to help clarify and answer your questions.

Except for “Change the device tree according to the patch below”

So this portion is only required if you are using the external capacitive touch adapter which is needed to use our display on our evaluation board. If you are using the Aster board like you are then there is already a built in touch adapter on the board itself.

All you need to do to enable touch is the following two commands in U-Boot.

This command enables the atmel touch driver in the device tree.
setenv fdt_fixup 'fdt addr ${fdt_addr_r} && fdt set /soc/aips-bus@02100000/i2c@021a8000/atmel_mxt_ts@4a status okay'

This will set the Aster device tree to be loaded. Which seems like from your logs to be the main issue.
setenv fdt_file 'imx6dl-colibri-aster.dtb'

For clarification by default the evaluation board device tree is set to load and for most cases this works whether you’re using the Aster or Evaluation carrier board. One case it does not work is in the case of touch, which is why you have to change which device tree is loaded on boot as shown above.

What is odd though is that these commands use to be listed on our developer article you’re referencing I’ll see about fixing this.

Please understand that I have never used yocto or bitbake before but I also need some good advice about it because I am gonna work on this for nearly the next 6 months.

As for your general questions/concerns about the Yocto build system. We do have our own documentation on the Yocto/Openembedded here . This page also includes a couple of videos covering yocto basics, they’re a little dated in terms of file/directory names but the fundamentals are still good.

This only scratches the surface however as Yocto is a very complex build system for which there is no easy guide.

For any more specific questions regarding our products/Yocto feel free to create another question on our community.

Best Regards,
Jeremias

Woow thank you very much!!

All you need to do to enable touch is the following two commands in U-Boot.

These two lines did the trick perfectly. It is still strange that I did not find it anywhere…

As for the Yocto system, I am starting to understand it a little bit better. I am now looking to build my own device tree (enabling touch, usb, i2c, etc.) for our own carrier board. Advices are welcome ;). For instance how is imx6dl-colibri-aster.dtb generated differently than imx6dl-colibri-eval-v3.dtb ?

Thanks again for your reply!

Romain

@Romain.Donze I’m glad you were able to get unblocked.

Do note that the whole U-Boot method of using fdt_fixup to modify the device tree at boot time while good for quick tests can be a tad unreliable. It is always suggested for an actual release to modify/patch the device tree yourself. For your reference this is where the touch driver for our display is defined in the Aster device tree: imx6dl-colibri-aster.dts « dts « boot « arm « arch - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules

All that fdt_fixup line did was change status = "disabled"; to status = "okay";

It is always suggested for an actual release to modify/patch the device tree yourself

Yes that’s what I though and that’s what I asked in the beginning since I don’t know how to do it

For your reference this is where the touch driver for our display is defined in the Aster device tree:

Also thanks for that, but now I need answer about the whole process of doing this device tree thing. Is it written by hand? Is it generated automatically with the meta-layer? So how do I write it in my meta-layer? How do we patch a device tree? etc.

(It seems to me that there is like some fight club rules about all this linux building process XD… First rule is that you don’t talk about it)

Thanks again and I hope you can help me!

Romain

HI @Romain.Donze

So as general Knowledge, we have a developer page about creating hello_world using Yocto. You can use this page as an example for creating your own meta-layer and put your custom device-tree there.

Also thanks for that, but now I need answer about the whole process of doing this device tree thing.

Please check the Yocto Manual.

Is it written by hand?

Yes. General Information about device-tree, you can find here.

Is it generated automatically with the meta-layer?

No

So how do I write it in my meta-layer?

Please check the developer page mentioned above.

How do we patch a device tree? etc.

One way do the this to make the changes by hand and create a patch file as explained here.

(It seems to me that there is like some fight club rules about all this linux building process XD… First rule is that you don’t talk about it)

No, everything is open-source. You just need to look for it and try it out. And it is more Matrix Style and it depends on what you want to believe.

Thanks again and I hope you can help me!

You are welcome

Best regards,
Jaski