[solved] Kernel configuration fragment application

Hi

We are trying to merge in our yocto layer into the source code for the 16.1 yocto build for the wp750x platform. In doing this I have some problems getting my kernel configuration fragment .cfg file applied to the kernel build. I have previously (version 15) been able to simply add a .cfg file to an linux-yocto_3.14.bbappend file and thereby edit the kernel .config file before building the kernel and thus been able to enable some kernel drivers that were otherwise disabled. Has this process been changed in the new 16.1 build setup?

Kind regards

Andreas

We checked in R16.1 and enabled drivers in menuconfig and checked in .config file to verify drivers enabled in menuconfig. drivers enabled is present in .config file.
Please provide the steps followed and logs if any.

The process is to make the changes in the menuconfig, then run a bitbake linux-yocto -c diffconfig and take the resulting fragment and add it to a new layer linux-yocto_3.14.bbappend recipe. This should be the correct way to add the changes in the menuconfig to the layer description, but it does not seem to be taken into account when actually building the kernel.

Hi @andcor,

that process has changed a bit because kernels for our other products (wp76xx, …) are not forks of ‘linux-yocto’, but instead forks of ‘linux-quic’, which has a configuration process that is similar to the linux from kernel.org.

So in a sense, our Yocto configuration is not really ‘the yocto way’ anymore but closer to ‘the kernel.org way’.

To patch the configuration on wp75/wp85, I would recommend that you create a patch for the arch/arm/configs/mdm9615_defconfig file, that you add in a linux-yocto_3.14.bbappend.

Makes sense and it close to what I ended up doing. I have just modified the recipe to overwrite the .config file with one of my own. But I see that the patch approach is much cleaner (Why didn’t I think of that).

How do you do a patch to that file? I have a couple of patches in my build recipe which I have just now discovered is not applied to the kernel tree before building.

You would need to apply the configuration to arch/arm/configs/mdm9615_defconfig, create a git commit with your change and then do a git format-patch -1.
If you apply multiple fragments, you can create as many commits as you want and run git format-patch -n with n=<nb of patches>.
Then add the .patch to yocto.

The thing is, I already have quite a lot of patches to the kernel that I have just know discovered were not applied. Is there any special tricks to make the .patch file actally get taken into account when building the kernel?

If we are talking about patches that are not just for the configuration but also the source code, and you’re adding these patches through SRC_URI, they should be applied to the kernel as extracted in build_bin. If that’s not the case I think that’s a bug.

It does, infact, not seem to work. At least for me.

Sorry to resurrect an old thread but…

I wonder if it’s not working because the do_patch() function is stubbed out in the linux-quic recipe:

fgodfrey@sierra-build:~/sierra-software-20190310/yocto/meta-swi/meta-swi-mdm9x28/recipes-kernel/linux$ more linux-quic_git.bb 
...
DEPENDS += "ima-support-tools-native gcc"

do_patch() {
}

do_configure_prepend() {
...

That is not at all unlikely. I, however, haven’t got the time to investigate it at the moment so I hope that someone else will step in and do some investigations in how to do this correctly.

What I have done in my code is to add a precompile step that applies my patches to the source

do_compile_prepend() {
    path=`pwd`
    cd ${KBUILD_OUTPUT}
    cp ../*.diff source/
    cd source
    for file in *.diff; do
        patch -p1 < $file
    done
    cd $path
}