Configuring Hardware


For many hardware items that you attach to your computer, Linux will simply detect them and configure them. During system boot time, the kernel will probe and identify your IDE drives, SCSI drives, PCI cards, and other hardware. After Linux desktop is running, USB devices that you plug in (such as pen drives or digital cameras ) will be detected and any file systems they contain will be automatically mounted.

The following section describes how to add and reconfigure hardware in Linux. This includes sections on checking your hardware, using kudzu (for detecting and configuring hardware) and commands for working with loadable modules when hardware isn't being detected and configured properly.

Checking Your Hardware

Sometime the fact that Fedora or RHEL can't properly detect and configure your hardware may make it impossible for you to install Linux. In those cases, I suggest you try to determine what hardware you have before you install. See Chapter 2 for information on checking your hardware before installing Fedora or RHEL (you can try the bootable live Fedora system that comes on the media with this book to test your hardware).

Reconfiguring Hardware with Kudzu

When you add or remove hardware from your computer and reboot Linux, a window appears during the boot 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 Linux is running. In either case, here is what kudzu does:

  1. It checks the hardware connected to your computer.

  2. It compares the hardware it finds to the database of hardware information stored in the /etc/sysconfig/hwconf file.

  3. 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, and so on) 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 - 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, and so on).

  • SCSI - Removes the alias for the SCSI host adapter (scsi_hostadapter).

  • 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 simply run the kudzu command (as root user from a shell). 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.

Note 

Removable devices, such as digital cameras, USB flash drives, and Webcams, are detected and configured on-the-fly using the hald daemon. The hald daemon relies on the Udev device management facility to dynamically create devices and mount points (if needed) when those types of devices are connected. See Chapter 8 for descriptions of how CDs and digital cameras are detected.

Configuring Modules

In a perfect world, after installing and booting Linux, all of your hardware should be detected and available for access. While Fedora and Red Hat Enterprise Linux systems are rapidly moving closer to that world, there are times when you must take special steps to get your computer hardware working.

Fedora and RHEL systems come 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 only the most critical drivers your system needs built into the kernel; these are called resident drivers. Other drivers that are added dynamically as needed are referred to as loadable modules. The trend is to keep the basic kernel as lean as possible, so that each running system has only a few resident drivers and it can dynamically add what it needs.

Listing Loaded Modules

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 snd_seq_oss 38912 0 snd_seq_midi_event 9344 1 snd_seq_oss snd_seq 67728 4 snd_seq_oss,snd_seq_midi_event snd_seq_device 8328 2 snd_seq_oss,snd_seq . . . autofs 16512 0 ne2k_pci 9056 0 8390 13568 1 ne2k_pci ohci1394 41860 0 ieee1394 284464 1 ohci1394 floppy 65712 0 sg 36120 0 scsi_mod 124600 1 sg parport_pc 39724 0 parport 47336 1 parport_pc ext3 128424 2 jbd 86040 1 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 ALSA sound system, including some that provide OSS compatibility (snd_seq_oss).

To find information about any of the loaded modules, you can use the modinfo command. For example, you could type the following:

 #  modinfo snd-seq-oss   filename: /lib/modules/2.6.17-1.2630/kernel/sound/ core /seq/oss/snd-seq-oss.ko   author: Takashi Iwai <tiwai@suse.de>   description: OSS-compatible sequencer module   license: GPL   alias: sound-service-?-1   alias: sound-service-?-8   parmtype: seq_oss_debug:int   parm: seq_oss_debug:debug option   parmtype: maxqlen:int   parm: maxqlen:maximum queue length   vermagic: 2.6.17-1.2630_FC5 686 REGPARM 4KSTACKS gcc-4.1   depends: snd,snd-seq,snd-seq-midi-event,snd-seq-device  srcversion: 993A0EE5C290DE0307DC6F7 

This output tells you the location of the module (filename), the author, and description, among other information. The output describes snd-seq-oss as an OSS-compatible sequencer module. You can use the -d option to list just the description, 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.

Loading Modules

You can load any module that has been compiled and installed (to the /lib/modules directory) into your running kernel using the modprobe 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 modprobe command being used to load the parport module. The parport module provides the core functions to share parallel ports with multiple devices.

 #  modprobe parport  

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:

 #  modprobe 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 modprobe command loads modules temporarily. At the next system reboot, the modules you enter disappear. To permanently add the module to your system, add the modprobe command line to one of the start-up scripts that are run a boot time.

Note 

An alternative to using modprobe is the insmod command. The advantage of using modprobe , however, is that insmod will only load the module you request, while modprobe will try to load other modules that the one you requested is dependent on.

Removing Modules

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. (Instead of rmmod , you can use modprobe -r to remove the module, plus related modules.)




Fedora 6 and Red Hat Enterprise Linux Bible
Fedora 6 and Red Hat Enterprise Linux Bible
ISBN: 047008278X
EAN: 2147483647
Year: 2007
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net