8

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?

aicastell
  • 2,182
  • 2
  • 21
  • 33
  • Which version of OE? Could you show us your recipe? – Anders Mar 30 '16 at 07:09
  • I don't think OE version is relevant for this, but if can be helpful, DISTRO="poky" and DISTRO_VERSION="1.8". The content of the recipe is exactly the contained into custom-layer/recipes-kernel/linux/linux-yocto_3.19.bbappend – aicastell Mar 30 '16 at 07:31

5 Answers5

6

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

SRC_URI_append = "file://fragment.cfg"

vyev
  • 69
  • 1
  • 3
  • This is the answer that solved my problem! The order in which `SRC_URI +=` and `SRC_URI_append` are applied is, apparently, different.The [Bitbake User Manual](https://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html#variable-interaction-worked-examples) hints at this, but I didn't fully appreciate, until now, just how ugly the consequences of my imperfect understanding of this were. In my case, I was "appending to an append", and it happens that the recipe I assumed was parsed before mine was overwriting `SRC_URI` _after_ my recipe had called `SRC_URI +=`. Doh! – evadeflow Aug 07 '17 at 15:38
4

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!

aicastell
  • 2,182
  • 2
  • 21
  • 33
4

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
}
denis
  • 41
  • 2
1

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.

Anders
  • 8,541
  • 1
  • 27
  • 34
  • The proposed solution doesn't work in my Freescale based Poky environment (DISTRO="poky", DISTRO_VERSION="1.8"). But at least it seems clear now that this is a broken feature that should be fixed in newer versions to work as expected. By the moment I'll fix it using the do_configure_append hack. Thank you for the answer Mr. Anders. – aicastell Mar 30 '16 at 14:55
0

If anyone comes by, this is working on jethro and sumo:

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

SRC_URI_append = " \
  file://fragment.cfg \
"

FILESEXTRAPATHS documentation says:

Extends the search path the OpenEmbedded build system uses when looking for files and patches as it processes recipes and append files. The directories BitBake uses when it processes recipes are defined by the FILESPATH variable, and can be extended using FILESEXTRAPATHS.

David Bensoussan
  • 2,887
  • 2
  • 38
  • 55