modifying kernel config in Yocto

38k views Asked by At

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?

6

There are 6 answers

0
Alexandre Belloni On

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.

0
ZBT248 On

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.

4
anoopknr On

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

bitbake -c menuconfig virtual/kernel
0
theadnangondal On

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

1
Georgi Georgiev On

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.

0
Craftonix - AA On

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.