如何安装第 3 方模块以便在启动时加载它?

Nat*_*ood 32 kernel modprobe 12.04

I have a third party module to go with a frame grabber. I've downloaded the kernel source, followed the vendor's instructions to compile it, and have the resulting module, arvdrv.ko, sitting in a folder.

The vendor has supplied a script that loads the module into the kernel and it works when I run it; the module is loaded but only until the next boot. The script does not use modprobe. I can access the frame grabber when the module is installed.

It appears to me that modprobe maintains a list of many modules. One can edit /etc/modules to add a module name and it will load at boot but the module arvdrv is not in modprobe's list.

My question is how to let modprobe know of the module? Does it need to be copied to a new location and if so where?

Nat*_*ood 42

使用sudo

  1. 编辑/etc/modules文件并.ko在其自己的行中添加模块的名称(不带扩展名)。启动时,内核将尝试加载此文件中命名的所有模块。

  2. 将模块复制到/lib/modules/`uname -r`/kernel/drivers. 就我而言,这是/lib/modules/`uname -r`/kernel/drivers/pci. 这会将模块放入 modprobe 的数据库中。不知道能不能给个链接

  3. 运行depmod。这将找到模块的所有依赖项。

  4. 此时,我重新启动然后运行lsmod | grep module-name以确认模块在启动时加载。

有关更多信息,请参阅modprobelsmoddepmod的手册页。

  • 我确实按照您的说明进行操作,但在供应商提供了一些调试代码之前没有任何效果!!!您的回答是完整、简单的,如果没有供应商错误,我相信它会起作用。是的,我会接受。 (4认同)
  • 很有帮助。我想在 2020 年(从哪个版本开始?)补充一点,可以(应该?)将模块添加到 `.conf` 文件中的 `/etc/modules-load.d/` 中,而不是 ` /etc/modules`。 (3认同)