What benefit could I see by compiling a Linux kernel myself? Is there some efficiency you could create by customizing it to your hardware?
|
In my mind, the only benefit you really get from compiling your own linux kernel is: You learn how to compile your own linux kernel. It's not something you need to do for more speed / memory / xxx whatever. It is a valuable thing to do if that's the stage you feel you are at in your development. If you want to have a deeper understanding of what this whole "open source" thing is about, about how and what the different parts of the kernel are, then you should give it a go. If you are just looking to speed up your boot time by 3 seconds, then... what's the point... go buy an ssd. If you are curious, if you want to learn, then compiling your own kernel is a great idea and you will likely get a lot out of it. |
|||||||||||||
|
|
Compiling the kernel yourself allows you to only include the parts relevant to your computer, which makes it smaller and potentially faster, especially at boot time. Generic kernels need to include support for as much hardware as possible; at boot time they detect which hardware is attached to your computer and loads the appropriate modules, but it takes time to do all that and they need to load dynamic modules, rather than having the code baked directly into the kernel. There's no reason to have your kernel support 400 different CPUs when there's only one in your computer, or to support bluetooth mice if you don't have one, it's all wasted space you can free up |
|||||||||||||||||||
|
|
Bragging rights :) |
|||||
|
|
I second gabe.'s answer (my comment is too long so I'm posting as an answer). Unless you have a highly specialized purpose (e.g. embedded machines, strict security profiling), I see no practical benefit to compiling your own kernel other than to see how it's done. By methodically reviewing the options, seeing how they interact with each other to build the system is a great way to understand how your system works. It's amazing what you find out when you try to remove components that don't appear to have any purpose for the tasks you're trying to accomplish. Be warned however--why jumping down the rabbit hole is undoubtedly exhilarating, it will suck back more nights and weekends than you thought possible! |
|||
|
|
|
Most users do not need to compile their own kernel, their distribution has done this work for them. Usually distributions will include a set of patches to either integrate with certain parts of the way the distribution works, backports of device drivers and fixes from newer, but unreleased versions of the kernel or features that they are pioneering with their users. When you compile your own kernel, you have a couple of options, you can compile an official Linus Torvalds kernel, this will not include any of the patches or customizations that were added by your distribution (which can be good or bad) or you can use your distribution rebuild tool to build your own kernel. The reasons you might want to rebuild your kernel include:
Many developers use it to create also custom versions of the kernel for embedded systems or settop boxes where they need special device drivers, or they want to remove functionality that they do not need. |
|||||||||||||
|
|
Compiling your own kernel allows you to participate in the kernel development process, whether that is simple stuff such as supplying PCI/USB device IDs for an existing driver that may make a newer device work for you, to getting deeply involved in the fray of core kernel development. It also allows you to test development kernels on your hardware and provide feedback if you notice any regressions. This can be particularly helpful to you and others if you have an uncommon piece of hardware. If you wait for a distro kernel, it can take some time for fixes from your problem reports to filter into a new distro kernel release. I also personally like to compile my own kernels to include support for only the hardware that I have. When you run distro kernels and look at the output of |
|||
|
|
|
For most uses generic kernels are good for virtually any hardware. Additionally they usually contain(ed) distribution-specific patches so compiling your own kernel may (might) cause problems. The reson to compile your own kernel are:
If I wasn't using source-based distro I wouldn't compile kernel at all. |
|||
|
|
|
At work, we use hand-rolled kernels in order to apply out-of-tree patches such as vserver and unionfs. At home, I am compiling hand-rolled kernels in order to find which commit introduced a bug I am experiencing. Once I've finished that, I will probably stick to a hand-rolled kernel until the bug is fixed in my distribution (Debian), at which point I would revert to their kernels again. |
|||
|
|
|
If you want to install Linux on very specific hardware, say more exotic than a DS, you will have to cross-compile your own kernel. |
|||
|
|
|
I can't believe the accepted answer here starts out saying "It's not something you need to do for more speed / memory / xxx whatever." This is totally false. I routinely custom build my Kernels to both remove unneeded code as well as including performance enhancing code mostly related to hardware. For example, I run some older hardware and can eek out some performance gains by enabling rarely enabled Kernel drivers such as HPT36x chipset support on some older MoBos that have this built-in. Another example, BIG SMP under Slackware is the default and on a Dell 2800, for example, will consume a sizeable foot print to run things like GFSD (not as a kernel module) that, also by the way, consumes CPU ticks for something I don't need. Likewise for NFSD and other catch-all to please all mentalities which is fine if you're just trying to get a Linux on a box and running but if you do care about "speed / memory / xxx whatever" then these things matter and work. All my production boxes are custom Kernels. If I'm on common hardware such as a Dell series (2800, 2850, 2900, etc...) hardware, it's simple matter of copying the kernel's .config file around to each box and compiling the kernel and installing. |
|||||||
|
|
Here are some situations where compiling your own kernel will benefit you:
|
|||
|
|
Another case besides the many mentioned here for having custom compiled kernels is setting up specialized network boot environments where module loading is not feasible and you have to pass out fully working kernels to specific machines for specific tasks. |
|||
|
|
