 |
» |
|
|
 |
This section describes the configuration and management of
DLKMs. It focuses on loadable device drivers,
because they constitute the majority of supported module types for
HP-UX release 11.0 and later releases. It covers the following three
topics: - DLKM Concepts
Introduces DLKM, defines important terms, and explains
detailed technical concepts. - DLKM Tools
Provides a summary of tools, collectively known
as the Kernel Configuration Tool Set, which
are used when installing, configuring, and managing DLKMs. - DLKM Procedures
Presents the key procedures used in the preparation, loading,
and maintenance of DLKMs.
DLKM Concepts |  |
This conceptual overview of DLKM features and functionality
covers the following: Defines
DLKM at a high level Explains terms and concepts essential to understanding
DLKM Describes how DLKMs are packaged in HP-UX Identifies the types of kernel modules currently
supported by DLKM Describes the advantages of writing kernel modules
in DLKM format Explains the concepts of loading, unloading, and
configuring drivers
The Dynamically Loadable Kernel Modules Infrastructure is
an HP-UX operating system feature that allows “DLKM-Enabled” kernel
modules to be dynamically loaded into, or unloaded from, the HP-UX
kernel without having to re-link the entire kernel or reboot the
system. Previously, to install and use a new driver, you had to edit
the system file, run the config or mk_kernel commands to create a new kernel, shut down the system,
and then bring the system back up. The DLKM feature not only provides the infrastructure to load
kernel modules into a running system, but it also allows you the
option of statically linking a kernel module when rebuilding the
kernel. This is accomplished by changing the value of one of the
DLKM module's configuration attributes. Important Terms and ConceptsThe DLKM infrastructure allows kernel modules to be configured
in a number of different ways. The following table considers the
different ways a kernel module can be configured and loaded, and
clearly defines each. It also clarifies the relationship between
each term as seen by the HP-UX kernel. Table 1-1 Important Terms and Concepts | Term / Concept | Definition |
|---|
| Kernel Module | A Kernel Module is a section of kernel
code responsible for supporting a specific capability or feature.
For example, file system types and device drivers are kernel modules. In
the kernel configuration context, a kernel module may be viewed
as an object that can be added and/or removed from the kernel, either
statically or dynamically. There are two categories
of kernel modules: Modularly Packaged Module
| | Traditional Module | A Traditional Module is a kernel module
whose configuration data has not been modularized and which can
only be statically linked to the kernel. In the kernel
configuration context, configuration information about traditional
modules is maintained in the shared master and system files, and the module can only be accessed upon booting
a kernel in which it has been statically configured. | | Modularly Packaged Module | A Modularly Packaged Module is a kernel
module whose configuration data has been modularized (not shared
with other kernel modules), which is a pre-requisite for a kernel
module to be considered DLKM-enabled. In order to be
classified as a modularly packaged module, the module must contain
its own master and system files as well as an individual object file, mod.o, which implements the module. However, the DLKM infrastructure
provides for the addition of module wrapper code and additional
data structures, which are both optional. A modularly
packaged module can be dynamically loaded into the HP-UX kernel only
if that module includes the module wrapper code and additional data
structures. For this reason, we place modularly packaged modules
in two categories: Static
Modularly Packaged Modules Loadable Modules (or DLKM Modules)
The
terms Loadable Module and DLKM Module are interchangeable. | | Static Modularly Packaged Module | A Static Modularly Packaged Module is
a modularly packaged module that can only be linked statically to the
kernel. In the kernel configuration context, this means
that the module uses its own master and system files but does not contain the module wrapper code and additional
data structures that provide the dynamic loading and unloading ability. | Loadable Module
(DLKM Module) | A Loadable Module (or DLKM Module) is
a modularly packaged module with the capability to be dynamically
loaded into a running kernel. In the kernel configuration
context, this means that the DLKM module uses its own master and system files and contains the module wrapper
code and additional data structures that provide the dynamic loading
and unloading ability. However, even though a DLKM module
is written with self-contained module wrapper code and packaged
with module-specific master and system files, it can still be statically configured into the kernel. For
this reason, we place loadable modules in two categories: Statically Configured Loadable Module Dynamically Configured Loadable Module
| | Statically Configured Loadable Module | A Statically Configured Loadable Module
is a DLKM module that has the capability to be dynamically loaded
but instead is configured to be statically built into the kernel. In
the kernel configuration context, this means that the module-specific system file was updated to indicate static configuration. Because
it is now statically built into the kernel, it cannot be unloaded
from, or reloaded into, the kernel dynamically. | | Dynamically Configured Loadable Module | A Dynamically Configured Loadable Module
is a loadable module which has been fully configured to be dynamically
loaded into or unloaded from the kernel without having to re-link
the entire kernel or reboot the system. To summarize
the terminology presented in this table, a dynamically configured
kernel module is all of the following: A
Modularly Packaged Module, which is
a kernel module with modular (module-specific) master and system files, and an individual object file, but which does
not necessarily utilize the wrapper code and data structures) A Loadable Module (or DLKM Module) which
is a modularly packaged module that contains the wrapper code and
additional data structures, but still could be configured as dynamic
or statically-linked. A Dynamically Configured Loadable Module which
is a DLKM module that has been configured to be fully capable of
dynamic loading into, and unloading from, the running kernel.
| | Module Wrapper | The additional code and data structures added
to a kernel module which enable the DLKM infrastructure to logically
connect and disconnect a loadable module to and from the running
kernel. | | Boot Time Loading | The loading of a dynamically loadable
kernel module during the early phases of the system boot up process. | | Supported Loading Phases | This is a static attribute associated with
each DLKM module that indicates when the module is capable of being
loaded. A DLKM module may indicate one or more of the following
supported loading phases: phase 1 of the boot sequence (BOOT1),
phase 2 of the boot sequence (BOOT2), or runtime
(RUN). Phase 1 and phase 2 of the boot sequence
are architecture-specific, so the Supported Loading Phases are architecture-specific
also. Refer to “Developing Dynamically Loadable Kernel Modules” for
more details. | | Planned Loading Phase, Configured Loading Phase | The Planned Loading Phase and the Configured Loading
Phase are configurable attributes that allow the administrator to
request a specific load time for a DLKM module, as long as the loading
phase is supported by the module. The Planned Loading Phase can
be set using kmsystem(1M) for any module installed on the system, and will
be used for the next module configuration and registration [See config(1M) and kmupdate(1M).]
Once a module is configured
and registered with the kernel, the Planned Loading Phase is used
to initialize the Configured Loading Phase for that module. The
Configured Loading Phase can be changed with kmadmin(1M) for any DLKM module registered with the kernel.
The
possible values are BOOT1, BOOT2, INIT,
and AUTO. BOOT1 will attempt
to load the module at every system reboot during phase 1 of the
boot sequence. BOOT2 will attempt to load the
module at every system reboot during phase 2 of the boot sequence. INIT will
attempt to load the module at every system reboot during the init
process, via rc scripts. AUTO will leave the
module ready to load on demand or via the DLKM auto-load mechanism
(load on access).
BOOT1 is
valid if the Supported Loading Phases include BOOT1. BOOT2 is
valid if the Supported Loading Phases include BOOT2. INIT and AUTO are valid
if the Supported Loading Phases include RUN. |
The DLKM feature currently supports the following types of
kernel modules: Miscellaneous modules - for example, loadable “libraries” of
kernel functions
DLKM modules provide many advantages relative to static modules, including: Reducing time spent on
device driver development by streamlining the driver installation
process Making it easier for administrators to install device
drivers from other vendors Improving system availability by allowing device
drivers and other modules to be configured into the kernel while
the system is running Conserving system resources by permitting the unloading
of infrequently used modules when not in use Providing administrators with the ability to demand
load and unload modules Providing the kernel with the ability to automatically
load modules
When a module is dynamically loaded, its object file is read
from disk and loaded into newly allocated kernel memory. Once in
memory, the module's symbols are relocated and any external
references are resolved. Special code in the module is then executed
to perform any required module-specific setup. Then the code specific
to the module's type, if any, is executed, making the newly
loaded module accessible to the rest of the kernel. A module can be loaded in the following ways: Demand Load A demand load is a user level request for a specific
module to be loaded. The load is accomplished through the kmadmin command. Autoload Event An autoload occurs when the kernel detects that a specific
module is required to provide the functionality necessary to perform
a task. The load is triggered by the initiation of the task. Once
the required module is loaded, the task continues.
When the functionality provided by a module is no longer needed
the module can be unloaded, thus freeing its resources for other
uses. When a module is
unloaded, the code specific to the module, if any, is executed to
disconnect the module from the kernel. Then special code in the
module is executed to perform any module-specific cleanup. Finally,
the memory allocated to the module is freed. A module may be unloaded only by a user level request.
The unload is accomplished through the kmadmin command. This request may fail for a number of reasons,
the most common being that the module is busy at the time. An example
of this would be attempting to unload a device while there are outstanding
opens on the device.
DLKM Configuration ConceptsThrough the use of configurable module attributes, system administrators
can control the various functions of a DLKM module, including whether
it is dynamically loaded or statically configured. The section “Developing Dynamically Loadable Kernel Modules”,
describes the required and optional component files and the keywords
and attributes which are configurable. It also presents a brief description
of STREAMS and Miscellaneous modules. The section “DLKM Procedures ”, presents detailed instructions
on how to modify the configurable module attributes, and how to
manage DLKM modules using the kernel configuration tool set. DLKM Tools |  |
There are a
number of HP-UX commands for installing, configuring, and managing
DLKM modules, collectively known as the Kernel Configuration
Tool Set. They are identified and briefly described in Table 1-1 “Important Terms and Concepts”. For complete descriptions
of these commands and their options, refer to the appropriate manpages. A driver writer or system administrator can use the kernel
configuration tools to install, configure, load, unload, update,
or remove kernel modules from the system; and to build new kernels.
You must have appropriate privileges (be logged in as root)
to perform these tasks. The tasks you can perform using the kernel
configuration tools are described in “DLKM Procedures ”. Table 1-2 Kernel Configuration Tool Set | Tool/ Command | Action |
|---|
| config(1M) | First form - performs a whole
kernel configuration, generating the main kernel file and other
kernel component set files, including the associated dynamically
loadable modules; a system reboot is necessary. Second
form, -M option - performs individual loadable
module configuration for use with the currently running kernel. The
newly configured service is available immediately, without requiring
a system reboot. Note: As an alternative, administrators
may use the mk_kernel(1M) command, which in turn calls config(1M), to perform either whole kernel configuration or
individual module configuration. | | kmadmin(1M) | Provides a general administrative interface to manage
the DLKM modules registered with the currently running kernel. -b option - sets the configured
loading phase of the currently registered DLKM module -k option - prints a
list of all statically linked modules in the running kernel. -L option - loads the
specified loadable module into the running kernel. -Q, -q option - prints
the status of the specified loadable module. -S, -s option - prints
the status of all currently loaded or registered loadable modules. -U, -u option - unloads
the specified loadable module from the running kernel.
| | kminstall(1M) | Installs, removes, or updates a module's
component files on a system. -a option - adds
a module's component files to certain subdirectories of /usr/conf and /stand. -d option - deletes
a module's component files from the subdirectories of /usr/conf and /stand. -u option - copies a
module's updated component files into
the subdirectories of /usr/conf and /stand.
| | kmmodreg(1M) | Unregisters and re-registers loadable
kernel modules with the running kernel. (Note: The interface for
the initial module registration of a newly configured loadable module
is kmupdate(1M), which in turn calls kmmodreg(1M).) -U option
- unregisters the specified loadable image. -M option - re-registers the
specified loadable image
| | kmsystem(1M) | Provides an interface to set and get
a module's planned configuration attributes prior to kernel
or module configuration. Values and attributes displayed and set
with kmsystem will be used to build a new kernel or module. -b value option - sets the planned loading phase of the specified
module. value can be 1 (BOOT1), 2 (BOOT2),
i (INIT), or a (AUTO), indicating
that once the module is configured and registered with the kernel,
it should be loaded during phase 1, phase 2, init, or on demand,
respectively. -c value option - assigns a value (y or n) to
the configuration flag of the specified module in preparation for
the next kernel or module configuration. "y" indicates
that the module will be configured into the kernel. -l option - assigns
a value (y or n) to the loadable flag of the
specified module in preparation for the next kernel or module configuration. "y" indicates
that the module will be built as dynamically loadable. -q option - prints the
values of the planned configuration attributes of the specified
module. Prints a - (signifies "does
not apply") when the attribute does not apply to the type
of module. no options or -S option only - prints
the values of the planned configuration attributes of all modules.
Prints a "-" when the attribute
does not apply to the type of module.
| | kmtune(1M) | Provides an interface to set the tunable
parameters -l option - prints
the values of all system parameters. -q option - queries
the value of the specified system parameter. -r option - resets the
value of the specified parameter to its default value in preparation
for the next kernel or module configuration. -s option - assigns
a value to the specified system parameter in preparation for the
next kernel or module configuration.
| | kmupdate(1M) | Updates the system with the newly built
kernel and/or associated DLKM files. First form - prepares the system to move the specified newly
built kernel and its associated files to the correct locations during
the next system shutdown and startup. This step is necessary to
be able to boot from a newly built kernel (see config(1M) for more detail). Second form, -M option - moves
the configured image of the specified loadable module to the location
where the DLKM loader can find it, and registers the module with
the kernel either (1) immediately or (2) later at the next system reboot.
|
Why you should use the kernel configuration tools
instead of manually editing or copying filesSince the introduction of DLKM to HP-UX, the installed kernel configuration
information is used to configure a whole kernel, or a specific module,
and is distributed among several files. The number and location
of the files used to configure a kernel depends on which modules are
installed on the system. Furthermore, the format of such information is
subject to change. Using the kmsystem(1M) and kmtune(1M) commands to modify the planned configuration prior
to a whole kernel configuration or a module configuration will avoid
corruption of the configuration files, and will ensure that the
correct files are updated.  |  |  |  |  | CAUTION: Avoid editing the system
files; doing so is not forward-compatible and increases the chance
of introducing configuration errors. |  |  |  |  |
In addition, a configured, bootable kernel is no longer composed
of a single file. Each new kernel configured with the config(1M) or mk_kernel(1M) command is composed of several files, including the main
kernel file, the loadable images for DLKMs, a symbol table file,
and a kernel-specific KRS file. All component files of the kernel
are essential for the kernel to boot and run properly. The kmupdate(1M) command understands the organization of these files
and prepares a directory structure accessible to the boot loader
that allows a newly generated kernel to boot and run properly. A whole kernel configuration must be followed by a kernel
update step initiated via the kmupdate(1M) command (or config -u) in order to be able to successfully boot the new kernel. Because of these effects, it is best to configure any type
of kernel module using the tools described in this section.  |  |  |  |  | CAUTION: Avoid copying or moving kernel files; doing so may
result in corrupting the running kernel, or any other configured
kernel on the system. |  |  |  |  |
See kmsystem(1M), kmtune(1M), mk_kernel(1M), config(1M), and kmupdate(1M) for more information. DLKM Procedures |  |
This section explains how to configure, load, and unload DLKM-enabled kernel
modules. Procedural information is shown in two different ways. The
first is a summary and the second provides the details. DLKM Procedural Flowchart Use this chart as a reference to view all of the procedures
and to determine the correct sequence in which to perform them. DLKM Procedures This section presents step-by-step instructions for preparing, configuring,
loading and unloading (or activating) loadable modules. The detailed procedures are presented in two sections: Dynamically Configured Loadable Module
Procedures Statically Configured Loadable Module Procedures
DLKM Procedures for Dynamically Configured
Loadable ModulesThese procedures: Prepare a DLKM module
for dynamic or static configuration Query, set or reset tunable DLKM module or static
kernel parameters Dynamically configure a DLKM Update the image of a DLKM and register it with
the kernel Load a dynamically configured loadable module Logically disconnect a module and perform cleanup View details of all registered DLKM modules View details of a specific DLKM module
Preparing a Loadable Module for
Dynamic Loading Into the HP-UX Kernel. You can use the kmsystem command to prepare a DLKM module to be either dynamically
configured or statically configured. The kmsystem command sets the planned configuration, planned linkage,
and planned loading phase of a module. The -c value option specifies whether the module will, or will
not, be configured at the next kernel or module build. If value is y, it will be configured, if value is n it will not be configured.
The -l value option specifies whether the module will be dynamically,
or statically, linked at the next kernel or module build. If value is y, it will be dynamically loadable.
If value is n it will be statically linked. The -b value option specifies the phase during which the module
will be loaded, assuming it has been configured and registered with
the kernel. The value argument can be one of the following: - 1
(BOOT1) Specifies that the module should be loaded during
phase 1 of the kernel boot sequence. - 2
(BOOT2) Specifies that the module should be loaded during
phase 2 of the kernel boot sequence. - i
(INIT) Specifies that the module should be loaded during
the init process. - a
(AUTO) Specifies that the module is not to be loaded upon
system reboot, but should remain ready to load on demand, or by
the DKLM auto loading mechanism.
The planned loading phase will become the configured loading
phase once a module is configured and registered with the kernel.  |  |  |  |  | NOTE: If the module does not support dynamic linkage, an attempt
to set the planned linkage as dynamic (kmsystem -l y),
and/or an attempt to set the planned loading phase (kmsystem
-b phase) will result in an error. |  |  |  |  |
To prepare a loadable module to be dynamically loaded into
the kernel, execute this command: /usr/sbin/kmsystem -c y -l y -b phase module_name |
 |  |  |  |  | NOTE: A module's system description file, as well
as the HP-UX system file, must only be modified using the kmsystem or kmtune commands. It is important to follow this practice because
the format of planned attributes and their location in the system
will change in future releases and if you manually modify the system
files as they are currently designed, your modifications will not
be forward compatible. |  |  |  |  |
Procedure 1-1 Querying and Tuning System Parameters
for DLKM Modules Use the kmtune command to query, set, or reset system (tunable) parameters
used by the DLKM module or the static kernel. kmtune reads the master configuration files, the system description
files, and the HP-UX system file. For any modularly packaged module, kmtune writes user modified system parameters to the module's
system description file. To query the value of a specific system parameter, execute
this kmtune command: /usr/sbin/kmtune -q system_parameter_name |
To set the value of a specific system parameter, execute
this kmtune command: /usr/sbin/kmtune -s system_parameter_name=value |
To reset the value of a system parameter to its default
value, execute this kmtune command: /usr/sbin/kmtune -r system_parameter_name |
At this point, you have set the values of the module's
system parameters for the next module configuration. The values
of the system parameters supplied by the module will become effective
with the running kernel after the loadable module is configured
and registered (see procedures in the following sections).  |  |  |  |  | NOTE: The
dynamic tuning of tunable system parameters without reconfiguring the
DLKM module is not supported in HP-UX 11i Version 1.5 but will be supported
in a future release. |  |  |  |  |
Configuring a Loadable Module
for Dynamic Loading. Use the config command to configure a loadable module (a DLKM module)
into the system as a dynamically configured module. For a DLKM module
configuration, config proceeds as follows: Reads
the module's master configuration file Reads the HP-UX system file Reads the module's system description file Checks the interface functions or symbols used by
the module Generates several C output files (including a makefile
named config.mod) describing the system configuration Generates the module's registration information
in KRS format. Executes the makefile to configure the dynamically
loadable module Places the generated dynamically loadable module
image files under the kernel function set directory associated with
the running kernel.
To configure a loadable module for dynamic loading and register
it with the running kernel, execute this config command: /usr/sbin/config -M module_name -u |
This results in the generation of a loadable image. The -u option
forces config to call the kmupdate command, which causes the system to move the newly generated
image into place and register it with the running kernel.Upon completing
this configuration procedure, the DLKM is ready to load on any of
its Supported Loading Phases. If the module specifies runtime (RUN)
as a supported loading phase, the module is ready to load immediately;
you do not have to wait for a reboot. Procedure 1-2 Registering a Dynamically Configured Loadable
Module With the HP-UX Kernel For a DLKM module configured as dynamically loadable, use
the kmupdate command to update its image and register it with the
kernel. Updating a dynamically configured loadable module's
image means moving its image into place and registering it with
the kernel either immediately or later, at system shutdown. Once
a module is registered with the kernel, you can view the configured
loading phase using kmadmin -Q module_name. Call kmupdate after first calling config. If you include the -u option in the config invocation, there is no need to invoke kmupdate separately. The config -M -u command automatically invokes kmupdate. To update the image of a dynamically configured loadable
module immediately, execute this kmupdate command: /usr/sbin/kmupdate -M module_name -i |
If a module by the same module name was already registered
with the running kernel, an immediate update will unregister the
old module and register the new module. In addition, if the old
module was loaded, the immediate update will also load the new module. To update the image of a dynamically configured loadable
module at system shutdown (an asynchronous
update), execute the following kmupdate command: /usr/sbin/kmupdate -M module_name -a |
If you do not specify the -i or -a option, kmupdate will attempt to update the specified loadable module
immediately. If the module cannot be updated immediately (for example,
the current module is in use and cannot be unloaded), the module
will be updated at system shutdown.
Loading a Dynamically Configured Loadable Module
Into the HP-UX Kernel. To load a dynamically configured loadable module, use the -L option
of the kmadmin command. The load operation initiated by the kmadmin -L command performs all tasks associated with link editing
the module to the running kernel and making the module accessible
to the system.  |  |  |  |  | NOTE: All dynamically loadable modules need
to be registered before they can be demand or autoloaded into the
running kernel. The kmupdate command carries out this task. |  |  |  |  |
Specifically, the load operation performs the following tasks: Verifies that the specified loadable
module is registered. Checks what other modules the loadable module depends
on and automatically loads any such module that is not currently
loaded Allocates space in active memory for the specified
loadable module Loads the specified loadable module from the disk
and link edits it into the running kernel Relocates the loadable module's symbols
and resolves any references the module makes to external symbols Calls the module's _load() entry point to do any module-specific initialization
and setup Logically connects the module to the rest of the
kernel, which is often accomplished with the help of module type-specific
installation functions accessed through the module's wrapper
code
To load a dynamically configured loadable module into the
running kernel, execute the following kmadmin command: /usr/sbin/kmadmin -L module_name |
When the loading completes, an identifier (ID) number prints
on the standard output to identify the module that was loaded. Changing the Configured Loading Phase of a Currently
Registered Module. Once a module has been registered with the currently running
kernel, the configured loading phase can be changed using the following command
syntax: /usr/sbin/kmadmin -b value module_name
For example, the following command schedules a registered
module named hello to be loaded at every system
reboot, at the end of the boot sequence (at init time);
/usr/sbin/kmadmim -b i hello For more information, see “Preparing a Loadable Module for
Dynamic Loading Into the HP-UX Kernel”. Procedure 1-3 Unloading a Dynamically Configured Loadable Module The unloading operation logically disconnects the module from
the running kernel and calls the module's _unload() entry point to perform any module-specific cleanup including: Canceling all outstanding calls to timeout() Disabling device interrupts Freeing all active memory allocated by the specified
loadable module
Use the -U or -u option
of the kmadmin command to unload a DLKM module configured as dynamically
loadable. You have the choice of unloading the module by its name
or by its ID number. To unload a dynamically configured loadable module by
name, execute this kmadmin command: /usr/sbin/kmadmin -U module_name |
To unload a dynamically configured loadable module by
ID number, execute this kmadmin command: /usr/sbin/kmadmin -u module_id |
Procedure 1-4 Determining Which Modules are Currently Registered
and/or Loaded Use the -S or -s option
of the kmadmin command to view detailed information about all currently
registered DLKM modules. To print the full status for all dynamically configured
loadable modules currently registered, execute this kmadmin command: To print the brief status for all dynamically configured
loadable modules currently registered, execute this kmadmin command: To print a list of all statically linked modules, execute
the following kmadmin command:
Procedure 1-5 Obtaining Information About a Registered and/or
Loaded Module Use the -Q or -q option
of the kmadmin command to view detailed information about a specific
DLKM module. For a DLKM module configured as dynamically loadable,
you can refer to the module by its name or by its ID number. To display a dynamically configured loadable module's
status by name, execute this kmadmin command: /usr/sbin/kmadmin -Q module_name |
To display a dynamically configured loadable module's
status by ID, execute the following kmadmin command: /usr/sbin/kmadmin -q module_id |
Depending on the type of module, information on the module's
block major number, character major number, and flags may also be
printed. Information returned by the -Q and -q options
includes: Module's version string (loadable modules
are given default version 0.1.0) Module's Configured Loading Phase Module's pathname to its object file on
disk Module's status (LOADED or UNLOADED) Module's virtual load address Memory size of BSS (Block Started by Symbol) (the
memory size of the uninitialized space of the data segment of the
module's object file) Module's reference or hold count (the number
of processes that are currently using the module) Module's dependent count (the number of
modules that currently depend on this module being loaded; modules
depended on are specified in the $DRIVER_DEPENDENCY section
of the module's master file) Module's unload delay value (currently
not used - always 0 seconds) Module's descriptive name Type of module (WSIO, STREAMS,
or Misc)
DLKM Procedures for Statically Configured
Loadable ModulesThese procedures: Prepare
a DLKM module for static configuration Query, set or reset tunable DLKM module or static
kernel parameters Build a whole kernel configuration Update the kernel's image with the newly
generated kernel Load the newly generated kernel by shutting down
and rebooting the system
Preparing a Loadable Module for
Static Linking. You can use the kmsystem command to prepare a DLKM module for configuration as statically
configured. Use the kmsystem command to set the planned configuration of a module. To prepare a DLKM module for static linking to the HP-UX kernel, execute
this kmsystem command: /usr/sbin/kmsystem -c y -l n module_name |
 |  |  |  |  | NOTE: A module's system description file, as well
