Sign in with Facebook
FeedGoogleFacebookTwitterLinkedinTechnorati
Home Tech How To Unix & Linux How to Compile a Linux Kernel to a Newer Version
How to Compile a Linux Kernel to a Newer Version
How to - Linux
Article Index
How to Compile a Linux Kernel to a Newer Version
A Shorter Way to Compile a Linux Kernel
All Pages
Posted by Denny John in Linux on March 21, 2010  |  0 Comments

This article describes how to compile a Linux kernel to a newer version. There are a couple of reasons you might want to upgrade the kernel. One is to take advantage of a specific new feature or driver. Another would be to protect your Linux PC against security vulnerability or just to maintain an up-to-date and healthy system.

argaiv1084

Drivers: If you have newer hardware or devices, chances are pretty good that there is updated support for them in the newer kernels.

Performance: A lot of times there is some general code clean up and algorithm fixes that will increase the performance of various parts of the kernel.

Features: Linux lags behind Windows for support of the newer hardware features. All of the PC hardware is created around the Windows API and therefore the Linux maintainers have to write a lot of the features from scratch. Currently, the APCI features are being heavily worked on and improved.

Bug Fixes: As long as Linux is being updated there is always going to be bug fixes.

The following table gives the step by step procedure to upgrade the Linux 2.4 Kernel. For 2.6 we need to have an initrd image also, which is shown in the next session.

Step 1:

Download the source tar ball  example <linux-2.4.34.6.tar.gz> from the link given below:

link: http://kernel.org/pub/linux/kernel/<v2.4>/

Step 2:

Copy the source tar ball to  /usr/src/linux-2.4.34.6.tar.gz.

Step 3: 

Extract the tar ball using the following command:

$ tar –zxvf  <linux-2.4.35.4.tar.gz >

This command creates the source directory linux-2.4.34.6  in the directory /usr/src.

Step 4:

After this it is better to clean the build tree for any left over files in the directory. There are two ways of cleaning it. You can do a mrpoper, it cleans all previous config files, dependency info and object files or you can do a make clean, which is what I am doing here.

$ make clean

Step 5:

Move the config file from /boot to /usr/src/ linux-2.4.34.6. (This is so that you do not have to select and verify all options, you do not have to do this step and step 6, if you are willing to sit and select/unselect all the options provided in the kernel configuration).

Step 6:

Move copied config file to .config.

Step 7:

Create a configuration to use for the kernel compile using the following command(execute the command from /usr/src/ linux-2.4.34.6 directory).

$ make menuconfig

One limitation for using menu option is that, you need to have ncurses library installed. If your kernel does not support GUI or you do not have ncurses, then you can do the following:

$ make config

Step 8:

After configuring the kernel for your hardware save your configuration and then run  the following command:

$ make dep

This will check that all the dependencies and include files are in place for compilation to take place.

Step 9:

Compile the kernel. make bzImage starts the kernel compile. This will create a compressed kernel image.

$ make bzImage

Step 10:

"make modules" will start compiling the various modules that you asked to build. 

$ make modules

Step 11:

Install the modules. make modules_install will take the newly compiled modules and place them in   /lib/modules/. You definitely need to be root user at this point.

$ make modules_install

Step 12:

The newly compiled kernel will be in usr/src/ linux-2.4.34.6/arch/i386/boot as bzImage. 

Copy the new kernel  to /boot and rename it:

$ cp  bzImage  /boot/vmlinuz-2.4.34.6

Step 13:

Copy the file /usr/src/linux-2.4.34.6/ System.map to boot directory.

$ cp  System.map /boot/System.map-2.4.34.6

Step 14:

Create a soft link for vmlinuz to the vmlinuz-2.4.34.6

$ ln –s   vmlinuz-2.4.34.6   vmlinuz

Step 15:

Make a new “grub”entry for the new kernel in /boot/grub/grub.conf

For example the entry will be as follows:

title Red Hat Linux (linux-2.4.34.6)
root (hd0,0)
kernel /vmlinuz-2.4.34.6  ro root=/dev/hda3

Step 16:

Reboot the machine and at the grub prompt enter Red Hat Linux (linux-2.4.34.6) to boot the new kernel.

If the system boots properly then half of the work is done. Now check out the various devices and see if you haven't missed out some important device driver.




rssfeed If you found this article helpful, please consider subscribing to Technodope Newsletter.

Enter your email address:

Delivered by FeedBurner

Email Drucken Favoriten Twitter Facebook Myspace Stumbleupon Digg MR. Wong Technorati aol blogger google reddit YahooWebSzenario
 

Subscribe to Technodope Newsletter

Enter your email address:

Delivered by FeedBurner

Post a Job Here for only $10 !!!

 

Sponsored Links

Chronological Archive

Powered by mod LCA