bitbake: how does the build system choose the recipe provided by more than one layer

dudengke picture dudengke · May 12, 2016 · Viewed 7.5k times · Source

The meta layer provide recipe:

meta/recipes-graphics/x11-common/xserver-nodm-init.bb 

The meta-oe layer provide recipe:

meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init_2.0.bb

My question is:

How the build system select the xserver-nodm-init from the multi-layers?

Does it select the xserver-nodm-init recipe according to the layers order in conf/bblayers?

Answer

Jussi Kukkonen picture Jussi Kukkonen · May 12, 2016

Layer priority (BBFILE_PRIORITY) and recipe version number (PV, often automated from filename) will decide which recipe is used. The recipe in higher priority layer will be used even if the recipe version in that layer is lower, so the version numbers should only matter if the layer priorities are the same.

In your case the recipe in meta/ has no explicit version number: PV defaults to 1.0.

You can use bitbake-layers show-layers to see the priorities of all your layers, and e.g. bitbake -e <recipe> | grep ^PV to check which version actually got selected for the recipe. To override a "wrong" selection of a specific recipe you can use PREFERRED_VERSION_<recipe> = <version> in your distro or local configuration.