【问题标题】:Yocto: Adding Kernel Module to ImageYocto:将内核模块添加到图像
【发布时间】:2019-06-17 16:01:42
【问题描述】:

我使用CORE_IMAGE_EXTRA_INSTALL += "iptables"iptables 包添加到我的设备映像中。

我尝试在设备上运行它并收到以下错误消息:

modprobe: FATAL: Module ip_tables not found in directory /lib/modules/4.9.11-1.0.0+gc27010d
iptables v1.6.1: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

好像我缺少内核模块。

在将标准内核模块添加到映像时需要您的帮助(在哪里可以找到所有模块文件以及如何将其添加和加载到映像中)。

【问题讨论】:

  • 你需要在你的内核中激活iptables,激活方式取决于你的内核版本。
  • 内核版本为 4.9.11-1.0.0。下一步是什么?
  • 在 Yocto 中,您有一种类型的内核允许 configuration fragments 和一种不允许的类型,您必须替换整个 defconfig。在任何情况下,您都可以使用bitbake -c menuconfig virtual/kernel 配置您的内核,并在网络中检查是否设置了 netfilter/iptables 选项。
  • 谢谢。我使用了bitbake -c menuconfig virtual/kernel,但找不到包含iptables 的模块。你知道在哪里可以找到它吗?
  • iptables 内核端称为 netfilter,例如见elixir.bootlin.com/linux/latest/source/net/netfilter/Kconfig。您可以在控制台菜单中搜索带有“/”的选项。

标签: kernel-module yocto


【解决方案1】:

您必须将iptables 模块添加到您的内核中。我有同样的问题,我可以通过以下步骤解决它:

  • 运行bitbake -c menuconfig virtual/kernel
  • 激活CONFIG_IP_NF_IPTABLES 模块(您可以在该菜单上输入斜杠“/”搜索其位置)。
  • 保存并运行bitbake -c savedefconfig virtual/kernel 将该文件保存为defconfig。
  • defconfig 文件从返回的路径复制到yocto-distro/layer-name/recipes-kernel/linux/files/(如果该目录不存在,则创建此目录)。
  • yocto-distro/layer-name/recipes-kernel/linux/ 内创建一个.bbappend 文件,与meta 层中的原始配方文件同名。
  • 编辑您的文件并在下面追加行:
SRC_URI += "file://defconfig"
KERNEL_DEFCONFIG = "${WORKDIR}/defconfig"
FILESEXTRAPATHS_prepend := "${THISDIR}/files"
~
  • 重启bitbake your-image-name

它适用于我的情况。顺便说一句,我从以下网站获得了该信息:

祝你有美好的一天! :D

【讨论】:

    猜你喜欢
    • 2021-10-07
    • 1970-01-01
    • 2021-09-06
    • 2016-07-11
    • 2017-06-21
    • 2020-06-22
    • 2018-06-20
    • 1970-01-01
    • 2020-03-16
    相关资源
    最近更新 更多