Linux Step By Steps
Linux Step by Steps
Adding 'foreign' modules to the kernel.

From: Richard Ebling <>
From: "Daniel B. Haun" <>

These notes currently apply to the 2.2.X kernels. Ymmv on 2.4.x

The problem.

As bugz, 'features', and new devices are added to Linux, the 'standard' method of applying them is to simply upgrade the kernel to the latest release. Ala 2.2.14 to 2.2.18 etc. This is covered well in Kantoine's recompiles.

Between each release of the kernel, obviously, some work has been carried out on either fixing A driver, or creating a new one for a new 'device'.

The absolute bottom line is:

  1.     a compiled binary <something>.o must exist in /lib/modules/<kernel version>/*
  2.     some means of loading it via /etc/modules/default, Coas, or, /etc/modules.conf
If you can achieve the above, you don't need to read further.

Merging foreign source.

There is nothing illegal or wicked in doing this, you are simply one step ahead of the kernel developers.

The steps here are indicative of how to merge new source code into the /usr/src/linux/driver tree.

The intention is, _when_ you recompile your kernel, your updated or new source code for A driver is automatically included.

The example shown is for a fictitious network card called zap.

Step one.

the driver tree begins at /usr/src/linux/drivers/

Since the example is for a network card, work in the /usr/src/linux/drivers/net directory. If this example were for a scsi device, figure out the obvious.

copy zap.c source code into this ~/net directory

Step two.

If zap.c is a never seen before, file:

edit the Makefile in the ~/net directory

scan down until you find the magic sentence


Immediately after this statement enter

M_OBJS += zap.o


If the new zap.c source is simply something overwiting an older version, you have nothing to do!

Step three:

Recompile, and Enjoy