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

Danny Stieben 12-05-2012

compile your own linux kernelLinux 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 your own linux kernel

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 How to Crack Your Own WEP Network to Find Out Just How Insecure It Really Is We’re constantly telling you that using WEP to 'secure' your wireless network is really a fools game, yet people still do it. Today I’d like to show you exactly how insecure WEP really is, by... Read More . 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 How to Install Proprietary Graphics Drivers in Ubuntu, Fedora, and Mint Most of the time, you'll be fine with open-source software on Linux. But if you want real gaming and graphical power, you'll need proprietary drivers. Here's how to get them. Read More sometimes have to recompile their kernels, although that usually happens automatically.

Remove Unneeded Code & Use Different Compilation Flags

building your own linux kernel


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 your own linux 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

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Adam Campbell
    November 4, 2012 at 7:32 pm

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

  2. zeeshan khan
    May 13, 2012 at 3:49 am

    How's Linux better than Mac?

    • Jorge Vilela
      May 13, 2012 at 2:40 pm

      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

    • gpvprasad
      May 14, 2012 at 8:23 am

      Mac is Linux kernel built for Mac computers.

      • Danny Stieben
        May 14, 2012 at 5:01 pm

        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.

        • gattolino
          June 13, 2012 at 4:52 pm

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

  3. Marc
    May 12, 2012 at 11:17 pm

    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.

    • Danny Stieben
      May 14, 2012 at 3:35 pm

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

  4. Bruce Epper
    May 12, 2012 at 9:45 pm

    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.