I am building multiple poky-based images for different projects but using the same build directory (because it seems a bit overkill to have a new clone of yocto for every project).
But I happen to have my images conflicting with each other because of the .bbappend
they define. For instance, I have two images that each extend the hostapd
recipe in order to define their own configuration file.
Let me illustrate with an example. I have two layers that each define an image: first-project and second-project. Each has its own layer, because they belong to a different repository: meta-first-project
and meta-second-project
. And both use hostapd
. So they projects look like this:
meta-first-project:
.
├── conf
│ └── layer.conf
├── recipes-connectivity
│ └── hostapd
│ ├── hostapd
│ │ └── hostapd.conf
│ └── hostapd_%.bbappend
└── recipes-first-project
└── images
└── first-project-image.bb
meta-second-project:
.
├── conf
│ └── layer.conf
├── recipes-connectivity
│ └── hostapd
│ ├── hostapd
│ │ └── hostapd.conf
│ └── hostapd_%.bbappend
└── recipes-second-project
└── images
└── second-project-image.bb
With a different hostapd.conf
for each.
The conf/bblayers.conf
file looks like this, including both layers:
conf/bblayers.conf:
BBLAYERS ?= " \
/home/user/Documents/yocto/poky/meta \
/home/user/Documents/yocto/poky/meta-poky \
/home/user/Documents/yocto/poky/meta-yocto-bsp \
/home/user/Documents/yocto/meta-first-project \
/home/user/Documents/yocto/meta-second-project \
When I run bitbake first-project-image
, I want it to use the hostapd_%.bbappend
in meta-first-project
and not the one in meta-second-project
. But my understanding is that both will be evaluated, meaning that meta-second-project/hostapd_%.bbappend
will have an impact on my first-project-image
, which I don't want.
Is there a way to solve that, or should I have two build folders (and download, build and duplicate everything there)?
For instance, I thought about checking something like this in the bbappend of hostapd
in meta-first-project
(pseudo-code):
if (${IMAGE_BASENAME} == "first-project-image") {
// write the whole bbappend here
}
Such that this bbappend is only considered when building the image first-project-image
. However, ${IMAGE_BASENAME}
does not seem to be set in the hostapd
recipe...
Another idea, similar to COMPATIBLE_HOST and COMPATIBLE_MACHINE would be to define a COMPATIBLE_IMAGE variable, but that does not exist.