Compiling the Kernel in Linux

Discussion in 'General Linux' started by ZZs, Feb 6, 2014.

  1. ZZs

    ZZs Active Member

    Messages:
    133
    Likes Received:
    49
    Trophy Points:
    28
    Ok new question here for me. What is the purpose of compiling your own kernel for Linux?
    I read @ryanvade always complies his own kernel. The distribution supplies the kernel so why would you compile one? Is compiling the kernel common knowledge to becoming a proficient Linux power user?

  2. Cyber-Berserker

    Cyber-Berserker Active Member

    Messages:
    232
    Likes Received:
    137
    Trophy Points:
    43
    I have never done it, because I have never had the need, but one reason I know of is to add support for hardware not supported in the version of the kernel used by a distribution. For example, some Debian users roll their own kernels so they can use hardware too new for the release's kernel. I am sure there are other reasons, but not having a need to it, I have not bothered to learn much about it.
  3. Yesyesloud

    Yesyesloud Active Member

    Messages:
    256
    Likes Received:
    126
    Trophy Points:
    43
    Are you asking about compiling your personal kernel with your own modifications or just the latest kernel release? Different matters. I'll assume you're inquiring about the last thing, which's more recurrent...

    I used to compile the latest kernel release when I used an Ubuntu minimal distro "built" on my own quite some time ago. Apart from other tiny annoyances, I had to fine tune/tweak the package manager configuration file manually after upgrades, in case the kernel name changed (Ubuntu...). I also had to reload the video drivers (proprietary) - mandatory. Not difficult at all, yet another little pain, I may tell you. I guess it will normally happen with all proprietary drivers if you don't script automations for their compilation after kernel upgrades (Catalyst-hook, on Arch, is a service that automatizes that process for proprietary AMD video drivers, for instance). On other words: after kernel compilations, if you didn't somehow embed the drivers you wanted in it, tell them bye bye until next meeting. These boring details forced me to avoid non-rolling operating systems (which can definitely be more stable though).

    If you are using a good rolling distro like Arch, just wait for the kernel upgrades, they will reach you sooner than you think; so that you won't have to tweak or even reinstall the "whole" OS for a properly updated system. That's one of the main beauties of Arch or any proper rolling release distribution.

    Unless you really need a specific hardware feature/enhancement that only a younger (or just different) kernel can provide you with, there's no need to upgrade your system beforehand, just pick a rolling distro and wait for the official downloads.

    Even on rolling... If you feel your OS is taking great advantage of your hardware and no device in your system was left behind, there's likely no need to upgrade the kernel at the moment. It will prevent "ruining" your system/making you roll back to the latest working kernel. Development (sometimes even stable) kernels can cause major issues, like ruining your wireless or SSD performance. Happened with me.

    I believe the power user thing is very subjective. If you do all you want with your OS, considering its inherent limits, then I guess that's all to it :)
    Last edited: Feb 6, 2014
  4. DevynCJohnson

    DevynCJohnson Well-Known Member Staff Member Staff Writer

    Messages:
    1,205
    Likes Received:
    1,017
    Trophy Points:
    113
    Sometimes, users configure and compile their own kernel to make a high-speed kernel specifically for their system. The kernels that come with Linux distros are very general, but users can make a stripped-down, fast kernel for their system.
    Haider92 and ryanvade like this.
  5. Yesyesloud

    Yesyesloud Active Member

    Messages:
    256
    Likes Received:
    126
    Trophy Points:
    43
    That's a truer view on compiling your own kernel :D (compared with that, compiling a merely downloaded kernel not meant for a given distribution sounds really easy). @DevynCJohnson (and whoever else has the experience), I have got a question that may be pertinent in this thread, but if it's too hijacking I can open my own annoying topic :D. If I strip off all things unrelated to my hardware from the Kernel, will it really improve performance considerably? Just asking...
    DevynCJohnson likes this.
  6. ryanvade

    ryanvade Administrator Staff Member Staff Writer

    Messages:
    1,201
    Likes Received:
    405
    Trophy Points:
    83
    It most likely would.
  7. Yesyesloud

    Yesyesloud Active Member

    Messages:
    256
    Likes Received:
    126
    Trophy Points:
    43
    God, Arch is really fast already and it can fly higher... Ok, compiling one's very own kernel is a great goal, probably a power user must.
  8. ZZs

    ZZs Active Member

    Messages:
    133
    Likes Received:
    49
    Trophy Points:
    28
    First of all, Thanks for all the replies guys!
    I started wondering about building the kernel after seeing Devyn posting articles on it. I thought to myself I won't be doing any of that so I never read the article. Then I started coming across it more from reading about users rolling back their kernel to fix their issue to building your own firewall with iptables in an article on this site . Again I kind of blew it off, but I keep seeing "compiling the kernel" coming up in many situations. I was just curious how important it is to know.
    DevynCJohnson likes this.
  9. DevynCJohnson

    DevynCJohnson Well-Known Member Staff Member Staff Writer

    Messages:
    1,205
    Likes Received:
    1,017
    Trophy Points:
    113
    Like Ryan said, it will enhance performance. Also, removing modules/code for debugging also helps speed as well as reduce memory usage.
    Haider92 likes this.

Share This Page