as the HP-UX system file, must only be modified using the kmsystem or kmtune commands. It is important to follow this practice because
the format of planned attributes and their location in the system
will change in future releases and if you manually modify the system
files as they are currently designed, your modifications will not
be forward compatible. |  |  |  |  |
Procedure 1-6 Querying and Tuning System Parameters
for a Statically Configured Module Present in the Static Kernel Use the kmtune command to query, set, or reset system (tunable) parameters
used by the DLKM module or the static kernel. kmtune reads the master configuration files, the system description
files, and the HP-UX system file. For a traditionally packaged module (one that uses pre-11.0
module packaging), kmtune writes any user modified system parameter to the HP-UX system file. To query the value of a specific system parameter: Execute this kmtune command: /usr/sbin/kmtune -q system_parameter_name |
To set the value of a specific system parameter, execute
this kmtune command: /usr/sbin/kmtune -s system_parameter_name=value |
To reset the value of a system parameter to its default
value, execute this kmtune command: /usr/sbin/kmtune -r system_parameter_name |
At this point you have set the values of system parameters
that will take effect after the next whole HP-UX kernel configuration,
update and system reboot (see procedures below).
Whole HP-UX Kernel Configuration to Include a
Statically Configured Loadable Module. When configuring a DLKM module into the system as statically configured, config builds an entire kernel, that is,
configures the static kernel and all kernel modules. For a whole
kernel configuration, config proceeds as follows: Reads the traditional and modular master
configuration files for the kernel modules Reads the HP-UX system file Reads the system description files for the kernel
modules Checks the interface functions or symbols used by
the kernel modules Generates several C output files (including two
makefiles named config.mk and config.mod) describing the system configuration Executes the config.mod makefile to configure any dynamically loadable modules associated
with the new kernel Executes the config.mk makefile to configure a new kernel, to link the kernel
with the appropriate kernel libraries associated with traditional
modules, and with the statically linked modules, and to generate
the kernel symbol table Places the newly generated static kernel file (vmunix_test) in the /stand/build directory Places the generated symbol table file (symtab) and generated dynamically loadable module image files
(module_names) under the kernel function set directory associated
with the newly generated kernel. Generates a kernel-specific KRS file that includes
the module registration information associated with the newly generated
kernel.
 |  |  |  |  | WARNING! Manually copying or moving kernel files is not a
