Saturday, August 22, 2009

Compiling and installing latest stable Linux kernel for Ubuntu

Just finished installing the latest stable Linux kernel 2.6.30.5 on my PC running Ubuntu. It was not a tedious experience at all as some had hinted earlier. Primarily, thanks to the instructions available at Ubuntu forum:

http://ubuntuforums.org/showthread.php?t=56835

The procedure mentioned there is compatible with 'deb'. Though I have used Linux for software development for some time now, I am still a newbie for hands-on administration. This was my first ever experience with building and installing the kernel.

Few optimizations I applied using 'make xconfig'
  • chose specific processor instead of the existing 'generic 686' and disabled SMP stuff (CONFIG_SMP not defined)
  • changed timer interrupt frequency from 250 to 1000 Hz (CONFIG_HZ_1000=y) for increased responsiveness
  • disabled support for lots of vendor hardware I knew I will never have: laptops, backlit display, touchscreen, etc.
  • opted out unwanted file systems
  • disabled lots of debug stuff--this one is not for meant for development
  • opted out ATM stuff from networking support. Yes, I know what I am doing! Left most of the rest unchanged. Don't have the patience for now to make sure... Perhaps I could have turned off routing, some rarely used QoS schedulers, etc. It's just a poor desktop PC.
Perceived improvements in experience
Kernel build time:
Removing unwanted stuff also saved compilation time by about an hour, that too, with 'nice -n 5 make make-kpkg ...'. Did not really want to simply watch the build happen. It allowed using the PC for normal daily usage. Without nice, even GDM failed to respond when I wanted to switch user :-).
Kernel image size:
3.4M vmlinuz-2.6.28-14-generic
7.3M initrd.img-2.6.28-14-generic
2.4M vmlinuz-2.6.30.5-custom
6.4M initrd.img-2.6.30.5-custom
(CONFIG_KERNEL_BZIP2=y)
Memory savings: (free -m)
12MB more user RAM available upon shell load
6M more buffered RAM available
Application performance:
OpenOffice Writer load time reduced by 1.25 seconds
Miscellaneous:
Bootup time reduction by 1.57s
Shutdown time reduction by 3.1s

Mouse, bash output and other UI interactions seem a bit more responsive.

Nothing is known to be broken while using the freshly compiled kernel, yet :-)

Plus, now I know what is running in the kernel for having created .config from scratch before kernel code compile. Happier :-)