Several of my coworkers have been building custom kernels for their workstations and servers.

What advantages/disadvantages are there to building a custom kernel?

Why should I build a custom kernel?

closed as primarily opinion-based by jasonwryan, Anthon, slm, Gilles, Mat Sep 13 '13 at 8:12

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    One reason is to disable builtin's and modules that you don't need to speed up boot time and space (not as much an issue) – jmathew Sep 12 '13 at 18:01
  • 2
    To learn more about the kernel, it's features, and how it's configured. – jordanm Sep 12 '13 at 18:44
  • 1
    There doesn't have to be a technical reason. You could build your own kernel because it's trendy ("all my coworkers are doing it!") or gains you geek cred. – drewbenn Sep 12 '13 at 20:25
  • I would just like to mention Gentoo, which is a distribution that's all about compiling your own packages. – jcora Sep 12 '13 at 20:47
  • Similar: unix.stackexchange.com/questions/905/… – darnir Sep 12 '13 at 20:54

There are multiple reasons why one may choose to manually compile a kernel. I'll try and list the ones that I can think of, off the top of my head here:

  1. An oft-cited, but often wrong reason is that it will work faster. By customizing the compiler flags for the specific system, you could theoretically create better byte-code. But with modern compilers, this is not often the case.
  2. Change certain compile time flags. E.g.: To compile the kernel with debugging information included. Although this may not apply in your case.
  3. To remove unnecessary parts from the kernel. But as stated by @jordanm, these parts are almost always modules and may not matter. But in some cases, the difference may be significant.
  4. For academic purposes. Compiling your own kernel helps you learn a lot about the build process. Also, one gets to learn about the various configuration options.
  5. To replace certain modules. For example, to use the con kolivas patchset, real time patchset, etc.
  6. In certain situations, especially in embedded scenarios, one may add custom system calls to the kernel. These would require a custom compilation too.
  7. Some people like me, just love to tinker with the system. And will randomly change some configuration options to see how the final system responds to them. However such people are few and rare.

By creating custom kernel, you can remove some of the unnecessary parts of kernel to reduce overhead(embeded devices) or security holes(servers).

  • Most of the "unnecessary" parts are modules in distro pre-built kernels, so this doesn't matter much. – jordanm Sep 12 '13 at 18:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.