Yocto - Cannot disable CONFIG_BT

I am trying to build a kernel with Yocto, with various kernel features disabled.
No matter what I try, the features eg. CONFIG_BT and CONFIG_STACKTRACE always gets enabled.

I have followed the guide on how to build the console-tdx-image from the reference 2.8 image layer.
Build a Reference Image with Yocto Project/OpenEmbedded | Toradex Developer Center.

For disabling the different features I have tried various techniques, but essentially I would just like to provide a full kernel config that I know will be used, so I can be in full control.
Following this Yocto - Change Kernel Configuration through defconfig - Technical Support - Toradex Community does not help, as it seems it is not actually being applied.
I ended up with the following to overwrite the colibri_t20_defconfig file in the kernel source tree.

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://t20-kernel.config"

do_unpack_append(){
    bb.build.exec_func('replace_file', d)
}

replace_file(){
    cp -f t20-kernel.config ${S}/arch/arm/configs/colibri_t20_defconfig
}

From a few other config variables I can tell that this technique works, but when I check the config extracted from the kernel I can see that eg. CONFIG_BT is re-enabled.
After a lot of hair pulling, my debugging tells me that it gets overwritten by the auto.conf file that I guess get’s brought in by the kernel source clone?!
There’s a small reference to this in the meta-toradex-bsp-common/recipes-kernel/linux/linux-toradex_%.bbappend file that looks like this:

do_shared_workdir_append () {
    if [ -f include/config/auto.conf ]; then
        mkdir -p $kerneldir/include/config/
        cp -f include/config/auto.conf $kerneldir/include/config/
    fi
....
}

Is there anyway this can be overcome, so that I can be in complete control of what my kernel should contain?

Thanks, Thomas Bowley

Hi @tbowley,

First, use bitbake to generate the menuconfig, so, then, make your changes on it.

bitbake -c menuconfig virtual/kernel

After that, save your config:

bitbake -c savedefconfig virtual/kernel

Yocto you provide you the path in which the defconfig is saved. Copy that to the path on your layer.

Then, please try the following:

Be sure that you have the following structure for your layer:

recipes-kernel/
└── linux
    ├── files
    │   ├── defconfig
    └── linux-toradex_%.bbappend

Considering that defconfig is the defconfig you plan to use.

Then, linux-toradex_%.bbappend can have the following content:

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI += "file://defconfig"

KERNEL_DEFCONFIG_colibri_t20 ?= "${WORKDIR}/defconfig"

Please let me know if that worked.

Best regards,
André Curvello