Building a new boot kernel from kernel source…

We can download the required Linux kernel source code from

I am downloading the linux- source file.

Now I become the root user by su . Since the downloaded file is in compressed format, we need to extract the contents. Now since it is a source code we need to move the contents to /usr/src directory.

Now I just moved into that directory by cd /usr/src .

Since the source will be searched using the keyword as “linux”, we can create a link to this directory with the name “linux”.

ln -s linux- linux

Now we can just get into this directory by just,

cd linux

Now I need a configuration file. The configuration file can be seen under /boot as config-2.6.26-2-686

So we can copy that file from /boot to file named config ( NOTE : we must currently be under the “linux” directory )

Since I’ve got the config file for the new kernel, I can now make changes on what modules need to be built-in and what modules shoud be integrated manually by using “modprobe”. To make these modifications, type make menuconfig

Ah..Oh.. I forgot to install the ncurses which brings up the Graphical User Interface used for this purpose.. So let’s first install the ncurses…

apt-get install libncurses5-dev ( if not sure about the package name, just check it using apt-cache search ncurses )

Now let me install the required building libraries to avoid any further issues…

apt-get install build-essentials

Now again try the make menuconfig

Cool… The GUI has appeared…

The changes to be made at this point can be learnt from the documentation provided by Debian.

First we need to check the processor type and its features, Since I’m using an Intel x86 architectured system I need to make the Generic x86 support as built-in by marking as * against it.

Now I need to check the File Systems, so I make both Second extended fs support and Ext3 journaling file system support as built-in by marking * against both of them.

Now since I have made these as built-in, these modules will be effective right from the boot-up… I need not use modprobe for these modules to take effect.

To make these changes to take effect we use the command make

This command reads the .config file from /boot. The .config file is created as a result of menuconfig

make modules_install ( to install the other modules required… ) /lib/modules/

make install ( this will copy the config- , System-map-, vmlinuz- to /boot)

cd /boot

mkinitramfs -o initrd.img- (this will create the initrd.img- file in /boot)

edit the /boot/grub/menu.lst file to add the newly created initrd image…

title Debian GNU/Linux, kernel

root (hd0,1)

kernel /vmlinuz- root=/dev/sda1 ro

initrd /initrd.img-

reboot the system and try to boot into the new kernel…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s