Removing not needed files from bootfs

Hi,

we build our own image on BSP 5.7 (Apalis) and the bootfs contains many unneccessary files now like:

imx6q-apalis-eval.dtb
imx6q-apalis-ixora.dtb
imx6q-apalis-ixora-v1.1.dtb
imx6q-apalis-ixora-v1.2.dtb

As we use our own device tree file.
I set the variable KERNEL_DEVICETREE = "ourowndevicetree.dtb" in layers/ourlayer/conf/machine/apalis-imx6.conf. “Our layer” has the hightest priority. Notice that I changed KERNEL_DEVICETREE += "... " to KERNEL_DEVICETREE = ...
But that does not stop the build to still include the files mentioned in layers/meta-toradex-nxp/conf/machine/include/apalis-imx6.inc and other layers where KERNEL_DEVICETREE is also set.

What is the cleanest way to override that variable without editing the apalis-imx6.inc in other layers?

How can I get rid of the devicetree overlay files?

Thank you

Why does overriding this variable does not give the expected output?

Hi @mkock !

I just tested the approach shown in the article Custom meta layers, recipes and images in Yocto Project (hello-world examples) | Toradex Developer Center, specifically the creation of the <machine>-extra.conf in the custom layer.

By doing this:

# meta-custom/conf/machine/apalis-imx6-extra.conf
KERNEL_DEVICETREE = "xablau.dtb"

I got the same result as you:

user@oe/build$ bitbake tdx-reference-minimal-image -e | grep "^KERNEL_DEVICETREE="                                                      
KERNEL_DEVICETREE="xablau.dtb imx6q-apalis-ixora-v1.2.dtb imx6q-apalis-eval.dtb imx6q-apalis-ixora.dtb                       imx6q-apalis-ixora-v1.1.dtb"

But, if I use the machine override:

# meta-custom/conf/machine/apalis-imx6-extra.conf
KERNEL_DEVICETREE:apalis-imx6 = "xablau.dtb"

I get the desired result:

user@oe/build$ bitbake tdx-reference-minimal-image -e | grep "^KERNEL_DEVICETREE="                                                      
KERNEL_DEVICETREE="xablau.dtb"

Hopefully, this solves your issue :slight_smile:


I actually need to study more to directly answer this question :sweat_smile:

But I am sure the answer is in plain text in OpenEmbedded’s / Bitbake’s (huge) documentation :wink:

Best regards,

Hi @henrique.tx,

thank you so much for your help! In my case I had to put the machine override into layer.conf to make it work:

#meta-custom/conf/layer.conf
KERNEL_DEVICETREE:apalis-imx6 = “xablau.dtb”

Thank you and best regards,
Matthias

Hi @mkock !

It is good to know that you found a way to make it work!

But I ask you to reconsider the idea of setting such a variable in a layer-related configuration file. If you check other examples, you will see that such a variable is expected to be configured in a machine-related configuration.

As an example, if you cd into your layers and run (I am using ripgrep):

$ rg -l KERNEL_DEVICETREE | rg layer

You will see that no layer sets this variable.

I would say that doing so in layer.conf is not recommended / “hackish” :stuck_out_tongue:

Best regards,

Hi, @henrique.tx,

thanks I have put it back to the machine/*.conf file which is included by layer.conf

Best,
Matthias

1 Like