Previous Next Contents

3. How to actually configure the kernel

3.1 Getting the source

You can obtain the source via anonymous ftp from ftp.funet.fi in /pub/OS/Linux/PEOPLE/Linus, a mirror, or other sites. It is typically labelled linux-x.y.z.tar.gz, where x.y.z is the version number. Newer (better?) versions and the patches are typically in subdirectories such as `v1.1' and `v1.2' The highest number is the latest version, and is usually a ``test release,'' meaning that if you feel uneasy about beta or alpha releases, you should stay with a major release.

I strongly suggest that you use a mirror ftp site instead of ftp.funet.fi. Here is a short list of mirrors and other sites:

USA:         tsx-11.mit.edu:/pub/linux/sources/system
USA:         sunsite.unc.edu:/pub/Linux/kernel
UK:          sunsite.doc.ic.ac.uk:/pub/unix/Linux/sunsite.unc-mirror/kernel
Austria:     fvkma.tu-graz.ac.at:/pub/linux/linus
Germany:     ftp.Germany.EU.net:/pub/os/Linux/Local.EUnet/Kernel/Linus
Germany:     sunsite.informatik.rwth-aachen.de:/pub/Linux/PEOPLE/Linus
France:      ftp.ibp.fr:/pub/linux/sources/system/patches
Australia:   ftp.dstc.edu.au:/pub/linux/kernel

If you do not have ftp access, a list of BBS systems which carry linux is posted periodically to comp.os.linux.announce; try to obtain this.

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.

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.

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.

In 2.0.x and later, there is a `?' option. Typing this will give you a brief description of the configuration parameter.

Kernel math emulation

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. The only consequence is that the kernel will be larger (costing RAM). I have been told that the math emulation is slow; although this does not have much to do with this section, it might be something to keep in mind when faced with sluggish X window system performance.

Normal (MFM/RLL) disk and IDE disk/cdrom support

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

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.

Limit memory to low 16MB

There exist buggy 386 DMA controllers which have problems with addressing anything more than 16 MB of RAM; you want to say `y' in the (rare) case that you have one.

System V IPC

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 type (386, 486, Pentium, PPro)

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

Extended fs - This was the first version of the extended filesystem, which is no longer in widespread use. Chances are that you'll know it if you need it and that if you are doubt, you do not need it.

Second extended - This is widely used in new distributions. You probably have one of these, and need to say `y'.

xiafs filesystem - At one time, this was not uncommon, but at the time of this writing, I did not know of anyone using it.

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

umsdos - This filesystem expands an MS-DOS filesystem with usual Unix-like features such as long filenames. It is not useful for people (like me) who ``don't do DOS.''

/proc - Another one of the greatest things since powdered milk (idea shamelessly stolen 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'.

OS/2 HPFS - At the time of this writing, a read-only fs for OS/2 HPFS.

System V and Coherent - for partitions of System V and Coherent systems (These are other PC Unix variants).

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: Selection 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. Selection support was a configuration option at one time, but is now standard.

Note 2: Selection is now considered obsolete. ``gpm'' is the name of the new program. It can do fancier things, such translate mouse protocols, handle multiple mice, ..

Sound card

If you feel a great desire to hear biff bark, say `y', and later on, another config program will compile and ask you 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.) I highly recommend looking at the Sound-HOWTO for more detail about sound support if you have a sound card.

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) put together by Axel Boldt (axel@uni-paderborn.de) with the following URL:

     http://math-www.uni-paderborn.de/~axel/config_help.html
or via anonymous FTP at:

     ftp://sunsite.unc.edu/pub/Linux/kernel/config/krnl_cnfg_hlp.x.yz.tgz
where the x.yz is the version number.

For later (2.0.x and later) kernels, this has been integrated into the source tree.

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 make config, 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.


Previous Next Contents