Custom Linux Kernels with Debian and Fedora - page 3
The Debian Way of Customizing Kernels
When you open
xconfig for the first time it's pretty overwhelming. Linux kernels are rather large now, so it takes awhile to wade through the configuration. As the whole point of this exercise is to wade through the configs and weed out the stuff you don't want and to include the stuff you do want, just settle in and take your time. After going through it once you'll have a re-usable custom
.config file which will streamline future kernel-buildings. Just copy it to the top-level directory of your source tree every time you build a new kernel.
We'll take a quick tour of necessary and common options, so you're still going to have to make some decisions on your own.
xconfig gives information on every option, plus the Documentation/ directory in your kernel source tree is cram-full of information.
Your first decision is in the "Code Maturity Level Options -> Prompt for development and/or incomplete code/drivers (EXPERIMENTAL)." If you want a plain old stable kernel without any wacky stuff, uncheck this. If you want to test new experimental features, then include this.
Say no to "Configure standard kernel features (for small systems) (EMBEDDED)." Unless of course you know this is something you want, which means you're probably a kernel developer.
Include everything under "Loadable module support."
"Processor Type and Features" is where you can make some noticeable performance tweaks. Turn off SMP if you're not running a multi-core or multi-processor machine. Select your CPU type. Select memory support for your amount of physical RAM. Turn off all the laptop stuff if you're not running a laptop.
"Block layer" is where you enable support for large disks and files, which means larger than two terabytes.
Under "Bus options" turn off PCMCIA guff on systems that are not laptops.
Under "Executable File Formats" include everything.
Under "Networking" get rid of all the network protocols you're not going to use like Appletalk, Bluetooth, radio, or IPX. On machines that are not routers or firewalls, you can also get rid of routing options and QoS, and even Netfilter/iptables if you really want to go lean. Don't go too crazy wiping out networking options unless you are very sure you do not want them, because you could break some networking feature that you need. Enable "IP: kernel level autoconfiguration (IP_PNP)" for diskless netbooting.
If you're configuring a kernel for a routerboard like a Soekris or PC Engines WRAP board you might consider removing support for SATA, SCSI, and PATA drives, since they are not supported on most of these.
The rest is reviewing hardware and filesystem support, and cryptography options, plus a few other odds and ends. I recommend supporting all cryptography, which has become an everyday necessity. I probably spend the most time hunting down and getting rid of laptop-related features on desktop systems, or features related to specific laptops such as Dell and Toshiba, and then the dozens of hardware drivers I'll never need.
As a general rule you can turn off anything related to generating debugging messages; these are interesting mainly to kernel hackers, and sometimes not even then.
- Please read the abundant documentation that comes in the kernel sources. This is priceless knowledge directly from the kernel developers.
- Debian Kernel Handbook
- Compiling a Custom Linux Kernel
This article originally appeared on Enterprise Networking Planet, a JupiterWeb site.
- 1Linux Top 3: Fedora 24, Peppermint 7 and Solus 1.2
- 2Linux Top 3: Alpine Linux 3.4, deepin 15.2 and Linux Lite 3.0
- 3Linux 4.7 Set to Boost Live Patching, Security and Power Management
- 4Linux 4.6 Charred Weasel adds USB 3.1 Support
- 5Linux Top 3: OpenIndiana 2016.04, Ubuntu 16.04 and Debian's New Leader