STLLUG - St. Louis Linux User Group
11/16/1995 : Compiling the Linux Kernel
Presenter: Matthew Feldt
Compiling the Linux Kernel
This page was put together by merging parts of the
Linux NET-2/NET-3 HOWTO and the
Linux Kernel HOWTO so that most of the present (November 1995)
kernel options are documented in one place instead of two. Please
refer to both documents for additional information.
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). 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.
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).
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 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 X windows)
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, Perl employs it to let processes
talk to each other, as well as many other packages, so it is not a good
idea to say n
unless you know exactly what you are doing.
Use -m486 flag for 486-specific optimizations
Loadable Module Support
Networking Options
Newer kernels have a number of options that you are asked about when
you do a make config
. Generally you will not need to change
these, but some of the options might be useful to you in certain
circumstances.
- TCP/IP networking
- This one is obvious, it selects whether you
configure the tcp/ip suite of protocols into your kernel. Chances are if
you are reading this then you will want to answer 'y' to this one.
- IP forwarding/gatewaying
- This determines what your kernel will do
when it receives a datagram that has a destination address that is not
one of its own devices. You must have this option selected if
you want your kernel to act as an IP router. Most SLIP and PPP servers will
want this option selected.
- IP multicasting
- This is alpha test code support for IP
multicasting, examples of which include services such as 'Internet Talk Radio'
and live video. You will need additional programs to make use of this facility,
this is just the kernel support.
- IP firewalling
- This option allows you to provide flexible security
options for your linux machine. You can selectively enable/disable access to
tcp/ip ports from any address ranges you choose. This also needs additional
programs to support it.
- IP accounting
- This option is for those people that want to use
their Linux machine to provide internet connectivity to others on a
commercial basis. It allows you to count and record incoming and outgoing
bytes on a per port and address basis. With the addition of suitable software
this would allow you to produce seperate usage charges for each person using
your systems networking capabilities.
- IP tunneling
- A network tunneling driver encapsulates packets
of one protocol type within packets of another protocol type. It sends
them out over the network to a relay (or destination) where the packet is
unwrapped and is forwarded to it's ultimate destination. Packet tunneling
is useful in situations where you want to route packets of a non-standard
protocol type over the common network. A good example of this is 'IPX
encapsulation', in which IPX packets from a DOS network are routed across
an IP network by encapsulating them in IP packets.
- PC/TCP compatibility mode
- This option provides a work-around for
a bug that causes problems when using the PC/TCP networking programs to talk
to your linux machine. There is a PC/TCP bug which provokes a difficult to
remedy Linux bug, and this option prevents the two clashing. Normally you
would leave this disabled, but if you have users on your network who use
PC/TCP then you may have to enable this option to prevent problems.
- Reverse ARP
- This option allows you to configure the RARP protocol
into your kernel. This option was added to allow the booting of Sun 3
systems. This is not generally very useful otherwise.
- Assume subnets are local
- This option selects whether you assume
that your whole subnet is directly connected to your linux machine, or
whether it might be bridged or otherwise subdivided at a lower layer. In
practise it will make little difference if you leave it set at the default.
- Disable NAGLE algorithm
- This is a timing option that determines
when a datagram should be transmitted. The default setting provides for the best
throughput in most situations and you should leave this set as it is, as
disabling it will degrade your throughput. This option can be selectively
changed from within a program with a socket option, and you would normally
be much better off leaving it set at the default and specifically writing
your programs to disable the NAGLE algorithm if they require extremely
fast interactivity.
- The IPX protocol
- This option selects whether you compile the IPX
protocol support into your kernel. The IPX protocol is an internetworking
protocol similar in function to the IP protocol. This protocol is one of
those used by the Novell suite.
- Amateur Radio AX.25 Level 2
- This option selects whether you compile
in the Amateur Radio AX.25 protocol suite. If you select this option then
a new class of network sockets are available for programming. The AX.25
protocol is used primarily by Amateur Radio Operators for packet radio
use.
This optimizes the kernel for use on a 486 processor. The new kernel will
be slightly larger, but will work fine on a 386.
SCSI support
If you have a SCSI device, 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, say 'y
'. The config script will prompt
for which kind of card you have, and which protocol to use.
CD-ROM Drivers
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 fairly
optimal for floppy disks.
- Extended fs
- This was the first version of the extended filesystem,
which is no longer in widespread use. 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, 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
'.
- msdos
- 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 share files with other
systems using NFS, 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
(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.
Character devices
Here, you enable the drivers for your printer, 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 X Windows for cut and paste between
virtual consoles. It's fairly nice if you have a serial mouse,
because it coexists well with X Windows, but you need to do special tricks
for others. Selection support was a configuration option at one time, but
is now standard.
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.)
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.
Last Modified: 11 December 1995
St. Louis Unix Users Group - Linux SIG