Managing and Developing Dynamically Loadable Kernel Modules
Managing and Developing Dynamically Loadable Kernel Modules
Developing Dynamically Loadable Kernel Modules
Chapter 12 559
❏ space.h – a configuration file that sets two flags and allocates space
for the sample character driver
❏ Makefile – a makefile for the template character driver; initiates the
compiling of dlclass.c and places a copy of mod.o in the current
working directory
❏ mod.mk – a file called by Makefile that contains cc command and
appropriate options to compile dlclass.c for either a 64-bit PA
target machine or a 64-bit Itanium target machine.
This driver skeleton is a complete working character driver that does not
use any hardware. It can be added to any HP-UX 11.0 kernel and
executed as an example.
The character driver supports a pseudo device. Characters written to the
device are passed to the kernel message buffer, so you have to execute
the dmesg (1M) command to actually see the output. A read sequence
results in the printing of the following hardcoded string compiled into
the driver: “Reading from loadable WSIO driver ‘dlclass’.”
The character driver supports three tunable parameters:
❏ dlclass_no_unload (integer)—prevents unloading when nonzero;
initially set to 0 in $TUNABLE section of master file
❏ dlclass_debug (integer)—writes debugging output into message
buffer when nonzero; initially turned on (set to 1) in $TUNABLE section
of master file
❏ dlclass_bufsz (integer)—size of internal write buffer; initially set to
40 characters in $TUNABLE section of master file
To install, configure, and load the character driver, log in as user root
and perform the following steps:
1. Execute the following command to create a working directory for
dlclass: mkdir /usr/conf/dlclass.
2. Change directories to the/usr/conf/dlclass directory.
3. Create all component files for dlclass in addition to Makefile and
mod.mk in the /usr/conf/dlclass directory.