Compiling Kernel   «Prev  Next»

Lesson 4 Loading modules
ObjectiveLoad kernel modules.

Loading Kernel Modules manually when compiling Linux Kernel

The modprobe command allows you to manually load kernel modules. modprobe is a smart command, as it performs several operations to make sure you load the module correctly.
  1. It loads all modules that your module depends on.
  2. It consults /etc/conf.modules for your module's default parameters.
  3. 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.

  1. Linux Kernel by itself
  2. A module loaded into the kernel
  3. A kernel with many modules

Kernel Loaded Module
Red Hat Enterprise Linux

Loading kernel modules on demand

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.