Friday, April 03, 2009

Ubuntu: Easy kernel compile for newbies

Building a fully optimised kernel just for your pc is one of most exiting things to do. But manual kernel compilation not an easy task and occasionally things go haywire all the time. Luckily Ubuntu comes with some nifty tools to make it easier than ever. Here is a short how-to for the starters. Remember, these are the basic steps. I've skipped most of the exiting parts to make it as simple as possible.
  • Download the latest Kernel from http://kernel.org/. For e.g. linux-2.6.29.tar.bz2
  • Create a folder named src in your home folder and put the downloaded file in it.
  • Untar the file
      $tar xvjf ~/src/linux-2.6.29.tar.bz2
      $cd ~/src/linux-2.6.29
    Run the Following commands to install the necessary packages to build the kernel
      $sudo apt-get install build-essential fakeroot initramfs-tools libncurses5 libncurses5-dev
  • Create a base config file, we'll reuse the current kernel's config
      $cp -vi /boot/config-`uname -r` .config
  • Run this command, a graphical window will appear. Here you can make change to the kernel configs. Right now we won't change anything. So just run it and save.
      $make menuconfig
  • Do a cleaning in the source tree
      $make-kpkg clean
  • The real stuff, build the kernel (this will take a really long time, so grab a cup of cofee). I'll call this version 'paladin'.
      $fakeroot make-kpkg --initrd --append-to-version=-paladin kernel-image kernel-headers
  • Install the packages
      $sudo dpkg -i ~/src/*.deb
  • Do a reboot and enjoy the new kernel
  • If anything goes wrong (kernel panic !!!), you might need to take a socond look at the configurations.



2 comments:

Anonymous said...

Thanks! This is real useful, keep it up!

xzcallaway said...

.deb packages are available for download at dotdeb.com

Back to Blogging

After a failed attempt last year to get back to blogging, I'm trying it again this year. I really wanted to get back, but got busy will...