Skip to contentSkip to conversation

exclude layer from specific image when have multiple images

DISCUSSION Haimbach 2 participants 5 messages Nov 7, 2024

lore
Share & tools
lore

Haimbach

author
#0 lore raw

Hello,

I have just wonder if there is an option to exclude specific layer to specific images.

For an example, lets says I have 2 images called: *image-A.bb* , *image-B.bb* And lets says I have the next layer: *meta-my-layer*
this layer is in the list of the bblayers.conf.

Now I want only that *image-A* will include that layer. But I don't want that *image-B* will include that layer.

Is there a way to achieve this?

I can do it with SRC_URI:remove the contents of the layer in image-B . *But I want to use more nicer approach.*

Regards,
Haim

#1 lore raw

Hi Haim,

Quoted 4 lines · Haimbach via lists.yoctoproject.org

Hello,

I have just wonder if there is an option to exclude specific layer to specific images.

Quoted 9 lines

For an example, lets says I have 2 images called: *image-A.bb* , *image-B.bb* And lets says I have the next layer: *meta-my-layer*
this layer is in the list of the bblayers.conf.

Now I want only that *image-A* will include that layer. But I don't want that *image-B* will include that layer.

Is there a way to achieve this?

No, this is not how BitBake works. Layers are included, then recipes are parsed. An image recipe is a recipe, so you cannot have a recipe remove a layer. Also, a recipe cannot influence another recipe, only configuration files (distro, machine, layer, bblayers, local...) can.

What exactly is in that layer you do not want in image-A that you want in image-B?

Ideally, including a layer should NOT modify anything. If it does, it's usually considered a bad practice layer and one may be able to do stuff smarter (but not necessarily).

Quoted 3 lines

I can do it with SRC_URI:remove the contents of the layer in image-B . *But I want to use more nicer approach.*

What exactly are you trying to do?

Cheers,
Quentin

author
#2 lore raw

Hi,

I have layer which I add into it some patches and configuration files for the RT PATCH.

So I need for an example the RT patch for "Image-A", and for "Image-B" I don't need it.

Regards,
Haim

#3 lore raw

Hi Haim,

Quoted 6 lines · Haimbach via Lists.Yoctoproject.Org

Hi,

I have layer which I add into it some patches and configuration files for the RT PATCH.

So I need for an example the RT patch for "Image-A", and for "Image-B" I don't need it.

You probably want a DISTRO here.

The issue is the image cannot decide which kernel to build for example. So if you have two kernel recipes, one RT and the other one non-RT, then you need a different mechanism. The selection is usually made via PREFERRED_PROVIDER_virtual/kernel = "<your-recipe-name>" and since recipes cannot impact other recipes and that an image recipe is a recipe, that variable needs to be set in a conf file (distro, machine, local, bblayers, etc...).

By having it in a distro conf file (let's say mydistro and mydistro-rt), you can then build your image-A without RT by using DISTRO=mydistro and image-B with RT by using DISTRO=mydistro-rt.

Additionally, your recipes can now decide to apply the patches only for the mydistro-rt by using the OVERRIDES mechanism:

SRC_URI:append:mydistro-rt = " file://rt.patch"

If you can provide the recipes, layers and content of the patches, we may be able to guide you better.

Cheers,
Quentin

author
#4 lore raw

Hi,

I don't want to specify those files which are inside the same layer, *because they can be changed.(this is layer I maintain)*

for an example, *first version* of the layer have the file *rt.patch,* but the *second version* of the layer have the file *rt1.patch*

And if they changed I don't want to change it in inside my build system IDE, SRC_URI:append:mydistro-rt = *" file://rt.patch"* to SRC_URI:append:mydistro-rt = *" file://rt1.patch"*

Regards,
Haim