Specifications
D
evice Driver Programming
13-10
Packaging a Loadable Module for Installation 13
Dynamically Loadable Modules under PowerUX are compiled as shared objects. The
shared object format gives the DLM implementation the advantages of position indepen-
dent code and easier module relocation when the DLM is dynamically loaded and linked
into the kernel.
To compile shared objects, certain compiler and linker options must be specified. Most of
these additional options have been hidden from the developer. However, the following
compiler option and its related side effects must be dealt with when building a Driver.o
that is to be, or has previously been, compiled as a DLM.
• When a kernel driver is to be compiled as a DLM, the -Zpic C compiler
option must be used in the driver’s make file in order to compile all the files
that are to be included in the DLM’s Driver.o file.
• If the -Zpic option was not used to build all of the object files that are
included in the DLM’s Driver.o file, the DLM module does not stati-
cally link properly at the DLM link time. Similarly, static kernel drives that
were compiled with the -Zpic option do not properly link into the kernel
at kernel link time.
• Therefore, when changing a Driver.o from a DLM to a driver that is
statically linked into the kernel, all the *.o files that make up that driver
must be removed, and the -Zpic option must be removed from the driver’s
make file before recompiling the driver.
• Similarly, when changing an existing statically linked kernel driver to a
DLM driver, all the *.o files of that driver must be removed, and the
-Zpic option must be added to the driver’s make file before recompiling
the driver.
This section—and the sections on installation and configuration that follow—describe
procedures that are specific to loadable modules. For information about the installation
tools and procedures for both loadable modules and static modules, refer to the chapter
Chapter 14 (“Driver Installation and Tuning”).
Master File Definitions for Loadable Modules 13
Loadable drivers can define two optional lines of configuration data in the Master com-
ponent of their Driver Software Package (DSP):
$depend specifies the loadable modules on which the driver depends
$modtype defines a character string that identifies the driver type in error
messages
If your loadable driver references symbols defined in other loadable modules, you must
supply DLM with the names of these modules so it knows to load them before it loads
your driver. You define the modules to DLM by listing them on the $depend line of your
driver's Master file. You can specify all of the module names (separated by white space)
on a single $depend line. You can also specify them individually, on multiple $depend
lines.