Debian Kernel Building Mini-HOWTO

Posted by hannibal on Fri 11 Feb 2005 at 18:04

This is intended to be a quick and dirty guide to building your own kernel packages for Debian. For more information, see the links at the end of the article.

1. Install the packages 'kernel-package' and 'fakeroot'.

2. Get a Linux kernel tarball, either from kernel.org or from a Debian package (kernel-source-x.x.xx).

3. Uncompress the tarball to a place of your choice (Debian kernel source packages end up in /usr/src)

4. cd into the kernel source directory

5. Configure your kernel (I prefer 'make menuconfig' - note that for menuconfig you will need libncurses5-dev)

6. Execute this command: fakeroot make-kpkg kernel_image

7. You will have a kernel deb in the parent directory of your kernel source now (e.g. /usr/src). Install it using dpkg (dpkg -i file.deb)

If you use grub, here is what you need to do to get your menu.lst automatically updated.

Create a file /etc/kernel-img.conf and add the following lines:

        postinst_hook = /sbin/update-grub
	postrm_hook = /sbin/update-grub
	do_bootloader = no
This will ensure update-grub is ran upon installation of any kernel packages, self-created or Debian-created.

For many more details about building kernels and Debian, see the following sources:

/usr/share/doc/kernel-package/README.gz (very in depth HOWTO)

/usr/share/doc/grub/README.Debian.gz (covers the grub steps above)

TLDP Kernel-HOWTO

original version of this article


This article can be found online at the Debian Administration website at the following bookmarkable URL (along with associated comments):

This article is copyright 2005 hannibal - please ask for permission to republish or translate.