modifying kernel config in Yocto
Asked Answered
V

6

20

I am trying to modify the kernel config without luck.

There is a BSP in meta-xxx-yyy/ with recipes-kernel/linux/linux_git.bb. I try to override the kernel config in my layer named meta-xxx-mylayer where I have recipes-kernel/linux/linux_git.bbappend and recipes-kernel/linux/files/frag.cfg

frag.cfg:

# CONFIG_NETFILTER is not set
CONFIG_AUTOFS4_FS=y 

linux_git.bbappend:

COMPATIBLE_MACHINE_my_mach = "my_mach"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://frag.cfg"

linux_git.bb: (just a part of the file)

KERNEL_RELEASE = "3.10"
PV = "3.10"
PR = "r10"
S = "${WORKDIR}/git"
COMPATIBLE_MACHINE = "(my_mach)"

meta-xxx-yyy/conf/machine/my_mach.conf: (there is no meta-xxx-mylayer/conf/machine/my_mach.conf)

PREFERRED_PROVIDER_virtual/kernel = "linux"
UBOOT_MACHINE = "socfpga_cyclone5_config"
KERNEL_MACHINE = "socfpga"

Build commands:

bitbake linux -c cleansstate -f
bitbake linux -c configure -f
bitbake linux -c compile -f
bitbake linux -c deploy -f

Everything builds, but when I inspect /proc/config.gz, I can see that CONFIG_AUTOFS4_FS is not enabled.

I have another recipe in the meta-xxx-mylayer layer which builds and installs into rootfs just fine so I know that the layer is enabled.

The frag.cfg file is copied to ./tmp/work/my_mach-poky-linux-gnueabi/linux/3.10-r10/ during build, while the rest of the files are in ./tmp/work/my_mach-poky-linux-gnueabi/linux/3.10-r10/git/. Is that a problem?

Vertical answered 24/6, 2015 at 20:24 Comment(0)
C
9

It is difficult to answer without seeing the real kernel recipe but what is probably happening is that the kernel recipe for the socfpga only inhertis kernel and not linux-yocto. If that is the case, then you can't change the configuration using fragments, you have to provide a full defconfig.

Commentary answered 25/6, 2015 at 9:22 Comment(0)
B
5

maybe it is late but...

The kernel development have its own way for making changes. I put one post here yesterday but I understood I am wrong so I erased it immediately. I will not put the exact steps. Just short description. You should find them in yocto dev manual, because it is not something special.

The kernel changes should be made directly on the sources (usually in /workdir/tmp/). And then use git to make patches. If you make changes in configuration using bitbake -c menuconfig virtual/kernel, or other way, put it directly in kernel .bbappend file as you did. That definitely works. I tried with devtool almost the same and the patches were left not merged.

Babiche answered 7/12, 2016 at 12:29 Comment(1)
It sounds all fine... but... WHERE is .config stored in case of bitbake -c menuconfig linux-ti-staging? I can't find it anywhere... Therefore I can't create patch and anything else. Everything stops HERE.Metaphosphate
E
4

I agree with Alexandre Belloni, but with a small correction. If your kernel recipe (linux_git.bb) only inherits from kernel and not kernel-yocto, then you cannot use configuration fragments.

Unfortunately, I was not able to see any explanation of this in the docs, but looking at

kernel-yocto.bbclass:

# returns all the elements from the src uri that are .scc files
def find_sccs(d):
    sources=src_patches(d, True)
    sources_list=[]
    for s in sources:
        base, ext = os.path.splitext(os.path.basename(s))
        if ext and ext in [".scc", ".cfg"]:
            sources_list.append(s)
        elif base and base in 'defconfig':
            sources_list.append(s)

    return sources_list



    sccs="$sccs ${@" ".join(find_sccs(d))}"
    patches="${@" ".join(find_patches(d))}"
    feat_dirs="${@" ".join(find_kernel_feature_dirs(d))}"



    # updates or generates the target description
    updateme ${updateme_flags} -DKDESC=${KMACHINE}:${LINUX_KERNEL_TYPE} \
                         ${includes} ${addon_features} ${ARCH} ${KMACHINE} ${sccs} ${patches}

you can see that any file with the extension .cfg gets added to the sccs variable, which gets used in the updateme kernel tool.

Elston answered 15/3, 2017 at 6:34 Comment(0)
E
4

The simple way to make modifying kernel config using menuconfig in Yocto is :-

bitbake -c menuconfig virtual/kernel
Extensible answered 3/1, 2019 at 6:9 Comment(4)
What do you do after overwriting the .config file? I ran bitbake $MY_IMAGE and nothing seemed to change...Swop
Menuconfig is a poor option for permanent changes. It only affect the build tree not the recipe.Fernandefernandel
I am on Yocto as well... I am using kernel linux-ti-staging and there is no .config file to be found anywhere at the moment. Especially not in the source tree of the kernel. Ìt is also not created when I ran bitbake -c menuconfig linux-ti-staging and chose to store the configuration as .config? Where is it created? Whoever at any time manually compiled Linux kernel (without Yocto) knows that .config is created in the current working directory from where we run "make menuconfig" but where is it stored in case of bitbake -c menuconfig linux-ti-staging?Metaphosphate
I found .config in the tmp/work/<machine>/linux-ti-staging/<version>/build.Metaphosphate
K
1

There can be two possible problems. First, your meta-layer, whatever its name, has low priority than the meta of your original kernel. Please check the priority of your meta-layer.

Secondly, use the devtool to segregate the kernel, with the command devtool modify virtual/kernel and then try to make your changes in that kernel which will be located into the workspace/sources/whatever-the-name-of-your-kernel.

Ketone answered 15/3, 2022 at 8:42 Comment(0)
C
0

are the dependencies for your kernel configuration flag resolved properly ? I guess this would be the problem in this case

Clemenciaclemency answered 8/10, 2015 at 13:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.