Apalis IMX8 - adding own DTS(I) files and building an Torizon image that uses them by default


I would like to add my own DTS(I) file(s) and use them in my Torizon build. I see that the DTB list is in KERNEL_DEVICETREE, in meta-toradex-nxp/conf/machine/apalis-imx8.conf. I don’t think overriding/apending to machine file is possible, so I added my own dts/dtsi files and DTB to KERNEL_DEVICETREE in my own linux-toradex_%.bbappend. It all seems to build okay - I can see the DTB files build from my dts files in the kernel build directory. My question now is how do I configure/force the build to use those files? Currently it seems to be using the Apalis Evaluation Board files (freescale/imx8qm-apalis-v1.1-eval.dtb). I can only see those files mentioned also in the machine file, in TORADEX_PRODUCT_IDS, but even when I change TORADEX_PRODUCT_IDS to my files the output image still uses the Evaluation Board files. In U-BOOT env also: ‘fdt_board=eval; fdtfile=imx8qm-apalis-v1.1-eval.dtb;’.


Hi @Mariusz, how are you?

Thanks for posting on the community. Before we go further I’d like to ask you a question. Is there a reason for you to build the TorizonCore image using Yocto?

TorizonCore has the possibility to use the TorizonCore Builder and it’s able to deal with device tree compilation and selection as you can find here: TorizonCore Builder Tool - Commands Manual | Toradex Developer Center. We conceived TorizonCore Builder so that users wouldn’t need to go through Yocto for most of the needed tasks to create and maintain a custom image.

If TorizonCore builder doesn’t fit your goal, you can have this example on how to edit device trees and make them default with Yocto: Custom meta layers, recipes and images in Yocto Project (hello-world examples) | Toradex Developer Center

Best regards,

Hello @gclaudino.tx . I need a minimalistic image without containers and which is still fairly customized. Using Yocto image seems to be the most convenient solution.

The ‘hello-world examples’ document looks okay and I’m doing thing the same way. The only problem is that the last step in ‘Customize the Kernel’ doesn’t work/apply to Apalis IMX8.
If I adjust the ‘sed’ command from:

sed -i 's/#define FDT_FILE.*/#define FDT_FILE "my-custom-devicetree-file.dtb"/' ${S}/include/configs/colibri_imx6.h


sed -i 's/#define FDT_FILE.*/#define FDT_FILE "my-custom-devicetree-file.dtb"/' ${S}/include/configs/apalis-imx8.h

it’ll do nothing, because there is no FDT_FILE in apalis-imx8.h. There is no FDT_FILE in any of the Apalis IMX8-related files. Also there are no references to the current DTB file (imx8qm-apalis-v1.1-eval.dtb), so I have no idea where to look.

Hi @Mariusz!

Thanks for the update.

What we’d suggest you then is to change the fdt_board with the u-boot recipe:

This board value is then appended to imx8qm-apalis-v1.1 so you could have something like the following:

Your device tree named as = imx8qm-apalis-v1.1-mydevicetree.dtb

sed -i 's/"fdt_board=eval\0".*/"fdt_board=mydevicetree\0"' ${S}/include/configs/apalis-imx8.h

You may need to validate the sed command as I didn’t test it yet but the main goal is to change it from eval to your device tree name.

Please test it and share it with us if it has worked :smiley:

Best regards,

I’ll check this new substitution tomorrow. Meanwhile I have another question. In U-Boot console when I set some variable using setenv and the do saveenv the changed seem to disappear the next boot. How to make them persistent?

Hi @Mariusz !

Usually, the changes made with this combination would be persistent. When did you do then and to which variables?

Best regards,

I entered the U-Boot console during boot and changed fdt_board using setenv fdt_board test and then saveenv.

hmmm, changing fdt_board seems to be working now, but still there are some variable that can’t be changed, like variant.

Hi @Mariusz,

The variant variable is dependent on the module version. For instance, if you use a V1.1 module it will show V1.1 there. This is one variable that you wouldn’t be able to change. This is also needed as even though you may have more than one version of a single module, some components may vary between the versions and therefore, maintaining more than one device tree for all the devices to work would be necessary.

Please tell us if your test with the fdt_board change on Yocto worked :smiley:

Best regards,

Please tell us if your test with the fdt_board change on Yocto worked

Yes, in the end it worked. Two things I had to change:

  • my dts/dtb wasn’t fully conformant with ‘${soc}-apalis${variant}-${fdt_board}.dtb’ format
  • I was deploying via torizon-builder (SSH) and with this method the U-Boot env is not updating

After changing the file name and updating using Easy Installer it all seems to work.

Hi @Mariusz, thanks for the update!

I’m glad you could make it work :slight_smile:

Can you please tag then the post as solved by selecting the most adequate answer?

Best regards,