Tuesday, September 17, 2013

difference between insmod and modprobe

Time to refresh memory:

modprobe reads the modules and its dependencies from /lib/modules/$(uname -r)/modules.dep or modules.dep.bin.  modprobe is a smarter tool which will also load the dependent modules.

modprobe accepts the name of a .ko file in /lib/modules/$(uname -r) and aliases (modules.alias.bin).

insmod takes file name or the exact paths to files. The module does not have to reside in /lib/modules/$(uname -r), but dependencies are not automatically loaded. This is the lower program used by modprobe to load modules.

rmmod removes a kernel name based on the name from /proc/modules. This name does not necessarily have to be the same as the one passed to modprobe (for the nvidia-current file, this is nvidia for example).

modinfo accepts a filename, or the filename without .ko suffix in /lib/modules/$(uname -r).