The title of this section may pop your eyes out! This is one of the best offers that Linux has for its users. Most newbies would wonder if this is necessary. Well, some Linux distributions have kernels specifically designed to run better on Pentium machines.
So, if you have any other processor, and you want to derive better performance out of your box - Linux kernel development is great option for you. Linux kernel development is required essentially when certain hardware support is absent, for instance, Linux kernel 2.4 did not support NTFS partitions by default, but it had the support to read it if enabled. Under such circumstances wherein your machine peripheral devices are upgraded and a support from the linux kernel update is lacking. Linux kernel debugging with the support or compiling a new kernel update becomes necessary. Compiling a new Linux kernel version imparts hardware supports available with the new distributions of Linux and you need not go about installing the entire Linux OS. Please Note that the looks of the GUI and other software will not change. It is just the Linux kernel version that undergoes the changes.
Understanding the Linux Kernel or Linux Make
Another point that we want to make here is that Linux is actually the kernel combined with certain utilities to become the Linux OS made by Linus Torvald. The basic Linux Operating System plus the numerous applications from GNU Linux and open source kernel put together, constitutes the Linux Distributions or Linux Version such as Redhat, Fedora, SUSE, Gentoo, etc. Linux Kernel Debugging or Linux Kernel Development is a huge process. We shall summarize it in point-to-point method and refrain from dragging the topic too far. You will get an idea of the subject and you will also be in a position to research more on the same. In our example, we have used Redhat as our reference distribution and here are all Linux kernel development download that we require for this complete process.
Where is kernel located in Linux
Linux Core: Most installations maintain a copy of the Linux Source Code or the kernel at /usr/src folder. A latest Linux Kernel will be available at www.kernel.org. Moreover if you are looking for older Linux Kernel download or some specific kernel version can also be found here and can easily have a Linux download.
Listed below are the essential utilities and libraries required for the compilation of the kernel. The steps for installation may vary a little depending on Linux distributions
Linux Kernel Developer - Compiler Utilities
gcc - It is a compiler program for C
dev86 - 8086 based processor assembler/linker
cpp - GNU C compiler procesor
make - program to create executables
binutils - Library of binary utilities
Linux Kernel Developer - Libraries
glibc-devel - Library files for standard header files for C
ncurses-5 - Screen handling package used mainly for CLI
ncurses-devel - for developing application that use ncurses.
Needed for menuconfig utility.
Rebuilding Kernel With Linux Version - Redhat
cd /usr/src/linux-2.*/
Stock kernel-if it exists else jump to ‗New Compilation‘
edit Makefile
Modify parameter EXTRAVERSION=-Rebuild
make mrproper
Deletes the existing .config
cp -p /usr/src/linux-2.*/configs/kernel-2.*-i686.config /usr/src /linux-2.*/.config
make oldconfig
To update .config with running kernel parameters
make config / menuconfig (for Text mode) / xconfig
make dep
make clean
make bzImage
Actual compilation process
cp /usr/src/linux-2.*/arch/i386/boot/bzImage /boot/vmlinuz
2.*-
Rebuild
cp /usr/src/linux-2.*/System.map /boot/System.map-2.*Rebuild
cp /usr/src/linux-2.*/.config /boot/.config-2.*-Rebuild
Edit boot loader (either lilo.conf or grub.conf) to add entry for the rebuild kernel
/sbin/lilo -v -t
/sbin/lilo -v
sync
make modules
make modules_install
Installs modules in /lib/modules/2.*-Rebuild/
reboot
uname -r
Check. Should give 2.* -Rebuild i.e. your re-built kernel
New Compilation
Assuming that you have downloaded the new kernel follow the steps to compile it on your system. Before you proceed; just in case you have installed Linux drivers for graphic card ATI or NVIDIA. You will have to perform and additional step of editing the
/etc/X11/xorg.conf.
Use any editor such as gedit or kate to open the file (from terminal switch to root if you are not and open file using #gedit /etc/X11/xorg.conf). Look for the line (Driver ―ati‖):
Section “Device”
Identifier “ATI Technologies, Inc. Radeon 330M/340M/350M (RS200 IGP)”
Driver “ati”
BusID “PCI:1:5:0”
Note: For NVIDIA the line may be Driver “nvidia”
Substitute the name of the driver with “vesa”
Save the file and exit editor.
Steps to new kernel compilation
Untar the downloaded kernel to /usr/src directory :
# tar -zxvf linux-2.*.tar.gz
# tar -Ixvf linux-2.*.bz2
# cd linux-2.*
# make mrproper
#make config / menuconfig / xconfig (in xterm)
#make dep
{checking for dependencies}
#make bzImage
{The actual compilation of the kernel begins here. Creates a compressed image of the kernel}
#make modules&&
{building modules}
#make modules_install
{installing the modules created in the previous step}
Check in /usr/src/linux-2.*/arch/i686/boot for a file : bzImage This will be the gzip-compressed binary file of the new kernel.
#cp bzImage /boot/vmlinuz-2.*
Make necessary changes to the boot loader. For LILO it is as shown below:
image=/boot/vmlinuz-2.*
label=kernel-2.*-NEW
root=/dev/hda5
read-only
Save the above file. And issue #lilo -v -t
title Linux-New-kernel
root (hd0,4)
kernel /vmlinuz-2.* ro root=LABEL=/ rhgb quiet
hdc=ide-scsi
EmoticonEmoticon