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 allows new 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

1And also some disadvantages. However, these are so minor that they are of little consequence.

2Unless, of course, the system has crashed in the meantime, and this is said to happen when developing drivers.

first and most widely used Open Source licenses.3 A major problem is the fact that for a variety of reasons — which may or may not be sensible and justified — many hardware manufacturers keep the documentation needed to control their add-on devices under wraps or require developers to sign ''nondisclosure agreements'' in which they, in turn, promise to keep secret the source code they write using information in the documentation and not to reveal it to the public. This means that the driver cannot be included in official kernel sources whose source code is always open.

This problem can be solved — at least from a technical point of view — by using binary modules that are passed on in compiled form only but not in source code. Control of proprietary hardware is possible using this approach, but most kernel developers are not happy with this situation because using open code has many advantages. The sweeping success of the Linux kernel is certainly a prime example.

Modules can be inserted almost seamlessly into the kernel, as illustrated in Figure 7-1. The module code exports functions that can be used by other kernel modules (and also by code permanently compiled into the kernel). The link between the module and the remaining parts of the kernel can, of course, be broken when the code needs to be unloaded; I discuss the technical details in the sections below.

Figure 7-1: Modules in the kernel.

Continue reading here: Adding and Removing

Was this article helpful?

0 0