Next Previous Contents

3. How to actually configure the kernel

3.1 Getting the source

You can obtain the source via anonymous ftp from ftp.kernel.org in /pub/linux/kernel/vx.y, where x.y is the version (eg 2.2), and as mentioned before, the ones that end with an odd number are development releases and may be unstable. It is typically labelled linux-x.y.z.tar.gz, where x.y.z is the version number. The sites also typically carry ones with a suffix of .bz2, which have been compressed with bzip2 (these files will be smaller and take less time to transfer).

It's best to use ftp.xx.kernel.org where xx is your country code; examples being ftp.at.kernel.org for Austria, and ftp.us.kernel.org for the United States.

3.2 Unpacking the source

Log in as or su to `root', and cd to /usr/src. If you installed kernel source when you first installed linux (as most do), there will already be a directory called `linux' there, which contains the entire old source tree. If you have the disk space and you want to play it safe, preserve that directory. A good idea is to figure out what version your system runs now and rename the directory accordingly. The command `uname -r' prints the current kernel version. Therefore, if `uname -r' said `1.0.9', you would rename (with `mv') `linux' to `linux-1.0.9'. If you feel mildly reckless, just wipe out the entire directory. In any case, make certain there is no `linux' directory in /usr/src before unpacking the full source code.

Now, in /usr/src, unpack the source with `tar zxpvf linux-x.y.z.tar.gz' (if you've just got a .tar file with no .gz at the end, `tar xpvf linux-x.y.z.tar' works.). The contents of the source will fly by. When finished, there will be a new `linux' directory in /usr/src. cd to linux and look over the README file. There will be a section with the label `INSTALLING the kernel'. Carry out the instructions when appropriate -- symbolic links that should be in place, removal of stale .o files, etc.

If you have a .bz2 file and the bzip2 program (read about it at http://www.muraroa.demon.co.uk/), do this:

     bz2cat linux-x.y.z.tar.bz2 | tar xvf -

3.3 Configuring the kernel

Note: Some of this is reiteration/clarification of a similar section in Linus' README file.

The command `make config' while in /usr/src/linux starts a configure script which asks you many questions. It requires bash, so verify that bash is /bin/bash, /bin/sh, or $BASH.

However, there are some much more pleasant alternatives to `make config' and you may very well find them easier and more comfortable to use. `make menuconfig' is probably the most widely-used. Whatever you choose, it's best to get familiar with the interface because you may find yourself back at it sooner than you think. For those ``running X,'' you can try `make xconfig' if you have Tk installed (`click-o-rama' - Nat). `make menuconfig' is for those who have (n)curses and would prefer a text-based menu. These interfaces have a rather clear advantage: If you goof up and make a wrong choice during configuration, it is simple to go back and fix it.

The configuration options will appear in hierarchies with `make menuconfig' and `make xconfig'.

You are ready to answer the questions, usually with `y' (yes) or `n' (no). Device drivers typically have an `m' option. This means ``module,'' meaning that the system will compile it, but not directly into the kernel, but as a loadable module. A more comical way to describe it is as ``maybe.'' Some of the more obvious and non-critical options are not described here; see the section ``Other configuration options'' for short descriptions of a few others. With `make menuconfig', the space bar toggles the selection.

In 2.0.x and later, there is a `?' option, which provides a brief description of the configuration parameter. That information is likely to be the most up-to-date. Here are a listing of some of the important features, which hierarchy they are in, and brief description.

Kernel math emulation (Processor type and features)

If you don't have a math coprocessor (you have a bare 386 or 486SX), you must say `y' to this. If you do have a coprocessor and you still say `y', don't worry too much -- the coprocessor is still used and the emulation ignored. For any halfway modern machine, the answer will be no, but don't worry if you say yes accidentally; if not needed, it is not used.

Enhanced (MFM/RLL) disk and IDE disk/cdrom support (Block Devices)

You probably need to support this; it means that the kernel will support standard PC hard disks, which most people have. This driver does not include SCSI drives; they come later in the configuration.

You will then be asked about the ``old disk-only'' and ``new IDE'' drivers. You want to choose one of them; the main difference is that the old driver only supports two disks on a single interface, and the new one supports a secondary interface and IDE/ATAPI cdrom drives. The new driver is 4k larger than the old one and is also supposedly ``improved,'' meaning that aside from containing a different number of bugs, it might improve your disk performance, especially if you have newer (EIDE-type) hardware.

Networking support (General Setup)

In principle, you would only say `y' if your machine is on a network such as the internet, or you want to use SLIP, PPP, term, etc to dial up for internet access. However, as many packages (such as the X window system) require networking support even if your machine does not live on a real network, you should say `y'. Later on, you will be asked if you want to support TCP/IP networking; again, say `y' here if you are not absolutely sure.

System V IPC (General Setup)

One of the best definitions of IPC (Interprocess Communication) is in the Perl book's glossary. Not surprisingly, some Perl programmers employ it to let processes talk to each other, as well as many other packages (DOOM, most notably), so it is not a good idea to say n unless you know exactly what you are doing.

Processor family (Processor type and features)

(in older kernels: Use -m486 flag for 486-specific optimizations)

Traditionally, this compiled in certain optimizations for a particular processor; the kernels ran fine on other chips, but the kernel was perhaps a bit larger. In newer kernels, however, this is no longer true, so you should enter the processor for which you are compiling the kernel. A ``386'' kernel will work on all machines.

SCSI support

If you have SCSI devices, say `y'. You will be prompted for further information, such as support for CD-ROM, disks, and what kind of SCSI adapter you have. See the SCSI-HOWTO for greater detail.

