# \[solved\] Kernel configuration fragment application

**URL:** https://forum.legato.io/t/solved-kernel-configuration-fragment-application/3943
**Category:** Legato Linux distribution (Yocto project)
**Created:** [December 12, 2018, 11:49am UTC](https://forum.legato.io/t/solved-kernel-configuration-fragment-application/3943 "2018-12-12T11:49:43Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![andcor](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@andcor](https://forum.legato.io/u/andcor)
#### Post date: [December 12, 2018, 11:49am UTC](https://forum.legato.io/t/solved-kernel-configuration-fragment-application/3943/1 "2018-12-12T11:49:43Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Manukumar](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@Manukumar](https://forum.legato.io/u/Manukumar)
#### Post date: [December 14, 2018, 12:21pm UTC](https://forum.legato.io/t/solved-kernel-configuration-fragment-application/3943/2 "2018-12-14T12:21:59Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![andcor](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@andcor](https://forum.legato.io/u/andcor)
#### Post date: [December 14, 2018, 1:17pm UTC](https://forum.legato.io/t/solved-kernel-configuration-fragment-application/3943/3 "2018-12-14T13:17:02Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![CoRfr](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/corfr/32/69_2.png) [@CoRfr](https://forum.legato.io/u/CoRfr)
#### Post date: [December 17, 2018, 7:09pm UTC](https://forum.legato.io/t/solved-kernel-configuration-fragment-application/3943/4 "2018-12-17T19:09:29Z")

</div>

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](http://kernel.org).

So in a sense, our Yocto configuration is not really ‘the yocto way’ anymore but closer to ‘the [kernel.org](http://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`.

---

<div class="post-metadata">

### Author: ![andcor](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@andcor](https://forum.legato.io/u/andcor)
#### Post date: [December 18, 2018, 6:07am UTC](https://forum.legato.io/t/solved-kernel-configuration-fragment-application/3943/5 "2018-12-18T06:07:01Z")

</div>

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).

---

<div class="post-metadata">

### Author: ![andcor](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@andcor](https://forum.legato.io/u/andcor)
#### Post date: [December 19, 2018, 1:49pm UTC](https://forum.legato.io/t/solved-kernel-configuration-fragment-application/3943/6 "2018-12-19T13:49:01Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![CoRfr](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/corfr/32/69_2.png) [@CoRfr](https://forum.legato.io/u/CoRfr)
#### Post date: [December 19, 2018, 5:09pm UTC](https://forum.legato.io/t/solved-kernel-configuration-fragment-application/3943/7 "2018-12-19T17:09:06Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![andcor](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@andcor](https://forum.legato.io/u/andcor)
#### Post date: [December 19, 2018, 7:09pm UTC](https://forum.legato.io/t/solved-kernel-configuration-fragment-application/3943/8 "2018-12-19T19:09:55Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![CoRfr](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/corfr/32/69_2.png) [@CoRfr](https://forum.legato.io/u/CoRfr)
#### Post date: [December 19, 2018, 7:30pm UTC](https://forum.legato.io/t/solved-kernel-configuration-fragment-application/3943/9 "2018-12-19T19:30:36Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![andcor](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@andcor](https://forum.legato.io/u/andcor)
#### Post date: [December 20, 2018, 7:57am UTC](https://forum.legato.io/t/solved-kernel-configuration-fragment-application/3943/10 "2018-12-20T07:57:34Z")

</div>

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

---

<div class="post-metadata">

### Author: ![fgodfrey](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@fgodfrey](https://forum.legato.io/u/fgodfrey)
#### Post date: [April 19, 2019, 5:15am UTC](https://forum.legato.io/t/solved-kernel-configuration-fragment-application/3943/11 "2019-04-19T05:15:33Z")

</div>

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() {
...

```

---

<div class="post-metadata">

### Author: ![andcor](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@andcor](https://forum.legato.io/u/andcor)
#### Post date: [May 22, 2019, 6:14am UTC](https://forum.legato.io/t/solved-kernel-configuration-fragment-application/3943/12 "2019-05-22T06:14:11Z")

</div>

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

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