[yocto] .bbappend and require

Nicolas Dechesne nicolas.dechesne at linaro.org
Mon Dec 8 12:05:24 PST 2014


On Mon, Dec 8, 2014 at 8:27 PM, Gary Thomas <gary at mlbassoc.com> wrote:
> I have a base image in my distribution (e.g. xyz-image-base.bb).
> Many of my layers will build on this using 'require', e.g.
>   require recipes-base/images/xyz-image-base.bb
>
> Sometimes a given layer may create many such image recipes, each
> using 'require' to fill in the base.  It would be nice to be able
> to adjust the base recipe using a .bbappend in the layer so that
> all images built by that layer use the same changes.  I've found
> that this doesn't work as .bbappend files do not seem to be used
> by 'require'.
>
> It's easy to see this bug in action - just create a file
> 'core-image-minimal.bbappend' which contains:
>   CORE_IMAGE_EXTRA_INSTALL += " non-existent-package"
> With this, you *can* build core-image-minimal-dev (which uses
> 'require' to build on core-image-minimal) but not core-image-minimal.
>
> Is there some [good] reason for this behaviour or a bug?

this isn't a bug. a .bbappend is to append content to a recipe. when
you build core-image-mininal-dev, this is the actual recipe name. so
if you want a .bbappend it would be core-image-minimal-dev.bbappend.

if you actually try to build core-image-minimal, then the .bbappend
would be applied.

this is good behavior here. nothing wrong.

> Could it be made to work the way I had hoped/expected?

i don't see any easy way to do that.
- you might be able to get something to work using layer priorities ,
but even if it works it's quite fragile.
- you can create another level of indirection, in the layer that
requires customization, you create xyz-image-base-layer-foo.bb, and
require that file in all your images, so that you can introduce
changes at one place.
- you can use variables in the generic image to offer several
configurations, and set these variables at the layer level
- maybe using a class instead of a recipe might make sense easier to
manage as well.



More information about the yocto mailing list