Hi Serj,

I'm using the -r / -R options in bitbake in order to customize the image via global
variables and be able to build different configurations for the same machine and
distro. You you use the same option to create e.g. different versions. Have a look
in the documentation


search for these lines:
-r PREFILE, --read=PREFILE
-R POSTFILE, --postread=POSTFILE

What those do is that you can add an extra configuration file wich either prepends
or appends the local.conf file. I'm using it both ways, but for your case I think you
need to add your default versions with ?= in the local.conf and then override them
with an external conf file and use --read option.

So, let's say that you have the minimal-image then you can have a number or
versioned configuration files (e.g. version-1.0.conf, version-1.2.conf, e.t.c.) then
you setup your environment as usual using your environment setup scripts or
just calling oe-init-build-env for your machine and then you'll be able to build
different versions like this:

bitbake -R version-1.0.conf minimal-image

You can also build a single recipe using the version file

bitbake -R version-1.2.conf virtual/kernel

Then, if you like, you can create a wrapper script that actually simplifies the call
and just pass the version. For example, you can create an executable bash script
and these

#!/bin/bash
CONF_VERSION="1.0"
while getopts v:h" OPTION
do
    case $OPTION in
    v) CONF_VERSION=${OPTARG} ;;
    h) echo "Print some help" ;;
    *) echo "Print some help" ;;
esac
done
bitbake --postread=${CONF_VERSION} ${1}

And then call the script using -v to pass the version. Of course, that assumes
that all version files are in the same folder with the local.conf. I usually make
such scripts but they are doing much more stuff, for example use variables
from the extra conf file to run other tasks.

Hope that helps.

Cheers,
Dimitris

Sergio Torres Soldado <torres.soldado@gmail.com> schrieb am Sa., 30. März 2019, 18:34:
Hi,

 What is the best alternative to setting variables in local.conf? The specific use-case is customising a meta-raspberrypi build, which has a bunch of variables that are picked up by the MACHINE code to influence build configurations. I want to version these customisations hence removing them from local.conf. 

 I have tried adding a machine definition in a separate layer that includes the same files as those from the machines in meta-raspberry pi but there is logic that depends on the machine name and building an image fails.

Many thanks,
Serj.
-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto