3 Reasons Why You Might Want to Compile Your Own Kernel [Linux]

tux big   3 Reasons Why You Might Want to Compile Your Own Kernel [Linux]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

compile linux kernel customization   3 Reasons Why You Might Want to Compile Your Own Kernel [Linux]

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

compile linux kernel optimization   3 Reasons Why You Might Want to Compile Your Own Kernel [Linux]

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

compile linux kernel experience   3 Reasons Why You Might Want to Compile Your Own Kernel [Linux]

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.

Conclusion

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

The comments were closed because the article is more than 180 days old.

If you have any questions related to what's mentioned in the article or need help with any computer issue, ask it on MakeUseOf Answers—We and our community will be more than happy to help.

9 Comments -

0 votes

Bruce Epper

I run Linux on a couple of really old laptops, so I regularly recompile the kernels for those machines for performance reasons. Dumping all of the unnecessary parts & optimizing for the hardware it is on has distinct benefits on old machines.

0 votes

Marc

I’ve compiled my own kernels in the past to get what I need, but I haven’t had to do that for years. Gnome or KDE make any kernel savings irrelevant really for my older machines and other than that what noticeable difference would you get with any newer computer. So for me it would boil down to server optimization: time & effort to tune versus time to serve requests to clients using (z) servers. I think you’ve got to be Google or alike to see real benefits. I suspect that you may be able to save significant resources with respect to IaaS environments.

0 votes

Danny Stieben

I suppose so. I do know that I’m still pretty happy with the default distribution kernel that I run.

0 votes

zeeshan khan

How’s Linux better than Mac?

0 votes

Jorge Vilela

It`s free, highly customizable and it`s going to be the strongest player in some time… The most of new games can run on androids, so… is very easy migrate them to Linux.

Linux don`t need an extensive hardware…

Well, I`m a Mac user (writing from a MacBook), using OS X… But I believe soon Linux and Android (I`m also an iPhone user) will get so good as Apple products OS X and iOS. I hope

0 votes

gpvprasad

Mac is Linux kernel built for Mac computers.

0 votes

Danny Stieben

That’s actually not true. Mac OS X does not have any part of the Linux kernel. While Mac OS X is UNIX and Linux is Unix-like, Mac OS X is still completely separate from Linux.

0 votes

gattolino

mac os x is bsd… not linux… and bsd kernel is compilable too :) darwin is the open part of macosx

0 votes

Adam Campbell

good read, only thing is, most people don’t have the time/interest