Saturday, January 30, 2010

module-assistant is a tool for building Debian kernel modules from source, without having to rebuild the whole kernel.

It fetches module-source packages that have been prepared for the Debian distribution via apt and produces .deb packages.

This tutorial shows how to use module-assistant in command-line mode and in interactive mode.

I do not issue any guarantee that this will work for you!

1 Preliminary Note
In this tutorial I will demonstrate how to build the ndiswrapper kernel module for Debian Lenny. The procedure is the same for any other kernel module that module-assistant knows.

2 Using Module-Assistant In Command-Line Mode
Install module-assistant as follows:

# aptitude install module-assistant

Next we must make module-assistant download the headers of the current kernel, and some tools that are needed to build packages from source (such as build-essential, etc.). This can be achieved with the following command:

Before we pick a module to build, we should make sure that our /etc/apt/sources.list includes the contrib and non-free repositories because otherwise module-assistant might not be able to install required dependencies for the kernel module that we want to build:

To make sure that the module gets loaded automatically whenever you boot the system, you can add it to /etc/modules:

# vi /etc/modules

[...]
ndiswrapper

That's it!

3 Using Module-Assistant In Interactive Mode

Install module-assistant as follows:

# aptitude install module-assistant

Before we start module-assistant in interactive mode, we should make sure that our /etc/apt/sources.list includes the contrib and non-free repositories because otherwise module-assistant might not be able to install required dependencies for the kernel module that we want to build:

You will see the following dialogue. We must make module-assistant download the headers of the current kernel, and some tools that are needed to build packages from source (such as build-essential, etc.). To do this, select PREPARE:

(JavaScript must be enabled in your browser to view the large image as an image overlay.)

Now we update the list of available kernel modules by selecting UPDATE:

(JavaScript must be enabled in your browser to view the large image as an image overlay.)

Afterwards, go to SELECT:

(JavaScript must be enabled in your browser to view the large image as an image overlay.)

You will see the list of available kernel modules. Pick the one you want to build by pressing the SPACE bar (I select ndiswrapper in this example), and hit Ok: