Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bitbake append file to reconfigure kernel

I'm trying to reconfigure some .config variables to generate a modified kernel with wifi support enabled. The native layer/recipe for the kernel is located in this directory:

    meta-layer/recipes-kernel/linux/linux-yocto_3.19.bb

First I reconfigure the native kernel to add wifi support (for example, adding CONFIG_WLAN=y):

    $ bitbake linux-yocto -c menuconfig

After that, I generate a "fragment.cfg" file:

    $ bitbake linux-yocto -c diffconfig

I have created this directory into my custom-layer:

    custom-layer/recipes-kernel/linux/linux-yocto/

I have copied the "fragment.cfg file into this directory:

    $ cp fragment.cfg custom-layer/recipes-kernel/linux/linux-yocto/

I have created an append file to customize the native kernel recipe:

    custom-layer/recipes-kernel/linux/linux-yocto_3.19.bbappend

This is the content of this append file:

    FILESEXTRAPATHS_prepend:="${THISDIR}/${PN}:"
    SRC_URI += "file://fragment.cfg"

After that I execute the kernel compilation:

    $ bitbake linux-yocto -c compile -f

After this command, "fragment.cfg" file can be found into this working directory:

    tmp/work/platform/linux-yocto/3.19-r0

However none of the expected variables is active on the .config file (for example, CONFIG_WLAN is not set).

How can I debug this issue? What is supposed I'm doing wrong?

like image 760
criptobadia Avatar asked Mar 30 '16 06:03

criptobadia


4 Answers

When adding this configuration you want to use append in your statement such as:

SRC_URI_append = "file://fragment.cfg"

like image 77
vyev Avatar answered Nov 15 '22 12:11

vyev


After analyzing different links and solutions proposed on different resources, I finally found the link https://community.freescale.com/thread/376369 pointing to a nasty but working patch, consisting in adding this function at the end of append file:

do_configure_append() {
    cat ${WORKDIR}/*.cfg >> ${B}/.config
}

It works, but I expected Yocto managing all this stuff. It would be nice to know what is wrong with the proposed solution. Thank you in advance!

like image 37
criptobadia Avatar answered Nov 15 '22 10:11

criptobadia


If your recipe is based on kernel.bbclass then fragments will not work. You need to inherit kernel-yocto.bbclass

You can also use merge_config.sh scripts which is present in kernel sources. I did something like this:

do_configure_append () {
    ${S}/scripts/kconfig/merge_config.sh -m -O ${WORKDIR}/build ${WORKDIR}/build/.config ${WORKDIR}/*.cfg
}
like image 25
denis Avatar answered Nov 15 '22 12:11

denis


Well, unfortunately, not a real answer... As I haven't been digging deep enough.

This was working alright for me on a Daisy-based build, however, when updating the build system to Jethro or Krogoth, I get the same issue as you.

Issue: When adding a fragment like

custom-layer/recipes-kernel/linux/linux-yocto/cdc-ether.cfg

The configure step of the linux-yocto build won't find it. However, if you move it to:

 custom-layer/recipes-kernel/linux/linux-yocto/${MACHINE}/cdc-ether.cfg

it'll work as expected. And it's a sligthly less hackish way of getting it to work.

like image 43
Anders Avatar answered Nov 15 '22 11:11

Anders