Linux is the kernel running behind hundreds of different desktop OS’s or better say – distributions, moreover, it also powers the Android mobile operating system as well. Simply put, the kernel is the layer which separates between the hardware and the user softwares such as: your web-browser for example, thus everything you do on the top level which is called ‘the user space’ has to go through the kernel in order to reach the hardware and vice versa.
The reasons for why operating systems are built this way are many but that’s beyond the scope of this article, suffice to say that this method increases the protection of data and functionality from faults and malicious behaviour.
What’s inside the kernel
So what’s inside the Linux kernel you probably ask yourself and how can it be configured by a non developer user? well, it’s a pretty straightforward answer – inside the kernel is the code to support different types of hardware functionalities which then can be used by the user-space programs, for example you can have your kernel configured with support for certain types of file systems like NTFS, EXT4, etc… other examples would be setting-up support for your graphics card or your network adaptor and so on.
How to configure the kernel
There are a few alternatives for configuring your kernel and compiling it specifically for your needs, we’re going to concentrate on one basic and a rather simple one – make menuconfig, below are two images of how it looks, somewhat reminding for the less younger of the infamous Norton Commander file manager.
The first image shows you the primary categories of each kernel functionality and as you go further inside your required category you’ll find more specific configurations in-order to optimize it as close as possible to your needs. The second image show you how after navigating to Device Drivers > Network device support > Ethernet driver support, you can choose which Ethernet driver you wish to load on booting the kernel and which you don’t, hence removing the unnecessary out of your way. This may help gain some performance increase.
To go inside these options you’ll need to issue the following commands inside Terminal / Console: # cd /usr/src/linux and make menuconfig.
So now after one has gone through the options and enabled the ones he need, it’s time to save, quit and compile the kernel together with its modules in order for the new configuration to take place, to do so you may issue the command: # make && make modules_install normally as su (super-user), when it’s done you also need to copy the compiled kernel into the /boot directory for it to be loaded on boot, an example for doing so taken from the Gentoo handbook is by issuing the command: # cp arch/x86_64/boot/bzImage /boot/kernel-3.4.9-gentoo.
Basically that’s about it. Of course, in case you have some specific modules you need to load (nvidia-driver for instance) in the boot process it would be wise to rebuild them too so that they would work with the new kernel configuration.
A fun fact
Researches had been done to estimate the cost of redeveloping the Linux kernel in a traditional proprietary development setting, these studies have found it would cost approximately 3 billion USD to redevelop the Linux kernel (good lord that’s a lot of money).