Bitbake附加文件以重新配置内核

aic*_*ell 5 configuration linux-kernel bitbake

我正在尝试重新配置一些.config变量,以生成启用了wifi支持的修改内核。内核的本机层/配方位于以下目录中:

    meta-layer/recipes-kernel/linux/linux-yocto_3.19.bb
Run Code Online (Sandbox Code Playgroud)

首先,我重新配置本机内核以添加wifi支持(例如,添加CONFIG_WLAN = y):

    $ bitbake linux-yocto -c menuconfig
Run Code Online (Sandbox Code Playgroud)

之后,我生成一个“ fragment.cfg”文件:

    $ bitbake linux-yocto -c diffconfig
Run Code Online (Sandbox Code Playgroud)

我已经将此目录创建到我的自定义层中:

    custom-layer/recipes-kernel/linux/linux-yocto/
Run Code Online (Sandbox Code Playgroud)

我已将“ fragment.cfg文件复制到此目录中:

    $ cp fragment.cfg custom-layer/recipes-kernel/linux/linux-yocto/
Run Code Online (Sandbox Code Playgroud)

我创建了一个附加文件以自定义本机内核配方:

    custom-layer/recipes-kernel/linux/linux-yocto_3.19.bbappend
Run Code Online (Sandbox Code Playgroud)

这是此附加文件的内容:

    FILESEXTRAPATHS_prepend:="${THISDIR}/${PN}:"
    SRC_URI += "file://fragment.cfg"
Run Code Online (Sandbox Code Playgroud)

之后,我执行内核编译:

    $ bitbake linux-yocto -c compile -f
Run Code Online (Sandbox Code Playgroud)

执行此命令后,可以在此工作目录中找到“ fragment.cfg”文件:

    tmp/work/platform/linux-yocto/3.19-r0
Run Code Online (Sandbox Code Playgroud)

但是,.config文件上没有任何预期的变量处于活动状态(例如,未设置CONFIG_WLAN)。

如何调试此问题?我应该怎么做错了?

aic*_*ell 5

在分析了不同资源上提出的不同链接和解决方案后,我最终发现链接https://community.freescale.com/thread/376369指向一个令人讨厌但有效的补丁,包括在附加文件末尾添加此函数:

do_configure_append() {
    cat ${WORKDIR}/*.cfg >> ${B}/.config
}
Run Code Online (Sandbox Code Playgroud)

它有效,但我希望 Yocto 管理所有这些东西。很高兴知道所提出的解决方案有什么问题。先感谢您!


小智 5

添加此配置时,您希望在语句中使用 append,例如:

SRC_URI_append = "file://fragment.cfg"


小智 5

如果您的配方基于 kernel.bbclass,则片段将不起作用。需要继承kernel-yocto.bbclass

您还可以使用内核源代码中存在的 merge_config.sh 脚本。我做了这样的事情:

do_configure_append () {
    ${S}/scripts/kconfig/merge_config.sh -m -O ${WORKDIR}/build ${WORKDIR}/build/.config ${WORKDIR}/*.cfg
}
Run Code Online (Sandbox Code Playgroud)