Managing and Developing Dynamically Loadable Kernel Modules
Managing and Developing Dynamically Loadable Kernel Modules
Developing Dynamically Loadable Kernel Modules
Chapter 12 529
A module having BOOT2 as its configured loading phase will be loaded
just after the statically linked device drivers have been initialized. Any
modules either referenced by an auto-loading stub linked into the static
kernel, or depended-upon by other modules loaded during the boot
process, are loaded when they are referenced at boot time. They must,
however, be configured with the applicable loading phase in their
supported loading phase specification.
Module Component Files
A DLKM module must be modularly packaged (see “Managing
Dynamically Loadable Kernel Modules” on page 493). A DLKM module
is installed on disk as a set of files, which includes the module’s object file
and other configuration files needed to install the module into the
system. The files are located in a single directory having an arbitrary
name. The kminstall(1M) command must then be used to copy the
module’s installation component files into the locations at which the
kernel configuration tools expect to find them.
The component files for a DLKM module are:
❏ mod.o – the object file for the module
❏ master – the master configuration file for the module
❏ system – the system configuration file for the module
❏ space.h (optional) – a configuration file that allocates and initializes
some module variables (tunable parameters)
❏ Modstub.o (optional) – an object file used by the DLKM stubs
mechanism
mod.o File Definition
The C program source code for a DLKM module, which is compiled and
possibly linked to become mod.o, is similar to the source code for a static
module except that it contains the following additional information:
❏ The source code for a DLKM module includes two additional header
files, <mod_conf.h> and <sys/moddefs.h>.