@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> \
"
classes-recipe/kernel.bbclass
and simply placed two lines:inherit kernel
andNEW_DEFINE = "abc"
. The yocto kernel recipe is using by defaultkernel.bbclass
, and since my layer has priority, it is loading my version. But, it is not inheritingkernel.bbclass
from openembedded like this post suggests it would. I get a simple error that proves that:ERROR: Nothing PROVIDES 'virtual/kernel'
– Hexachord