Prepare the Debian kernel-source 

Getting the kernel source 

$ uname -r
2.4.25-1-386
debfoster kernel-source-2.4.25 kernel-headers-`uname -r`

NB,

% debfoster kernel-source
Package kernel-source is a virtual package [...]

Unpacking kernel sources 

cd /usr/src/
tar jfx kernel-source-2.4.25.tar.bz2
ln -s kernel-source-2.4.25 linux
cp /boot/config-* linux/.config
cd linux
# use all answers from ./.config file
$ make oldconfig
*** End of Linux kernel configuration.
*** Check the top-level Makefile for additional configuration.
*** Next, you must run 'make dep'.
# Finally, do a "make dep" to set up all the dependencies correctly.
$ make dep

Prepare the kernel 

patch kernel to the correct release version 

This might be optional. You can also upgrade between 2.4.xx releases by patching. Patches are distributed in the traditional gzip and the new bzip2 format. To install by patching, get all the newer patch files, enter the top level directory of the kernel source (linux-2.4.xx) and execute:

gzip -cd ../patch-2.4.xx.gz | patch -p1
or
            bzip2 -dc ../patch-2.4.xx.bz2 | patch -p1

The script patch-kernel can be used to automate this process. It determines the current kernel version and applies any patches found.

linux/scripts/patch-kernel linux

The first argument in the command above is the location of the kernel source. Patches are applied from the current directory, but an alternative directory can be specified as the second argument.

Clean it before starting 

Make sure you have no stale .o files and dependencies lying around:

cd linux
make mrproper

You should now have the sources correctly installed.

Configuration File 

Kernel package by itself does not create any configuration file (.config); it uses whatever you have. You can use your current version made for you machine by copying it over from /boot/config-Y.Y.YY, like so:

% cp /boot/config-Y.Y.YY .config

cp /boot/config-* linux/.config

Configuring the kernel 

Kernel package by itself does not create any configuration file (.config); it uses whatever you have. Do a "make config" to configure the basic kernel and generate this configuration file.

Alternatively, use "make xconfig", which is X windows based configuration tool. Exit and save your configuration. This will create a hidden file named ".config" in your current "/usr/local/src/linux" directory. You could edit this file directly to make changes to your configuration, but I wouldn't. All that this step has done is to set up this configuration file. This file is read by the actual kernel compilation process to compile the options you've specified.

Do not skip this step even if you are only upgrading one minor version. New configuration options are added in each release, and odd problems will turn up if the configuration files are not set up as expected.

Alternatively, you can use your current version made for you machine by copying it over from /boot/config-Y.Y.YY,

cp /boot/config-* linux/.config

If you want to carry your existing configuration to a new version with minimal work, use "make oldconfig", which will default all questions based on the contents of your existing ./.config file, and only ask you for the answers to new questions.

Finally, do a "make dep" to set up all the dependencies correctly.

Compiling the kernel 

Use the command "make-kpkg clean; make-kpkg kernel_image". This will cause a bunch of grinding and text; details omitted.

This step is a Debian-way of compiling the kernel. The "other" way is to do it manually, which consists of several steps such as "make dep" and "make modules" and "make modules_install" and manually finding and moving the kernel to where it needs to be and setting up symlinks and configuring lilo.conf and running lilo.