Pick a Free OS

User login

Navigation

Compiling the Linux kernel

The Linux kernel is the heart of the operating system. This is the software that takes care of the programs that are currently running on your system as well as handling the interactions of those processes with your hardware. The kernel will decide how much CPU time and usage is allowed to the various programs.

Why would you need to compile a kernel? Well, the Linux kernel is what interfaces with your hardware and newer hardware is always out in the market. A newer kernel will probably support that hardware. Hardware might not be the only reason you will want to upgrade to a newer kernel. The kernel is not flawless code. There are always going to be bugs found and fixed. The kernel will need to be patched and re-compiled with these fixes in place.

Getting the source

The kernel source code will be included in the distribution that you use. Red Hat has the kernel source RPM's named kernel-source-2.2.14-5.rpm, whereas SuSE names the kernel source as lx_suse-2.2.14.SuSE-12.i386.rpm. The source should already have been installed under /usr/src/linux-2.2.x if you chose the standard installation. If not then you should install it off your distribution CD.

If you would like to get the latest bleeding edge kernel then you will probably have to look elsewhere. Most Linux distributions do not carry the latest kernel in their distributions. Kernel.org is a good place to download the latest kernel from. Kernel.org carries older kernels too. All the even numbered kernel versions are stable production releases whereas the odd numbered releases will be the development releases. The development releases are not renowned for their stability as new features are added/removed, bugs are fixed. They're basically for hardcore programmer to test, debug, work on. At the end of all the testing, programming and debugging lies the stable kernel release. So 2.2 is a stable kernel release whereas 2.3 will be the development kernel release. This doesn't mean that kernel 1.x was a development kernel and 2.x is the stable release. Only the minor version number is taken into account. The minor number will be the second number.

Once you read the download area on kernel.org, you will have a choice of several files to download. The files with the extension .tar.gz use the old gzip compression whereas the files with the extension .tar.bz2 use the more efficient bzip2 compression. The bz2 files are always significantly smaller than the .gz so you will always want to go in for these archives. The 2.2 kernels will be 10 MB or thereabouts compressed and should takes something like 70 MB uncompressed. Make sure you have enough room.