How it all started
Off late , i had been feeling sluggish with ubuntu 12.10 on my laptop , a 2 year old PDC 2GB ram machine.
So first i tried switching to lubuntu 13.04 alpha then eventually moved to beta. I experienced good speedup since it removed a lot of bloatware like zeitgeist , the service that records user activity for customised search results in unity ,the desktop shell of ubuntu (Hey , i had privacy concerns too)
Now coming back to the topic , i decided to try downloading the linux kernel and compile it , i was doing it for first time. I never knew it would be this easy.
I got the 3.8.0-16 kernel source (the one already available) and tried to compile but it failed.(Need to investigate more on this)
Then i downloaded the upstream kernel 3.8.6 from kernel.org and compiled it successfully.
Prerequisite : Basic knowledge of working in linux terminal .
The Steps
Optional but Important. Backup any important Data
1. Download the latest stable kernel from kernel.org , Current stable version is 3.8.6 .It's an archive of size 70 MB.
Link: https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.8.6.tar.xz
2.Extract it as below , (xz is a relatively new format )
xz -dv linux-3.8.6.tar.xz
We will get a tar archive .
tar -xvf linux-3.8.6.tar
It will be extracted to linux-3.8.6 directory.
cd linux-3.8.6
3.Install the following packages using sudo or from root login,
sudo apt-get install libncurses5-dev gcc make git exuberant-ctags
I would also suggest to optionally install below packages ,
sudo apt-get install fakeroot g++
Actually i faced an error with gcc (when i tried compiling kernel i downloaded from ubuntu using apt-get source)
I re-installed gcc and installed g++ before trying to compile the kernel.org kernel.
4.Copy your kernel config ,
cp /boot/config-`uname -r`* .config
(We can also create a config from the one supplied with kernel , but it's a good idea to start with the one supplied with your distro , as it comes with optimisations)
5.Optionally edit the config ,
make menuconfig
In the ncurses based interface change the options you want ,I changed the processor type from pentium pro to core2 since i had a PDC P6200 CPU based on intel 2010 core micro architecture and hence wanted to compile against an advanced micro architecture.You can also enable/disable/enable to load as module the various kernel features (eg virtualisation support . My CPU does not have virt-x extensions, so i did not enable it , curse Intel for not providing it. They are providing it on all new Ivybridge CPU's which is good news ) at this stage.
6.Build it,
make
or
make -jx (where x is degree of parallelism)
I used make -j2 (since i had a dual core CPU and wanted to utilise both the cores)
Now take a break. Go for a walk , prepare tea or have a meal pr anything you like to do. Building a kernel may take a lot of time depending on your CPU/RAM and load on your machine. In took around 1 hour in my case
7.Install it,
sudo make modules_install install
It invokes the installkernel script in ubuntu which installs kernel,modules and updates grub too.
8.In case if it does not update grub (may be in older ubuntu versions),
sudo update-grub2.
Now reboot, select the new kernel , boot with it :)
Continued..
I hope you enjoyed it . It's a nice feeling to do something new and learn from it. Its a great experience , playing with linux .It just gives you more power and control which the geek in you craves for ..!
See you again with my next experiment :)