Conditional Metadaa in Yocto - OVERRIDES

Bitbake provides a very way to write conditional metadata. It uses OVERRIDES variable to control what variables will be overridden after Bitbake parses recipes and configuration files.

With OVERRIDES you can conditionally select a particular version of a variable and to conditionally prepend and append the value of variable.

OVERRIDES variable contains value separated by colon character (:), and each value is an item we want to satisfy conditions. So, if you have a variable that is conditional on "x86", and "x86" is in OVERRIDES then x86 version will be used.


You can see from the above screenshot, 'beaglebone-yocto' was present in OVERRIDES, so the default value of FOO ("bar") was overriden with FOO_beaglebone-yocto("hello")

Now, I will change the MACHINE value to "qemux86", so instead of 'beaglebone-yocto' you will have 'qemux86' in OVERRIDES, and the value of 'FOO_qemux86' will be assigned to FOO. This way you can support your solution to multiple hardware.


Similarly, you can use overrides to include a package for one particular image, when there are multiple images supported by your target. (E.g. one with SSH Server, and one without SSH Server)



You can see from the above example, "python" is only added to 'core-image-minimal' and not 'core-image-sato' image. If we use 'IMAGE_INSTALL_append = 'python', it will be added to both 'core-image-minimal' and 'core-image-sato' image



References:
1. https://www.yoctoproject.org/docs/current/bitbake-user-manual/bitbake-user-manual.html#conditional-syntax-overrides

Comments

Popular posts from this blog

bb.utils.contains yocto

Difference between RDEPENDS and DEPENDS in Yocto

PR, PN and PV Variable in Yocto