Managing and Developing Dynamically Loadable Kernel Modules

Managing and Developing Dynamically Loadable Kernel Modules
Developing Dynamically Loadable Kernel Modules
Chapter 12554
NOTE The file locations receiving copies of the module’s component files may
change in future HP-UX releases.
Activating the DLKM
After a module’s component files have been installed using the kminstall
command, the module is ready to be configured and registered with the
running kernel. Follow the procedures in “DLKM Procedures for
Dynamically Configured Loadable Modules” on page 511 for instructions
on how to prepare, configure, register, load, and manage your DLKM as
dynamically loadable, on the target system.
To configure and test your DLKM as statically linked refer to “DLKM
Procedures for Statically Configured Loadable Modules” on page 518.
Creating Device Special Files for the Module
Before devices supported by a driver type DLKM module can be accessed
by the system, you need to create special files in the /dev directory using
the mknod (1M) command. You do not have to create these files every
time you build and boot a new kernel--only when you first add the new
module. There must be a special file for each device on your system.
When you set up the special files for a newly added device driver, you
must specify the device type (character or block) and the major and
minor device numbers. The kernel recognizes any single device by the
major-minor number combination encoded in the device special files.
For a dynamically loadable driver, the system assigns a major number to
the driver when it first registers with the system. For a statically linked
driver, the system assigns a major number to the driver during system
boot. The system remembers assigned major numbers from system boot
to system boot.
To have the system dynamically assign a major number to your driver,
follow these steps:
1. Specify -1 in both the block major and char major fields in the
$DRIVER_INSTALL section of your driver’s master file.
2. Specify -1 in both the b_major and c_major fields of the drv_info_t
structure of your driver source code.