Linux Kernel Architecture

(Jacob Rumans) #1

Modules


Modules are an efficient way of adding device drivers, filesystems and other components dynami-
cally into the Linux kernel without having to build a new kernel or reboot the system. They remove
many of the restrictions constantly raised as arguments against monolithic architectures by, above
all, micro-kernel proponents. These arguments concern primarily the lack of dynamic extensibility.
In this chapter, we examine how the kernel interacts with the modules; in other words, how they are
loaded and unloaded and how the kernel detects the interdependencies between various modules.
It is therefore necessary to deal in some detail with the structure of module binary files (and their
ELF structure).

7.1 Overview


Modules have many advantages,^1 of which the following are worthy of particular mention:

❑ By using modules, distributors are able to pre-compile a comprehensive collection of
drivers without bloating the size of the kernel image beyond bounds. After automatic
hardware detection or user prompting, the installation routine selects the appropriate
modules and adds them into the kernel.
This enables even inexperienced users to install drivers for system devices without having
to build a new kernel. This represents a major step toward (and perhaps even a prerequisite
for) wider acceptance of Linux systems.

❑ Kernel developers can pack experimental code into modules that can be unloaded and
reloaded after each modification. This allowsnew features to be tested quickly without
having to reboot the system each time.^2

License issues can also be resolved with the help of modules. As is generally known, the source
code of the Linux kernel is available under the GNU General Public License (Version 2), one of the

(^1) And also some disadvantages. However, these are so minor that they are of little consequence.
(^2) Unless, of course, the system has crashed in the meantime, and this is said to happen when developing drivers.

Free download pdf