【问题标题】:How to do a clean rebuild of Linux kernel modules in Yocto?如何在 Yocto 中彻底重建 Linux 内核模块?
【发布时间】:2019-09-15 04:19:09
【问题描述】:

我可以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 配方是 here

在重建 Linux 内核模块之前我还应该清理什么其他东西吗?

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

【问题讨论】:

  • 检查这个答案stackoverflow.com/a/44585113/795910。 bitback -c cleanall 应该可以帮到你。
  • @OttavioCampana 感谢您的回复。不幸的是,正如我所提到的,我尝试了bitbake -c cleanall linux-iwg15 kernel-module-imx-gpu-viv cryptodev-module,但仍然遇到相同的错误(它只是有一个额外的缺点,即强制重新下载每个源)。
  • 我看到了同样的问题。如果我从头开始构建,则模块可以干净地构建,但是如果我只是尝试清理模块并重新构建,则内核会如您所说的那样失败。你能解决这个问题吗?
  • @PhilBot 我最近没有进行太多内核特定的更改,我已经更新到 Yocto 3.1 Dunfell。最近的 Yocto 版本似乎确实改进了重建过程,所以如果可能的话,尝试使用 Dunfell 可能是值得的。当然,很多 BSP 不为最新版本提供官方支持,所以我也一直在使用 meta-freescale 的“社区”版本,而不是落后几年的制造商官方 BSP。

标签: linux-kernel kernel-module yocto bsp


【解决方案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 目录。 (在 conf/bitbake.conf 中设置为 STAGING_KERNEL_BUILDDIR。)

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

【讨论】:

猜你喜欢
  • 2021-10-20
  • 2018-06-20
  • 1970-01-01
  • 1970-01-01
  • 2019-07-01
  • 2020-03-16
  • 2021-10-07
  • 2021-10-01
  • 2011-07-28
相关资源
最近更新 更多