Re: Using OVERRIDES to set variables from outside the recipe file

Robert P. J. Day

On Thu, 3 Dec 2020, Quentin Schulz wrote:

Hi Andrew,

On Thu, Dec 03, 2020 at 03:45:41AM +0000, Andrew Loader wrote:
In the bitbake user manual it has an example of how to set the variable value using the OVERRIDE variable

OVERRIDES = "architecture:os:machine"
TEST = "default"
TEST_os = "osspecific"
TEST_nooverride = "othercondvalue"

Lets say this is in the recipe called "" and we remove the OVERRIDES line from it

If we want to the OVERRIDES value to configure the recipe externally say in local.conf as I do not want to change the recipe how would I do that?
OVERRIDES is set in configuration files usually (always?). It can be
either in a distro if you use DISTROOVERRIDES, in a machine if you
use MACHINEOVERRIDES, and you might be able to add manually to it
from local.conf or other ways but I think you should go with

among other things) will be used in all recipes you can find and it
should just work.

You can use bitbake -e my-recipe | grep -e "^OVERRIDES=" to check
the content of the OVERRIDES variable. Note that righmost "OVERRIDE"
is the one which takes precedence over all others.
i'm going to weigh in on this, as it *seems* that andrew has the
same misunderstanding i had when, lo those many years ago, i read that
section in the BB manual, and read this:

OVERRIDES = "architecture:os:machine"
TEST = "default"
TEST_os = "osspecific"
TEST_nooverride = "othercondvalue"

my initial problem with that section was that it wasn't clear that
entities like "architecture" and "os" and so on were *replaceable*, in
that one was supposed to put *examples* of those values in those
places. (laugh if you like, but if one is totally new to overrides,
that section can be misinterpreted in a truly tragic way on first

i recall extending that section to attempt to make it more
understandable, but i think, over the holidays, i'm going to rewrite
it again with a simpler introduction and more examples straight from
the code base. (i believe i was the one who added the example
involving overriding the value of KBRANCH based on the target arch.)

in any event, i can easily see a much longer and involved
introduction to overrides.


Join { to automatically receive all group messages.