Bob's Debian Kernel Build Page

Get the bits onto your machine

Use the Debian source packages.

sudo apt-get install kernel-source-2.4.20

Build the kernel modules

The make-kpkg process uses two environment variables to specify who built the package. You will usually want to put these into your environment such as in your .bashrc file. These can also be specified on the command line too, however.

export KPKG_MAINTAINER="Bob Proulx"
export KPKG_EMAIL=bob@proulx.com

Using an initrd kernel

Here is the process to build the new kernel.

cd /usr/src
tar xjf kernel-source-2.4.20.tar.bz2
cd kernel-source-2.4.20
cp /boot/config-2.4.20-2-k7 .config
fakeroot make-kpkg clean
fakeroot make-kpkg --initrd --append-to-version -k7-2 --revision 1.1 kernel_image modules_image
cd /usr/src
sudo dpkg -i kernel-image-2.4.20-k7-2_*.deb

I usually start with the known good Debian kernel config files from an existing Debian kernel. These are installed in /boot/config-2.4.20-k7. These are modular configurations. Modular meaning that the kernel is small and everything is loaded as needed dynamically instead of being compiled into the kernel statically. After copying that file into the kernel directory you may make adjustments using make menuconfig or whatever.

Using an non-initrd kernel

Note that it is not necessary to use a Debian kernel. One from www.linux-kernel.org is fine as well and prefered by many. In that case do not use an initrd however. One of the advantages to the Debian kernel is the application of patches to create a compressed initial ram disk image. Since the stock kernel does not support that you can't use it. You will have to ensure that all of the modules that you need to boot are compiled into the kernel in that case.

cd /usr/src
tar xjf linux-2.4.20.tar.gz
cd linux
cp /boot/config-2.4.20-2-k7 .config
fakeroot make-kpkg clean
fakeroot make-kpkg --append-to-version -k7-2 --revision 1.1 kernel_image modules_image
cd /usr/src
sudo dpkg -i kernel-image-2.4.20-k7-2_*.deb

Using XFS Patches

The XFS filesystem is not yet a standard part of the kernel. In order to use this you will need to install the patches and compile.

Since patches are considered more extreme you must confirm that you are really wanting to build a patched kernel. Set the following in your environment. I normally set this in my .bashrc file.

export PATCH_THE_KERNEL=AUTO

This is very similar to the above process. Note the only difference is making sure the patches you want to use are installed ahead of time and specifically telling make-kpkg that you want to use those patches.

sudo apt-get install kernel-source-2.4.20
sudo apt-get install kernel-patch-xfs
cd /usr/src
tar xjf kernel-source-2.4.20.tar.bz2
cd kernel-source-2.4.20
cp /boot/config-2.4.20-2-k7 .config
make-kpkg clean
fakeroot make-kpkg --added-patches xfs --initrd --append-to-version -k7-2 --revision 1.1 kernel_image modules_image
cd /usr/src
sudo dpkg -i kernel-image-2.4.20-k7-2_*.deb

The official Debian kernels use the kernel version as the Debian version. Which is the natural thing to do. But Debian has determined this to be something which is to be reserved for them alone.

Reference Information

/usr/share/doc/kernel-package/README.gz

http://newbiedoc.sourceforge.net/

http://newbiedoc.sourceforge.net/system/kernel-pkg.html