如何在Yocto中彻底重建Linux内核模块?

时间:2019-04-25 16:56:48

标签: linux-kernel kernel-module yocto bsp

我可以rm -rf tmp/ sstate-cache/ cache/并从头开始运行整个Yocto构建,但是我宁愿不重建所有内容(尤其是像Qt这样的软件包可能需要一些时间)。

我尝试过:

bitbake -c cleansstate linux-iwg15 kernel-module-imx-gpu-viv cryptodev-module

注意:我也尝试过cleanall,但结果相同:

其中一个内核模块一旦到达do_compile,最终都会引发此错误:

  ERROR: Kernel configuration is invalid.
         include/generated/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.

{build_dir}/tmp/work-shared/{MACHINE}/kernel-build-artifacts文件夹实际上包含include/generated/autoconf.h

我尝试将kernel-build-artifacts的内容复制到{build_dir}/tmp/work-shared/{MACHINE}/kernel-source,但仍然出现错误。

linux-iwg15的BitBake配方为this

在重建Linux内核模块之前,还有其他需要清除的东西吗?

干净构建后,我确实注意到kernel-build-artifacts包含kernelscripts文件夹(以及source..\kernel-source的符号链接),我不记得在运行bitbake -c cleansstate后尝试重建时在那儿了。

1 个答案:

答案 0 :(得分:1)

<块引用>

在重建 Linux 内核模块之前,我还有什么需要清理的吗?

是的。 bitbake -c cleansstate make-mod-scripts

任何内核模块配方都将包含 inherit module。这引用了包含 inherit module-basemeta/classes/module.bbclass。这引用了 meta/classes/module-base.bbclass,其中包含:

# We do the dependency this way because the output is not preserved
# in sstate, so we must force do_compile to run (once).
do_configure[depends] += "make-mod-scripts:do_compile"

ma​​ke-mod-scripts 配方(位于 meta/recipes-kernel/make-mod-scripts/make-mod-scripts.bb)将文件添加到{build_dir}/tmp/work-shared/{MACHINE}/kernel-build-artifacts 目录。 (这被称为 STAGING_KERNEL_BUILDDIR,它在 conf/bitbake.conf 中设置。)

不幸的是,内核配方将删除 STAGING_KERNEL_BUILDDIR 目录中的所有内容,因为该目录已添加到 meta/classes/kernel.bbclass 中的 do_shared_workdir[cleandirs] 变量中。这最终会删除 make-mod-scripts 放在那里的文件。