I'm building an image with Yocto, and need to patch a BitBake class in the upstream tree. I do not want to modify the upstream sources and would prefer to add the modification to a local layer.
For a BitBake recipe, I'd use a .bbappend file. What should be used for a class?
Create classes folder in your meta layer and create a new class, e.g. myclass.bbclass. Inherit original class with inherit original-bitbake-CLASS and add whatever functionality you need.
Then use the new bbclass instead of the original.
@lukaszgard method works except for one minor issue. BBFILE_PRIORITY does not provide override capability for bbclass and conf files, it only works for recipes (.bb). This is based on a section of the Yocto manual, Prioritizing Your Layer where it says
Note: It is possible for a recipe with a lower version number PV in a layer that has a higher priority to take precedence. Also, the layer priority does not currently affect the precedence order of .conf or .bbclass files. Future versions of BitBake might address this.
A method I found that works is to create a bblayer, create and apply changes of the required bbclass and then in /build/conf/bblayers.conf, place the created bblayer above the layer that you are trying to override.
This is based on another section of the Yocto manual which says
Note: During a build, the OpenEmbedded build system looks in the layers from the top of the list down to the bottom in that order.
An example:
BBLAYERS ?= " \
${TOPDIR}/../layers/<layer with new bbclass> \
${TOPDIR}/../layers/<layer with old bbclass> \
"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With