Outside, it was a cold and rainy day. Inside, though, the convention
center was bustling with warm bodies and even warmer servers. Tucked
away in the .org pavilion was the Linux.com booth. The staff was rushing
around, making sure all of the final details were ready, to the theme of
"2001: A Space Odyssey."
The "2.4: A Kernel Odyssey" presentation at LinuxWorld 2001 New York was
an overview of the 2.4.0 kernel and its various features. This live
presentation by Brian Richardson introduced the audience to the new Linux
kernel by stepping through the kernel configuration process.
This Linux.com Live! presentation demonstrated how to upgrade an
existing Linux system to use the 2.4 kernel. Our demonstration machine
was a VA Linux workstation (PIII 850 MHz, 384 MB RAM, 20 GB IDE disk)
running Storm Linux ('Hail' version 2.06).
Sit back, relax, and enjoy this retelling of Linux.com's epic kernel
presentation.
Precompile
Before an unsuspecting victim was selected from the audience, Brian
explained a few things that you have to do to prepare for recompiling
your kernel. One of the most important things to do is check to see
exactly what type of hardware you have on your computer. When you
configure the kernel for your system, you have to be able to tell it what
hardware you have on your system, so that it knows how to communicate
with your specific system. Take a look at all of the files in /proc.
This will have all of the information about your system, just make sure
you know how to interpret it. Also, you can find out exactly what you
have if you keep all of the paperwork that companies send you with your
computer or with the different components. If you have any other
questions about preparing your computer for a recompile, take a look at
Brian Richardson's article
Before downloading the kernel source code, it is also a good idea to
upgrade modutils. The modutils package contains utilities used to load
modules for the Linux kernel. Since the 2.4 kernel changed the location
of some modules, certain devices may not work unless a newer version is
installed. This software can be downloaded from rpmfind, freshmeat, or kernel.org.
Downloading the Kernel
Once you have finished preparing for the recompile, you will need to
download the kernel source code. There are two places you can go for
this. You can go to the Linux Kernel
Archives or you can go to one of the mirrors of this site. You
will need to download either linux-2.4.x.tar.gz or linux-2.4.x.tar.bz2.
For our demonstration, we downloaded linux-2.4.0.tar.gz and for the rest
of this event we will refer to this file.
Note: The kernel is distribution independent. It does not matter
which distribution you are running on your computer, you will need the
same kernel for all of them.
For the sake of time constraints, we completed all of these above tasks
before the event. As soon as Brian finished going through these events,
we asked the audience for a volunteer. A few people hesitantly raised
their hands, unsure of what they were volunteering for. Our volunteer had
never actually compiled a kernel before, the perfect victim for our
plans. The participant sat down in front of the computer and began the
kernel configuration process.
Prepping for the New Kernel
One of the most important things that you must remember when you are
preparing to compile the kernel is that you must be root on your system.
If you are not currently root, then type in su and the system will
prompt you for the root password. Once you are root, type in cd
/usr/src. This will move you to the source directory. You will then
need to copy linux-2.4.0.tar.gz into this directory. When this is
copied, look at the contents of this directory. Make sure there are no
symbolic links called 'linux'. If there are, remove them by typing rm
/usr/src/linux.
Unpacking the Kernel
Once the symbolic link is removed, we then needed to unpack the kernel
source. When it is downloaded, it is packed into a tarball. For Windows
users, this is the same thing as zipping a file. In order to unpack the
kernel source, type tar xvzf linux-2.4.0.tar.gz. This will
unpack the kernel source into the directory you are in, so make sure that
you are in the /usr/src directory. This creates the directory
/usr/src/linux, which contains the 2.4.0 kernel source tree.
The /usr/src/linux directory should be renamed to refer to the
kernel version; type mv /usr/src/linux /usr/src/linux-2.4.0. This
keeps the kernel source organized, in case you keep more than one version
available. Now create a symbolic link to the 2.4.0 kernel tree. In order
to create the symbolic link, type ln -s /usr/src/linux-2.4.0
/usr/src/linux. You will now need to change to the new directory;
type cd /usr/src/linux.
Running Config
You are now in the new directory. Now comes the long, but necessary
process of configuring the kernel. You will need to run one of the
configuration tools so that the computer knows what parts of the kernel
to compile, what to keep as modules or what to not worry about. There
are three different configuration tools that a user can run.
- A text based config tool is make config. This is very
primitive, so if you like something that is a little bit more graphically
oriented, this is not the tool for you to run.
- The make menuconfig is also text based, but it is menu
driven. In order to run this, you will need to have the ncurses library
installed.
- The make xconfig tool requires the X Window System, but it is menu
driven and has a graphical interface. We used this one for our
demonstration.
Once xconfig is started, the kernel options are presented as a series of
menus. We will list all of these categories in italics. If you don't
know what something does, click on the help button. This will explain
the option. If you are still stumped, read the last line of the help
description ... this will usually tell you if you need the option or not.
Every kernel option has one of three selectable states:
- 'y' (yes) - include this support in the kernel
- 'n' (no) - do not include this support
- 'm' (module) - include this as a module, which is only loaded on
demand
Note: If an option is 'greyed out', it is dependent on another options
which has been turned off.
- Code Maturity Level Options
This gives the user the chance to automatically disable any experimental
code in the kernel. Enable this at your own discretion.
- Loadable Module Support
Loadable module support allows parts of the kernel to be loaded only
when needed. You will want to turn all of these options on, as this will
allow you to select the option 'module' or 'm' later on in the
configuration process.
- Processor Type and Features
This section allows for optimization of specific processor types. In
this kernel, support was added for AMD Athlon and Duron, P4, WinChip,
Via/Cyrix and Crusoe. If your motherboard supports more than one CPU,
enable SMP here. Support for large memory systems (1GB RAM or larger) is
also an option here. Users will want to enable MTRR and MSR if they have
a K6, PPro, PII, PIII, P4, Celeron, Duron or Athlon. MTRR is used by
most AGP drivers. Users will also want to enable cpuid support for any
CPU except a 384 or 486.
Note: This menu will look different if you are on a non-x86
machine.
Note: The kernel may not boot if you compile for the
wrong CPU, so make sure you select the correct processor.
- General Setup
General setup includes support for networking, expansion bus, module
format and power management. You will want to enable 'Support for
hot-pluggable devices' if you want to use FireWire, USB or PCMCIA with
your computer. You will also want to enable PCI support. We disabled
MCA, EISA and PCMCIA for our machine. If you are running a notebook,
enable PCMCIA. If you have PCI bus, then enable 'PCI Device Name
Database' and leave 'PCI Access Mode' as Any. Advanced Power Management
(APM) support is only
necessary for notebook power management.
- Memory Technology Devices
This is new to Kernel 2.4. 'Disk on chip' style storage is supported
here. This section is useful for embedded platforms. We will not enable
this for our system.
- Parallel Port Support
If you have an parallel devices, such as printers or other hardware that
plugs into your parallel port, then you will want to enable this
support. We will not enable this option, as we don't have any devices
for it.
- Plug and Play
This is for, you guessed it, plug and play devices. You will want to
turn this on as a module. It will then load if needed.
- Block Devices
Standard floppy support is in this section. ATAPI/IDE drive options
were listed here in 2.2.x kernels, but they were moved to a new section.
Options for some 'antique' storage devices are also located here.
- Multi-Device Support (RAID and LVM)
RAID and clustering storage device support can be found here. Most
people will not need to worry about this.
- Networking Options
If you have your computer set up on any network, LAN, modem or
otherwise, then you will need to pay attention to this section. You will
need to turn on 'Packet Socket,' 'TCP/IP' and 'UNIX Domain Sockets' for
any network cards or standard Internet access
. If you are curious about using 'network packet filtering' instead of
ipchains for firewall configurations, please consult additional documentation.
- Telephony Support
This is not for modems. This support is used for voice mail, fax
and other multimedia devices that interface with modems. No telephony ...
no need for the support.
- ATA/IDE/MFM/RLL Support
This support is compiled directly into the kernel, rather than as a
module, because we will be booting off of an IDE hard drive. If you are
using an ATAPI CD-RW, then you will need to turn 'SCSI Emulation' on in
this section (see our CD-RW article
for details). ATAPI/IDE devices that had been moved from the Block
Devices section are listed in a submenu here.
If you have an IDE hard drive, then you will need to select
support for the proper IDE hard disk controller (this was part of the
information you should have gathered in the precompile section). We
turned on support for an Intel PIIX4 (also directly part of the kernel,
not as a module). Turn off support for controllers that you don't need,
as this will optimize your kernel.
- SCSI Support
Support for a SCSI controller needs to be enabled here if you have one
or if you enabled SCSI emulation earlier. If you are booting from a SCSI
card, you will need to enable the proper one here in the 'SCSI Low-level
Drivers' sub menu. SCSI support is a lso required for 'USB Mass Storage'
... but that's another article.
- IEEE 1394 (Fire Wire) Support
This is still experimental, so most users will want to leave this alone.
- I2O Device Support
If you have this, you paid quite a lot of money for it. You know if you
have this and you should know what to do with it (or can afford somebody
who does). Most people will leave this alone.
- Network Device Support
Users will want to select the type(s) of network adapters that are
present on their systems. For our system, we just want to select
'Ethernet 10/100' as that is the only type of adapter that we have
present. In the submenu, we will select the Intel EtherExpress 100. If
your ISP requires PPP, then you will want to enable this. This is also
valid for DSL services that use PPPoE.
- Amateur Radio Support
This section deals with transmitting data using a HAM radio. This is
not new to Kernel 2.4. If you want more information, you can go to this
site.
- IrDA Support
IrDA are infrared devices. Users who own notebooks will mainly be
concerned with this. There is a great web site for the Linux/IrDA
Project, if you would like some more information on this topic.
- ISDN Subsystem
We sincerely hope that you have better bandwidth than this. If you do
not, you have our sincerest apologies. Contact your ISP if you have any
questions about this.
- Old CD-ROM Drivers
This section is for old CD-ROMs that attach to the sound card. Most
people will not need to worry about this.
- Input Core Support
Input core support is for USB input devices. This includes everything
from USB mice to USB keyboards and joysticks. In this section, we turned
on support for a USB keyboard, as this is one of the items that we
demonstrated at the end of the event.
- Character Devices
Character devices include everything from serial ports and TTY devices
to speech synthesizer cards. At the end of our demonstration, we also
set up a speech synthesizer card so that people could listen to the
computer talk to them. Although speech synthesizer support is not new to
Linux, it is new to the kernel itself. Kernel 2.4 has finally integrated
speech synthesizer support into the source. In this section, we also
enabled standard serial support and support for a PS/2 mouse. If you
want X terminals to work, you will need to enable Unix98 PTY support.
Vmware needs enhanced real time clock support enabled as well. Under
Character Devices, there is AGP support. We enabled this for our
chipset. If you do not know what your chipset is, this should be in the
information you obtained during the precompile process.
- Multimedia Devices
Video for Linux support is in this menu. This includes TV tuner cards,
video capture and FM radio cards. We do not have any of these, so we
left this section alone.
- File Systems
This section determines what types of file systems can be mounted.
Users will always want to include 'ext2' support. Also, if you would
like to read files from a Windows partition on your computer, then enable
'DOS FAT fs' support, as well as 'VFAT fs' support. In order to read
CD-ROM and ISO formats, you will need to include 'ISO 9660' and Joliet
support.
Note: Always include '/proc file system' support.
- Console Drivers
For this section, the user will always want to include 'VGA text
console' support. Also the user might want to select 'Video mode
selection' support in order to take advantage of higher resolutions for
text mode.
- Sound
If your computer has a sound card or on-board sound (the sound card is
built into the motherboard) you will at least want to enable sound
support. Once you have enabled it, find your sound card in the list and
enable that as well. Remember how we told you to upgrade your modutils?
If you didn't, then your sound is not going to work (trust us, we learned
that lesson the hard way).
- USB Support
This support is new to Kernel 2.4. Remember to always turn on 'USB
verbose debug messages' as well as 'Preliminary USB device file system.'
You will then need to select the appropriate USB support. This is an
important time to determine if you have a 'UHCI' or
'OHCI' USB controller ... Intel and VIA chipsets use UHCI, everybody
else uses OHCI.
Our Intel motherboard has an Intel PIIX4 USB controller, so the 'UHCI
(Intel PIIX4, VIA, ...) support' option was selected (not as a module,
but directly into the kernel). We also selected 'USB Human Interface
Device (HID) support' to enable our USB keyboard and trackball.
- Kernel Hacking
Congratulations! You've gotten to the very end of the config tool.
This last option is mainly for hackers. Go ahead and enable it, though.
If something breaks, then you can invite your kernel hacker friend to fix
your system (with the proper bribe of pizza and caffeine).
Once you have gotten through all of these options, you will be returned
to the main menu. Please click 'Save & Exit' ... that's 'Save & Exit',
not just 'Exit'. If you exit without saving, you will have lost all of
the information that you had and you'll have to go through the process of
running the config tool all over again.
Compiling the Kernel
We finally got through the whole xconfig tool. Since we still had an
audience, we figured we were doing something right. We had also gotten
to the really important part. It was time to compile the kernel. Before
we actually compiled it, though, we needed to quickly modify LILO so that
if something went wrong, we could still boot into the stable version that
was still in the computer.
In order to do this, we had our victim ... er, volunteer change to the
/boot directory. We then found the symbolic link 'vmlinuz.' Our
older kernel version was 2.2.15, so we created a link from
/boot/vmlinuz-2.2.15 to stable (ln-s vmlinuz-2.2.15
stable). Once this link is created, you will need to edit
/etc/lilo.conf using your preferred text editor. You will create
a new set of instructions, to create /boot/stable as well as the
/boot/linux. Save the changes, exit the editor and then type 'lilo' to
reconfigure the boot loader.
Don't worry folks ... almost finished. It is now time to type the
commands that will compile the kernel on your system. You have a couple
choices in how you type these commands. You can either type them one at
a time, or you can put them together, separating each part with just a
space. Listed below are both ways of doing this.
make dep
make clean
make install
make modules
make modules_install
OR
make dep clean install modules modules_install
Note: you can also create a boot floppy using the
make
bzfloppy command
After these commands finished running their course, we were done (kernel
compile time is dependent on system speed ... this took about 7 minutes
on our computer). The computer was rebooted and 'linux' was selected from
lilo at boot.
The 2.4.0 kernel compile was a success! The demonstration machine booted
straight to Linux ... we were even able to use the USB keyboard. Thanks
to our willing victim and the help of our audience members (and remote
audience on IRC), we were able to get through the entire compiling
process.
Out presentation had the support of a trained presenter and several
hard-core Linux geeks. But you don't need an entire Linux convention to
compile a kernel. If you ever run into any kernel problems and can not
find the solution on your own, there are channels that you can go to on
IRC that have people who can help. Both #kernelnewbies and #linuxhelp on
irc.openprojects.net are good places to go searching for help. Even if
they can not answer your question directly, these folks will be able to
give you a web page to that will help.