۱.۱۰۱.۱ - پیکربندی تنظیمات پایه‌ای BIOS\\ تنظیمات BIOS\\ این بخش احتیاجات سرفصل 1.101.1 را برای سطح مقدماتی مدیریت ( LPIC-1 ) پوشش می دهد. این بخش دارای ارزش 1 در آزمون است.\\ ما با مروری بر سیستم های شخصی پیشرفته امروزی شروع خواهیم کرد و سپس به موضوع پیکربندی تنظیمات سیستم خواهیم پرداخت. در اینجا ما بر روی سیستم هایی که از پردازنده های x86 استفاده می کنند مانند پردازنده های Intel® Pentium® و AMD Athlon و گذرگاه های PCI که امروزه بیشتر معمول هستند تمرکز خواهیم کرد.\\ Many of the topics covered here have a high level of overlap with LPI objectives for specific peripherals. Later sections of this tutorial will refer you back to this section for basic material.\\ بسیاری از سرفصلهایی که در ایجا پوشش داده می شود در سطحی بالاتر با سرفصلهای LPI برای ابزارهای خاص همپوشانی دارد. در بخش بعدی به این فصل به عنوان پیش نیاز رجوع داده می شوید.\\ مروری بر سیستم و BIOS\\ A modern personal computer (or PC) system consists of a central processing unit (CPU) for performing calculations, along with some memory for storing the data that the processor is using. To make such a device useful, we attach peripheral devices, such as keyboards, mice, displays, hard drives, CD or DVD drives, printers, scanners, and network cards, which allow us to enter, store, print, display, and transmit data.\\ In the computer just described, the memory used by the processor is called Random Access Memory (RAM). In a typical PC, this memory is volatile, meaning that it requires power to keep its data. Turn off the PC and the memory is wiped clean. Put another way, when we turn off a PC, we turn it into a collection of hardware components that will do nothing until reprogrammed. This reprogramming occurs when we turn on the machine; the process is called bootstrapping or booting the computer.\\ Bootstrap process and BIOS\\ The process of booting involves loading an operating system from an external storage device, such as a floppy disk, CD, DVD, hard drive, or memory key. The program that does this initial loading is permanently stored in the computer and is called the Basic Input Output System (BIOS). The BIOS is stored in non-volatile memory, sometimes called Read Only Memory (ROM). In early PCs, the ROM chip was often soldered or socketed to the computer main board (or motherboard). Updating the BIOS meant replacing the ROM chip. Later, Electrically Erasable Programmable Read Only Memories (EEPROMs) were used. EEPROMs allowed BIOS to be upgraded in the field with a diskette instead of special tools. Today you will more often find a form of non-volatile memory known as Flash memory, which is also used in digital cameras and memory keys. Flash memory also permits BIOS upgrades in the field.\\ Besides controlling the initial bootup of a PC, today's BIOS programs usually permit a user to set or verify several configuration options on a system. These include verifying installed features such as RAM, hard drive, optical drive, keyboard, mouse, and possibly onboard display, sound and network connections. The user may enable or disable some features. For example, the onboard sound may be disabled to allow use of an installed sound card. The user may also choose which devices will be considered for booting the system and whether the system is protected by a password.\\ Accessing the BIOS setup screens usually requires a keyboard to be attached to the system. When a system is powered on a Power On Self Test or POST is performed. On some systems you will be briefly prompted to press a particular key to enter setup otherwise normal bootup takes over. On other systems you will need to know which key to press before the normal boot process is invoked as the prompt is either not present or may have been removed as the result of previous customization of setup options. On some systems you may have other choices besides going to the BIOS setup, such as illustrated in Figure 1. Otherwise, you should see a BIOS summary screen such as that shown in Figure 2.\\ The above illustrations are examples of what you may see, but BIOS setup screens vary widely, so don't be surprised if yours looks different.\\ Figure 2 shows us that the Flash EEPROM (or system BIOS) revision level is 24KT52AUS and it is dated March 4, 2004 while the current date on the system is June 9, 2005. A check on the manufacturer's (IBM) support site shows that several later BIOS versions are available, so it would probably be a good idea to upgrade this system's BIOS.\\ You will notice several other menu selections in Figure 2. We will cover these in the remaining sections of this tutorial. Before we do though, let's review a little more of the inner workings of a PC.\\ در اینجا ترجمه نوشته می‌شود. (بهراد)\\ Buses, ports, IRQs, and DMA.\\ PCI and ISA buses\\ Peripheral devices, including those that may be built in to the system board, communicate with the CPU over a bus. The most common bus type in use today is the Peripheral Component Interconnect or PCI bus which has mostly superseded the earlier Industry Standard Architecture or ISA bus. The ISA bus was sometimes called the AT bus after the IBM PC-AT in which it was first used in 1984. During the transition from ISA to PCI bus, many systems included both buses with slots permitting the use of either ISA or PCI peripherals.The ISA bus supports 8-bit and 16-bit cards, while the PCI bus support 32-bit devices.\\ There are a couple of other bus standards that you should also know about. Many systems include an Accelerated Graphics Port or AGP slot which is a special slot based on the PCI 2.1 bus specification, but optimized for the high bandwidth and fast response required for graphics cards. This is slowly being replaced by the newer PCI Express or PCI-E bus which addresses many limitations of the original PCI design.\\ We'll learn more about the Linux file system in later tutorials in this series, but right now we'll introduce you the /proc filesystem. This is not a real filesystem on disk, but a "pseudo file system" which provides information about the running system. Within this file system, the file /proc/pci contains information about the devices on the system's PCI bus. There has been some discussion about discontinuing this particular file, as the lspci command gives similar information. Run the command cat /proc/pci to see output which will look something like Listing 1.\\ The port numbers are in hexadecimal (base 16). You'll doubtless see several that look familiar, such as keyboard, timer, parallel (printer), serial (modem) and display (vga+). Compare these with the some of the standard IO port assignments for a PC as shown in Listing 3. Notice, for example, that the first parallel port is (parport0) has the address range 0378 to 037A allocated in the /proc/ioports listing, but the standard allows it (LPT!) to use the range 378 through 37F.\\ Interrupts\\ So how does the CPU know when the last output is finished or when data is waiting to be read? Usually, this information is available in a status register which may be accessed by reading one (or more) of the IO ports associated with a device. Two obvious problems arise with this scenario. Firstly, the CPU has to spend time checking the status. Secondly, if the device has data coming from somewhere, such as an attached modem, the data must be read by the CPU in a timely fashion otherwise it might be overwritten by the next available data byte.\\ The dual problems of not wasting unnecessary CPU cycles and ensuring that data is read or written in a timely fashion are addressed by the concept of interrupts. Interrupts are also called Interrupt Requests or IRQs. When something happens in a device that the CPU needs to know about, the device raises an interrupt and the CPU temporarily stops whatever else it was doing to deal with the situation.\\ With our experience from the last section, it should hardly come as a surprise that information on interrupts is also kept in the /proc file system, in /proc/interrupts. Run the command cat /proc/interrupts to see output which will look something like Listing 4.\\ This time, the interrupt numbers are decimal in the range 0 through 15. Once again, Compare these with the standard IRQ assignments for a PC as shown in Listing 5.\\ Originally, each device had its own private IRQ. In Listing 5, note, for example, that IRQ5 was often used for either a sound card or a second parallel (printer) port. If you wanted both, you had to find a card that could be configured (usually via hardware jumper settings) to use another IRQ such as IRQ15.\\ Today, PCI devices share IRQs, so that when one interrupts the CPU, an interrupt handler checks to see if the interrupt is for it and, if not, passes it to the next handler in the chain. Listings 4 and 5 do not tell us about this sharing. We will learn about the grep command in a later tutorial, but for now we can use it to filter the output from the dmesg command to look for bootstrap messages about IRQs as shown in Listing 6. we've highlighted the shared interrupts here.\\ DMA\\ We mentioned earlier that communication with peripheral devices through IO ports occurs a byte or two at a time. For a fast device, servicing interrupts could use a lot of the CPUs capability. A faster method is to use Direct Memory Access or DMA, in which a few IO instructions tell the device where in RAM to read or write data and then the DMA controller provides hardware management of the actual transfer of data between RAM and the peripheral device.\\ Hands up anyone who can guess where we find information about the DMA channels are in use. If you said it is in /proc/dma, then you are right. Run the command cat /proc/dma to see output which will look something like Listing 7.\\ s that all? It is important to remember that most devices will only request one of the limited number of DMA channels when IO is actually happening, so /proc/dma will frequently look nearly empty as in our example. We can also scan the bootstrap messages for evidence of DMA capable devices as we did for IRQs above. Listing 8 shows typical output.\\ Plug and play\\ Early PCs allocated fixed port numbers and IRQs for particular devices, such as keyboard or parallel printer port. This made it difficult to add new devices or even run two devices of the same type such as two modems or two printers. The first serial port was usually called COM1 and the second COM2. Linux systems usually refer to these as ttyS0 and ttyS1. Some cards were configurable usually with hardware jumpers which allowed a modem to operate as either COM1 or COM2, for example. As devices proliferated and the original space allocated for IO port addresses and IRQs became scarce, Plug and Play or PnP was developed. The idea was to allow a device to tell the system how many and what kind of resources it needed and for the BIOS to then tell the device which particular resources it should use. This semi-automatic configuration was introduced with the IBM PS/2 which used a bus architecture called microchannel. Later, the idea, and the plug and play name were used for ISA cards, particularly modems and sound cards which were popular add-on cards at the time. The PCI bus advanced the idea further and all PCI devices are inherently plug and play.\\ If you happen to work on a system with ISA PnP devices, be aware that you must avoid port and IRQ conflicts between devices. Ports cannot be shared between two devices; each device must have its own ports. The same applies for DMA channels. With few exceptions, ISA devices cannot share IRQs either. If you have non-PnP devices, you must manually configure each device so that it does not interfere with another device. The promise of PnP was that configuration could be performed automatically. However, with some ISA devices not participating in PnP, this does not always work perfectly. You may be able to resolve conflicts using the isapnptools that we will discuss next, or you may have to reassign some of the ports or IRQs on non-PnP devices in order to get a working system.\\ Prior to the 2.4 kernel, a package called isapnptools allows a user to configure PnP devices. The isapnp command interprets a configuration file (normally /etc/isapnp.conf) to configure PnP devices. This is usually done during the Linux boot process. The pnpdump command scans PnP devices and dumps a list of resources your PnP cards either need or would prefer to use. The format is suitable for use by the isapnp command, once you uncomment the actual commands that you wish to use. You must be sure to avoid resource conflicts. Refer to the man pages for isapnp and pnpdump for more information on using these commands.\\ Since the 2.4 kernel, PnP support has been integrated into the Linux kernel and the isapnptools package has become obsolete. For example, it was removed from Red Hat 7.3 which was released in May 2002. The support is similar to the PCI support discussed earlier. You can use the lspnp command (part of the kernel-pcmcia-cs package) to display information about PnP devices. You will also find this information in the /proc file system if the BIOS found PnP devices during initialization. The file /proc/bus/pnp will contain this information. This file will not be present on a PCI-only system.\\ گذرگاه های PCI و ISA\\ دستگاه های جانبی آنهایی که ممکن است در برد سیستم نصب شوند که توسط یک گذرگاه یا CPU ارتباط برقرار می کنند.عمومی ترین نوع گذرگاه که امروزه مورد استفاده قرار می گیرد Component Interconnect یا گذرگاه PCI است که در صنعت ISA یا Standard Architecture بسرعت جا افتاد. گذرگاه ISA گاهی (بعد از IBM PC-AT که در سال ۱۹۸۴ برای اولین بار مورد استفاده قرار گرفت)گذرگاه AT نیز می نامند.در طول انتقال از گذزگاه ISA به گذرگاه PCI بیشتر سیستم ها شامل هر دو گذرگاه بودند که توسط شکافها یا Slots از دستگاه های جانبی PCI یا ISA استفاده می کنند.گذرگاه ISA کارتهای ۸-بیت و ۱۶-بیت را پشتیبانی می کند در حالی که گذرگاه PCI دستگاهای ۳۲-بیت را پشتیبانی می کند.گذرگاه های استاندارد دیگری نیز وجود دارند که باید درباره آنها بدانید.بیشتر سیستمهای کامپیوتری شامل یک شکاف Accelerated Graphics Port یا AGP هستند که شکاف خاصی است که بر پایه گذرگاه PCI۲.۱ بنا شده است که این کار برای بهبود پهنای باند و پاسخگویی سریع به درخواست ها برای کارت گرافیک ایجاد شده است.گذرگاه PCI به آرامی توسط گذرگاه جدید PCI Express یا PCI-E که بسیاری از محدودیت هایی را که در طراحی PCI اصلی وجود دارد را برطرف کرده است.\\ در اینجا ترجمه نوشته می‌شود (آربی)\\ IDE Hard drives\\ On modern PC systems, Integrated Drive Electronics or IDE hard drives are the most common. These are also known as AT Attachment or ATA drives after the original IBM PC-AT. Another type of drive using the Small Computer System Interface or SCSI interface is also popular, particularly on server machines. IDE drives have an advantage of low cost, while the SCSI interface permits attachment of a larger number of drives, with higher potential for overlapping operations to different drives on the same bus, and therefore higher potential performance.\\ A new type of drive, called Serial ATA or SATA has recently entered the market. The SATA specification seeks to address some of the limitations of the ATA specification while preserving significant compatibility with ATA.\\ BIOS and IDE drive sizes\\ IDE drives are formatted into sectors, data units of 512 bytes. A drive might contain multiple rotating disk platters, so the sectors are arranged in concentric circles with each circle called a cylinder. Data from a particular platter is read or written by a head. To find the data in a particular sector, the disk moves the head assembly to the cylinder, selects the appropriate head and waits for the right sector to come under the head. This gives rise to the notion of CHS (for Cylinder, Head and Sector) addressing. You may also hear this called disk geometry.\\ Unfortunately for history, early BIOS implemented a limit to the size permitted for each of the C, H and S values and DOS, a popular operating system for the PC, implemented a different limitation. During the 1990s, Disk sizes quickly outstripped the artificial CHS limitations imposed by BIOS and DOS. Several intermediate strategies involved translating the real CHS values to "virtual" values that would meet the constraints, either in the BIOS itself or by means of low level software routines such as Ontrack's Disk Manager software.\\ Even without the artificial limits of BIOS or DOS, the CHS design allows for up to 65536 cylinders, 16 heads, and 255 sectors/track. This limits the capacity to 267386880 sectors, or approximately 137 GB. Note that disk capacities, unlike some other PC values, are measured in powers of 10, so 1GB=1,000,000,000 bytes.\\ The solution was to have the system ignore the geometry and leave that to the drive to figure out. The system, instead of asking for a CHS value simply asks for a Logical Block Address or LBA and the drive electronics figure out which real sector to read or write. The process was standardized in 1996 with the adoption of the ATA-2 standard (ANSI standard X3.279-1996, AT Attachment Interface with Extensions).\\ As we discussed earlier, BIOS is needed to boot a system, so booting from a hard drive requires that the BIOS understand enough of the disk layout to locate and load the initial program that will then load the full operating system. An older BIOS that does not understand LBA disks will probably be limited to booting from within the first 1024 cylinders of a disk, or at least the first 1024 cylinders as the BIOS understands the disk geometry! Such a BIOS is probably now fairly rare, but if you do need to work with one, it may have a setting for LBA support and you may need to locate the /boot directory in a partition within the first 1024 cylinders. Even when your system will happily boot from the very end of a very large disk, many Linux partitioning tools will warn you that a partition extends beyond the 1024 cylinder limit.\\ Figure 3 shows information available in the BIOS of my Intel motherboard for the 250GB IDE disk on one of my Linux systems.\\ Listing 9 shows part of the output available on a Linux system (Fedora Core 3 in this case) using the hdparm -I /dev/hda command for the same disk as was used in Figure 3. Note that CHS values limit addressing to 4,128,705 sectors and the LBA value is set to 268,435,455 sectors or 137GB. These values together imply that the real capacity is in the LBA48 value. This is 490,234,752 sectors or 251GB.\\ While we are discussing booting, one other point should be noted. By default, a PC will boot from the first IDE drive in the system. Some systems have BIOS settings that will allow you to override this, but most will boot this way. The system will first load a small piece of code from the master boot record and that will, in turn, provide information on which partition to boot. We will cover more about boot loaders for Linux in a later tutorial.\\ If you'd like to know even more about the history of large disks, see Resources for a link to the Large Disk HOWTO which is available from the Linux Documentation Project.\\ Linux disk names\\ We will cover a lot more about how Linux uses disks in later tutorials in this series. However, right now is a good time to introduce you to another important Linux file system, the /dev filesystem. This, like /proc, is a pseudo file system which describes the devices that are or could be on a Linux system. Within the /dev filesystem you will find entries such as /dev/hda, /dev/hda5, /dev/sda, /dev/sdb1 and so on. You will find lots of other entries for other device types, but for now lets look at the ones that start with either /dev/hd or /dev/sd.\\ Devices that start with /dev/hd, such as /dev/hda or /dev/hda5 refer to IDE drives. The first drive on the first IDE controller is /dev/hda and the second one, if present, is /dev/hdb. Likewise, the first drive on the second IDE controller is /dev/hdc and the second one is /dev/hdd. As you can see from Listing 10, there are many more defined in /dev than are likely on your system.\\ As we did earlier for IRQs, we can use the dmesg command to find out what disk devices were found during bootstrap, Output from one of my systems is shown in Listing 11.\\ From the highlighted lines in Listing 11, we see that the system has two IDE drives (hda and hdc) and a DVD-RW drive (hdd). Note that there is no hdb, indicating that there is no second drive on the first IDE controller on this system. An IDE drive can have up to four primary partitions and an unlimited number of logical partitions. Considering the drive hdc in Listing 11, we see that it has one primary partition (hdc1) and four logical partitions (hdc5, hdc6, hdc7, and hdc8). We will see in Topic 104 in a later tutorial in this series that hdc1 is actually a container (or extended partition) for the logical partitions.\\ Historically, devices such as sda and sdb were SCSI disks, which we will discuss further when we see how to set up SCSI devices Up to the 2.4 kernel, IDE CD and DVD devices were usually handled through SCSI emulation. Such a device often appeared in /dev as something like /dev/cdrom which was a symbolic link to the SCSI emulated device. For the above system, Listing 12 shows that /dev/cdrom is a link to /dev/scd0 rather than to /dev/hdd as might have been expected. Note the hdd=ide-scsi kernel parameter in Listing 11 as well as the indication that the ide-scsi driver was attached for hdd.\\ Today, you will find that both USB and SATA storage devices appear as sd, rather than hd, devices.\\ در اینجا ترجمه نوشته می‌شود.(شهریار)\\ Legacy peripherals\\ We have alluded above to peripherals such as serial or parallel ports that are usually integrated into a motherboard, and we have seen some standard IO port and IRQ assignments for these devices. Serial ports, in particular, have been used for connecting a variety of devices and they have a history of being hard to configure. With the advent of IEEE 1394, also known as Firewire and Universal Serial Bus or USB devices, automatic configuration and hot plugging of devices has largely replaced the chore of ensuring correct serial or parallel port configuration. Indeed, a legacy-free system does not support the standard serial or parallel ports. Neither does it support a floppy drive or a PS/2 connected keyboard or mouse.\\ We'll now discuss some common BIOS settings that you may need to configure.\\ Serial ports (COMn)\\ The legacy serial ports are known as COM1 through COM4. If your system has a single serial port connector (originally a 25-pin DB25 connector but now more commonly a 9-pin DB9 connector) it will probably use the default base address and IRQ for COM1, namely IO port 3F8 and IRQ 4. The standard IO port addresses and IRQs for serial ports are shown in Table 3.\\ You will notice that COM1 and COM3 share IRQ 4 and likewise COM2 and COM4 share IRQ 3. Unless the driver and the device can actually share the interrupt, or a device does not use interrupts, this means that most real systems will use only COM1 and COM2.\\ Occasionally, you may need to either disable an onboard serial port or configure it to use an alternate address and IRQ. The most likely reason to do this is because of conflicts with a PnP modem in an ISA slot or a desire to use the PnP modem as COM1. We recommend that you only change these if you are having problems with Linux detecting your configuration.\\ Parallel ports (LPTn)\\ The legacy parallel ports are known as LPT1 through LPT4, although usually only at most two are present. If your system has a single parallel port connector it will probably use the default base address and IRQ for LPT1, namely IO port 378 and IRQ 7. The standard IO port addresses and IRQs for parallel ports are shown in Table 4.\\ Note that the IO ports 3BC-3BE were originally used on a Hercules graphics adapter that also had a parallel port. Many BIOS systems will assign this range to LPT1 and then the other two ranges would become LPT2 and LPT3 respectively instead of LPT1 and LPT2.\\ Many systems do not use interrupts for printers, so the IRQ may or may not actually be used. It is also not uncommon to share IRQs for printing and also to share IRQ 7 with a sound card (Sound Blaster compatible).\\ The parallel ports were originally used for printing with data flowing to the printer and a few lines reserved for reporting status. Later, the parallel port was used for attaching a variety of devices (including early CD-ROMs and tape drives), so the output-only nature of the data flow changed to a bidirectional data flow.\\ The current standard applicable to parallel ports is IEEE Std. 1284-1994 Standard Signaling Method for a Bi-Directional Parallel Peripheral Interface for Personal Computers which defines five signaling modes. Your BIOS may give you choices in setup such as bi-directional, EPP, ECP and EPP and ECP. ECP stands for Enhanced Capabilities Port and is designed for use with printers. EPP stands for Enhanced Parallel Port and is designed for devices such as CD-ROMs and Tape drives which require large amounts of data to flow in either direction. The default BIOS choice is likely to be ECP. As for serial ports, change this only when you have a device that does not work properly.\\ Floppy disk port\\ If your system has a legacy floppy disk controller, it will use ports 3F0-3F7. If you install a legacy floppy drive in a system that shipped without one, you may have to enable legacy options in your BIOS. Consult the manufacturer's information for more details.\\ در اینجا ترجمه نوشته می‌شود.(بهراد)\\ Keyboard and mouse\\ The keyboard/mouse controller uses ports 0060 and 0064 for legacy keyboards and mice. That is, those connected by a round PS2 connector. Many systems will generate a Power-On-Self-Test (POST) error if a keyboard is not attached. Most machines designed to be used as servers, and many desktops, now have BIOS options to allow clean startup without a keyboard or mouse present.\\ Once a system is installed, running without a keyboard (or mouse) is seldom a problem. Servers frequently run this way. Management is performed over the network using either web administration tools, or a command line interface such as telnet or (preferably) ssh.\\ Installation on a keyboardless system is usually accomplished using a terminal (or terminal emulator) attached through a serial port. Usually, you will need a keyboard and display to ensure that the BIOS is set up correctly with an enabled serial port. You may also need a customized boot disk or CD to perform a Linux system install.\\ Another approach used by systems such as the IBM JS20 blade server is to emulate a serial connection over a LAN.\\ در اینجا ترجمه نوشته می‌شود.(بهراد)\\