Kernel Configuration using Config

i am trying to make some modifications on kernel but it’s not able to use the defconfig
this is my bbappend recipe :

ILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

SRC_URI += "file://0001-add-qmi-support.patch \
            file://defconfig"

KCONFIG_MODE = "alldefconfig"

the problem is that the defconfig is not used when i do -c cleansstate and rebuild my recipe alll the modifications are gone
here’s the error

WARNING: linux-toradex-5.15.148+gitAUTOINC+bfdbfb2c85-r0 do_kernel_metadata: [NOTE]: defconfig was supplied both via KBUILD_DEFCONFIG and SRC_URI. Dropping SRC_URI defconfig
WARNING: linux-toradex-5.15.148+gitAUTOINC+bfdbfb2c85-r0 do_kernel_configme: [NOTE]: defconfig was supplied both via KBUILD_DEFCONFIG and SRC_URI. Dropping SRC_URI defconfig

i though KCONFIG_MODE = “alldefconfig” is suppose to use both default defconfig and my custom defconfig

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello!

It seems you’re encountering a conflict between your custom defconfig and the default one specified by KBUILD_DEFCONFIG. The warnings indicate that the defconfig from SRC_URI is being ignored. Let’s address this so your custom configuration is used.

Here’s what you can do:

  1. Unset KBUILD_DEFCONFIG: This will prevent the default in-tree defconfig from taking precedence. Add the following line to your bbappend file:

    unset KBUILD_DEFCONFIG
    
  2. Ensure Correct File Path Precedence: You’ve already set FILESEXTRAPATHS correctly, which is great. This ensures the build system looks in your custom directory first:

    FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
    
  3. Verify KCONFIG_MODE: The KCONFIG_MODE = "alldefconfig" setting should work for using your custom defconfig. Ensure your defconfig file is correctly named and placed in the expected directory.

  4. Rebuild the Kernel: After making these changes, clean the state and rebuild your kernel recipe:

    bitbake -c cleansstate linux-toradex
    bitbake linux-toradex
    

By following these steps, your custom defconfig should be applied during the kernel build process, resolving the warnings and ensuring your modifications are included.

If you have any more questions, feel free to ask!

Best regards,
Toradex AI Assistant

Please, also check if these links can help you solve your problem:

https://git.yoctoproject.org/poky/plain/meta-skeleton/recipes-kernel/linux/linux-yocto-custom.bb.

Hi @rania !

For BSP 7, the approach for adding your own kernel configs should be done using kernel config fragments.

We need to update our documentation regarding this.

For now, this Wiki from one of our partners can help you on how to deal with kernel config fragments: Modify the linux kernel with configuration fragments in Yocto - KoanSoftware Wiki

Best regards,

Hi @rania !

Do you have any updates here? Were you able to solve it on your side?

Best regards,