Read an Excerpt
Hardware and ArchitectureTerms you'll need to understand:
- Serial port
- I/O address
- I/O port
- Parallel port
- Chat script
- Setting the system clock
- Checking serial port configurations
- Documenting IRQ and port settings
- Accessing the SCSI BIOS and determining the ID
- Creating a disk partition and a file system
- Configuring a network interface card (NIC), modem, and sound card
- Configuring a SLIP and PPP connection
System ArchitectureLinux is available for a variety of platforms, with each offering its own idiosyncrasies in configuration and device management. The most common hardware in use for Linux today is the Intel family of processors. Linux also runs on system architectures as different as the Compaq (formerly DEC) Alpha, the RISC-based processors and the Motorola 68K processors.
With the wide support for system processors, a variety of bus architectures are supported, including:
- ISA, VLB, EISA, and PCI
- PS/2 MCA
Laptops pose a special problem due to the specific nature of their hardware design. As a result, it can sometimes be a challenge to get Linux to operate correctly on them. This primarily has to do with the customized nature of hardware services such as sound and video, modems and power management, or the use of PCMCIA cards; we discuss these issues later in this chapter.
Before moving on to the other topics, we should point out the proc file system structure can provide you with information about your system. For example, /proc/interrupts identifies the currently used interrupt request lines on your system, as shown in Figure 2.1.
Figure 2.1 The /proc/interrupts file shows what IRQ resources are presently in use.
From Figure 2.1, you can see the interrupts used on this machine and what they are currently assigned to. Note that this particular system does not have a parallel port (as neither interrupt 5 nor 7-typical for parallel ports-is in use on the system). Knowing the interrupts in use will be important later on when we're adding other hardware, such as serial ports.
BIOSThe BIOS (basic input-output system) provides the interface between the system hardware and the operating system software. All requests to perform activities that the operating system software makes of the hardware (such as accessing the floppy disk drive) are made through the system BIOS.
The BIOS and its settings are different for each computer system in use today. A system that uses PCI bus architectures has different BIOS configurations than does a system with an EISA bus. These differences make configuring the BIOS a special challenge and require that you have the appropriate documentation for your BIOS revision and system board.
Figure 2.2 illustrates a sample BIOS from a PCI-based Pentium system (the exact version of which is unimportant for our discussion). This system has two hard disks: one configured as the primary IDE master and one as the secondary IDE master. The first disk has specific information entered regarding the disk geometry, and the second is set to autodiscover the disk geometry. The system diskette drives and video type also are defined at this level in the BIOS.
Figure 2.2 The BIOS holds drive-configuration details.
Changing the date and time in the BIOS affects the hardware clock and subsequently alters the time reported by the operating system.
Setting the ClockLinux is aware of the state of the hardware clock, which it uses to track the actual time of day. To configure the clock under Linux, you must perform two steps. First, you configure the time zone to ensure that the time is reported correctly and that messages or information received from outside your time zone also are properly reported. (The time zones are used to provide the correct time in the different geographical areas based on GMT (Greenwich Mean Time), which is also known as UTC or Universal Time Clock. The terms are synonymous and refer to the time at Greenwich, England.)
Once the time zone is selected, you must set the correct date and time. Both of these steps will be reviewed.
Running the timeconfig program as root produces the display shown in Figure 2.3. You'll select the time zone from here. The time zones defined here cover the entire globe, and an option identifies if the hardware clock is set to GMT. If you set your hardware clock to GMT, be sure to check this box. Otherwise, leave it empty.
Figure 2.3 Configuring the time zone is a necessary step when setting the correct time.
After selecting the time zone, timeconfig exits to the prompt. At this point, we can set the correct system time using the date command. The date command is typically used to retrieve the system date, as in:
[root@localhost bin]# date Sun Nov 12 16:10:08 EST 2000
Multitudes of settings can be passed to the date command to adjust the actual output results, but these options aren't applicable to this discussion. To set the time, the superuser ("root") must provide the new date and time on the command line. This date and time is then applied to the system. Here is an example:
[root@localhost bin]# date Sun Nov 12 16:12:19 EST 2000 [root@localhost bin]# date 111110112000.22 Sat Nov 11 10:11:22 EST 2000 [root@localhost bin]#
In the preceding example, we see the current date and time how we change it. The arguments to the date command are:
The parameters are:
- MM-two-digit year
- DD-two-digit day of the month
- hh-two-digit hour in 24-hour clock format
- mm-two-digit minutes
- CC-two digits of the year (century)
- YY-current year
- ss-the number of seconds to be applied
The values for century, year, and seconds are optional, because the system applies the current century and year and resets the number of seconds to zero when setting the time. In the following example, we set the date and time using only the required arguments:
[root@localhost bin]# date 12252349 Mon Dec 25 23:49:00 EST 2000 [root@localhost bin]#The time zone and clock now are set. However, most systems suffer from clock drift, which affects the accuracy of the clock. The use of an NTP (Network Time Protocol) server is highly recommended to keep the system clock synchronized. From a security perspective, if all the systems in your network are synchronized to the same time source, it's easier to track any intrusions through the systems.
Using I/O Communication PortsLinux supports the standard serial, parallel, and joystick ports that are common to today's computer systems. The basic kernel includes support for the serial UART types 8250, 16450, 16550, and 16550A. More than nine IRQ lines can also be used. Support is included in the kernel for two single-port and multiport serial cards.
The CPU processes all the data that is received from the serial port. Consequently, the CPU must know where the data is to be received and what signal or interrupt is used to tell the CPU that data needs to be processed. These are called I/O ports and IRQs. Thus, every serial port device must store in its nonvolatile memory both its I/O address and its IRQ (interrupt request) number.
Don't confuse I/O addresses with memory addresses, because they aren't the same. The memory address normally used by main memory is ignored, and the I/O address is used to transmit and receive data with the serial device. Multiport serial cards are available in two formats: intelligent and dumb. A nonintelligent serial port card relies totally upon the CPU to perform all the I/O processing, just as a single-port serial card does. This reliance on the CPU greatly affects the performance of the system as the level of data on the serial ports increases. Intelligent serial cards alleviate this problem by putting a processor on the serial port card to perform the I/O processing and then sending a block of data to the CPU for processing.
The nonintelligent cards come in two varieties. One uses the AST Fourport approach, using a block of memory addresses and a single IRQ. The second format uses four IRQ lines for serial data processing. It's advisable to know the type of processing and amount of data to be handled through the serial port when making the decision to buy a multiport serial card.
Device NamesThe serial ports are named ttyS0, ttyS1, and so on, and they usually correspond respectively to COM1, COM2, and so on in DOS/Windows. The /dev/ directory contains a file for each serial port that's available on the system, as seen in the following example:
[chare@localhost chare]$ ls -l /dev/ttyS* crw------ 1 root tty 4, 64 May 5 1998 /dev/ttyS0 crw------ 1 root tty 4, 65 May 5 1998 /dev/ttyS1 crw------ 1 root tty 4, 66 May 5 1998 /dev/ttyS2 crw------ 1 root tty 4, 67 May 5 1998 /dev/ttyS3 [chare@localhost chare]$
It's important to remember that just because the device file exists does not mean a physical device is associated with it. The serial port driver in the kernel maintains a list of the I/O addresses for ea_h serial port, and this table maps the physical device to its name. The setserial command is usad to list and alter the serial port configuration. The arguments for setserial are identified below....