http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html
Install needed compilers
# apt-get install build-essential
Get Your desired kernel version
$ cd /tmp $ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2 # tar -xjvf linux-2.6.25.tar.bz2 -C /usr/src # cd /usr/src/linux-2.6.... (the new linux folder)
If you want your current kernels config, you can run # make oldconfig which should create a .config file in /usr/src/linux2... I believe its the same one as the one in your /boot (current config), but \ double check that. Or else to be sure you can just copy /boot/config-2..., to /usr/src/linux2.../.config
Now look/edit the config either by editing .config or running
$ make menuconfig - Text based color menus, radiolists & dialogues. This option also useful on remote server if you wanna compile kernel remotely. $ make xconfig - X windows (Qt) based configuration tool, works best under KDE desktop $ make gconfig - X windows (Gtk) based configuration tool, works best under Gnome Desktop.
I use menuconfig, now save and edit
Compile Kernel (make sure still in /usr/src/linux2... folder)
$ make $ make modules $ su - (to become root) # cd /usr/src/linux2.6... # make modules_install
Install kernel (installs 3 files to /boot, System.map-xx, config-xx, vmlinux-xx, just kernel stuff, not initramfs yet)
# make install
Create initramfs (sometimes the command is mkinitrd ...)
# cd /boot # mkinitramfs -o initrd.img-2.6.xx 2.6.xx (sub your kernel version of course)
Now update your grub menu.lst, you can either edit manually, or just run
# update-grub