Chapter 11. Kerneld and Advanced Modularization
In this second part of the book, we’ll be discussing more advanced topics than we’ve seen up to now. Once again, we’ll start with modularization. The introduction to modularization in Chapter 2, is only part of the story; the modules package (whose latest versions are called modutils instead) supports some advanced features that are more complex than we needed earlier to get a basic driver up and running.
This chapter talks about the kerneld program, version support inside modules (a facility meant to save you from recompiling your modules each time you upgrade your kernel), and support for data persistence across unload and reload of a module. This last capability is available only with version 2.0.0 or later of the modules package.
Loading Modules on Demand
To make it easier for users to load and unload modules, and to avoid wasting kernel memory by keeping drivers in core when they are not in use, Linux offers support for automatic loading and unloading of modules. (This support was missing from versions 1.2 and earlier.) To exploit this feature, you need to enable kerneld support when you configure the kernel before you compile it. The ability to request additional modules when they are needed is particularly useful for drivers using module stacking.
The idea behind kerneld is simple, yet effective. Whenever the kernel tries to access unavailable resources, it notifies the user program instead of simply returning an error. ...
Get Linux Device Drivers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.