Linux geeks like to show off their geekiness by talking of recompiling the kernel.
In most cases, when you use Linux on standard/popular hardware devices, there is no need to go through this step. But still, if you want to give a superior smile the next time the neighborhood geek starts off, here is what it means.
What is the kernel? It’s the core OS. The Linux kernel contains large chucks of C and assembly code for providing the functions of an OS. Compilation is the conversion of a program written in a programming language (like C, C++, Java, C#) to a binary form that can be understood by a computer.
Thus, recompiling the kernel means recompiling the original programming code for the kernel. Now, why would you do that? To understand the need for kernel compilation, let’s take a simple program as below.
void main( )
{
printf(“Hello World”);
/* printf(“How are you”); */
}
|
This program simply prints Hello World on the screen. It will not print ‘How are you’ because this line is commented out (enclosed within /* and */). Similarly, the Linux kernel has support for many dozens of hardware, protocols etc. But by default only selected ones (the standard/popular ones) are activated. Support for others are disabled (commented out).
Now if you want your program to display ‘How are you’ also, then you need to uncomment the second line by removing the /* and */ from the source code and compile the program once again. Similarly, you can enable disabled facilities in the Linux kernel, and to do that you have to recompile the kernel and activate it to enable the changes.
But what if you want to do something totally new, like printing ‘Having fun’? Then you have to write a new program for it and compile it. Similary, for an altogether new functionality, say USB 3 or the latest webcam, you need to download and compile the latest kernel program (called kernel sources), which have support
for it.
But do you always have to go through the hassles of compiling a new kernel every time you want to add a new device? Not so. The latest Linux kernels are modularized. That is, you can extend their functionality (like supported new devices) by adding small chunks of programs called modules. This is very similar to device drivers in the Windows.
Again, a module may need to be compiled if it has not already been done by someone else, like the vendor of the product. Subsequently, a module when loaded into memory (similar to
Windows device driver installation) extends the kernel’s functionality.
Shekhar Govindarajan