Required packages installation:
apt-get install build-essential kernel-package libncurses5-dev initrd-tools
Get the desired Linux kernel source from http://www.kernel.org/pub/linux/kernel
Unpack the kernel sources in /usr/src, and (to follow conventions) create the symbolic link /usr/src/linux to it:
cd /usr/src
tar xjf linux-{version}.tar.bz2
ln -s linux-{version} linux
To apply a patch “linux.patch” to the linux sources:
cd /usr/src/linux patch -p1 < /path_to/linux.patch
cd /usr/src/linux make menuconfig
In the menuconfig screen the first step, usually, is to load an existing working configuration file. The current kernel configuration is located in the /boot directory with the following name pattern:
/boot/config-{version}
Select Load an Alternate Configuration File and enter the location of the configuration file of your current kernel. The configuration of your current kernel will be loaded, and you can now browse through the menu and change the configuration to suit your needs. When you are finished, hit exit and select yes to save the new kernel configuration.
The kernel configuration will be saved in the file .config.
cd /usr/src/linux make-kpkg clean make-kpkg --initrd kernel_image kernel_headers
cd ..
dpkg -i linux-image-{version}.deb
dpkg -i linux-headers-{version}.deb
Reboot the system and check the system information:
uname -a