[yocto] KBUILD_DEFCONFIG_KMACHINE not used anywhere

Bruce Ashfield bruce.ashfield at windriver.com
Tue Nov 7 09:47:47 PST 2017


On 11/07/2017 08:46 AM, Alan Martinovic wrote:
> Hi,
> I'm trying to get yocto to build the kernel with an in-tree defconfig.
> For that I found references to the variable KBUILD_DEFCONFIG_KMACHINE.
> 
> However, I've been experiencing that the kernel is being built with
> some default defconfig, and not the in-tree one that came with the
> kernel and I defined with the KBUILD_DEFCONFIG_KMACHINE.
> 
> I've looked through all yocto sources for where the
> KBUILD_DEFCONFIG_KMACHINE is actually used, and found it only in my
> kernel recipe. So I decided to dissect my recipe.

What is your kernel recipe ? Something you wrote, or something
from a vendor ?

> 
> There is a:
> 
> inherit kernel
> 
> in my recipe for which, besides others, defines how the kernel config
> will be selected.
> Looking at the sources of oe/meta/classes/kernel.bbclass exposes how
> the kernel configuration happens:
> 
> kernel_do_configure() {
>          # fixes extra + in /lib/modules/2.6.37+
>          # $ scripts/setlocalversion . => +
>          # $ make kernelversion => 2.6.37
>          # $ make kernelrelease => 2.6.37+
>          touch ${B}/.scmversion ${S}/.scmversion
> 
>          if [ "${S}" != "${B}" ] && [ -f "${S}/.config" ] && [ ! -f
> "${B}/.config" ]; then
>                  mv "${S}/.config" "${B}/.config"
>          fi
> 
>          # Copy defconfig to .config if .config does not exist. This allows
>          # recipes to manage the .config themselves in do_configure_prepend().
>          if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then
>                  cp "${WORKDIR}/defconfig" "${B}/.config"
>          fi
> 
>          ${KERNEL_CONFIG_COMMAND}
> }
> 
> 
> I'm planning a workaround by overriding the do_configure in my recipe
> to select the correct defconfig from the kernel. It does seem however
> like the KBUILD_DEFCONFIG_KMACHINE is exactly here to not have to do
> the workarounds.
> 
> Anyone has experiences with successfully using KBUILD_DEFCONFIG_KMACHINE?
> Is it a specific poky feature (I'm not using poky but specific open
> embedded layers and bitbake)?
That is a feature of kernel-yocto, so if your recipe is inheriting
kernel-yocto you can use what you are looking for.

But note, in the documentation you are referencing you have to replace
KMACHINE with your actual machine .. not use the string KMACHINE.

i.e. in your recipe (or bbappend)

# for cases where the KMACHINE (KERNEL MACHINE) and bitbake
# machine match, just do this:
KMACHINE=$MACHINE

KBUILD_DEFCONFIG_${KMACHINE}="your defconfig"

i.e. it is just a standard bitbake variable with a machine OVERRIDE
to make it specific to the machine you are building.

Bruce

> 
> Be Well,
> Alan
> 
> Ref.
> https://www.yoctoproject.org/docs/2.2/kernel-dev/kernel-dev.html#using-an-in-tree-defconfig-file
> 




More information about the yocto mailing list