Modifying Linux kernel configuration options the easy way
Modifying a Linux kernel configuration option can be an annoying
experience, as you poke around the menus of 'make menuconfig
' trying
to find where the configuration option you want to change is hiding.
Fortunately there's a less well known but much easier way.
The kernel build process stores configuration settings in the file
.config
in the root of the kernel source tree. However, it generates
other things from the file (and some options are interdependent), so you
can't just edit the file and go; you need to resynchronize the build
system with the .config
.
So the easy way to modify an existing configuration is the following:
- Find out what the
CONFIG_
variable you want to change is. Many of these have obvious names, likeCONFIG_SMP
. - Edit
.config
to delete any mention of the option, even if this is in a comment. (Comments are significant in.config
files.) - Run '
make oldconfig
', which will stop to ask you about the missing options at appropriate moments. - Build.
Finding the right CONFIG_
variable is a bit tricky. I will just
say that they are all specified in Kconfig
files in various source
directories (for example, net/Kconfig
), which is also where you find
all of the help text. (A few Kconfig
files are called things like
fs/Kconfig.binfmt
.)
'make oldconfig
' is also what you use if you're migrating a
.config
from one Linux kernel version to another, since it will
prompt you about any new configuration options (including new
drivers). In fact, any time you change or shuffle .config
s around,
you want to do 'make oldconfig
'; it is the easiest way of getting
the kernel build system synchronized with the .config
.
PS: remember to save your .config
file before you do a 'make
mrproper
' to clean out kernel source trees; it's one of the files
that a full cleaning deletes.
PPS: many distributions ship kernel source with their .config
files
stored somewhere; for example, Red Hat (including Fedora Core) puts
them in configs/*
. They make good starting .config
s, saving you
the tedium of 'make menuconfig
' from scratch.
|
|