https://help.ubuntu.com/community/Kernel/Compile
Install tool:
sudo apt-get install fakeroot build-essential crash kexec-tools
makedumpfile kernel-wedge
sudo apt-get build-dep linux
sudo apt-get install git-core libncurses5 libncurses5-dev
libelf-dev asciidoc binutils-dev
Download the source archive
sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)
apt-get source linux-image-$(uname -r)
Change to source directory & Make scripts executable
cd linux-2.6.32/
sudo chmod -R u+x debian/scripts/*
Modify code
……
Update config
debian/rules updateconfigs
Build kernel
sudo fakeroot debian/rules clean
AUTOBUILD=1 NOEXTRAS=1 DEB_BUILD_OPTIONS=parallel=2 sudo
fakeroot debian/rules binary-generic
Trigger Rebuild
sudo rm debian/stamps/stamp-build-generic
AUTOBUILD=1 NOEXTRAS=1 DEB_BUILD_OPTIONS=parallel=2 sudo
fakeroot debian/rules binary-generic
Build Result
Located in parent directory:
Install new kernel
sudo dpkg -i linux-headers-2.6.32-30-generic_2.6.32-30.59_amd64.deb
sudo dpkg -i linux-image-2.6.32-30-generic_2.6.32-30.59_amd64.deb
Check new kernel
ls /usr/src
ls /boot