Proper way of customizing Device Tree

Hi,

We are developing a product using Verdin iMX8M-Plus module. So far we were using Dahlia board. But now we completed our carrier board design and we had to use many non verdin standard functionalities on it therefor we need to customize Device Tree file a lot.

I use BSP 5.0 and created our own image with desired recipes inherited from tdx-reference-minimal-image. Now I need to change dtb file integrated to it and play a lot by changing and testing it. What is the suggested workflow for it?

We have also Toradex Pinout Designer xml file for the project if it helps us in someway.

Thank you.

Hi @Fide !

First of all, I would like to share this Device Tree Customization article with you.

And, about workflow, there are several possible workflows to do what you want.

We can think of at least 3 ways:

Best regards,

Hi @henrique.tx,

I went through Device Tree Customization article that you suggested also watched the video there but none of them helped. Here are the steps that I followed and stuck.

  1. I setup the yocto environment for Toradex BSP 5 nightly build and used Verdin iMX8M-Plus machine and typed bitbake virtual/kernel -c devshell
  2. This cloned linux-toradex-5.4.161 recipe and bring a new terminal window with all compiler setting are set.
  3. Then I went to the folder “./build/tmp/work-shared/verdin-imx8mp/kernel-source/arch/arm64/boot/dts/freescale” and found imx8mp-verdin-wifi-dahlia.dts file there.
  4. Here $ARCH is set to “arm64” and $CROSS_COMPILE is set to “aarch64-tdx-linux-” by Yocto and I assumed that these are correct for 64 bit platforms and Verdin iMX8M-Plus.
  5. When I use command “make imx8mp-verdin-wifi-dahlia.dts” it returns “make: Nothing to be done for 'imx8mp-verdin-wifi-dahlia.dts'
  6. If I run “make dtbs” as suggested in the article, it says “make: *** No rule to make target 'dtbs'. Stop.

From that point on, your helps are appreciated.

Thank you.

Hi @Fide !

If I understood, those are some common mistakes :slight_smile:

Let’s go through the issues:

  • You executed the make command from a folder that is not the root of the kernel source, right?

    • in your case, you were in the ./build/tmp/work-shared/verdin-imx8mp/kernel-source/arch/arm64/boot/dts/freescale folder, whereas the root of your kernel repository is ./build/tmp/work-shared/verdin-imx8mp/kernel-source/
  • To build a device tree, you need to refer to its “final product”, which is the .dtb binary file instead of the source (.dts)

    • In your case, you should execute make imx8mp-verdin-wifi-dahlia.dtb instead of make imx8mp-verdin-wifi-dahlia.dts
  • The make dtbs should work, but as (seems like) you were in the wrong folder, it didn’t work.

Please refer to the https://developer.toradex.com/knowledge-base/build-u-boot-and-linux-kernel-from-source-code article and take a look at the steps there to learn how to build kernel-related binaries. An important step is to build the correct defconfig. I just don’t remember if by dropping into the devshell the defconfig build step is already don’t or not.


Also, a nice way of better understanding how the kernel build works is to take a look at the Makefiles spread through the kernel source.


Best regards,

1 Like