PREFERRED_PROVIDER and PREFERRED_VERSION in Yocto

When we run "bitbake <target>", bitbake looks at the PROVIDES variable of each recipe to find out the recipe for the particular target. The Default value of PROVIDES is PN.

PN --> Name of the Recipe
PV --> Version of the Recipe
PR --> Revision of the Recipe

PREFERRED_PROVIDER: Sometimes a target can have multiple providers. PREFERRED_PROVIDER determines which recipe should be given preference when multiple recipes provide the same item.

E.g. virtual/kernel, u-boot will be provided by multiple recipes
PREFERRED_PROVIDER_virtual/kernel = "linux-imx"
PREFERRED_PROVIDER_u-boot = "uboot-imx"

This should be written in local.conf or machine.conf

PREFERRED_VERSION: When multiple versions of  a recipe are available, this variable determines which recipe should be given preference. If we don't state the version, bitbake will pick up the highest version.

E.g. PREFERRED_VERSION_linux-imx = "3.10.17-1.0.0"
PREFERRED_VERSION_u-boot-imx = "2013-04"



In the above screenshot, "linux-yocto" is selected as the provider for kernel.
You can also see there are multiple linux-yocto recipes. With PREFERRED_VERSION, version is set to 4.18%. The % matches any number of characters, useful when version numbers is long. 

Comments

Popular posts from this blog

bb.utils.contains yocto

Difference between RDEPENDS and DEPENDS in Yocto

make config vs oldconfig vs defconfig vs menuconfig vs savedefconfig