insmod vs modprobe
Both utilities are used to load the given module
insmod
|
modprobe
|
Loads the module given
insmod /path/to/module.ko |
Loads the module only in
/lib/modules/$(uname -r)
modprobe
/home/test/hello.ko will not work
|
Dependencies if present
are not loaded
|
modprobe calculates
dependencies , loads the dependencies and then the main module
|
How modprobe calculates dependencies?
Modprobe depends on depmod tool to calculate dependencies. depmod calculates dependencies of all the modules present in /lib/modules/$(uname -r) folder, and places the dependency information in /lib/modules/$(uname -r)/modules.dep file
E.g. kernel/drivers/net/wireless/admtek/adm8211.ko: kernel/net/mac80211/mac80211.ko kernel/net/wireless/cfg80211.ko kernel/drivers/misc/eeprom/eeprom_93cx6.ko
In this case, eeprom_93cx6.ko, cfg80211.ko is loaded first and then adm8211.ko
Modules are loaded right to left and removed left to right. So while removing adm8211.ko is removed, then cfg80211.ko and finally eeprom_93cx6.ko
We can re-load the modules.dep file by running "depmod -a" command
Comments
Post a Comment