Linux systems are so ridiculously flexible and configurable, it’s downright crazy. A huge part of why Linux is so flexible is because of its modular structure. Every single system component and program is split up into many different packages that can easily be removed, added, or replaced by something else. Absolutely no part of the operating system has an exception to that rule, including the Linux kernel itself.
Due to that fact, you can relatively easily take out the kernel, do some stuff to it, and then put it back in. But what exactly can you do with the kernel, and why should you consider compiling your own, customized kernel?
Patching Or Replacing Drivers & Other Parts
One of the most common reasons why people compile their own kernels at home is the fact that some drivers (and other kernel features) need to be patched up or completely replaced with either a completely different driver or an updated one. A good example of this is the need to patch some wireless drivers in order to be able to capture packets for WEP cracking . Backtrack Linux, which is mentioned in that article, comes with the drivers already patched, but any other distribution will have unpatched drivers.
Sometimes, people also backport certain drivers, especially open source graphics drivers. If you backport a driver, it means that you’re taking a driver from a newer kernel and sticking it into an older one as a patch. Even people who install proprietary graphics drivers sometimes have to recompile their kernels, although that usually happens automatically.
Remove Unneeded Code & Use Different Compilation Flags
Another very beneficial part of compiling your own kernel is that you can do your own optimization. While customization focuses on changing parts of the kernel, optimization focuses on all unneeded parts that can be removed, as well as the best combination of compilation flags that will produce a speedier kernel.
Say that your laptop doesn’t have Bluetooth capabilities, and you don’t plan on getting a USB dongle, you can remove everything that has to do with Bluetooth from the kernel. Through this logic, a lot of unneeded drivers can be removed, saving disk space and other resources. If they’re never with the final kernel, then they won’t load and take up valuable resources that could be used for something else.
Learning More About The Kernel
Last but not least, compiling your own kernel has the benefit of giving you Linux experience. Even if you don’t change anything (both customization and optimization perspectives) about the kernel, the experience you get by downloading a vanilla copy of the Linux kernel, compiling it, and running it on your system can be invaluable if it’s something you’re interested in. Obviously, this is also something that people who work on the kernel daily as a job have to do, so computer types who are in contact with Linux should take this step under consideration.
In the end, it’s completely up to you what you want to do. For most users, the kernel offered by your distribution of choice will do just fine, and people who regularly compile their own kernels do so because there are specific needs or requirements. However, if you have a need such as those that I mentioned, or are simply interested in getting into the nitty gritty of Linux, then compiling your own kernel is definitely a good idea.
Do you compile your own Linux kernel? Is it worth it, and what modifications do you do compared to vanilla/distribution kernels? Let us know in the comments!
Image Credits: Repairing of modern diesel engine, workers hands and tool via Shutterstock, Recycling truck picking up bin via Shutterstock, Educational theme: funny teen, medicine, science via Shutterstock