Red Hat Linux 9 Professional Secrets [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Red Hat Linux 9 Professional Secrets [Electronic resources] - نسخه متنی

Naba Barkakati

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید


Upgrading and Customizing the Linux Kernel


One reason that Linux is so exciting is that many programmers are constantly improving it. Some programmers, for example, write drivers that add support for new hardware, such as a new sound card or a new networking card. All these innovations come to you in the form of new versions of the Linux kernel.

Although you do not have to upgrade or modify the Linux operating system-the kernel-every time a new version is available, sometimes you need to upgrade simply because the new version corrects some problems or supports your hardware better. On the other hand, if an earlier kernel version has everything you need, there is no need to rush out and upgrade.

Sometimes you may want to rebuild the kernel even when there are no fixes or enhancements. The Linux kernel on the companion CD-ROM is generic and uses modules to support all types of hardware. You may want to build a new kernel that links in the drivers for only the devices installed on your system. In particular, if you have a SCSI hard disk, you may want to create a kernel that supports your SCSI adapter. Depending on your needs, you may also want to change some of the kernel-configuration options, such as creating a kernel that's specific for your Pentium processor (instead of a generic Intel 386 processor).

The rest of this chapter explains how to upgrade a kernel using a kernel RPM provided by Red Hat as well as how to rebuild and install a new Linux kernel.








Secret


In the past it was possible to apply kernel patches-alterations to the kernel source code-and rebuild the kernel. You would typically download the Linux kernel patches (as well as the latest versions of the kernel sources) from the website

patch command. Unfortunately, these steps do not usually work with Red Hat Linux because Red Hat has modified some of the kernel files. In Red Hat Linux, you can still upgrade the kernel to newer versions-you just have to get the newer kernels from Red Hat's FTP server. If a Red Hat RPM for a newer kernel is not available yet, you can download the entire new kernel source from

next section.












Upgrading with a Red Hat Kernel RPM


Red Hat distributes all software updates, including new versions of kernels, in the form of RPM files. To download and install the kernel RPMs, follow these steps:



  1. Use a Web server to download the kernel RPM files from Red Hat's FTP server (the next section explains the details). If you want to rebuild the kernel, you have to download the

    kernel-source RPM corresponding to the new version of the kernel.



  2. Install the RPMs by using the

    rpm -i command.



  3. Create a new, initial RAM disk by running the

    /sbin/mkinitrd command.



  4. Reconfigure GRUB to boot the new kernel.



  5. Try out the new kernel by rebooting the system.



The next few sections further describe these steps.


Downloading New Kernel RPMs


Red Hat makes software updates available in the form of RPMs-packages-at its FTP server or one of the mirror sites listed at

http://www.redhat.com/download/mirrorl . The updates are organized in directories according to Red Hat Linux version numbers. For example, any updates for Red Hat Linux 9 for Intel x86 systems reside in the

9/en/os/i386 directory. Use a Web browser (for example, Mozilla) to visit the FTP site and download any kernel RPMs available at that site.


Installing the Kernel RPMs


To install the kernel and the modules, follow these steps:



  1. Log in as

    root .



  2. Use the

    cd command to change directory to where the RPM files (the ones you have downloaded from Red Hat's FTP server) are located.



  3. Type the following command to install the kernel RPM:

    rpm -ivh kernel*.rpm



You need to install the

kernel-source RPM only if you want to build a new kernel.


Making a New, Initial RAM Disk


Next, you have to make a new, initial RAM disk image-a file that the kernel can copy into a block of memory and use as a memory-resident disk.

Usually, the initial RAM disk image is stored in a file whose name begins with

initrd .

initrd is shorthand for initial RAM disk; the

mkinitrd command is so named because it makes an

initrd file.

Log in as

root and type a command-line of the following form to create the

initrd file:

mkinitrd /boot/initrd-filename.img  module-dir-name

The

initrd file has to be in the

/boot directory where the kernel is located. You can use any filename for

initrd-filename . The

module-dir-name is the name of the directory in

/lib/modules where the module files are located. By convention, the module directory name is the same as the kernel version number. For example, if your kernel version (type the

uname -r command to see the version number) is 2.4.20-2.48, the module directory name is 2.4.20-2.48. Another common practice is to use an

initrd filename created by appending the version number to the

initrd- prefix. Thus, for kernel version 2.4.20-2.48, the

initrd file is

initrd-2.4.20-2.48.img .

To create the initial RAM disk image for kernel version 2.4.20-2.48, type the following command:

/sbin/mkinitrd /boot/initrd-2.4.20-2.48.img 2.4.20-2.48

This creates the file

initrd-2.4.20-2.48.img in the

/boot directory. You refer to this

initrd file in the GRUB configuration file (

/etc/grub.conf ).








Reconfiguring GRUB


After you install the kernel RPMs and create the initial RAM disk image, you have to reconfigure GRUB so that it can boot the new kernel.

Use a text editor such as

vi or Emacs to edit the

/etc/grub.conf file. Add the following lines near the beginning of that file right after the

splashimage line:

title Red Hat Linux (NEW)
root (hd0,0)
kernel /vmlinuz-2.4.20-2.48 ro root=/dev/hda2
initrd /initrd-2.4.20-2.48.img

In the kernel line where it says

root=/dev/hda2 , change

/dev/hda2 to the correct device name for the disk partition where your Linux system's root file system (

/ ) is located. Also, make sure that the correct names are used for the kernel and

initrd filenames-these names depend on the version number of the kernel you have downloaded.

After editing and saving the

/etc/grub.conf file, you can reboot the system and try out the new version of kernel.












Trying out the New Kernel


After installing the new kernel RPM, creating the initial RAM disk file, and reconfiguring GRUB, it's time to try the new kernel. To restart the system, log in as

root and type the following command from the Linux prompt:

reboot

You may also reboot the system as you log out of the GNOME or KDE desktop. Select Restart the computer from the dialog box, and click OK.

When the system reboots and you see the GRUB screen, press the arrow key to select the new kernel's name. If you have added the new kernel description before all other operating systems in the GRUB configuration file, that kernel should boot even if you don't do anything at the boot screen.

After Red Hat Linux starts, you should see the usual graphical login screen. Log in as a user, open a terminal window, and type the

uname -sr command to see the version number. The response should show that your system is running the new version of the kernel.


Rebuilding the Kernel


Rebuilding the kernel refers to creating a new binary file for the core Linux operating system. This binary file is the one that runs when Linux boots. You may have to rebuild the kernel for various reasons:



  • After you initially install Linux, you may want to create a new kernel that includes support for only the hardware installed on your system. In particular, if you have a SCSI adapter, you may want to create a kernel that links in the SCSI driver. The kernel in the companion CD-ROM includes the SCSI driver as an external module you load at start up.



  • If you have a system with hardware for which only experimental support is available, you have to rebuild the kernel to include that support into the operating system.



  • You may want to recompile the kernel and generate code that works well on your specific Pentium processor (instead of the generic 386 processor code that comes in the standard Red Hat Linux distribution).










Secret


Before you rebuild the kernel, make sure you have the emergency boot floppy (covered in Chapter 2) you have prepared when installing Red Hat Linux. If the system does not boot after you rebuild the kernel, you can use the emergency boot floppy to start the system and repeat the kernel build process.

Never rebuild and install a new kernel without first making sure you have an emergency boot floppy. If you have not createed the boot floppy during Red Hat Linux installation, use the

/sbin/mkbootdisk command to create the boot floppy. Type man mkbootdisk to learn the syntax of that command. The exact command line to build the emergency boot floppy depends on the kernel version number. For example, to create a boot floppy for version 2.4.20-2.48, log in as

root , and type the following command at the shell prompt (you have to insert a blank floppy disk when prompted):

mkbootdisk -device /dev/fd0 2.4.20-2.48

Replace

2.4.20-2.48 with the version number of your Linux kernel, as displayed by the

uname -r command.











To rebuild the Linux kernel, you need the kernel source files. The kernel source files are not normally installed. Use the following steps to install the kernel source files on your system:



  1. Log in as

    root and insert the second Red Hat Linux CD-ROM into the CD-ROM drive.



  2. If the CD-ROM drive does not mount automatically, type the following command to mount the CD-ROM drive:

    mount /mnt/cdrom

    If you are using GNOME or KDE, the CD-ROM is automatically mounted, and you should not have to perform this step manually.



  3. Change the directory to the

    RedHat/RPMS directory on the CD-ROM, and use the

    rpm command to install the kernel source files. Type the following commands:

    cd /mnt/cdrom/RedHat/RPMS
    rpm -ivh kernel-source*

    After the

    rpm command finishes installing the kernel source package, the source files appear in the

    /usr/src/linux-2.4 directory.






    Note

    If you cannot find the kernel-source RPM on this book's CD-ROMs, you have to download that file from one of the mirror sites listed at

    www.redhat.com/download/mirrorl . Click on the Distribution link next to one of the listed FTP sites and then look in the directory corresponding to the Red Hat Linux version number. For example, the RPM files for Red Hat Linux 9 should be in the

    9/en/os/i386/RedHat/ RPMS directory. Use a Web browser to download the kernel-source RPM file and install it by following the steps outlined above.




Building the kernel involves the following key phases:



  • Configuring the kernel



  • Building the kernel



  • Building and installing the modules (if any)



  • Installing the kernel and setting up GRUB



The next section describes the use of modules versus linking hardware support directly into the kernel. Subsequent sections describe the phases of kernel building.






Insider Insight

When you create a custom kernel for your hardware configuration, you may want to link all required device drivers into the kernel. In this case, you can keep the size of such a monolithic kernel under control because you link in device drivers only for the hardware installed on your system.









Creating a Monolithic versus a Modular Kernel


Before you start configuring the kernel, understand that you have two options for the device drivers needed to support various hardware devices in Linux:



  • Link in support-You can link the drivers for all hardware on your system into the kernel. As you might imagine, the size of the kernel grows as device-driver code is incorporated into the kernel. A kernel that links in all necessary support code is called a monolithic kernel.



  • Use modules-You can create the necessary device drivers in the form of modules. A module is a block of code the kernel can load after it starts running. A typical use of modules is to add support for a device without having to rebuild the kernel for each new device. Modules do not have to be device drivers; they can also serve to add new functionality to the kernel. A kernel that uses modules is called a modular kernel.

    You do not have to create a fully monolithic or fully modular kernel. In fact, it is common practice to link some support directly into the kernel. Conversely, you can build infrequently used device drivers in the form of modules. For a company such as Red Hat, it makes sense to distribute a modular kernel. Red Hat provides a generic kernel, along with a large number of modules, to support many different types of hardware. Then, the Red Hat installation program configures the system to load only modules needed to support the hardware installed in a user's system.














Configuring the Kernel


The first phase in rebuilding a kernel is configuring it. To configure the kernel, log in as

root . Then change the kernel source directory by using the

cd command as follows:

cd /usr/src/linux*

To configure the kernel, you have to indicate which features and device drivers you want to include in your Linux system. In essence, you build a copy of Linux with the mix-and-match features you want.

Linux provides several ways for you to configure the kernel:



  • Type make menuconfig to enter the kernel-configuration parameters through a text-based interface similar to the one the Red Hat installation program uses.



  • Type make xconfig to use an X Window System-based configuration program to configure the kernel. You have to run X to use this configuration program with a graphical interface.



  • Type make config to use a shell script that prompts you for each configuration option one by one. You can use this configuration program from the Linux command prompt. When you use this option, you undergo a long question-and-answer process to specify the configuration parameters.



  • Type make oldconfig to use a shell script to reconfigure the kernel after upgrading the sources. This configuration script keeps the existing options and prompts you only for new or changed options.










Secret


The

make menuconfig ,

make xconfig ,

make config , and

make oldconfig commands achieve the same end result-each stores your choices in a text file named

.config located in the

/usr/src/linux-2.4 directory. Because the filename starts with a period, you don't see it when you use the

ls command alone to list the directory. Instead, type ls -a to see the

.config file in the directory listing.

The kernel-configuration step merely captures your choices in the

.config file. (In fact, the

.config file does not exist until you configure the kernel once.) The kernel file does not change until you compile the kernel with the

make command. That means you can go through the kernel-configuration option as many times as you want. If you want to start over with default settings, type the following command before you start configuring the kernel:

make mrproper











Here are some lines from the

.config file on my system (after I configure the kernel):

more .config
#
# Automatically generated make config: don't edit
#
#
# Code maturity level options
#
CONFIG_EXPERIMENTAL=y
#
# Loadable module support
#
CONFIG_MODULES=y
CONFIG_MODVERSIONS=y
CONFIG_KMOD=y
#
# Processor type and features
#
# CONFIG_M386 is not set
# CONFIG_M486 is not set
# CONFIG_M586 is not set
# CONFIG_M586TSC is not set
# CONFIG_M586MMX is not set
# CONFIG_M686 is not set
# CONFIG_MPENTIUMIII is not set
CONFIG_MPENTIUM4=y
(rest of the file not shown)

Essentially, each configuration option has a name, and each one is assigned a value. The name begins with

CONFIG_ followed by a word that identifies the option. Each selected option has a value of

y (to link in support for that feature) or

m (to use a module for that feature). Lines beginning with

# are comments. Comment lines list features not selected.






Note

I describe the configuration process through the

make config command. Although this approach is somewhat tedious because it walks you through each option one by one, it is ideal as a learning tool. As you step through the groups of configuration options, I provide notes explaining what most of the options mean. You can then use any configuration tool (

make xconfig ,

make menuconfig ,

make config , or

make oldconfig ) to configure the kernel.


As you configure the kernel with the

make config command, you have to select how to include support for specific devices. Typically, for each configuration option, you have to respond with one of the following choices:



  • y to link support into the kernel



  • m to use a module



  • n to skip the support for that specific device



  • ? to get help on that kernel-configuration option



If a device does not have a modular device driver, you won't see the

m option. For some configuration options, you may have to type a specific answer. For example, when responding to the processor type, type Pentium-4 to indicate that you have a Pentium 4 PC.


Starting the Kernel Configuration

To start configuring the kernel, type:

rm -f include/asm
( cd include ; ln -sf asm-i386 asm)
/bin/sh scripts/Configure arch/i386/config.in
#
# Using defaults found in configs/kernel-2.4.20-i686.config
#
*
* Code maturity level options
*
Prompt for development and/or incomplete code/drivers (CONFIG_EXPERIMENTAL) [Y/n/?]

Press Enter to accept the default Yes answer. This causes the configuration process to show all experimental device drivers.






Insider Insight

The possible answers to each prompt appear in square brackets with the default answer in uppercase. Thus,

[Y/n/?] means the default answer is Yes, and two other possible answers are

n and

? . To accept the default, press Enter. For help on this option, press

? . If you have questions about any option, press

? and carefully read the help text before you decide what to do.



Enabling Support for Loadable Modules

The next group of options asks you about support for loadable modules. A loadable module is a block of code that the Linux kernel can load and execute as if it were a part of the operating system.

*
* Loadable module support
*
Enable loadable module support (CONFIG_MODULES) [Y/n/?]
Set version information on all module symbols (CONFIG_MODVERSIONS) [Y/n/?]
Kernel module loader (CONFIG_KMOD) [Y/n/?]

You want to include support for modules, so answer Yes to the first question. The next question asks you about including version information in each module. If modules have version information, the module is checked for compatibility with the current kernel version. Because it is easy to unload a module that does not work, I tend to answer No to this option. However, you may safely accept the default and press Enter. The third question asks whether or not you want the kernel to be capable of loading required modules. You should answer Yes to this option.


Configuring Processor-Related Features

The next set of questions involves the processor type and support for specific processor-related features. The first question of this set queries you about a new configuration parameter-

CONFIG_LOLAT -when this parameter is set to

y , the kernel uses code that tries to lower the latency (the time elapsed between an interrupt and starting the interrupt handler). You can press Enter to accept the default Yes answer.

The next question asks about your system's processor family. If you answer 386, the compiled kernel can run on any other processor (such as a 486 or any type of Pentium). However, if you are creating a kernel specifically for your system, enter your processor type from the choices shown in parentheses. If you have an older 386 or 486SX PC that does not have a math coprocessor, you should answer Yes to the math-emulation question and have the kernel perform floating-point arithmetic in software. You can also enable symmetric multiprocessing (SMP) support, but you should do so only if your system's motherboard has two or more processors.

There are a host of other processor-specific options in this section. You can read the help for each option and select the ones that apply to your system.


Configuring General Options

Next, comes a set of general options that deal with networking, PCI bus, MCA bus, PCMCIA, parallel port, and advanced power management (APM) BIOS support.

You can simply press Enter to accept the default answers for these options. If you don't understand what an option means, press ? to get help on that option.






Cross Ref

One of the general options is

CONFIG_SYSCTL . By answering Yes to this option, you enable the necessary support in the kernel so you can use the

/sbin/sysctl program to view or set kernel parameters. Chapter 20 shows you how to use the

sysctl program.



Enabling Plug and Play Support

The next two questions ask if you want to enable Plug and Play (PnP) support in the kernel. If you enable PnP support, the kernel automatically configures PnP devices (just as Windows does). You should press Enter to accept the default choices for these two questions.

*
* Plug and Play configuration
*
Plug and Play support (CONFIG_PNP) [Y/m/n/?]
ISA Plug and Play support (CONFIG_ISAPNP) [Y/m/n/?]


Configuring Floppy and Parallel Port IDE Devices

The next set of questions involves the floppy and IDE (Integrated Drive Electronics) devices connected to the PC's parallel port.

*
* Block devices
*
Normal floppy disk support (CONFIG_BLK_DEV_FD) [Y/m/n/?]
XT hard disk support (CONFIG_BLK_DEV_XD) [M/n/y/?]
Parallel port IDE device support (CONFIG_PARIDE) [M/n/?]

The first question asks if you want floppy-drive support. Because most PCs do have a floppy drive, your answer generally is Yes. You should press Enter to accept the default for the third question if you have external CD-ROM or disk devices that connect through your PC's parallel port. Some IDE devices use a parallel port IDE adapter-that's what the

PARIDE in the

CONFIG_PARIDE option refers to.

The next set of options is for various parallel IDE drivers. You may want to build in support for parallel port IDE devices through loadable modules. That way, the modules are there if you need them, but the kernel doesn't become bloated with extra code.


Configuring Additional Block Devices

Next comes another set of options for block devices, which refers to devices that transfer data in chunks (as opposed to a keyboard that transfers data one character at a time). The

CONFIG_BLK_DEV_LOOP option is for loopback device. Enabling the loopback device lets Linux manipulate an entire file system inside a single large file. The multiple devices driver (

CONFIG_BLK_DEV_MD option) allows Linux to combine several hard-disk partitions into a single logical device. This option supports RAID (Redundant Array of Independent Disks) devices. The RAM disk support allows the kernel to use a portion of your system's memory as a disk capable of storing a file system. Typically, a RAM disk functions only during system startup when the hard disk may not yet be available. The RAM disk is essential if you are booting a SCSI disk and you haven't compiled the SCSI drivers into the kernel.


Enabling Cryptography Support

Next comes a set of options for enabling cryptography support in the kernel. You can build them as modules, as the default selections of the following options show:

*
* Cryptography support (CryptoAPI)
*
CryptoAPI support (CONFIG_CRYPTO) [M/n/y/?]
Cipher Algorithms (CONFIG_CIPHERS) [M/n/?]
*
* 128 bit blocksize
*
AES (aka Rijndael) cipher (CONFIG_CIPHER_AES) [M/n/?]
Identity Function cipher (CONFIG_CIPHER_IDENTITY) [M/n/?]
Crypto Devices (CONFIG_CRYPTODEV) [M/n/?]
Loop Crypto support (CONFIG_CRYPTOLOOP) [M/n/?]


Configuring the Network

The next set of options deals with networking. How you answer depends on how you want to use your Linux system in a network. Here are some guidelines:



  • Answer Yes to enable

    CONFIG_NETFILTER if you want to use your Linux system as a firewall-an intermediary system that controls information flowing between a local area network (LAN) and the Internet. When you enable

    CONFIG_NETFILTER , you can use the Linux PC as a packet-filtering firewall. (See Chapter 22 for more information on packet filters.) You should also turn on this option if you want to use IP masquerading, which allows many systems on a private LAN to access the Internet through a Linux system with a single public IP address. Also, you have to turn on

    CONFIG_IP_NF_CONNTRACK, CONFIG_IP_NF_IPTABLES , and

    CONFIG_IP_NF_NAT . Chapter 13 explains IP masquerading.



  • If you answer Yes to

    CONFIG_IP_ALIAS , you can assign multiple IP addresses to a single network interface card.



  • You should always enable

    CONFIG_INET for TCP/IP networking.



  • Answer Yes to

    CONFIG_IP_ADVANCED_ROUTER if you want to use your Linux system as a router-a gateway between two LANs.



  • You should turn on

    CONFIG_IP_MULTICAST if you employ the Linux system to address several networked computers at once using IP multicasting.



  • You can enable

    CONFIG_SYN_COOKIES if you want Linux to resist a type of attack known as SYN flooding, which can overwhelm the network connection.



  • You can safely answer No to the IP tunneling (

    CONFIG_NET_IPIP ) option. You need to address this option only in certain situations, such as moving a laptop from one network to another, without changing its IP address.



Note that the Linux kernel now supports the next version of the Internet Protocol: IP version 6 (IPv6, also called IPng or IP next generation).


Configuring Telephony Support

Next come two options for telephony support in Linux. With the right hardware and software, telephony support enables you to use the Linux system for making phone calls over the Internet (also known as voice over IP or VoIP).

*
* Network testing
*
Packet Generator (USE WITH CAUTION) (CONFIG_NET_PKTGEN) [N/y/m/?]
*
* Telephony Support
*
Linux telephony support (CONFIG_PHONE) [M/n/y/?]
QuickNet Internet LineJack/PhoneJack support (CONFIG_PHONE_IXJ) [M/n/?]
QuickNet Internet LineJack/PhoneJack PCMCIA support (CONFIG_PHONE_IXJ_PCMCIA) [M/n/?]

You can accept the default choices to build driver modules for telephony support if you have a telephony card, such as the Internet PhoneJACK or Internet LineJACK manufactured by Quicknet Technologies, Inc. If you do not have any Quicknet telephony cards, you can safely ignore this option.


Configuring IDE Devices

The next set of questions involves IDE devices, such as hard disks and ATAPI CD-ROM drives.

*
* ATA/IDE/MFM/RLL support
*
ATA/IDE/MFM/RLL support (CONFIG_IDE) [Y/m/n/?]
*
* IDE, ATA and ATAPI Block devices
*
Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support (CONFIG_BLK_DEV_IDE) [Y/m/n/?]

This set of questions has four acronyms: ATA, IDE, MFM, and RLL. All of these relate to hard disks or interface of disk drives to the PC. Here's what they mean:



  • ATA stands for Advanced Technology Attachment and refers to the PC-AT style interface used to connect hard disks and CD-ROM drives to the PC's motherboard.



  • IDE stands for Integrated Drive Electronics and refers to the original PC hard disks that integrated the disk controller onto the hard disk itself. The IDE interface is more accurately described as AT Attachment Packet Interface, or ATAPI. You typically see the terms IDE, ATA, and ATAPI used interchangeably.



  • MFM stands for modified frequency modulation and refers to the way data was encoded on older hard drives. These hard drives can work over an IDE interface.



  • RLL stands for run length limited and is also a technique for storing data on hard disk. RLL disks can work over an IDE interface.



The first question asks if you want the kernel to support IDE devices. The second question asks if you want to use the full-featured IDE device that can control up to 10 IDE interfaces. Because each IDE interface can have a master and a slave device, this enables Linux to access a total of up to 20 IDE devices, such as disks or CD-ROM drives. You can press Enter to accept the default choices of Yes for both of these options.






Insider Insight

The next set of options concerns various IDE drivers. The initial comment starts with a note that refers to the file

/usr/src/linux-2.4/Documentation/ide.txt . You can find many useful help files (these are all text files) in the

/usr/src/linux-2.4/Documentation directory.


You can accept the default answers for these options. Note that

IDE/ATAPI FLOPPY refers to IDE floppy drives, such as Iomega Zip drive or Imation Superdisk LS-120 drive. The questions about CMD640 and RZ1000 bug fixes refer to some known problems with specific chipsets used in IDE interfaces.


Configuring SCSI Devices

Next follows an entire set of options that has to do with SCSI devices. SCSI stands for Small Computer Systems Interface and refers to a type of interface through which you can connect multiple devices such as hard disks and scanners to the PC. If your system has a SCSI adapter, you should start by answering Yes to the

CONFIG_SCSI option. After that, you have to answer questions about the types of devices (disk, tape, CD-ROM) connected to the SCSI adapter. Finally, you must enable support for the specific SCSI adapter model on your system.






Insider Insight

If your system has a SCSI adapter, always press y in response to all the needed SCSI options. Do not press m to create SCSI modules. You have to go through several extra steps to install a kernel that has to load modular SCSI device drivers. The easiest approach is to simply link in the SCSI support by answering

y to options such as

CONFIG_SCSI, CONFIG_BLK_DEV_SD and the configuration option corresponding to your SCSI adapter.



Configuring IEEE 1394 Support

The next set of options is for enabling IEEE 1394 support, either as a module or linked into the kernel. IEEE 1394 is a high-speed serial bus for connecting peripherals to PCs. Apple calls this bus FireWire; Sony calls it i.Link. IEEE 1394 is similar to USB, but it can transfer data at rates up to 400 Mbps, which is more than 30 times the data rate of the older USB version 1.1 (note that USB 2.0 is much faster; it can transfer data at rates of up to 480 Mbps). Because of its high data-transfer rates, IEEE 1394 is ideal for connecting high-speed peripherals such as digital audio and video devices and external hard drives to the PC.

The Linux kernel includes experimental support for the IEEE 1394 bus. Currently, Linux supports IEEE 1394 chipsets that are compatible with Texas Instruments PCILynx/ PCILynx2 and OHCI chipsets. If your PC has an IEEE 1394 adapter, you can build the necessary drivers through the following options:

*
* IEEE 1394 (FireWire) support (EXPERIMENTAL)
*
IEEE 1394 (FireWire) support (EXPERIMENTAL) (CONFIG_IEEE1394) [M/n/y/?]
*
* Device Drivers
*
Texas Instruments PCILynx support (CONFIG_IEEE1394_PCILYNX) [N/m/?]
OHCI-1394 support (CONFIG_IEEE1394_OHCI1394) [M/n/?]
*
* Protocol Drivers
*
OHCI-1394 Video support (CONFIG_IEEE1394_VIDEO1394) [M/n/?]
SBP-2 support (Harddisks etc.) (CONFIG_IEEE1394_SBP2) [M/n/?]
Enable Phys DMA support for SBP2 (Debug) (CONFIG_IEEE1394_SBP2_PHYS_DMA) [Y/n/?]
Ethernet over 1394 (CONFIG_IEEE1394_ETH1394) [M/n/?]
OHCI-DV I/O support (CONFIG_IEEE1394_DV1394) [M/n/?]
Raw IEEE1394 I/O support (CONFIG_IEEE1394_RAWIO) [M/n/?]
IEC61883-1 Plug support (CONFIG_IEEE1394_CMP) [M/n/?]
IEC61883-6 (Audio transmission) support (CONFIG_IEEE1394_AMDTP) [M/n/?]
Excessive debugging output (CONFIG_IEEE1394_VERBOSEDEBUG) [N/y/?]

To learn more about using IEEE 1394 peripherals in Linux, visit the website of the IEEE 1394 for Linux project at

http://www.linux1394.org/ .


Configuring I2O drivers

Pronounced eye-two-oh, I20 refers to Intelligent Input/Output-a new device driver architecture independent of the operating system and the controlled device. I2O functions by logically separating the part responsible for managing the device from the part that contains operating system-specific details (it's called the I2O Split Driver model). The two parts of an I2O driver are the OS Services Module (OSM), which works with the operating system, and the Hardware Device Module (HDM) that interfaces with the particular device the driver manages. The OSM and HDM communicate by passing messages to each other. To learn more about I2O, visit the Intelligent-IO.com website at

http://www.intelligent-io.com/ .

Linux comes with some I2O drivers for SCSI and PCI devices. You can build the I2O drivers through the following configuration options:

*
* I2O device support
*
I2O support (CONFIG_I2O) [M/n/y/?]
I2O PCI support (CONFIG_I2O_PCI) [M/n/?]
I2O Block OSM (CONFIG_I2O_BLOCK) [M/n/?]
I2O LAN OSM (CONFIG_I2O_LAN) [M/n/?]
I2O SCSI OSM (CONFIG_I2O_SCSI) [M/n/?]
I2O /proc support (CONFIG_I2O_PROC) [M/n/?]


Configuring Network Adapters

The next group of options involves networking. It includes the configuration of LAN adapters such as Ethernet (10/100 Mpbs as well as Gigabit Ethernet), ATM (Asynchronous Transfer Mode), Token ring, ARCnet, and AppleTalk network adapters. You can also enable dial-up and wide area network (WAN) support by using SLIP and PPP through options in this category.

For Ethernet, you can build support for the Ethernet card installed on your system. This category also includes support for wireless networking and drivers for wireless Ethernet cards.

Network adapters also includes support for modems built into sound cards.


Enabling Support for Infrared Devices

The Linux kernel now supports IrDA-compliant infrared (IR) devices. This set of options allows you to enable support for IrDA devices. If your PC has any IrDA interfaces, you can build the modules needed to support such devices.

Many IR interfaces are in the form of dongles-small adapters that typically attach to the serial port of the PC. You can use the options in this section to enable support for several common types of dongles.


Enabling Support for ISDN

The next set of options enables you to include support for ISDN (Integrated Services Digital Network)-a digital telephone line you can use to connect the Linux system to the Internet. These ISDN-related options include the configuration of specific ISDN adapters.

You should build the ISDN driver only if your PC has an ISDN card. If you anticipate adding an ISDN card and purchase ISDN service from the phone company, you can build the driver as a module. Read the file

/usr/src/linux-2.4/Documentation/isdn/ README for more information on how to set up and use the ISDN driver in Linux.


Configuring CD-ROM Drives with Proprietary Interfaces

If you have a CD-ROM drive with a proprietary interface-not a SCSI or IDE (ATAPI) CD-ROM drive-you should select your CD-ROM interface from the following set of options:

*
* Old CD-ROM drivers (not SCSI, not IDE)
*
Support non-SCSI/IDE/ATAPI CDROM drives (CONFIG_CD_NO_IDESCSI) [Y/n/?]

If you enter

y for that option, you can select the specific model of proprietary CD-ROM drive that your system has.

Typically, you can ignore the CD-ROM options, unless you have an old non-IDE and non-SCSI CD-ROM drives.


Configuring Character Devices

The next few options deal with configuring character devices, which include devices connected to the serial and parallel ports. These options also include configuration of multiport serial interface cards that enable you to connect multiple terminals or other devices to your Linux system. Answer No if you do not have any such devices on your system. Near the end of the list, you see a question about parallel-printer support (

CONFIG_PRINTER ). If you plan to connect a printer to the parallel port, answer Yes to this option.


Configuring I2C Protocol

I2C-pronounced eye-squared-see-is a protocol Philips has developed for communication over a pair of wires at rates between 10 and 100 kHz. System Management Bus (SMBus) is a subset of the I2C protocol. Many modern motherboards have an SMBus meant for connecting devices such as EEPROM (electrically erasable programmable read-only memory) and chips for hardware monitoring. Linux supports the I2C and SMBus protocols. You need this support for Video for Linux. If you have any hardware sensors or video equipment that needs I2C support, answer

m to the

CONFIG_I2C option, and answer

m to the specific driver for your hardware. For example, if you want to use a BT848 frame-grabber board (to capture video), you should answer

m to the

CONFIG_I2C_ALGOBIT option.

To learn more about the I2C, read the documentation in the

/usr/src/linux-2.4/ Documentation/i2c directory. In particular, the summary file briefly describes the I2C and SMBus protocols.


Specifying the Type of Mouse

From the next set of options, specify the type of mouse on your PC:

*
* Mice
*
Bus Mouse Support (CONFIG_BUSMOUSE) [M/n/y/?]
ATIXL busmouse support (CONFIG_ATIXL_BUSMOUSE) [M/n/?]
Logitech busmouse support (CONFIG_LOGIBUSMOUSE) [M/n/?]
Microsoft busmouse support (CONFIG_MS_BUSMOUSE) [M/n/?]
Mouse Support (not serial and bus mice) (CONFIG_MOUSE) [Y/m/n/?]
PS/2 mouse (aka "auxiliary device") support (CONFIG_PSMOUSE) [Y/n/?]
C&T 82C710 mouse port support (as on TI Travelmate)
(CONFIG_82C710_MOUSE) [M/n/y/?]
PC110 digitizer pad support (CONFIG_PC110_PAD) [M/n/y/?]
MK712 touch screen support (CONFIG_MK712_MOUSE) [M/n/y/?]


Enabling Support for Joysticks

If you have a joystick or a special game controller (steering wheel, game pad, six-degrees-of-freedom controller), you can build the driver modules for your game controller from the options in this section.


Enabling Support for a Non-SCSI Tape Drive

If you have a non-SCSI tape drive that uses the QIC-02 format, you should answer Yes to the next question; otherwise, answer No:

QIC-02 tape support (CONFIG_QIC02_TAPE) [N/y/m/?] 


Configuring the Watchdog Timer

Configuration options in the next set enable you to turn on support for the watchdog timer. Essentially, this causes the kernel to create a special file; failure to open the file and write to it every minute causes the system to reboot. Some watchdog boards can monitor the PC's status (including the temperature). You can also enable support for specific watchdog cards from this set of options.

If you want access to the PC's nonvolatile (battery-backed) memory-NVRAM-in the real-time clock, answer Yes to the

CONFIG_NVRAM option. You can get access to the real-time clock by enabling the

CONFIG_RTC configuration option.


Configuring Floppy Tape Drive

If you have a tape drive connected to your floppy controller, answer

y or

m to the next option, and select the other parameters appropriately (or accept the default choices):

*
* Ftape, the floppy tape device driver
*
Ftape (QIC-80/Travan) support (CONFIG_FTAPE) [M/n/y/?]
Zftape, the VFS interface (CONFIG_ZFTAPE) [M/n/?]
Default block size (CONFIG_ZFT_DFLT_BLK_SZ) [10240]

You can also enable several parameters related to floppy tape drives.


Configuring Graphics Support

The next set of options configures support for advanced video cards that can perform hardware-accelerated, 3D graphics. You can enable the first option to build the AGP (Accelerated Graphics Port) driver and can answer Yes to the option for your specific chipset.

/dev/agpgart (AGP Support) (CONFIG_AGP) [M/n/y/?]
Intel 440LX/BX/GX and I815/I820/I830M/I830MP/I840/I845/I850/I860 support (CONF
IG_AGP_INTEL) [Y/n/?]
Intel I810/I815/I830M (on-board) support (CONFIG_AGP_I810) [Y/n/?]
VIA chipset support (CONFIG_AGP_VIA) [Y/n/?]
AMD Irongate, 761, and 762 support (CONFIG_AGP_AMD) [Y/n/?]
AMD 8151 support (CONFIG_AGP_AMD_8151) [Y/n/?]
Generic SiS support (CONFIG_AGP_SIS) [Y/n/?]
ALI chipset support (CONFIG_AGP_ALI) [Y/n/?]
Serverworks LE/HE support (CONFIG_AGP_SWORKS) [Y/n/?]

Next, you have to configure a set of options for the Direct Rendering Manager (DRM)-a device-independent driver that supports the XFree86 Direct Rendering Infrastructure (DRI). DRI is meant for direct access to 3D graphics hardware in advanced graphics cards,

such as 3Dfx Banshee and Voodoo3. To learn more about DRI, use your Web browser to visit the URL

http://dri.sourceforge.net/ .

If you have a 3D graphics card, you can answer Yes to

CONFIG_DRM and build the module for the graphics card in your system. If you do not have one of the listed graphics cards, you should answer No to these options.


Configuring Audio and Video Devices


The next set of options involves audio and video devices, including FM radio cards. For more information on these devices, consult the documentation in the

/usr/src/linux-2.4/Documentation/video4linux directory.


Enabling Support for Specific File Systems

The next set of options enables you to turn on support for specific types of file systems. You can make your choices based on the guidelines shown in Table 21-2.

















































































Table 21-2: Common File System Configuration Options


Option


Description


CONFIG_ADFS_FS


Enables Linux to read from the ADFS-the Acorn Disc Filing System-the standard file system of the RiscOS operating system that runs on Acorn's ARM-based Risc PC systems and the Acorn Archimedes systems. Answer y if you want Linux to read from ADFS partitions on hard drives and from ADFS floppy disks.


CONFIG_AFFS_FS


Enables support for the Fast File System (FFS)-the file system used by Amiga systems since AmigaOS version 1.3 (34.20). Answer y if you need to read from and write to an Amiga FFS partition on your hard drive. Note that this support does not enable Linux to read from Amiga floppy disks because of an incompatibility of the floppy controller used in an Amiga and the standard floppy controller in PCs.


CONFIG_CODA_FS


Enables support for Coda, an advanced network file system that is similar to NFS but that better supports disconnected operation (for example, laptops) and is a better security model. Answer y only if you need your Linux system to act as a Coda client. Consult the file

/usr/src/linux-2.4/ Documentation/filesystems/coda.txt for more information.


CONFIG_EXT2_FS


Enables support for the second extended file system. You should definitely answer y to turn on this option.


CONFIG_EXT3_FS


Enables support for the journaling version of the second extended file system-the current standard file system for Linux. You should definitely answer

y to turn on this option. The use of journaling means that you do not have to check the file system after a crash-the journal keeps track of all changes and can keep the file system consistent even if there is a crash.


CONFIG_FAT_FS


Turns on support for any File Allocation Table (FAT)-based file system (including MS-DOS and Windows 95 VFAT file systems). Answer

y if you want to access MS-DOS or VFAT files.


CONFIG_HFS_FS


Enables Linux to mount Macintosh-formatted floppy disks and hard drive partitions with full read/write access. Answer

y if you want to access Macintosh file systems.


CONFIG_HPFS_FS


Enables your Linux system to access and read an OS/2 HPFS file system (you can only read HPFS files). Answer

y if you have an OS/2 partition on your hard disk.


CONFIG_ISO9660_FS


Turns on support for the standard ISO 9660 file system used on CD-ROMs (this is also known as the High Sierra File System and is referred to as

hsfs on some UNIX workstations). If you have a CD-ROM drive, answer

y here.


CONFIG_JOLIET


Enables support for Microsoft's Joliet extension for the ISO 9660 CD-ROM file system, which allows for long filenames in Unicode format (Unicode is the new 16-bit character code that can encode the characters of almost all languages of the world.) Answer

y if you want to be able to read Joliet CD-ROMs under Linux.


CONFIG_MINIX_FS


Supports the Minix file system-the original file system of Linux. This simple file system still functions on floppy disks, so you should answer

m to include support in the form of a module.


CONFIG_MSDOS_FS


Supports MS-DOS file systems. Press

y if you want to read an MS-DOS partition on the hard disk or an MS-DOS floppy.


CONFIG_NFS_FS


Enables you to mount Network File System (NFS) directories from other systems on a network. Answer

y if you want to access NFS directories.


CONFIG_NTFS_FS


Enables Linux to read from the NT file system (NTFS)-the file system used by Microsoft Windows NT. Answer

y here for read-only access to an NTFS partition on the hard disk.


CONFIG_PROC_FS


Turns on support for the

/proc virtual file system through which you can get information about the kernel. (For example, type the

cat /proc/interrupts command to list the IRQs used by the system.) The

/proc file system does not exist on the disk; files are created when you access them. You should answer y to enable this option because it is useful and several Linux system utilities rely on the

/proc file system.


CONFIG_QNX4FS_FS


Supports the file system used by the QNX 4 operating system-a popular real-time operating system (

http://www.qnx.com/ ). Answer

y if you intend to mount QNX hard disks or floppies for read-only access.


CONFIG_QUOTA


Turns on disk quota so you can limit each user's disk space. Answer

y only if your system has many users and you want to implement disk quota for the

ext2 file system.


CONFIG_ROMFS_FS


Turns on support for a very small, read-only, memory-resident file system used in the initial RAM disk (

initrd ) during Red Hat Linux installation. Answer

y to include support for this file system. Consult the file

/usr/src/linux-2.4/ Documentation/filesystems/romfs.txt for more information.


CONFIG_SMB_FS


Enables your Linux system to access shared directories from networked PCs running Windows 95/98/NT/2000 or Windows for Workgroups. Answer

y if you want to access shared directories on Windows systems.


CONFIG_SYSV_FS


Turns on support for the System V file system used by SCO, Xenix, and Coherent variants of UNIX for Intel PCs. If you need to access a System V file system, answer

y here.


CONFIG_UFS_FS


Allows your Linux system to read to (but not write to) the UFS file system used by the BSD (Berkeley Software Distribution) variants of UNIX (such as SunOS, FreeBSD, NetBSD, and NeXTstep). Answer

y if you need to access any UFS file system. If you also want to write to UFS file systems, answer y to the experimental

CONFIG_UFS_FS_WRITE option.


CONFIG_UMSDOS_FS


Supports the UMSDOS file system, which stores a Linux file system in a FAT or VFAT partition. You have to also include support for FAT or VFAT file system to support the UMSDOS file system.


CONFIG_VFAT_FS


Supports Windows 95/98/NT/2000 VFAT file systems with long filenames. Answer

y if your system has partitions with VFAT file systems, or you expect to read floppy disks with Windows files.


Linux can read and manipulate disk partitions created by many different systems. The next option enables you to include support for specific partition types:

*
* Partition Types
*
Advanced partition selection (CONFIG_PARTITION_ADVANCED)
[Y/n/?]
Acorn partition support (CONFIG_ACORN_PARTITION) [N/y/?]
Alpha OSF partition support (CONFIG_OSF_PARTITION) [Y/n/?]
Amiga partition table support (CONFIG_AMIGA_PARTITION) [N/y/?]
Atari partition table support (CONFIG_ATARI_PARTITION) [N/y/?]
Macintosh partition map support (CONFIG_MAC_PARTITION) [Y/n/?]
PC BIOS (MSDOS partition tables) support (CONFIG_MSDOS_PARTITION)
[Y/n/?]
BSD disklabel (FreeBSD partition tables) support (CONFIG_BSD_DISKLABEL)
[Y/n/?]
Minix subpartition support (CONFIG_MINIX_SUBPARTITION) [Y/n/?]
Solaris (x86) partition table support (CONFIG_SOLARIS_X86_PARTITION)
[Y/n/?]
Unixware slices support (CONFIG_UNIXWARE_DISKLABEL) [Y/n/?]
Windows Logical Disk Manager (Dynamic Disk)
support (EXPERIMENTAL) (CONFIG_LDM_PARTITION) [N/y/?]
SGI partition support (CONFIG_SGI_PARTITION) [Y/n/?]
Ultrix partition table support (CONFIG_ULTRIX_PARTITION) [N/y/?]
Sun partition tables support (CONFIG_SUN_PARTITION) [Y/n/?]
EFI GUID Partition support (CONFIG_EFI_PARTITION) [N/y/?]


Selecting a Native Language Character Set

Next comes a set of configuration options that requires you to select a native language character set. The Microsoft FAT file systems use these character sets to store and display filenames in one of several languages. The character sets are stored in files called DOS codepages. You have to include the appropriate codepages so that the Linux kernel can read and write filenames correctly in any DOS partitions in the hard disk. Note that the codepages apply only to filenames; they have nothing to do with the actual contents of files.

You can include support for as many codepages as you want. Simply answer Yes to the codepages for your selection of languages.


Configuring the Console Drivers

After selecting the natural language support for DOS file systems, you have to configure the console drivers that the kernel can use to display text output without the X Window System. You definitely want to answer Yes to the

CONFIG_VGA_CONSOLE option, which allows the kernel to display output in text mode using generic VGA mode (supported by nearly all video cards). Most of the other console drivers are experimental. A new feature is the

CONFIG_FB option, which can enable support for frame-buffer devices. A frame buffer is an abstraction for the graphics hardware so that the kernel and other software can produce graphical output without having to rely on low-level details (such as hardware registers) of a video card. Frame buffer support is available for a few specific video cards.


Configuring the Sound Card

The next set of options involves sound-card support. If you have a sound card installed, start by answering

y or

m to the

CONFIG_SOUND option. After that, you have to answer a number of questions about various sound cards. You can always answer

m to build the sound support in the form of modules you can load when needed.


Enabling USB Support

The next set of options enables support for the Universal Serial Bus (USB)-a serial bus that comes built into most new PCs. USB version 1.1 supports data-transfer rates as high as 12 Mbps-12 million bits per second or 1.5 megabytes per second-compared with 115 Kbps or the 0.115 Mbps transfer rate of a standard serial port (such as COM1). You can daisy-chain up to 127 devices on a USB bus. The bus also provides power to the devices, and you can attach or remove devices while the PC is running-a capability commonly referred to as hot swapping. USB version 2.0 (or USB 2.0 or USB2, for short) ups the ante by raising the data transfer rates to a whopping 480 Mbps, slightly faster than the competing IEEE 1394 (FireWire) bus.

USB can replace the functionality of the PC's serial and parallel ports, as well as the keyboard and mouse ports. Nowadays, many PC peripherals-such as mouse, keyboard, printer, scanner, modem, digital camera, memory card, and so on-are designed to connect to the PC through a USB port.

If your PC has a USB port, you should answer

y or

m to the

CONFIG_USB option. Then, you have to answer

m to the

CONFIG_USB_UHCI or

CONFIG_USB_OHCI option, depending on the type of USB interface-UHCI (Intel) or OHCI (Compaq and others) -your PC has. To determine the type of USB interface, type the

/sbin/lspci command, and look for the USB controller's make and model in the output. For example, here's the output from

/sbin/lspci for a PC with a USB port:

/sbin/lspci
00:00.0 Host bridge: Intel Corp. 82845 845 (Brookdale) Chipset Host Bridge (rev
05)
00:01.0 PCI bridge: Intel Corp. 82845 845 (Brookdale) Chipset AGP Bridge
(rev 05)
00:1d.0 USB Controller: Intel Corp. 82801CA/CAM USB (Hub #1)
(rev 02)
00:1d.1 USB Controller: Intel Corp. 82801CA/CAM USB (Hub #2)
(rev 02)
00:1e.0 PCI bridge: Intel Corp. 82801BAM/CAM PCI Bridge
(rev 42)
00:1f.0 ISA bridge: Intel Corp. 82801CAM ISA Bridge (LPC)
(rev 02)
00:1f.1 IDE interface: Intel Corp. 82801CAM IDE U100
(rev 02)
00:1f.3 SMBus: Intel Corp. 82801CA/CAM SMBus (rev 02)
00:1f.5 Multimedia audio controller: Intel Corp. 82801CA/CAM AC'97
Audio (rev 02)
00:1f.6 Modem: Intel Corp. 82801CA/CAM AC'97 Modem
(rev 02)
01:00.0 VGA compatible controller: nVidia Corporation NV11 [GeForce2 Go]
(rev b2)
02:01.0 Ethernet controller: 3Com Corporation 3c905C-TX/TX-M [Tornado]
(rev 78)
02:04.0 CardBus bridge: O2 Micro, Inc. OZ6912 Cardbus Controller

As the output shows, this PC has an Intel USB controller. Therefore, I need the driver module for the Intel UHCI support (CONFIG_USB_UHCI option).

After you select the UHCI or OHCI interface support, you have to build the driver modules for specific USB devices on your system. Linux supports a huge number of USB devices. For more information on USB devices, consult the documentation in the

/usr/src/linux-2.4/Documentation/usb directory-especially the links in the

usb-help.txt file.


Enabling Bluetooth Support

The next few options are for enabling support for Bluetooth-a low-power, short-range wireless technology for connecting devices on the 2.4 GHz frequency band. Devices that use Bluetooth can usually connect when they are within 10 meters of one another. To learn more about Bluetooth, visit

http://www.bluetooth.com/ .

Linux supports Bluetooth through a core driver and several other modules. You can answer

y to the

CONFIG_BLUEZ option to enable Bluetooth support and then select other options specific to your Bluetooth devices.


Enabling Support for Kernel Debugging

The next and final set of options enables you to use the SysRq key (equivalent to pressing Alt-PrintScreen) to get important status information right after a system crash. This information is useful if you are a Linux developer who expects to debug the kernel. Most users answer No (because most users run a stable version of the kernel and do not expect to fix kernel errors) to disable these options.

The kernel configuration session ends with the following message, which tells you to type the command

make dep before building the kernel.

*** End of Linux kernel configuration.
*** Check the top-level Makefile for additional configuration.
*** Next, you must run 'make dep'.


Building the Kernel


You should initiate the next three tasks by using a single command line (Linux enables you to enter multiple semicolon-separated commands on the same line) so that you can type the line, then press Enter, and take a break. This part takes a while.

Depending on your system, making a new kernel can take anywhere from a few minutes to over an hour. Type the following on a single line to initiate the process:

make dep; make clean; make zImage

The

make dep command determines which files have changed and what needs to be compiled again. The

make clean command deletes old, unneeded files (such as old copies of the kernel). Finally,

make zImage creates the new kernel in a compressed file and places it in a certain directory.








Secret


If you link too many features into the kernel (by answering Yes to configuration options), the kernel file size may be too big to fit in the 640K of memory a PC can use as it boots up. This 640K limit exists because Intel x86 processors start in real mode and can only access 1MB of memory, of which 640K is available for programs. This limit is a leftover from the old MS-DOS days, and it applies only as the Linux kernel is initially loaded as the PC starts. In this case, the

make command displays an error message such as the following:

System is too big. Try using bzImage or modules.

If you get a 'System too big' error, type make bzImage to use a different type of compressed kernel that may fit within the memory limits. Otherwise, go through the

make config step again, and eliminate unnecessary features by answering No to those configuration questions. For other features you really need or may want to try out, type m to create modules. Although the kernel size is limited at startup, the kernel can load as many modules as it needs once the boot process is complete.











As the kernel is built, you see a lot of messages on the screen. When it's all over, there is a new kernel in the form of a compressed file named

zImage in the

/usr/src/linux-2.4/arch/i386/boot directory.

To use the new kernel, you have to copy the kernel to the

/boot directory under a specific name and edit the

/etc/grub.conf file to set up GRUB-the new boot loader. You learn these steps in the section, 'Installing the New Kernel and Setting up GRUB' later in this chapter. Before you proceed with the kernel installation, however, you have to build and install the modules.


Building and Installing the Modules


If you select any modules during the kernel configuration, you have to build the modules and install them. Perform these tasks with the following steps:



  1. Type the following commands to build the modules:

    cd /usr/src/linux
    make modules



  2. The current set of modules in a directory is named after the version of Linux kernel your system is running. For example, if your system runs kernel version 2.4.20-2.48, the modules are in the following directory:

    /lib/modules/2.4.20-2.48

    Move the module directory to a new location as follows:

    mv /lib/modules/2.4.20-2.48 /lib/modules/2.4.20-2.48-old



  3. Install the new modules with the following command:

    make modules_install



Now you can install the kernel and make it available for GRUB to boot.


Installing the New Kernel and Setting up GRUB


Red Hat Linux uses GRUB to load the Linux kernel from the disk. The configuration file

/etc/grub.conf lists the kernel binary that GRUB runs. You can examine the contents of the GRUB configuration file by typing the following command:

cat /etc/grub.conf

Here is what I see when I try this command on one of my systems with a SCSI adapter:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,2)
# kernel /vmlinuz-version ro root=/dev/hda5
# initrd /initrd-version.img
#boot=/dev/hda
default=0
timeout=10
splashimage=(hd0,2)/grub/splash.xpm.gz
title Red Hat Linux (2.4.20-2.48)
root (hd0,2)
kernel /vmlinuz-2.4.20-2.48 ro root=LABEL=/
initrd /initrd-2.4.20-2.48.img
title Windows XP
rootnoverify (hd0,1)
chainloader +1

You learn more about GRUB and its configuration file (

/etc/grub.conf ) by typing

info grub in a terminal window. For this discussion, you should note the following:



  • The

    default=0 line specifies the first boot entry as the default one that GRUB should boot.



  • The

    timeout=10 command causes GRUB to boot the default entry automatically after waiting for 10 seconds. If other boot entries are in the file, the user may select another one from a boot menu GRUB displays.



  • The four lines starting with title Red Hat Linux (2.4.20-2.48) define a specific kernel file GRUB can boot. You can make GRUB boot another kernel by adding a similar section to the configuration file.



  • The

    root (hd0,2) line sets the root device to the third partition of the first hard disk.



  • The

    kernel /vmlinuz-2.4.20-2.48 ro root=LABEL=/ line identifies the kernel GRUB loads. In this case, the kernel file is

    vmlinuz-2.4.20-2.48 , which is located in the root device-the third partition on the first hard disk. In my system, that partition is mounted on the

    /boot directory. In other words, GRUB loads the kernel file

    /boot/vmlinuz-2.4.20-2.48 . The

    root=LABEL=/ part of the line specifies that the Linux root file system is on the device whose label is

    / . This location may differ on your system.



  • The

    initrd /initrd-2.4.20-2.48.img line specifies a file that contains an initial RAM disk (

    initrd stands for initial RAM disk) image that serves as a file system before the disks are available. The Linux kernel uses the RAM disk-a block of memory used as a disk-to get started, then it loads other driver modules and begins using the hard disk.



On systems that have a Windows partition, the GRUB configuration file typically includes another section with details for the operating system (perhaps Windows 98, Windows 2000, or Windows XP) on that partition.

To configure GRUB to boot yet another kernel (the one you just built), you need to follow these steps:



  1. Copy the new kernel binary to the

    /boot directory. The new, compressed kernel file is in the

    /usr/src/linux-2.4/arch/i386/boot directory. If you have typed the command

    make zImage , the kernel filename is

    zImage; if you have built the kernel with the

    make bzImage command, the filename is

    bzImage . I simply copy that file to the

    /boot directory with the same name:

    cp /usr/src/linux-2.4/arch/i386/boot/zImage /boot

    If the kernel filename is

    bzImage , make sure you use

    bzImage instead of

    zImage . You can use any other filename you want, as long as you use the same filename when referring to the kernel in the

    /etc/grub.conf file in Step 3.



  2. Save the old

    System.map file in the

    /boot directory, and copy the new map file. (I assume you have rebuilt kernel version 2.4.20-2.48 after changing some configuration options):

    mv /boot/System.map-2.4.20-2.48 /boot/System.map-2.4.20-2.48-old
    cp /usr/src/linux*/System.map /boot/System.map-2.4.20-2.48
    cd /boot
    ln -s System.map-2.4.20-2.48 System.map



  3. Use your favorite text editor to edit the

    /etc/grub.conf file to add the following lines just after the

    splashimage line in the file. (If you need help with a text editor, consult Chapter 14 to learn about vi and Emacs-two popular text editors for Linux):

    title Red Hat Linux (2.4.20-2.48 NEW)
    root (hd0,2)
    kernel /zImage ro root=LABEL=/

    Note that I do not show the

    initrd line anymore because I assume you are no longer using a modular SCSI driver even if your system has a SCSI adapter.



  4. Save the

    grub.conf file, and exit the editor.






    Caution

    On your system, you should make sure the

    root (hd0,2) line is correct-instead of

    (hd0,2) , you should list the correct disk partition where the Linux

    /boot file system is located. Also, make sure that you use the correct filename for the kernel image file (for example,

    /boot/bzImage if the kernel file is so named).




After preparing the

/etc/grub.conf file, you are ready to reboot the system and try out the new kernel.


Rebooting the System to Test the New Kernel


While you are still logged in as

root , type the following command to reboot the system:

reboot

When you see the GRUB screen, select the name you have assigned to the new kernel in the

/etc/grub.conf file.








Secret


After the system reboots with the new kernel, you should see the familiar graphical login screen. To see proof that you are indeed running the new kernel, log in as a user, open a terminal window, and type uname -srv. This command shows you the kernel version, as well as the date and time when this kernel was built. If you have upgraded the kernel source, you should see the version number for the new kernel. If you have simply rebuilt the kernel for the same old kernel version, the date and time should match the time when you rebuilt the kernel. That's your proof that the system is running the new kernel.

If the system hangs (nothing seems to happen-there is no output on the screen and no disk activity), you may have skipped a step during the kernel rebuild. You can power the PC off and on to reboot. This time, select the name of the old working kernel at the GRUB screen.

If you cannot boot the older version of Red Hat Linux either, use the emergency boot disk (containing an earlier, but working, version of Linux) to start the system. Then, you can repeat the kernel rebuild and installation process, making sure you follow all the steps correctly.











/ 341