This DKMS (Dynamic Kernel Module Support) package (http://linux.dell.com/dkms/) provides support for installing supplementary versions of kernel modules. The package compiles and installs into the kernel tree. Uninstalling restores the previous modules. By default, installation is into the current kernel tree, but any kernel tree can be selected with command-line options. Furthermore, DKMS is called automatically upon installation of new Ubuntu kernel-image packages, and therefore modules added to DKMS will be automatically carried across updates.

Overview

To use a module with DKMS, one places the module installation files (could be source code or binary) in /usr/src/<modulename>-<version>, along with a configuration file dkms.conf that tells DKMS how to build/configure the module and what its name is. Under more advanced scenarios, conditional build instructions and patching can be done by the dkms system, but considering on your case this may not be necessary.

Walk-through

Let's say you want to install a module for your fancy "Awesome Adaptor." You are given a source tarball awesome-20091211-v1.1.tgz.

Without DKMS, you would unpack the module and read the README to figure out how to compile and install the module.

All directories are with respect to the location of the dkms.conf file. This tells DKMS

The command to build the module (run make in the directory src/). You should look at your Makefile and determine any environment variables that need to be set to the appropriate kernel-specific directory. Many packages will build by default against the currently running kernel, but you want dkms to be able to build against a different kernel that may be specified to it on the command line, the version of which is held in the "$kernelver" variable. The environment variable "KERNELVERSION=${kernelver}" is automatically appended to the make line by dkms at runtime, but this variable may not be the one used by your Makefile. Another common environment variable is "INCLUDEDIR=/lib/modules/${kernelver}/build/include."

The command to clean the source tree (run make clean in the directory src/).

The name of the module without the .o or .ko extension. This may actually be an array of modules if multiple modules are built, see man dkms.

Where DKMS can find the built module.

The name and version DKMS should associate with the module(s).

To remake the initrd image after installing the module.

You can also add options to call scripts before or after build or install, provide additional (conditional) make commands, patch commands, etc. The dkms.conf is in fact sourced into a shell script, so a fair amount of trickery can be done if necessary. These options and more are described in the dkms.conf section in man dkms.

Next, we install the module into DKMS by copying the module installation files into the kernel source tree /usr/src/<modulename>-<version> and tell DKMS about the new module:

That's it! DKMS has now added our module to its list of modules to build for future kernel installations. To make sure it works and to install the module into our current kernel, we can instruct dkms to build and install the module:

With some luck, your module will be installed and reinstalled into future kernel updates.

Examples

The DKMS man page has helpful information on setting up your favorite kernel module for use with DKMS. It is not comprehensive documentation, but it will answer lots of questions. It may help you to note the following examples, even if the modules used are not the ones you want to setup:

RocketRaid - Two examples on how-to setup the Highpoint RocketRaid drivers RR26xx and RR62x with DKMS.