Search code examples
bitbakeopenembedded

How to modify a kernel based on what top-level recipe is being built using openembedded and bitbake?


I have two recipes that build an embedded linux image, call them A.bb and B.bb. I have a kernel patch that needs to be applied to one recipe but not the other. Following these docs I created my own layer and added a bbappend <your-layer>/recipes-kernel/linux/linux-yocto_3.4.bbappend and inside I put SRC_URI|+="kernel.patch". How can I do something like the following:

if (A):
   SRC_URI+="kernel.patch"
else:
   SRC_URI+=""

I tried the following:

Inside A.bb, I have export IMAGE_NAME="A"
Then inside linux_yocto_3.4.bbappend I have
SRC_URI_append = " ${@bb.utils.contains('IMAGE_NAME', 'A', 'file://kernel.patch', '', d)} "

But this doesn't work. Thank you for your help!


Solution

  • You can't.

    A recipe can't influence how anything else is built; an image is just a recipe, thus is can't modify how the kernel is being built nor patched.