The following section describes how to add and reconfigure hardware using kudzu. The section after that describes how to manage loadable modules when hardware isn't being detected and configured properly.
When you add or remove hardware from your computer and reboot Red Hat Linux, a window appears during the reboot process advising that hardware has either been added or removed and asking if you want to reconfigure it. The program that detects and reconfigures your hardware is called kudzu.
The kudzu program is a hardware autodetection and configuration tool that runs automatically at boot time. If you like, you can also start kudzu while Red Hat Linux is running. In either case, here is what kudzu does:
It checks the hardware connected to your computer.
It compares the hardware it finds to the database of hardware information stored in the /etc/sysconfig/hwconf file.
It prompts you to change your system configuration, based on new or removed hardware that was detected.
The following is a list of hardware that kudzu can detect (according to the kudzu README file), followed by a description of what kudzu does to configure the device. Other devices may be detected as well (such as USB devices).
Network devices — Adds an Ethernet interface alias (eth0, eth1, etc.) if necessary and either migrates the old device configuration or creates a new one.
SCSI — Adds an alias for scsi_hostadapter.
Sound card — Runs the sndconfig command to configure and test the sound card.
Mouse — Links the new mouse device to /dev/mouse and runs the mouseconfig command to configure and test the mouse.
Modem — Links the new modem device to /dev/modem.
CD-ROM — Links the CD-ROM device to /dev/cdrom.
Scanner — Links the new scanner device to /dev/scanner.
Keyboard — Runs the kbdconfig command to reconfigure the keyboard. Also, if you are using a serial console, it makes sure /etc/inittab and /etc/securetty are configured to be used by a serial console.
The following is a list of actions kudzu takes when a device is removed:
Network — Removes the alias for the Ethernet interface (eth0, eth1, etc.).
SCSI — Removes the alias for the SCSI host adapter (scsi_hostadapter).
Mouse — Removes the link to /dev/mouse.
Modem — Removes the link to /dev/modem.
CD-ROM — Removes the link to /dev/cdrom.
Scanner — Removes the link to /dev/scanner.
To run kudzu, either reboot (during the reboot, kudzu is run automatically) or switch to a virtual terminal (Ctrl+Alt+F2), log in as root, and run the kudzu command. For any hardware that has been added or removed since the last time kudzu was run, you are asked if you want to configure it, not configure it, or do nothing.
In a perfect world, after installing and booting Red Hat Linux, all of your hardware should be detected and available for access. While Red Hat Linux is rapidly moving closer to that world, there are times when you must take special steps to get your computer hardware working.
Red Hat Linux comes with tools for configuring the drivers that stand between the programs you run (such as CD players and Web browsers) and the hardware they use (such as CD-ROM drives and network cards). The intention is to have the drivers your system needs most often built into the kernel; these are called resident drivers. Other drivers that are added dynamically as needed are referred to as loadable modules.
Appendix A contains descriptions of how to rebuild your kernel, including how to place drivers into your system as either resident kernel drivers or to have them available as loadable modules. This section describes how to display, add, and remove loadable modules in Linux.
If you have installed the Linux kernel source code (kernel-source package), source code files for available drivers are stored in subdirectories of the /usr/src/linux-2.4/drivers directory. There are several ways of finding information about these drivers:
make xconfig — With /usr/src/linux-2.4 as your current directory, type make xconfig from a Terminal window on the desktop. Select the category of module you are interested in and click Help next to the driver that interests you. The help information that appears tells you the module name and a description of the driver.
Documentation — The /usr/src/linux-2.4/Documentation directory contains lots of plain-text files describing different aspects of the kernel and related drivers. Of particular interest is the modules.txt file (which describes how to work with modules) and the Configure.help file (which contains all the help files hardware drivers).
kernel-doc — The kernel-doc software package (available on CD #3 of the Red Hat Linux distribution) contains a large set of documents describing the kernel and drivers. These documents are stored in the /usr/share/doc/kernel-doc* directory.
After modules have been built, they are installed in the /lib/modules/2.4* directory. The name of the directory is based on the current release number of the kernel. Modules that are in that directory can then be loaded and unloaded as they are needed.
In previous releases, Red Hat Linux stored modules in the /lib/modules directory, rather than the /lib/modules/2.4* directory. This new structure allows you to store modules on your system that relate to different kernel versions you may be running.
To see which modules are currently loaded into the running kernel on your computer, you can use the lsmod command. Here's an example:
# lsmod Module Size Used by sr_mod 15120 0 (autoclean) es1371 26784 0 (autoclean) ac97_codec 8704 0 (autoclean) [es1371] gameport 1920 0 (autoclean) [es1371] soundcore 4112 4 (autoclean) [es1371] binfmt_misc 6272 1 nuscsitcp 17200 0 (unused) autofs 10816 1 (autoclean) tulip 46400 1 ipchains 36960 0 (unused) ide-scsi 8192 0 scsi_mod 93568 3 [sr_mod nuscsitcp ide-scsi] hid 18160 0 (unused) input 3456 0 [hid] usb-uhci 21440 0 (unused) usbcore 50432 1 [hid usb-uhci] ext3 50656 2 jbd 39376 2 [ext3]
This output shows a variety of modules that have been loaded on a Linux system. The modules loaded on this system include several to support the Ensoniq 1371 sound card that is installed (es1371, ac97_codec, gameport, and soundcore). There are also modules to support the IDE CD-ROM drive running in SCSI emulation (scsi_mod, sr_mod, nuscsitcp, and ide-scsi).
To find information about any of the loaded modules, you can use the modinfo command. For example, you could type the following:
# modinfo -d es1371 "ES1371 AudioPCI97 Driver"
Not all modules have descriptions available. In this case, however, the es1371 module is described as an ES1371 AudioPCI87 Driver. You can also use the -a option to see the author of the module or -n to see the object file representing the module. The author information often has the e-mail address of the driver's creator, so you can contact the author if you have problems or questions about it.
You can load any module that has been compiled and installed (to the /lib/modules directory) into your running kernel using the insmod command. The most common reasons for loading a module are that you want to use a feature temporarily (such as loading a module to support a special file system on a floppy you want to access) or to identify a module that will be used by a particular piece of hardware that could not be autodetected.
Here is an example of the insmod command being used to load the parport module. The parport module provides the core functions to share parallel ports with multiple devices.
# insmod parport Using /lib/modules/2.4.20-2.48/kernel/drivers/parport/parport.o
After parport is loaded you can load the parport_pc module to define the PC-style ports available through the interface. The parport_pc module lets you optionally define the addresses and IRQ numbers associated with each device sharing the parallel port. For example:
# insmod parport_pc io=0x3bc irq=auto
In the previous example, a device is identified as having an address of 0x3bc. The IRQ for the device is autodetected.
The insmod command loads modules temporarily. At the next system reboot, the modules you enter disappear. To permanently add the module to your system, add the insmod command line to one of the start-up scripts that are run a boot time.
You can remove a module from a running kernel using the rmmod command. For example, to remove the module parport_pc from the current kernel, type the following:
# rmmod parport_pc
If the module is not currently busy, the parport_pc module is removed from the running kernel.