Remove Device Tree overlay applied by `:use-mainline-bsp` override

Hello there,
I am working on bringing up a custom carrier board for the Colibri iMX7 currently using the yocto build system. My image is based on torizon-core-docker (kirkstone 6.4.0 based). I followed the instructions on your website (setting up the CUSTOM_DEVICETREE and integrating it into the bootloader by way of adapting the colibri_imx7.h file in uboot. I now have the problem, that the TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT file specifies the colibri-imx7_vga-640x480_overlay.dtbo device tree overlay that gets applied on top of my custom device tree and breaks some things in the process.
Specifically the use-mainline-bsp override value from meta-toradex-nxp/conf/machine/include/colibri-imx7-emmc.inc causes this behaviour. I have tried setting this variable to “” using the conf file in my custom layer. The overlay still ends up in the environment, and thus will be applied on boot.

What is the recommended way of configuring device tree (overlay) files for torizon derivatives.

So Hello again,
I ended up being able to remove the device tree overlay from the boot process by using the TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT:use-mainline-bsp:remove = " colibri-imx7_vga-640x480_overlay.dtbo" directive in my meta-mylayer/conf/local.conf file.

This still feels kind hacky to me and I’d like to know if there is a recommended way of collecting all the device tree modifications in a structured way.

Greetings @Nabla,

This property gets set in the machine configuration level so it’s a bit tricky to override/change as you have noticed.

Though I have some alternative suggestions. First of all, you could create your own machine configuration in your meta-layer, that overrides this behavior as described here: First Steps with Device Tree Overlays | Toradex Developer Center

Another idea is to create a bbappend to the following recipe ./meta-toradex-bsp-common/recipes-kernel/linux/device-tree-overlays-mainline_git.bb, then override TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT in there. This is the recipe that consumes this variable so overriding it here should have an effect I would think.

By the way, if you don’t mind me asking. You said you’re building a custom image based on torizon-core-docker correct? May I ask the purpose for building a custom image? I’m just curious since most people just use Torizon OS as is without doing a Yocto build.

Best Regards,
Jeremias

Hello Jeremias,
I am using torizon-core-docker, because it has the features (mainly docker and ota updates) we wanted. A previous engineer had already spent quite some time writing custom layers about three years ago, so I wanted to use what he had already written, even if it meant digging through yocto in more depth. Personally learning about Yocto and building a custom linux image was on my list of things I wanted to do and I think having knowledge of the yocto project ends up being a more transferable skill, than how to use the admitedly very nice tools you have built for your modules and torizon OS. I then was allowed the freedom to explore this system for building our images. I did really appreciate the articles the team at Toradex have written about how everything works. They where very helpful indeed.
Thanks for pointing me to the article, I did not add the -extra to the machine conf file, so thats why that probably did not get picked up.
I had tried resetting the value in a device-tree-overlays-mainline_git.bbappend file, but that was applied before it was set to include colibri-imx7_vga-640x480_overlay.dtbo. I just flashed a version of my yocto built torizon derivative to verify. The device tree overlay gets applied if i set TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT = "" in the device-tree-overlays-mainline_git.bbappend file. I did verify that the bbappend file was being applied by checking the output of bitbake-layers show-appends device-tree-overlays-mainline.

On that note, is there a way to have a custom machine ‘inherit’ the settings from a base machine? I think I slowly understand how to override things as they are (using .bbappend files and *-extra.conf files. I have not created my own machine yet and am not sure what I’d need to set up for a new machine to work the same way as the colibri-imx7-emmc. Any help with this would be appreciated.

Thank you for sharing more information on your goal here. I just wanted to make sure I understood where you were coming from.

I had tried resetting the value in a device-tree-overlays-mainline_git.bbappend file, but that was applied before it was set to include colibri-imx7_vga-640x480_overlay.dtbo. I just flashed a version of my yocto built torizon derivative to verify. The device tree overlay gets applied if i set TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT = "" in the device-tree-overlays-mainline_git.bbappend file. I did verify that the bbappend file was being applied by checking the output of bitbake-layers show-appends device-tree-overlays-mainline.

How exactly was your bbappend formatted? I believe this other post has an example on how to override that variable in the bbappend: Adding custom overlays to Yocto image - #6 by lucas_a.tx

On that note, is there a way to have a custom machine ‘inherit’ the settings from a base machine? I think I slowly understand how to override things as they are (using .bbappend files and *-extra.conf files. I have not created my own machine yet and am not sure what I’d need to set up for a new machine to work the same way as the colibri-imx7-emmc.

We have an example of adding *-extra.conf files here: Custom meta layers, recipes and images in Yocto Project (hello-world examples) | Toradex Developer Center

It’s towards the end of the section I linked. The idea is not to create a brand new machine config. But, rather create an extra config file that gets included alongside the default machine config from us.

Best Regards,
Jeremias