supported practice, and may result in corrupting the running kernel
or other kernels on the system. See kmupdate(1M) for the supported interfaces to update and remove
kernels. |  |  |  |  |
 |  |  |  |  | NOTE: A whole kernel configuration generates several files
that will make up the kernel component set for the new kernel. After
a whole kernel configuration, a kernel update (see next section)
and a system shutdown and restart are required to be able to make
the newly configured kernel the active kernel. The kernel update
step, initiated with the kmupdate command or config -u, is now a required step to be able
to successfully boot a newly configured kernel. |  |  |  |  |
To configure the HP-UX kernel to include a statically configured
loadable module and update the system with the new kernel, execute
this config command: /usr/sbin/config -u /stand/system |
config builds a new kernel. The -u option
forces config to call the kmupdate command to schedule the update of the kernel image, a required
step in the process of successfully booting a newly configured kernel. After the system reboots, your DLKM module will be available
as statically configured in the new running kernel. Updating the Kernel. For a DLKM module configured as statically linked, use the kmupdate command to schedule the update of the system with the
newly configured kernel. Each new kernel configured with the config(1M) command is composed of several distributed files,
which are all required for a kernel to boot and run properly. The
main kernel file is associated with its component files by way of
a Kernel ID String (KIS) in the main kernel image. For any kernel,
all the files required by the boot loader need to be accessible
from the /stand/boot.KIS directory, where KIS uniquely identifies the kernel being booted. The kmupdate(1M) command does the following: schedules the move of the main kernel image and
its associated kernel-component-set files to the default locations creates and populates the kernel-specific directory
(/stand/boot.KIS) from which the boot loader will be able to obtain all
the kernel components needed at boot time.
Call kmupdate after first calling config. If you include the -u option in the config invocation, there is no need to invoke kmupdate. The config -u command automatically invokes kmupdate. To update the kernel, execute the following kmupdate command: /usr/sbin/kmupdate /stand/build/vmunix_test |
Loading the Kernel. For a DLKM module configured as statically linked, use the -r option
of the shutdown(1M) command
to load the newly generated kernel by shutting down and rebooting
the system. Executing the shutdown -r command terminates all currently running processes and
reboots the system, which causes the new kernel configuration to
take effect. At that time, all statically linked, dynamically configured
modules associated with the new kernel are accessible to the system. To load the new kernel, move to the / directory, and execute the following shutdown command: cd / /usr/sbin/shutdown -r |
|