6

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?

tbenz9
  • 292
  • 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
  • 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: http://unix.stackexchange.com/questions/905/what-is-the-benefit-of-compiling-your-own-linux-kernel – darnir Sep 12 '13 at 20:54

2 Answers2

6

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.
darnir
  • 4,489
3

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

Soosh
  • 133
  • 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