3 How to actually configure the kernel

Contents of this section

3.1 Getting the source

You can attain the source via ftp from ftp.funet.fi or mirror in /pub/OS/Linux/PEOPLE/Linus, a mirror of this site, or other sites. It is typically labelled linux-x.x.x.tar.gz, where x.x.x is the version number. Newer (better?) versions and the patches are typically in subdirectories like ``v1.1'' and ``v1.2.''

It is strongly suggested that you use a mirror ftp site instead of ftp.funet.fi! A short listing of mirrors and other sites follows.

(mirrors of ftp.funet.fi:)
Germany:        ftp.Germany.EU.net
UK:             doc.ic.ac.uk
Australia:      kirk.bu.oz.au
(sites that also carry the kernel files:)
USA:            tsx-11.mit.edu
USA:            sunsite.unc.edu
Germany:        ftp.dfv.rwth-aachen.de

If you don't have ftp access, there is a list of BBS systems carrying linux which is posted periodically to comp.os.linux.announce; try to get your hands on this.

3.2 Unpacking the source

Make sure you're ``root,'' and cd to /usr/src. If you got your linux from anywhere reasonable, there will already be a directory there called ``linux.'' That's the old linux source code. If you have the disk space and you want to play it safe, you'll want to preserve that directory. A good idea is to figure out what version you're running and rename the directory accordingly. The command ``uname -r'' will tell you the new version. Therefore, if ``uname -r'' said ``1.1.47,'' you would rename ``linux'' to ``linux-1.1.47.'' If you're the reckless kind of person, just wipe out the directory. In any case, just make sure there is no ``linux'' directory in /usr/src before unpacking the full source code.

In /usr/src, unpack the source with ``zcat linux.x.x.x.tar.gz | tar xvf -'' (You could also use ``tar zxvf linux.x.x.x.tar.gz'' for simplicity; if you've just got a .tar file (no .gz at the end), ``tar xvf linux.x.x.x.tar'' will work fine.). You'll see the contents of the source fly by. When finished, there will be a new ``linux'' directory. ``cd'' to linux and look over the README file. There will be a section labelled ``INSTALLING the kernel'' or something like that. Carry out the instructions when appropriate -- symlinks that should be in place, removal of stale .o files, etc.

3.3 Configuring the kernel

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

The command ``make config'' while in /usr/src/linux will start up a script that asks you all sorts of questions. It needs bash, so make sure bash is /bin/bash, /bin/sh, or $BASH.

You're ready to answer the questions, usually with ``y'' or ``n.'' Some of the more obvious and non-critical options are not described.

Kernel math emulation

If you don't have a math coprocessor (ie, you've got a bare 386 or 486SX), you need to say ``y'' to this. If you do have a coprocessor and you still say ``y,'' don't worry too much -- the coprocessor will be used and the emulation ignored. The only consequence is that the kernel will be larger.

Normal harddisk support

You'll almost always need to say yes to this. This means that the kernel will support standard PC disks like IDE stuff, which most people have. This does not include SCSI drives.

Networking support

If you're on a network, say, if you are on the internet, or you're going to use SLIP, PPP, term, or something to dial up to places for internet access, say ``y.''

Limit memory to low 16MB

If you've got less than 16MB of RAM, you almost always want to say ``y'' to this; you save a little bit of RAM when the new kernel is in use. But, of course, if you've got more than 16, if you don't say ``n,'' the new kernel will only use 16 of your 34 billion megs of RAM. There are supposedly bad 386 DMA controllers (or something hardware-related) out there which don't address anything above 16 megs correctly, either; you would want to say ``y'' in the (rare) case that you have one.

Use -m486 flag for 486-specific optimizations

This optimizes the kernel for the 486. The new kernel will be slightly bigger, but it will still work fine on a 386, if you're worried about that. It might be a ``little'' slower on the 386, but you won't notice it.

SCSI support

If you've got a SCSI device, say ``y.'' You'll be prompted for further information, like if you want to support CD-ROM, disks, and what kind of SCSI adapter you've got. See the SCSI-HOWTO for more detail.

Network device support

If you've got an ethernet card, or you want to use SLIP, PPP, or a parallel port adapter, say ``y.'' You'll be prompted for which kind of card you have, or which serial protocol to use.

Filesystems

You'll be prompted for support of a number of filesystems. They are:

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 optimal for floppy disks.

Extended fs - This was the first version of the extended filesystem, which isn't used much anymore. Chances are, you'll know it if you need it.

Second extended - This is widely used in new distributions. You probably have one of these.

xiafs filesystem - At one time, this was pretty common, but at the time of this writing, I didn't know anyone running it.

msdos - Well, you guessed it; if you want to use your MS-DOS hard disk partitions, or mount MS-DOS formatted floppy disks, say ``y.''

umsdos - This is a fairly slick filesystem which can make an MS-DOS filesystem have more features, like long filenames, etc. It's not really useful for people (like me) who don't run MS-DOS.

/proc - One of the most slick filesystems (idea shamelessly stolen from Bell Labs, I guess). It's not anything you partition disks with; but a filesystem interface to the kernel and processes. Many process-listers (like ``ps'') use it. If you've got it installed, try ``cat /proc/meminfo'' or ``cat /proc/devices'' sometime. Some shells, like rc, use /proc/self/fd (known as /dev/fd on other systems) for i/o. You should almost certainly say ``y'' to this; many important standard Linux tools depend on it!

NFS - If you're on a network and you want to share files, say ``y.''

ISO9660 - Found on most CD-ROMs.

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.

But I don't know which filesystems I need!

Ok, type ``mount.'' It 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. On this example, my / and /usr partitions are the second extended type, I'm using /proc, and there's a floppy disk mounted using the msdos (bleah) filesystem.

You can try ``cat /proc/filesystems'' if you've got /proc. It will give you a list of what's in your current kernel.

Character devices

Here, you'll find the devices for your printer, busmouse, PS/2 mouse (most notebooks use builtin PS/2 mice), some tape drives, selection. Say ``y'' when appropriate.

Note: ``Selection'' allows one to run a program that lets you use the mouse outside of X-Windows to cut and paste between virtual consoles. It's fairly nice if you've got a serial mouse, because it interacts well with X Windows, but at the time of this writing, it didn't play nice with PS/2 type mice (it locks up the mouse port, making it impossible to run X Windows until you kill the selection process.).

Sound card

If you're interested in keeping the people next door awake, say ``y,'' and later on, a config program will compile and ask you all about your sound board.

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)

You'll get a message telling 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 won't have to change it, but it doesn't hurt to look. You may also change the options in there with the ``rdev'' command once the new kernel is in place, too.

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter