2011年7月21日 星期四

Upgrade Kernel in Ubuntu 11.04

紀錄一下怎麼自己升級Kernel。

Now, go to the folder where you downloaded the kernel and move the file linux-2.6.38.3.tar.bz2 to the new location, to do that run:

sudo mv linux-2.6.38.3.tar.bz2 /usr/src/

Extract the file:

cd /usr/src/
sudo tar jxvf linux-2.6.38.3.tar.bz2

Now let’s gain a little time. Let’s import the kernel settings we are currently using:

cd /usr/src/linux-2.6.38.3
sudo cp /boot/config-`uname -r` .config

We are almost ready to compile the kernel. Open the kernel menu settings:


sudo make menuconfig

The command above will open a window inside of the shell. Select the menu item called “Processor type and features —>” and after “Processor family —>”. Choose your processor. In my case, my notebook is a Core i5, I chose the option “Core 2/newer Xeon”.

After run the command sudo make menuconfig, If you receive the error below:

*** Unable to find the ncurses libraries or the
*** required header files.
*** ‘make menuconfig’ requires the ncurses libraries.
***
*** Install ncurses (ncurses-devel) and try again.
***
make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
make: *** [menuconfig] Error 2

Still In the shell, type:

sudo apt-get install libncurses5-dev

After that, run the command sudo make menuconfig again.

Clean up temp files from a previous compile attempt (skip if necessary)

make-kpkg clean

Compile your Kernel

time fakeroot make-kpkg --initrd --append-to-version=-tweak kernel-image kernel-headers

You can change -tweak to anything you wish

Install your Kernel

cd ~/src


sudo dpkg -i linux-image-2.6.38.2-tweak_2.6.38.2-tweak-10.00.Custom_amd64.deb


sudo dpkg -i linux-headers-2.6.38.2-tweak_2.6.38.2-tweak-10.00.Custom_amd64.deb

Reboot