If you have a valid module in the correct location, and you have run “sudo depmod -a
” to tell the system the module is there, then it should auto load. However, to preload (in the Linux stage once the kernel is loaded) you could add a spec to /etc/modules-load.d/
, then it will load regardless of seeing a need. If the module is not valid, then it can never load. If the module is required to mount the actual filesystem (e.g., it is a module needed for an NFS mount or for a filesystem not natively in the kernel), then you have to place this in the initrd
. If this is to be part of a boot chain (before the Linux kernel loads), then you have to compile it for that boot chain and adjust the boot chain itself.
If this is a camera driver, then you won’t have any special early load required. If that module is valid, and thus that module can load, then anything requiring that module will result in it loading.
However, let’s talk about how the “need” to load is determined…
Some devices are “plug-n-play”, and others are not. Plug-n-play devices include PCIe and USB devices, and the PCI bus and USB bus can actually query the device to ask what its specs are. The hot plug layer will broadcast what the device is, and drivers known to have that capability will take ownership; the module will auto load.
Other devices are not plug-n-play. Those devices cannot be hot-plug detected, and those devices are incapable of being queried as to what they are and what their requirements are. These devices will have a physical address on a bus, and the module must be told to access that address with the right arguments. At that moment the module will load, and the module will blindly try to access that address. The method for telling the o/s what that address is, along with which driver to use, is via the device tree (which is “firmware”). If your device is not plug-n-play, then if the module is capable of loading, that device tree entry is how you would trigger this.
If you happen to have a module which can be loaded, and you manually load it, then the module will do nothing at all unless it is paired with information on where the non-plug-n-play device is.