How to separate camera.cfg of kernel bbappend file into two conditions? 10/3 Yocto Build Issues AMA
From @MayQueen Technologies: In the camera.cfg of kernel bbappend file, is there a way to separate two conditions where only camera customers need to add this cfg or not? Should I add a new DISTRO variable?
@Ming
1 Reply
The dfirst thing is to make use of Configuration Fragments. These are files ending in
.cfg
that contain fragments of configuration for things like the Kernel. The configuration fragment will be applied to the configuration after the main .config
file has been applied.
e.g. to enable USB Cameras, you can create a cameras.cfg
file containing:
Then, you will need an append file in your layer, e.g. layers/project/meta-my_bsp/recipes-kernel/linux-yocto/linux-yocto_%.bbappend
containing
Then put the cameras.cfg
in layers/project/meta-my_bsp/recipes-kernel/linux-yocto/linux-yocto/cameras.cfg
This will get applied to all machines.
If you now have two machines defined, say, my-eye
that has a camera and my-blind
, then to configure it so that only my-eye
picks up the camera configuration, you can change the append file to make use of conditional overrides
.
This makes use of the OVERRIDES variable, which by default contains the Architecture, the OS and the Machine name.
The format of an override is
VARIABLE:append:override
So, to only have my-eye
pick up the camera configuration, the value of SRC_URI
needs to be
SRC_URI:append:my-eye = " file://cameras.cfg"
This way the camera.cfg
would only get picked up if the machine my-eye
is used.