Kernel with Debian “make-kpkg”

When compiling and installing a custom kernel for a Debian based Linux system, wouldn’t it be nice if your new Kernel was installable (or removable) trough the Debian package manager? And wouldn’t it even be nicer if that package also created the GRUB menu entries for that new Kernel? And maybe you need a “initrd” image as well?

All the above (and more) could easily be achieved by using a tool called “make-kpgk”. The usage of this tool, I will try to describe in the following steps.

Step 1: install “make-kpgk”

On a Debian based system just “apt-get” like this:

apt-get install kernel-package

Step 2: get some Kernel sources

Download the Kernel sources from kernel.org, extract them to a directory of your choice.

Step 3: configure your Kernel

Configure your custom Kernel as usual. For example by using “menuconfig”:

make menuconfig

Step 4: Compile your Kernel

Instead of using something like “make bzImage modules”, we will use “make-kpkg”. To generate a Kernel with modules and “initrd” image, we issue the following command:

make-kpkg --initrd --bzimage kernel-image

This will produce a Debian package (e.g. linux-image-2.6.34_2.6.34-10.00.Custom_i386.deb).

Step 4: install your Kernel

The Kernel could be installed by using “dpkg”:

dpkg -i linux-image-2.6.34_2.6.34-10.00.Custom_i386.deb

Leave a Reply

You must be logged in to post a comment.