Building Your Own Linux Kernel, part 2
Configuring a New Linux Kernel
Part 1 of this series taught a fast way to practice building a kernel using the kernel configuration from your current Linus distro.
But the real motivation for building a kernel is to use your own configuration: add new experimental drivers, get rid of drivers you don't need, and make a lean, mean and fast kernel. Wading through the Linux kernel's multitude of configuration options takes some time, so don't be in a hurry. One way to save time is to develop your own base configuration, and then use this as basis to create new custom kernels.
Four ways to configure
From the kernel source directory, there are four ways to configure depending on what sort of user interface you want: make config (command-line), make menuconfig (terminal-based menus, Figure 1), make xconfig (Qt, Figure 2), and make gconfig (GTK, Figure 3).
I recommend menuconfig. Plain config makes you step through all the kernel options (there are thousands!) one by one, while xconfig and gconfig require lots of development headers for Qt or GTK/Glade.
In menuconfig, use the up and down arrow keys to move between options. On a category (anything with "---->"), the "buttons" at the bottom control what happens when you Enter: Select descends into the category, Exit goes back up a level, and Help displays help. The right and left arrow keys move between buttons. You can also type ? to view help.
Modules or not
Most kernel configuration options can take one of three states: built-in (*), not built ( ), or module (M). If you're not sure whether you'll buy that Wacom tablet, or you might not have it plugged in all the time, you can build the Wacom driver as a module and it will only be loaded when it's needed.
Sounds great, right? Why not just build everything as modules? That's what the distro kernels do: type lsmod | wc -l to see how many modules you have loaded. But there are disadvantages. The biggest one is speed: each loaded module adds up to half a second to your boot time.
Drivers configured as modules will show an 'M' in menuconfig (Figure 4). Typing 'y' will tell the kernel to build them in instead.
... Well, at least in theory. But once you actually start trying it, you'll find that a lot of them won't let you change 'm' to 'y'. If an option depends on another module, you have to find the dependency and unmark it first.
That's easier said than done. So instead, turn off the second option on the top-level screen, Enable loadable module support (Figure 5). You can always turn it back on later -- but turning it off temporarily will flip all those "M"s to "Y" and take care of your dependency issues.
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 2Linux Top 3: Debian Dumps SPARC, Ubuntu Takes Over Linux 3.13 and the Core Infrastructure Initiative
- 3Linux Top 3: Fedora, Ubuntu and Gluster Lose Community Leaders
- 4Red Hat Enterprise Linux 7 Finally Hits the Big Time
- 5Linux Top 3: Tails 1.0, OpenMandriva Lx 2014.0 and Debian 7.5