Posts Tagged ‘kernel’

Getting a Debian kernel source tree for driver compilation

Sunday, August 15th, 2004

I have stumbled into this a few times, so I’d better write it down. Here is how you get a kernel source tree setup for compilation of drivers under Debian, assuming you’re using a Debian provided kernel package.

The information is shamelessly stolen from Martin List-Petersen:

Lets assume you’ve installed kernel-image-2.x.y-z-arch. It could be kernel-image-2.4.25-1-386 in which case x=4, y=25, z=1, arch=386. These numbers are need in the following.

The procedure is this:

Download the kernel source package:

apt-get install kernel-source-2.x.y

Unpack it:

cd /usr/src
tar -xjvf kernel-source-2.x.y.tar.bz2

Install the correct config-file:

cd kernel-source-2.x.y
cp /boot/config-2.x.y-z-arch .config

Generate dependencies and Makefiles:

make-kpkg --append-to-version "-z-arch" --revision 2.x.y-z --config old configure

Check build link:

rm -f /lib/modules/2.x.y-z-arch/build
ln -s /usr/src/kernel-source-2.x.y /lib/modules/2.x.y-z-arch/build

Most drivers will use the build link to find the correct kernel source tree for include files and Makefiles.

With this in place many drivers can be installed with a simple “make install”.