Home | Hardware | Internet News |Web Hosting |IT Management |Network Storage
LinuxPlanet
Search 
  Power Search | Tips 

 Front Door
 Discussion
 LinuxEngine
 Opinions
 Reports
 Reviews
 Tutorials
 News
 Technology Jobs

 Browse by subject.
Free Newsletter

Server Daily
More Free Newsletters

Be a Commerce Partner


















internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Print this article
Email this article

   LinuxPlanet / Tutorials







Building Your Own Linux Kernel, part 2
Configuring a New Linux Kernel

Akkana Peck
Thursday, October 8, 2009 11:12:49 AM

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).

figure 1
figure 1

figure 2
figure 2

figure 3
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.

figure 4
figure 4

... 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.

figure 5
figure 5

Next: Modules or Not? »

Skip Ahead

1 Configuring a New Linux Kernel
2 Modules or Not?
figure 1
figure 1

figure 2
figure 2

figure 3
figure 3

figure 4
figure 4

figure 5
figure 5





Linux is a trademark of Linus Torvalds.


internet.com home | search | help! | about us

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers