【问题标题】:How can I auto load kernel module on boot in Yocto? (like "insmod /xxx/oo.ko")如何在 Yocto 启动时自动加载内核模块? (如“insmod /xxx/oo.ko”)
【发布时间】:2019-09-18 00:48:29
【问题描述】:

我们的系统是 NXP fsl-image-auto 并使用 Yocto 项目构建。 现在我们有一个 3rd 方 ko "apex.ko",rootfs 路径是 /s32v/apex.ko

这个模块需要在 linux 启动时加载,所以我们在 rcS.d 中添加“insmod /s32v/apex.ko”行来完成这项工作。

这个功能可以用 Yocto 完成吗?

我尝试了“KERNEL_MODULE_AUTOLOAD += apex”,但似乎无法正常工作。 我尝试了“module_do_install()”,但 bitbake 有“make: *** No targets specified and no makefile found. Stop. ERROR: oe_runmake failed” 错误消息。

我该怎么做? 谢谢...

【问题讨论】:

  • 你试过KERNEL_MODULE_AUTOLOAD += "kernel-module-apex" 吗?

标签: linux yocto bitbake nxp-microcontroller


【解决方案1】:

我们在启动时添加内核模块的方法是添加 KERNEL_MODULE_AUTOLOAD 变量:

KERNEL_MODULE_AUTOLOAD += "mymodule"

但您需要将其添加到您的 machine.conf 中,或者添加到一个配方(不是图像)中,如 documentation 中所述:

您可以在任何地方使用 KERNEL_MODULE_AUTOLOAD 变量 被内核配方或树外内核模块识别 配方(例如机器配置文件、分发 配置文件、配方的附加文件或配方 本身)。

[...]

包含 KERNEL_MODULE_AUTOLOAD 会导致 OpenEmbedded 构建系统 用列表填充 /etc/modules-load.d/modname.conf 文件 引导时自动加载的模块。模块出现在每行一个 文件。

【讨论】:

    【解决方案2】:

    我认为您应该在模块名称中添加前缀:

     KERNEL_MODULE_AUTOLOAD += "module_name"
    

    https://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html#var-KERNEL_MODULE_AUTOLOAD

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-20
      • 1970-01-01
      • 2014-05-12
      • 2016-07-11
      • 1970-01-01
      • 1970-01-01
      • 2015-07-20
      • 1970-01-01
      相关资源
      最近更新 更多