Shekhar Govindarajan
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.
To read the full article click here.