You first need to download two packages, so run apt-get install kernel-package and then apt-get install libncurses5-dev.
You may already have these.
Now you need to decide which version of the kernel you want to build. You can go to
www.kernel.org and have the pick of the litter. Here, we're going to build 2.4.20. You can download it with apt-get install kernel-source-2.4.20.
You may use the latest kernel which is 2.4.22
After this has completed, change directories to /usr/src. Next you need to link the kernel version directory to Linux with ln -s kernel-source-2.4.20 linux . Now, change directories to Linux, and run make menuconfig. This presents you with a text-based menu where you can switch between kernel parameters. A help menu even is available for assistance if you are not sure what something means. To complete this step successfully, it is imperative that you know the intricate components that make up your laptop. Many kernel parameters are extremely specific. Be prepared to know minute details, for example, which AGP controller, sound card chipset, video card chipset, USB controller or ATA Bus adapter your laptop has.
After you have gone through the lengthy process of selecting the parameters you like, there are a few different ways to compile the kernel. One way is to run make-kpkg clean and then make-kpkg --revision yourname.1 kernel_image. This uses the make-kpkg utility, a Debian tool used to assist you with compiling kernels. It compiles the kernel and all associated modules and puts them in a .deb package one directory below your kernel source. After you have built the package you can install it with the dpkg utility. I like this because it's easy to keep multiple kernel compiles around. Especially if you are troubleshooting a problem, your latest compile may not be the best. If you're having a problem, all you have to is install an older, more successful one.
The make-kpkg method replaces the more standard six step method of
make dep
make
make bzImage
make modules
make install
make modules_install
Both techniques work, but if you are trying a kernel recompile on a non-Debian system, you do not have the make-kpkg utility at your disposal.
After you have compiled and installed your new kernel, reboot to see how its working. Don't fret if you get some random errors here and there. You can always chase those down. Your main worry is if you get to a valid prompt and the system is coming up in multi-user mode. If the system boots completely, you have jumped the first big hurdle. You can run uname -a to verify that you are indeed running the latest kernel.
This was taken from the
Debian Install on a Laptop article.
It may give you a better idea on how to do it.