如何查找我内核中已安装的驱动程序?

sensors-detect 告诉我:

To load everything that is needed, add this to /etc/modules:

# Chip drivers
coretemp
w83627ehf

If you have some drivers built into your kernel, the list above will contain too many modules. Skip the appropriate ones!

如何找出哪些驱动程序是可以跳过的,如果有的话?
1个回答

规范的方法是检查您正在运行的内核配置,但这可能很难解析,因为它将包括模块和其他选项,并且名称可能不对应:

grep "=y" /boot/config-`uname -r`

实际上,使用findlocate要容易得多。

  • 使用find搜索常见位置:
    find /usr /lib /opt -type d -name modules -exec find {} -path "*`uname -r`*" -name "*.ko" \;
  • 使用locate搜索整个系统:
    locate name-of-module | grep "`uname -r`.*ko"
    (如果需要,请先运行sudo updatedb以确保数据库准确性。)

如果您看到一个像这样的.ko文件条目:

/lib/modules/3.2.0-29-generic/kernel/drivers/hwmon/coretemp.ko
然后这个模块是没有内置的,可以添加到/etc/modules中。如果找不到它,那么它要么是内置的,要么不存在,不应该被添加。
/lib/modules中查找所有非内置模块的变体是:
find /lib/modules/`uname -r` | grep -oP "(?<=/)\w+(?=\.ko)"