A R
A R

Reputation: 2803

How to add a macro or variable in yocto recipe which can be used in other recipes?

I have a component named "foo", its recipe and an image recipe which will add foo to the entire stack and build a foo enabled image.

Now I have to enable a feature in foo enabled image only. So I need to add a macro or variable for foo enabled image to distinguish them.

I tried adding foo in distro features through the image recipe as shown below.

DISTRO_FEATURES_append = " foo"

but it is not working as it is not reflecting in other recipes.

I have to make changes in another module depending on foo. I need to check if foo is enabled or not from the second module.

Is there any other way to achieve this. Can i use distro feature for this?

Upvotes: 2

Views: 2269

Answers (1)

Ross Burton
Ross Burton

Reputation: 4063

Distro features - as their name suggests - are distro wide. You can't change it in a recipe and expect it to spread to others, as each recipe inherits the distro-wide configuration and then makes it's own changes.

This includes image recipes, as all an image recipe does is take packages that have been already built and install them. If you change DISTRO_FEATURES in an image recipe then you change it for the image construction but the packages used have already been built.

As your question is quite vague on details it's hard to give a good answer. Do you mean that depending on whether the image is "foo enabled" or not, individual recipes need to be built differently? Or is this just a matter of an image having a foo package in or not?

Upvotes: 1

Related Questions