Recompiling a Debian Linux kernel package

I’m recompiling my linux kernel on one of my home (Debian) servers that has dual processors today. When I initially compiled the kernel on this system I mostly followed the instructions on this site. I’m going to base my recompile on those same instructions. If you’re looking for a very detailed guide to building a kernel package you might try this site.

The first thing I needed to do was make sure I had the appropriate tools to build a Debian kernel package (my preferred method of kernel installation) so I issued a command like this:

# apt-get install debhelper modutils kernel-package libncurses5-dev fakeroot

The next step is to download appropriate kernel source packages. I want both a 2.6.x and a 2.4.x kernel so I selected both:

# apt-get install kernel-source-2.4.27 kernel-source-2.6.8

To do this correctly you should change the kernel package config file to include specific (name & email) details about your package. I also made sure to set the SMP concurrency_level to 2.

# vi /etc/kernel-pkg.conf

Next I entered the source directory, unpacked the source and moved into the unpacked directory.

$ cd /usr/src
$ tar --bzip -xvf kernel-source-2.4.27.tar.bz2
$ cd kernel-source-2.4.27

Since I haven’t been having any problems with my existing kernel configuration and just want to make some changes to it I copied the existing config file into the source directory.

$ /usr/src/kernel-source-2.4.27
# cp /boot/config-2.4.26-20040815-1-chiefgreen .config

I like to modify my kernel settings using the menuconfig program.

$ make menuconfig

You want to clean existing build files before attempting a build.

$ make-kpkg clean

Time to build the kernel package, you can change the append information to match your specifics.

$ fakeroot make-kpkg --append_to_version -20051203-1-686-smp --initrd --revision=rev.01 kernel_image modules_image

You’ll get a warning about using initrd without the cramfs patch, we’re ok because we are using debian kernel sources and not pristine ones. Continue past the warning and take a break while your kernel builds. Next you’ll probably want to install your new kernel using the dpkg tool.

$ cd ..
# dpkg -i kernel-image-2.4.27-20051203-1-686-smp_rev.01_i386.deb

Check to make sure the boot loader is set to boot the new kernel, reboot and kick the tires.

If you want to add the MPPE patch to the kernel package you’ll need to do some additional work. I did this based on the instruction on this site. First get a copy of the MPPE patch.

# apt-get install kernel-patch-mppe

When you do your make-kpkg you need to add an –added-patches mppe command.

# make-kpkg --added-patches mppe --append_to_version -20051203-1-686-smp-mppe --initrd --revision=rev.01 kernel_image modules_image
During the build you will be asked if you want to include PPP MPPE compression. If you include it as a module after you reboot with your new kernel you can test it with:

# modprobe ppp-compress-18 && echo success

If this works, “success” will be displayed. If you are on a console or watching syslog, you may see:

ppp_mppe: module license 'BSD without advertisement clause' taints kernel.
PPP MPPE Compression module registered

These messages do not stop it from working.

If you find it’s taking far too long to build your kernel packages and you have other systems availible you may be able to use distcc to help speed the compiling process.

Comments are closed.