Network device support

If you have a network card, or you would like to use SLIP, PPP, or a parallel port adapter for connecting to the Internet, say `y'. The config script will prompt for which kind of card you have, and which protocol to use.

Filesystems

The configure script then asks if you wish to support the following filesystems:

Standard (minix) - Newer distributions don't create minix filesystems, and many people don't use it, but it may still be a good idea to configure this one. Some ``rescue disk'' programs use it, and still more floppies may have a minix filesystem, since the minix filesystem is less painful to use on a floppy.

Second extended - This is the standard Linux filesystem. You almost definitely have one of these, and need to say `y'.

msdos - If you want to use your MS-DOS hard disk partitions, or mount MS-DOS formatted floppy disks, say `y'.

There are various other foreign operating system filesystem types available.

/proc - (idea from Bell Labs, I guess). One doesn't make a proc filesystem on a disk; this is a filesystem interface to the kernel and processes. Many process listers (such as `ps') use it. Try `cat /proc/meminfo' or `cat /proc/devices' sometime. Some shells (rc, in particular) use /proc/self/fd (known as /dev/fd on other systems) for I/O. You should almost certainly say `y' to this; many important linux tools depend on it.

NFS - If your machine lives on a network and you want to use filesystems which reside on other systems with NFS, say `y'.

ISO9660 - Found on most CD-ROMs. If you have a CD-ROM drive and you wish to use it under Linux, say `y'.

But I don't know which filesystems I need!

Ok, type `mount'. The output will look something like this:

    blah# mount
    /dev/hda1 on / type ext2 (defaults)
    /dev/hda3 on /usr type ext2 (defaults)
    none on /proc type proc (defaults)
    /dev/fd0 on /mnt type msdos (defaults)

Look at each line; the word next to `type' is the filesystem type. In this example, my / and /usr filesystems are second extended, I'm using /proc, and there's a floppy disk mounted using the msdos (bleah) filesystem.

You can try `cat /proc/filesystems' if you have /proc currently enabled; it will list your current kernel's filesystems.

The configuration of rarely-used, non-critical filesystems can cause kernel bloat; see the section on modules for a way to avoid this and the ``Pitfalls'' section on why a bloated kernel is undesirable.

Character devices

Here, you enable the drivers for your printer (parallel printer, that is), busmouse, PS/2 mouse (many notebooks use the PS/2 mouse protocol for their built-in trackballs), some tape drives, and other such ``character'' devices. Say `y' when appropriate.

Note: gpm is a program which allows the use of the mouse outside of the X window system for cut and paste between virtual consoles. It's fairly nice if you have a serial mouse, because it coexists well with X, but you need to do special tricks for others.

Sound

If you feel a great desire to hear biff bark, say `y', and you can tell the configuration program all about your sound board. (A note on sound card configuration: when it asks you if you want to install the full version of the driver, you can say `n' and save some kernel memory by picking only the features which you deem necessary.)

If you are serious about sound card support, have a look at both the free drivers at http://www.linux.org.uk/OSS/ and the commercial Open Sound System at http://www.opensound.com/.

Other configuration options

Not all of the configuration options are listed here because they change too often or fairly self-evident (for instance, 3Com 3C509 support to compile the device drive for this particular ethernet card). There exists a fairly comprehensive list of all the options (plus a way to place them into the Configure script) in an effort started and maintained by Axel Boldt (boldt@math.ucsb.edu) and it's the online help. It's also available as one big file at the Documentation/Configure.help in your Linux kernel source tree as of version 2.0.

Kernel hacking

>From Linus' README:

the ``kernel hacking'' configuration details usually result in a bigger or slower kernel (or both), and can even make the kernel less stable by configuring some routines to actively try to break bad code to find kernel problems (kmalloc()). Thus you should probably answer `n' to the questions for a ``production'' kernel.

3.4 Now what? (The Makefile)

After you finish configuration, a message tells you that your kernel has been configured, and to ``check the top-level Makefile for additional configuration,'' etc.

So, look at the Makefile. You probably will not need to change it, but it never hurts to look. You can also change its options with the `rdev' command once the new kernel is in place. If you're feel lost when you look at the file, then don't worry about it.


Next Previous Contents