I read in https://help.ubuntu.com/community/Kernel/Compile there is a different way for compiling kernel in each version of ubuntu. Today I am interesting to compile Karmic kernel. Because my netbook here can not be shut down.
#sudo apt-get install fakeroot kernel-wedge build-essential makedumpfile kernel-package
#sudo apt-get build-dep –no-install-recommends linux-image-$(uname -r)
#sudo apt-get source linux-image-$(uname -r)
#sudo apt-get install qt3-dev-tools libqt3-mt-dev # if you plan to use ‘make xconfig’
#sudo apt-get install libncurses5 libncurses5-dev # if you plan to use ‘make menuconfig’
download the source if you don’t have any in here. Remember to find the approriate kernel version for your karmic. The default is 2.6.31
Extract the source in /usr/src (standard folder or you may change it)
copy file config-bla bla in your /boot/ folder
#cp /boot/config-huge-2.6.31 /usr/src/kernel/config
(usually huge or something with smp thing)
Make some necessary change to your config
Especially the power acpi function. that function is not working sometime to some laptop. so we need to have some experiement to test a setting.
Now compile them
#sudo make-kpkg clean # only needed if you want to do a “clean” build
#sudo fakeroot make-kpkg –initrd –append-to-version=-some-string-here kernel-image kernel-headers
Install your new kernel (with the sample kernel)
#sudo dpkg -i linux-image-2.6.31-16-2be-k7_2.6.20-16_i386.deb
#sudo dpkg -i linux-headers-2.6.31-16-2be-k7_2.6.20-16_i386.deb
Try it. If you failed don’t worry I had the same problem happened. So try it again.