Loading Kernel Modules manually when compiling Linux Kernel
The modprobe command allows you to manually load kernel modules.
is a smart command, as it performs several operations to make sure you load the module correctly.
It loads all modules that your module depends on.
It consults /etc/conf.modules for your module's default parameters.
It can try a list of modules, and when it loads a module successfully, it ceases to try others in the list.
You can also use the depmod, insmod, and rmmod commands to load modules.
However, I recommend steering away from them, as you will need to follow more steps to obtain the same functionality as modprobe.
The SlideShow below demonstrates how to load modules into the kernel.
How do you load kernel modules manually when compiling a Linux Kernel?
When compiling a Linux kernel, you may want to manually load certain kernel modules after booting the system. Here are the steps to load kernel modules manually:
Compile the kernel with the necessary module(s) enabled or built-in. This can be done by selecting the appropriate configuration option during the kernel compilation process. For example, if you need to load the "vfat" module for reading and writing FAT filesystems, you would select the "FAT filesystem support" option and the "VFAT (Windows-95) fs support" option in the kernel configuration.
After booting the new kernel, log in as root.
Check if the module you want to load is available by using the "lsmod" command. This command lists all currently loaded modules.
If the module is not listed, you can manually load it by using the "modprobe" command. For example, to load the "vfat" module, type "modprobe vfat". This will load the module and any dependencies it requires.
You can verify that the module has been loaded by using the "lsmod" command again.
Note that if you want to load a module automatically at boot time, you can add the module name to the "/etc/modules" file. This file contains a list of modules that should be loaded at boot time, one module per line.
The Linux 2.2 kernel thread, kmod, constantly checks to see if any requests require missing functionality.
If kmod sees the need to load a module, it will call modprobe to load the module. For example, if you mount a filesystem that your kernel does not support, kmod will load the support automatically. Automatic loading of modules is called demand loading. The Linux kernel is multi-threaded, meaning that multiple actions occur within the kernel simultaneously.
The next lesson explains how to configure kernel modules.