LinuxHelps.com

A blog for Linux Lovers.

Archive for the ‘Kernel’ Category

Posted by sibu on March 8, 2009

About Kernel Versions

Command to show the running kernel version:

[root@wordsworth modules]# uname -r
2.6.9-42.0.3.ELsmp

Kernel Version Numbers:

The Linux kernel version numbers consist of three numbers separated by decimals, such as 2.2.14. The first number is the major version number. The second number is the minor revision number. The third number is the patch level version.

At any given time there is a group of kernels that are considered “stable releases” and another group that is considered “development.” If the second number of a kernel is even, then that kernel is a stable release. For example, the 2.2.14 kernel is a stable release because the second number is even. If the second number is odd, then that kernel is a development release. For example, the 2.3.51 is a development release because the second nubmer is odd.

Once the 2.3.x branch is considered finished, then it will become the 2.4.0 kernel. Patches will then appear for the 2.4.x branch and development work will begin on the 2.5.x branch. If the 2.3.x advancements are significant enough to be considered a major revision, the 2.3.x branch will become 3.0.0 and development work will begin on the 3.1.x branch.

Posted by sibu on March 8, 2009

Kernel Compilation

Kernel Compilation

cd /usr/src/linux

Install your kernel source from RPM
$ rpm -i filename.rpm

or download the kernel source from http://kernel.org

Go to your /usr/src/linux directory
$ cd /usr/src/linux

Applying the Patch

For the purpose of this guide, we will use linux-2.2.x for the kernel name. You should replace the x with the version number of the patch you are installing.

1. Move the downloaded kernel patch to the /usr/src/linux directory.

2. cd /usr/src/linux

3. If you downloaded a patch with a .gz extension, execute the following command:
gunzip patch-2.2.x.gz

If you downloaded a patch with a .bz2 extension, execute the following command:
bunzip2 patch-2.2.x.bz2

4. There should now be a file called patch-2.2.14 in the /usr/src/linux directory. Apply the patch to the kernel source tree with the following command:
patch -p1 < patch-2.2.x or
zcat patch-2.2.x.gz | patch -p1

Run configuration program

There are 3 to choose from:

config -> text only
xconfig -> graphical (must be running X)
menuconfig -> text baised, menu driven

Output will be saved as .config

The following commands will compile and install the new kernel.

make dep - This step identifies kernel dependencies so that they will be resolved at compile time.

make clean - This step removes any old object files from previous builds. Even if you haven’t compiled a kernel before, this step only takes a second and doesn’t do any damage.

make bzimage - This step actually compiles the kernel. This results in the kernel being named bzImage and will be located in the /usr/src/linux directory. This step will take some time to complete..

make modules - This step compiles all the modules that the kernel may need to use in the future, such as the network and sound card drivers. This step will take some time to finish.

make modules_install - This step moves the module object files into the correct directory.

make install - This step will move the new kernel and its associated files into the correct directories on your system.