17.5.2.1. Kernel module dependencies with modprobe

Unlike insmod, modprobe deals with kernel module dependencies for us.

Then, for example:

modprobe buildroot_dep2

outputs to dmesg:

42

and then:

lsmod

outputs:

Module                  Size  Used by    Tainted: G
buildroot_dep2         16384  0
buildroot_dep          16384  1 buildroot_dep2

Sources:

Removal also removes required modules that have zero usage count:

modprobe -r buildroot_dep2

modprobe uses information from the modules.dep file to decide the required dependencies. That file contains:

extra/buildroot_dep2.ko: extra/buildroot_dep.ko

Bibliography: