| How to Compile a Linux Kernel to a Newer Version |
| How to - Linux | ||||
Page 1 of 2
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. buy cialis 10mgcialis professional online buy viagra 20mg cialis generic vs brand
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: 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. 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). 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: Step 8: After configuring the kernel for your hardware save your configuration and then run the following command: 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. Step 10: "make modules" will start compiling the various modules that you asked to build. 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. 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: Step 13: Copy the file /usr/src/linux-2.4.34.6/ System.map to boot directory. Step 14: Create a soft link for vmlinuz to the vmlinuz-2.4.34.6 Step 15: Make a new “grub”entry for the new kernel in /boot/grub/grub.conf For example the entry will be as follows: 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. |