这时不妨来看看 /lib/modules/内核版本/ 目录下的文件
root:/lib/modules/3.14.26-gb9df364-dirty# ls -la
drwxr-xr-x 5 root root 4096 Jul 29 2017 .
drwxr-xr-x 3 root root 4096 Jul 1 2017 ..
drwxr-xr-x 3 root root 4096 Apr 10 19:50 extra
drwxr-xr-x 7 root root 4096 Apr 10 19:12 kernel
-rw-r--r-- 1 root root 36015Jul292017 modules.alias-rw-r--r-- 1 root root 45727Jul292017 modules.alias.bin
-rw-r--r-- 1 root root 10984Apr1019:01 modules.builtin
-rw-r--r-- 1 root root 12627Jul292017 modules.builtin.bin
-rw-r--r-- 1 root root 12686Jul292017 modules.dep
-rw-r--r-- 1 root root 19561Jul292017 modules.dep.bin
-rw-r--r-- 1 root root 75Jul292017 modules.devname
-rw-r--r-- 1 root root 4978Apr1019:01 modules.order
-rw-r--r-- 1 root root 131Jul292017 modules.softdep
-rw-r--r-- 1 root root 42250Jul292017 modules.symbols
-rw-r--r-- 1 root root 50259Jul292017 modules.symbols.bin
drwxr-xr-x 5 root root 4096 Apr 10 19:09 updates
可以发现很多文件已经更新了,说明这些文件在depmod时重新生成了,这里我们着重看看modules.dep文件
...
kernel/drivers/usb/dwc3/dwc3.ko:
kernel/drivers/usb/dwc3/dwc3-omap.ko:
kernel/drivers/usb/dwc3/dwc3-pci.ko:
kernel/drivers/usb/serial/usbserial.ko:
kernel/drivers/usb/serial/pl2303.ko: kernel/drivers/usb/serial/usbserial.ko
kernel/drivers/usb/musb/musb_hdrc.ko:
kernel/drivers/usb/musb/omap2430.ko: kernel/drivers/usb/musb/musb_hdrc.ko
kernel/drivers/usb/musb/musb_dsps.ko: kernel/drivers/usb/musb/musb_hdrc.ko
kernel/drivers/usb/musb/musb_am335x.ko:
kernel/drivers/input/keyboard/matrix_keypad.ko:
kernel/drivers/input/touchscreen/pixcir_i2c_ts.ko:
kernel/drivers/input/input-polldev.ko:
...
在这个文件中可以找到我们之前添加的驱动的路径。
man一下depmod
depmod - Generate modules.dep and map files.
Linux kernel modules can provide services (called "symbols") for other
modules to use (using one ofthe EXPORT_SYMBOL variants inthe code).
If a second module uses this symbol, thatsecond module clearly depends
onthefirst module. These dependencies can get quite complex.
depmod creates a listof module dependencies by reading each module
under /lib/modules/versionand determining what symbols it exports and
what symbols it needs. By default, this listis written to modules.dep,
and a binary hashed version named modules.dep.bin, inthe same
directory. If filenames are givenonthe command line, only those
modules are examined (which is rarely useful unless all modules are
listed). depmod also creates a listof symbols provided by modules inthefile named modules.symbols andits binary hashed version,
modules.symbols.bin. Finally, depmod will output a file named
modules.devname if modules supply special device names (devname) that
should be populated in /dev on boot (by a utility such as udev).
If a versionis provided, thenthat kernel version's module directory
is used rather than the current kernel version (as returned by uname
-r).
depmod命令是用于生成模块之间的依赖关系的