简体   繁体   English

如何在 Yocto 中干净地重建 Linux 内核模块?

[英]How to do a clean rebuild of Linux kernel modules in Yocto?

I can rm -rf tmp/ sstate-cache/ cache/ and run a whole Yocto build from scratch just fine, but I'd rather not rebuild everything (especially as packages like Qt can take some time).我可以rm -rf tmp/ sstate-cache/ cache/并从头开始运行整个 Yocto 构建,但我宁愿不重建所有内容(尤其是像 Qt 这样的包可能需要一些时间)。

I've tried:我试过了:

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

Note: I've also tried cleanall , but it has the same result:注意:我也尝试过cleanall ,但结果相同:

Either one of the kernel modules end up throwing this error once they get to do_compile :一旦进入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.

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

I tried copying the contents of kernel-build-artifacts to {build_dir}/tmp/work-shared/{MACHINE}/kernel-source but still get the errors.我尝试将kernel-build-artifacts的内容复制到{build_dir}/tmp/work-shared/{MACHINE}/kernel-source但仍然出现错误。

The linux-iwg15 BitBake recipe is here . linux-iwg15 BitBake 配方在这里

Is there anything else that I should be cleaning before rebuilding the Linux kernel modules?在重建 Linux 内核模块之前,还有什么我应该清理的吗?

After a clean build, I did notice that kernel-build-artifacts contains kernel and scripts folders (as well as a symlink of source to ..\kernel-source ) that I don't remember being there when attempting to rebuild after running bitbake -c cleansstate .干净构建后,我确实注意到kernel-build-artifacts包含kernelscripts文件夹(以及source..\kernel-source的符号链接),我不记得在运行bitbake -c cleansstate后尝试重建时在那里bitbake -c cleansstate

Is there anything else that I should be cleaning before rebuilding the Linux kernel modules?在重建 Linux 内核模块之前,还有什么我应该清理的吗?

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

Any kernel module recipe will contain inherit module .任何内核模块配方都将包含inherit module This references meta/classes/module.bbclass which contains inherit module-base .这引用了包含inherit module-base meta/classes/module.bbclass This references meta/classes/module-base.bbclass which contains:这引用了 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"

The make-mod-scripts recipe (at meta/recipes-kernel/make-mod-scripts/make-mod-scripts.bb ) adds files to the {build_dir}/tmp/work-shared/{MACHINE}/kernel-build-artifacts directory. make-mod-scripts配方(位于meta/recipes-kernel/make-mod-scripts/make-mod-scripts.bb )将文件添加到{build_dir}/tmp/work-shared/{MACHINE}/kernel-build -工件目录。 (This is referenced as STAGING_KERNEL_BUILDDIR which is set in conf/bitbake.conf .) (这被称为STAGING_KERNEL_BUILDDIR ,它在conf/bitbake.conf中设置。)

Unfortunately, the kernel recipe will remove everything in the STAGING_KERNEL_BUILDDIR directory, since that directory is added to the do_shared_workdir[cleandirs] variable in meta/classes/kernel.bbclass .不幸的是,内核配方将删除STAGING_KERNEL_BUILDDIR目录中的所有内容,因为该目录已添加到meta/classes/kernel.bbclass中的do_shared_workdir[cleandirs]变量中。 This ends up removing files that make-mod-scripts put there as well.这最终会删除make-mod-scripts放在那里的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM