My defconfig is not used when building Kernel

Hello,

I’m using Openembedded to generate a full target image (boot/kernel/rootfs…)

I had my own meta directory with a “recipes-kernel/linux” directory. Here are the folder/files:

  • conf
  • layer.conf
  • machine
  • colibri-imx7.conf
  • recipes-kernel/
  • linux-toradex_4.1.15.bbappend
  • linux-toradex/
  • files/
    - defconfig

In the linux-toradex_4.1.15.bbappend file, I add defconfig to the SRC_URI. If I remove the defconfig file, there is an error when trying to compile the kernel. But when the defconfig file is present, it is like it is not used. My modifications are not present in the config file of the build directory. Any idea what is wrong?

The meta priority is set to 90, highest in the project, so it should be used.

Note that the meta-toradex-nxp layer also has a priority of 90. Depending on how much you modify the defconfig, you may want to consider only making modifications to the defconfig provided by meta-toradex-nxp/meta-fsl-3rdparty using do_configure_prepend(), for example as done here: http://code.qt.io/cgit/yocto/meta-boot2qt.git/tree/meta-toradex-extras/recipes/linux/linux-toradex_4.%.bbappend?h=jethro#n32.

This solution only alow to add option to the defconfig. I can not remove option already present in the defconfig.

There are option activated in Toradex defconfig that I want to be remove. So I need to have my own defconfig to be use.

That is not exactly true.
You could add something as follows to remove stuff:

sed -i -e /CONFIG_MXC_TVIN_ADV7280/d ${WORKDIR}/.config

That is true. But easyest way to test configuration would be to make the

bitbake linux-toradex -c menuconfig

And then save the defconfig in my layer. Any idea why the defconfig used is always the Toradex one, even if I change the priority to 91?
Otherwise I will have to compare files, see what is removed, what is added… quite long just for tests…

Hi

The above source tree is sort of strange.
I would expect that the bbappend file would be the linux-toradex directory, not in recipes-kernel. (But of course your layer.conf could contain an unusual search pattern for bbappend files)

Then you’re bbappend need probably only contain the following line:
FILESEXTRAPATHS_prepend := “${THISDIR}/files:”

If you delete both your defconfig and the defconfig in meta-toradex-nxp you will get a bitbake error message with a list of directories search in turn for the defconfig file. That should contain your directory before any other one.

Max

About directory, mine looks like meta-toradex-nxp.

Anyway, my defconfig is found by bitbake. If I remove it, I have an error “Failed to fetch…”

If I put it back, bitbake kernel compilation work fine. But when I check in the build directory, the .config file is generated from the Toradex defconfig, and not mine. :frowning:

It is working like if Toradex recipe is applied after mine…

So what version of things are you using?

What is the content of your bbappend file?

What files do you have in your layer related to the kernel?
e.g. what is the output of

find <your-layer>/recipes-kernel

Ok… I do not know how to remove the “answer” for my previous comment…

In fact, it is still the toradex defconfig that is used. I is like there is NO way to use a different defconfig. Really an,oying. Yocto is ***!!

Priority seems to be only for decoration as it do not change anything!

The only “solution” seems to be removing defconfig from Toradex and copy yours in the directory…

THANK YOU STEFAN!! :slight_smile:

Having the defconfig file in the colibri-imx7 directory make it being used by Yocto!!

I came across the this issue today, while searching a possibility to customize the kernel config for colibri-imx6.

Basically I do like the idea of modifying the existing defconfig file as suggested in thecomments above. But I’ve found that do_configure_prepend() is not the right place to modify ${WORKDIR}/defconfig. Two working solutions for me are:

  • Either to modify ${WORKDIR}/defconfig in do_preconfigure_prepend()
  • Or to modify ${B}/.config in do_configure_prepend()

This is because do_preconfigure() copies ${WORKDIR}/defconfig to ${B}/.config.

Regards,
Joerg

I share your pain, OpenEmbedded drives me crazy sometimes too, I guess that is just the nature of such a complex beast…

That said, I created a layer ontop of our layer recently for our Low Power Demo, and it seemed to work there:

