Tuesday, February 7, 2012

Make kernel name same as your name

We have to compile linux kernel in order to change kernel name same as your name.

There are three stages involved in compiling linux kernel.

(1). Configuration of kernel.
(2). Building the kernel.
(3). Installing the kernel.


Open terminal using Applications ---> Accessories ---> terminal (or) Press Ctrl + Alt + t.

Step 1 : Install the packages kernel-wedge, kernel-package and libncurses5-dev.

             sudo apt-get install kernel-wedge kernel-package libncurses5-dev

Step 2 : To build dependencies for the installed packages run the following command.

             sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)

Step 3 : Make your source directory.

             mkdir ~/src

Step 4 : Change your directory to source directory.

             cd ~/src

Step 5 : Then,download the kernel source using apt-get source command.

            sudo apt-get source linux-image-$(uname -r)

Step 6 : Now do the configuration of kernel.
             Usually the current kernel configuration is saved in a file under /boot.

             cd linux-2.6.38

             make menuconfig

             The menuconfig will bring up an 'ncurses' menu where you can customize the kernel.

Step 7: Increase the building speed.
              Before building the kernel,the concurrency_level is set in order to speed up the build.

              export CONCURRENCY_LEVEL=3

              Note : The concurrency_level can be calculated using the formula:

              Concurrency_level  = 2 ( Number of processor cores)  +  1

Step 8 : Clean the temporary files.

             make-kpkg clean
              The make clean command above will clear all temporary files.

Step 9 : Building the kernel using the following command.

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

Here, initrd is used for initializing ram disk which gets appended to the kernel version.tweak is the name of the kernel which has been modified from the existing kernel name.

Step 10 : Installing the kernel using the following command.

              cd ~/src

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

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

Step 11 : Reboot the system.

             sudo reboot (or) sudo init 6

Step 12 : Open terminal and type

             uname -r

And hit Enter.


Its simple !

2 comments:

  1. We don't need --append-to-version in fakeroot as it can be modified in menuconfig

    ReplyDelete
  2. I have compiled the kernel. Now can i change the kernel name? or i have to recompile the kernel after changing name?

    ReplyDelete