Nick
Nick

Reputation: 499

Yocto: Adding Kernel Module to Image

I added iptables package to my device image, using CORE_IMAGE_EXTRA_INSTALL += "iptables".

I tried to run it on the device and get the following error message:

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.

Seems like I have missing kernel module.

Need your help in adding standard kernel module to the image (Where can I find all modules files and how should I add and load it to the image).

Upvotes: 1

Views: 6628

Answers (1)

jdalmena
jdalmena

Reputation: 81

You must add the iptables module to your kernel. I had the same problem and I could solve it with these steps:

  • Run bitbake -c menuconfig virtual/kernel
  • Activate CONFIG_IP_NF_IPTABLES module (you can search its location on that menu typing slash '/').
  • Save it and run bitbake -c savedefconfig virtual/kernel for saving that file as a defconfig.
  • Copy defconfig file from returned path to yocto-distro/layer-name/recipes-kernel/linux/files/ (make this directory if it does not exist).
  • Create a .bbappend file inside yocto-distro/layer-name/recipes-kernel/linux/ with the same name as your original recipe file from meta layer.
  • Edit your file and append lines below:
SRC_URI += "file://defconfig"
KERNEL_DEFCONFIG = "${WORKDIR}/defconfig"
FILESEXTRAPATHS_prepend := "${THISDIR}/files"
~
  • Relaunch bitbake your-image-name

It worked on my situation. Btw, I got that info from the following webs:

Have a nice day! :D

Upvotes: 8

Related Questions