I think what happens here is that OE prefers the defconfig in the meta-toradex-nxp layer since that is inside a machine specific directory (in this case colibri-imx7). OE precedence ${MACHINE}/file over file. In a quick test it seems to even prefer machine specific files in a “lower layer” also when prepending a path which contains a non-machine specific file of the same name. So in your case, moving defconfig to meta-mymeta/recipes-kernel/linux/linux-toradex/colibri-imx7/defconfig should help…

Some useful tips:

  • Use bitbake-layers show-layers to make sure the layer got applied
  • Use bitbake-layers show-appends | grep -A 5 linux-toradex to check that the bbappend gets properly applied
  • Sometimes checking the environment generated by a recipe helps (use bitbake -e linux-toradex > /tmp/env and then check /tmp/env)

Ok, I found out what was wrong…
My layer was like that:

meta-mymeta/recipes-kernel/
meta-mymeta/recipes-kernel/linux
meta-mymeta/recipes-kernel/linux/linux-toradex_4.1.15.bbappend
meta-mymeta/recipes-kernel/linux/linux-toradex
meta-mymeta/recipes-kernel/linux/linux-toradex/files
meta-mymeta/recipes-kernel/linux/linux-toradex/files/defconfig

It seem that the problem was with the “files” directory. If I put the defconfig file directly in the linux-toradex directory, it work!
So my meta looks like that:

meta-mymeta/recipes-kernel/
meta-mymeta/recipes-kernel/linux
meta-mymeta/recipes-kernel/linux/linux-toradex_4.1.15.bbappend
meta-mymeta/recipes-kernel/linux/linux-toradex
meta-mymeta/recipes-kernel/linux/linux-toradex/defconfig
meta-mymeta/recipes-kernel/linux/linux-toradex/files

Here my defconfig file is found (I change SRC_URI += “file://file/defconfig” to SRC_URI += “file://defconfig” in the bbhappend file) and is used to compile kernel!

Thank you all for your help

I just wanted to share my setup, because it has worked quite well for me. First, I have my own layer in the bblayers setup with priority 91. bitbake-layers show-layers:

layer                 path                                      priority
==========================================================================
meta                  /home/kory.swain/eezrevision/poky/meta    5
meta-poky             /home/kory.swain/eezrevision/poky/meta-poky  5
meta-yocto-bsp        /home/kory.swain/eezrevision/poky/meta-yocto-bsp  5
meta-toradex-bsp-common  /home/kory.swain/eezrevision/poky/meta-toradex-bsp-common  90
meta-toradex-tegra    /home/kory.swain/eezrevision/poky/meta-toradex-tegra  90
meta-apollo-poky      /home/kory.swain/eezrevision/poky/meta-apollo-poky  91
meta-qt4              /home/kory.swain/eezrevision/poky/meta-qt4  6

My mainline kernel.bb has our own tegra-apollo_defconfig

SRC_URI_append_apalis-t30-mainline = " \
    file://0036-apalis-t30-mainline-usb-device-aka-gadget-specific-d.patch \
    file://0500-apollo-enable-lvds.patch \
    file://0501-apollo-mainline-AR1100-touchscreen.patch \
    file://0502-apollo-mainline-slowuarts.patch \
    file://0504-apollo-uart-fix.patch \
    file://xusb.bin \
    file://sd8787_uapsta.bin \
    file://tegra-apollo_defconfig \
"

In our own layer priority 91, the machine conf selects our own defconfig

PREFERRED_PROVIDER_virtual/kernel = "linux-toradex-mainline"
KERNEL_DEFCONFIG = "tegra-apollo_defconfig"
PREFERRED_PROVIDER_u-boot = "u-boot-apollo-toradex"
KERNEL_DEVICETREE += "tegra30-apalis-eval.dtb"

Now, you run bitbake -c menuconfig virtual/kerenel. Make your changes. Then run bitbake -c savedefconfig virtual/kerenel. The output of savedefconfig tells you where to fetch the config. Copy that config back to your own layer recipe-kernel/linux-mainline. Then you can bitbake -fc compile virtual/kernel and bitbake virtual/kerenel. For further tuning, you just got back to menuconfig and do it again.

That might sound tricky, but I do not need to maintain a separate kernel to tune the defconfig outside openembedded, and it’s clear which file is being used for our defconfig. When you overwrite your own defconfig, Ive found it a good idea to rename as backup, instead of overwrite, or delete. That way you can backtrack if you need to. Hope that helps.

Thanks for your input.

Thanks for the Input.