System Architecture (Topic 101.1) 系统结构
This Topic requires general knowledge of fundamental PC architecture facts that you must know before attempting any operating system installation. It includes this Objective:
这个项目需要你在安装任何一个操作系统之前,掌握基本的PC结构基础知识。包含以下目标:
Objective 1: Determine and Configure Hardware Settings Weight: 2.
检测并设置你的硬件
Candidates should be able to determine and configure fundamental system hardware. Setting up a PC for Linux (or any other operating system) requires some familiarity with the devices installed in the system and their configuration. Items to be aware of include modems, serial and parallel ports, network adapters, SCSI adapters, hard drives, USB controllers, and sound cards. Many of these devices, particularly older ones, require manual configuration of some kind to avoid conflicting resources. The rest of the configuration for the system hardware is done in the PC’s firmware, or Basic Input/Output System (BIOS).
应考者应该能够确定和配置基本的硬件系统。针对Linux(或其他的操作系统)设置PC需要熟悉系统中设备的安装和配置。应该知道猫、串行和并行端口、网络适配器、SCSI适配器、硬盘驱动器、USB控制器、声卡等。很多这样的设备,特别是更早的一些设置,它们需要手动配置一些参数来避免资源冲突。系统硬件的其他设置在PC的固件中完成,或者基本的输入输出系统中(BIOS)。
BIOS
The firmware located in a PC, commonly called the BIOS, is responsible for bringing all of the system hardware to a state at which it is ready to boot an operating system. Systems vary, but this process usually includes system initialization, the testing of memory and other devices, and ultimately locating an operating system from among
several storage devices. In addition, the BIOS provides a low-level system configuration interface, allowing the user to choose such things as boot devices and resource assignments. Quite a few BIOS firmware vendors provide customized versions of their products for various PC system architectures. Exams do require an understanding of the basics. For example, a laptop BIOS may differ significantly from a desktop system of similar capability from the same manufacturer. Due to these variations, it’s impossible to test specifics, but the LPIC Level 1 exams do require
an understanding of the basics.
PC中的固件一般也被称作BIOS,它负责使所有系统硬件达到一个准备启动操作系统的状态。系统虽然不同,但这个过程通常包含系统初始化、内存和其他设备的检测,最后,在一些存储设备中确定操作系统的位置。另外,BIOS提供了一个低级别系统配置接口。它允许用户选择诸如启动设备和资源分配。相当多的BIOS固件供应商针对不同的PC系统架构提供他们产品的定制版本。考试要求理解基础。比如,一个笔记本的BIOS可能和同一制造商的具有类似功能桌面系统大不相同。由于这些变化点,不可能测试细节,但LPI 1考试的确要求对基础的理解。
At boot time, most PCs display a method of entering the BIOS configuration utility,usually by entering a specific keystroke during startup. Once the utility is started, a menu-based screen in which system settings can be configured appears. Depending on the BIOS vendor, these will include settings for disks, memory behavior, on-board ports (such as serial and parallel ports), and the clock, as well as many others.
启动时,大多数的PC机显示一个进入BIOS配置功能的方法。通常在启动时以输入一个特定的按键的方式进入。一旦这个功能启动,会显示一个基于菜单的可以配置系统设置屏幕,根据BIOS提供商,将包含硬盘、内存性能,板载端口(比如串行和并行端口)、时钟以及很多其他设置。
Date and time 日期与时间
One of the basic functions of the BIOS is to manage the on-board hardware clock. This clock is initially set in the BIOS configuration by entering the date and time in the appropriate fields. Once set, the internal clock keeps track of time and makes the time available to the operating system. The operating system can also set the hardware clock, which is often useful if an accurate external time reference, such as an NTPD server (see Chapter 16), is available on the network while the system is running.
BIOS的一个基本功能就是管理板载硬件时钟。这个时钟最初在BIOS配置中通过在适当的区域输入日期和时间来设置。一旦设置,内置的时钟记录时间,并使时间对操作系统可用。操作系统也能设置硬件时钟,如果系统运行中,网络上有一个可用的精确的外部时间基准,比如一个NTPD服务器(看16章),这通常非常有用。
Disks and boot devices 硬盘与启动设备
Another fundamental configuration item required in BIOS settings is the selection of storage devices. Newer systems are able to detect and properly configure much of this hardware automatically. However, older BIOS versions require manual configuration. This may include the selection of floppy disk sizes and disk drive parameters.
另一个要求的BIOS基本设置配置项是选择存储设备。新的系统能对这个设备检测并恰当的自动化配置很多。然而,旧一些的版本需要手动配置,这可能包含选择软盘大小和驱动器参数。
Most PCs have at least three bootable media types: an internal hard disk (IDE or SCSI, or perhaps both), a CD-ROM drive (again IDE or SCSI), and a floppy disk. After initialization, the BIOS seeks an operating system (or an operating system loader, such as the Linux Loader [LILO]) on one or more of these media. By default, many BIOS configurations enable booting from the floppy or CD-ROM first, then the hard disk, but the order is configurable in the BIOS settings.
大多PC机至少有3个可以启动的介质类型:一个内置硬盘(IDE或者SCSI,又或许两者都有),一个CD-ROM驱动器(又是IDE或SCSI),一个软盘驱动器。初始化完成后,BIOS会在一个或者多个这样的介质中寻找一个操作系统(或者一个操作系统装载器,如linux装载器LILO).默认地,很多BIOS配置允许首先从软驱或光盘启动,然后是硬盘,但这个顺序在BIOS设定中是可以配置的。
In addition to these default media types, many server motherboard BIOS (as well as high-end system motherboards) support booting from a network device such as a NIC with a bootable ROM. This is often used when booting diskless workstations such as Linux-based terminals.
另外,对这些默认的介质类型,很多服务器主板BIOS(以及一些高端系统主板)支持从网络设备启动,比如具有可启动ROM的NIC。这个通常在启动无盘工作站时使用。比如基于Linux的终端。
|
On the Exam 在考试中 你应该熟悉对一个典型计算机的一般的配置要求和BIOS配置显示的布局 |
Using the /proc filesystem 使用 /proc 文件系统
When adding new hardware to an existing Linux system, you may wish to verify which resources the existing devices are using. The /proc filesystem, the kernel’s status repository, contains this information. The proc files, interrupts, dma, and ioports, show how system resources are currently utilized. (These files may not show devices unless their device files/drivers are open/active. This may make the problem harder to find if you’re experiencing resource conflicts.) The following is an example of /proc/interrupts from a dual-CPU system with an Adaptec dual-AIC7895 SCSI controller:
当在一个现有的Linux系统中添加一个新硬件时,你可能希望核实有哪些资源被已有的设备所使用。/proc 文件系统-----Linux核心的状态库中有这个信息。proc文件、中断、DMA 、IO端口、显示系统资源当前如何被使用。(这些文件只显示设备文件/驱动器是打开或者激活的设备。如果你遭受着资源冲突,这点可能会使得问题更难查找。)下面是一个有双CPU和一个AIC7895SCSIC控制器系统的/proc/interrupts例子:
# cat /proc/interrupts
CPU0 CPU1
0: 98663989 0 XT-PIC timer
1: 34698 34858 IO-APIC-edge keyboard
2: 0 0 XT-PIC cascade
5: 7141 7908 IO-APIC-edge MS Sound System
6: 6 7 IO-APIC-edge floppy
8: 18098274 18140354 IO-APIC-edge rtc
10: 3234867 3237313 IO-APIC-level aic7xxx, eth0
11: 36 35 IO-APIC-level aic7xxx
12: 233140 216205 IO-APIC-edge PS/2 Mouse
13: 1 0 XT-PIC fpu
15: 44118 43935 IO-APIC-edge ide1
NMI: 0
ERR: 0
In this example, you can see that interrupt 5 is used for the sound system, so it isn’t available for a second parallel port. The two SCSI controllers are using interrupts 10 and 11, respectively, while the Ethernet controller shares interrupt 10. You may also notice that only one of the two standard IDE interfaces is enabled in the system
BIOS, freeing interrupt 14 use for another device.
在这个例子中,你能看到中断5被用于音频系统。所以它对第二个并行端口不再可用。两个SCSI控制器分别使用中断10和11,而以太网控制器共享使用中断10,你也许注意到在这个系统BIOS中,2个标准的IDE接口只有一个是启用的。使得14号中断可以用于其它设备。
Here are the /proc/dma and /proc/ioports files from the same system:
这是相同系统中的 /proc/dma 和 /proc/ioports 文件:
# cat /proc/dma
0: MS Sound System
1: MS Sound System
2: floppy
4: cascade
# cat /proc/ioports
0000-001f : dma1
0020-003f : pic1
0040-005f : timer
0060-006f : keyboard
0070-007f : rtc
0080-008f : dma page reg
00a0-00bf : pic2
00c0-00df : dma2
00f0-00ff : fpu
0170-0177 : ide1
02f8-02ff : serial(auto)
0370-0371 : OPL3-SAx
0376-0376 : ide1
0388-0389 : mpu401
03c0-03df : vga+
03f0-03f5 : floppy
03f7-03f7 : floppy DIR
03f8-03ff : serial(auto)
0530-0533 : WSS config
0534-0537 : MS Sound System
e800-e8be : aic7xxx
ec00-ecbe : aic7xxx
ef00-ef3f : eth0
ffa0-ffa7 : ide0
ffa8-ffaf : ide1
|
On the Exam 在考试中 |
Universal Serial Bus (USB) is a type of interface used to connect various types of peripherals, ranging from keyboards and mice to hard drives, scanners, digital cameras, and printers. The USB Objective covers the general architecture of USB, USB modules, and configuring USB devices.
通用串行总线(USB)是一个用来连接不同类型外设的接口,外设分类从键盘和鼠标到硬盘、扫描仪、数字相机和打印机。 USB涵盖了一般的USB架构,USB模块和配置USB设备。
USB Topology USB技术
USB devices are attached to a host in a tree through some number of hub devices.The lsusb command can be used to see how devices are physically attached to a Linux system.
USB设备通过一些设备集线器的号码被附加给一个树中的host。 lsusb 命令能被用来查看设备是如何物理的附加给一个linux系统的。
# lsusb -t
Bus# 4
'-Dev# 1 Vendor 0x0000 Product 0x0000
Bus# 3
'-Dev# 1 Vendor 0x0000 Product 0x0000
|-Dev# 2 Vendor 0x046d Product 0xc501
'-Dev# 3 Vendor 0x0781 Product 0x0002
Bus# 2
'-Dev# 1 Vendor 0x0000 Product 0x0000
|-Dev# 2 Vendor 0x0451 Product 0x2036
| |-Dev# 5 Vendor 0x04b8 Product 0x0005
| '-Dev# 6 Vendor 0x04b8 Product 0x0602
'-Dev# 3 Vendor 0x0451 Product 0x2046
'-Dev# 4 Vendor 0x056a Product 0x0011
Bus# 1
'-Dev# 1 Vendor 0x0000 Product 0x0000
USB Controllers USB控制器
There are three types of USB host controllers: 一共有三种主USB控制器
• Open Host Controller Interface (OHCI) 开放式主控制器接口
• Universal Host Controller Interface (UHCI) 通用型主控制器接口
• Enhanced Host Controller Interface (EHCI) 增强型主控制器接口
OHCI and UHCI controllers are both USB 1.1 controllers, which are capable of a maximum of 12 Mbps. EHCI controllers are USB 2.0 controllers, which are capable of a theoretical maximum of 480 Mbps. To get greater than USB 1.1 speeds, you must have a USB 2.0 controller, as well as USB 2.0 devices, hubs, and cables. A USB 2.0 device attached to a USB 1.1 hub will only be able to run at USB 1.1 speeds.
OHCI和UHCI控制器都是USB1.1控制器,他们的最大数据传输率为12Mbps。EHCI控制器是USB2.0控制器。最大的理论数据传输率为480Mbps。为了达到超过USB1.1的速度,你必须有一个USB2.0控制器,以及USB2.0设备、集线器、电缆。一个USB2.0设备连接到一个USB1.0接口将只能以USB1.1的速度使用。
USB Drivers USB驱动
USB support was added to the Linux kernel in the 2.3.x development kernel series,then back-ported to 2.2.x, minus support for USB mass storage devices (due to SCSI changes in 2.3.x). The back-port was included in the 2.2.18 kernel release.
USB支持是在2.3.x核心系列被加入的。然后在2.2.x中也加入了USB支持,但去除了USB大容量存储设备的支持。(由于SCSI在2.3.x中的变化)。
Notice:There is no kernel USB support in 2.0.x and earlier
在2.0.x以及更早的版本中没有内核的USB支持。
The Linux kernel USB drivers fall into three categories: Linux内核USB驱动分为三个目录:
1、Host controller drivers 主控制器驱动
The USB host controller drivers include usb-ohci.o (OHCI driver), usb-uhci.o (UHCI driver), uhci.o (old “alternate” UHCI driver), and ehci-hcd.o (EHCI driver).
USB主控制器驱动包含usb-ohci.o(OHCI驱动),usb-uhci.o(UHCI驱动),unci.o(老的交互式UHCI驱动)和ehci-hcd.o(EHCI驱动)。
2、Class drivers 类驱动
The USB class drivers include hid.o, usb-storage.o (mass storage driver),acm.o (Automated Control Model [ACM] communications class driver, which deals with modems that emulate the standard serial modem AT command in-terface), printer.o, and audio.o.
USB驱动类包括hid.o,usb-storge.o(大容量存储驱动),acm.o(自动控制模块通信类驱动。可以处理以命令接口模拟标准串行猫),printer.o和audio.o。
3、Other device drivers 其他设备驱动
There are many drivers for devices that either don’t fit into one of the standard USB classes or don’t work with one of the standard class drivers. Examples include rio500.o (the driver for the Diamond Rio 500 MP3 player) and pwc.o
(the driver for various Philips webcams).
有很多设备驱动即不适合标准usb类的一种或者对标准的类驱动无效。例如包含rio500.o(Diamond Rio500MP3播放器驱动)和pwc.o(各种philips摄像头驱动)。
The Linux drivers implement USB support in layers. At the bottom is usbcore.o,which provides all of the generic USB support for the higher-level drivers as well as USB hub support. The host controller drivers load in the middle of the stack. On top are the device and class drivers and any modules they require. The following is an example of what you might see in /proc/modules (or from the output of lsmod) on a system with several USB devices:
Linux驱动在底层实现USB支持。在usbcore.o的底部提供了所有通用高级驱动器,和uSB hub支持。主控制器驱动装载在栈的中间。顶部为设备和类驱动以及任一他们需要的模块。下面例子你可能在一个有USB设备的系统的中/proc/modules(或者lsmod命令的输出)文件中看到。
例省略!
Reporting Your Hardware
Before you tackle adding any new hardware devices to your system, it’s useful to obtain information about the hardware you have installed. Some useful tools to report this information include lsmod, lsdev, and lspci.
报告你的硬件
在你为你的系统安装新的硬件之前,获取一些你已经安装的硬件信息是有用的。一些有用的报告这个信息的工具包括 lsmod,lsdev,lspci.
lsmod [options]
Description 描述
The lsmod command displays all the information available about currently loaded modules.Reviewing your loaded modules is often the first step in identifying possible problems, such as driver conflicts (quite frequently found with USB device drivers). This information can also be found in /proc/modules. lsmod has only two options, neither of them affecting its operation.
lsmod命令显示所用可用的关于当前装载模块的信息。审核你的装载模块经常是识别可能性错误的第一步。比如,驱动冲突(USB设备驱动中非常频繁)。这个信息也可以在/proc/modules中找到。lsmod只有2个选项,任何一个都不会影响它的操作。
Options 选项
-h, --help 帮助 Display help information.显示帮助信息
-V, --version 版本 Display the version. 显示版本
The output of lsmod is a series of columns identifying the module name, its size, its use number,and its status. A sample of lsmod output looks like this:
lsmod的输出是一系列模型的标识符,他的大小,它使用的号码,他的状态。一个简单的lsmod输出像这样:
Module Size Used by Not tainted
vfat 12844 0 (autoclean)
fat 38328 0 (autoclean) [vfat]
nfs 79960 0 (autoclean)
ide-scsi 11984 0 (autoclean)
ide-cd 35196 0 (autoclean)
cdrom 33440 0 (autoclean) [ide-cd]
Manipulating Modules 操纵模块
A module is dynamically linked into the running kernel when it is loaded. Much of Linux kernel module handling is done automatically. However, there may be times when it is necessary for you to manipulate the modules yourself, and you may come across the manipulation commands in scripts. For example, if you’re having difficulty with a particular driver, you may need to get the source code for a newer version of the driver, compile it, and insert the new module in the running kernel. The commands listed in this section can be used to list, insert, remove, and query Modules.
一个模块是在它被装载的时候动态链接到运行核心的。很多Linux核心模块处理自动完成。然而,也许有时候当你有必要自己操作模块。并且你或许在脚本中遇到了操作命令。例如,如果你对一个特别的驱动有困难,你或许需要获取这个驱动的更新版本的源代码。编译它,把这个新模块插入你的运行核心。这个列在本节的命令可以被用来显示,插入,删除和查询模块。
lsmod
For each kernel module loaded, display its name, size, use count, and a list of other referring modules. This command yields the same information as is available in /proc/modules.
应用于每个已经装载的核心。显示它的名字、大小、使用数量、和一个相关模块列表。这个命令产生和/proc/modules中同样的信息。
insmod [options] module
Insert a module into the running kernel. The module is located automatically and inserted. You must be logged in as the superuser to insert modules
将一个模块插入到运行核心。这个模块会被自动定位和插入。你必须以一个超级用户的方式登录来插入模块。
rmmod [options] modules
The rmmod command is used to remove modules from the running kernel. You must be logged in as the superuser to remove modules, and the command will fail if the module is in use or being referred to by another module.
rmmod命令被用来从运行核心删除模块。你必须以超级用户登录来删除模块。并且如果所要删除的模块正在使用或被其他模块所引用,那么这个命令将会失败。
modinfo [options] module_object_file
Display information about a module from its module_object_file. Some modules contain no information at all, some have a short one-line description, and others have a fairly descriptive message.
从模块目标文件显示一个模块的信息。一些模块根本一点信息也没有。一些有一个短的单行描述,其他的有的描述性信息。
Device Management Definitions 设备管理定义
Hotplugging is often taken to mean the opposite of coldplugging—in other words,the ability of a computer system to add or remove hardware without powering the system down. Examples of devices that are coldpluggable include PCI (some PCI chipsets have hotplug support, but these are very expensive and almost exclusively used in server systems), ISA devices, and PATA devices.
热插拔经常被认为是冷插拔的反义。换句话说,就是一个计算机系统不关闭电源来安装或者删除硬件的能力。设备冷插拔的例子包括PCI(一些PCI芯片具有热插拔支持,但是这些非常昂贵且几乎只使用在服务器系统中),ISA设备和PATA设备。
In most computer systems, CPUs and memory are coldpluggable, but it is common for high-end servers and mainframes to feature hotplug capability of these components.
在大多计算机系统中,CPU和内存是冷插拔的,但是在高端服务器和大型机中都把热插拔作为他们组件的能力。
sysfs is a RAM-based filesystem initially based on ramfs. It provides a means to export kernel data structures, their attributes, and the linkages between them to the user space. sysfs contains several directory hierarchies showing the available hardware devices and attributes of the modules/drivers. It can be accessed by running:
# mount -t sysfs sysfs /sys
sysfs 是一个RAM-based 文件系统,最初基于ramfs。它提供了一个输出核心数据结构、参数和与用户空间联系的方式。sys包含不同级别的目录显示可用的硬件设备和模块/驱动属性。它通过运行下面的命令来访问:
The udev process uses sysfs to get the information it needs about the hardware and creates dynamic device files as kernel modules are loaded. The directory /etc/ udev.d holds all the rules to be applied when adding or removing a device.D-Bus is an application that uses sysfs to implement a message bus daemon. It is used for broadcasting system events such as “new hardware device added” or “printer queue changed” and is normally launched by an init script called messagebus.
udev过程使用sysfs来获得他需要的关于硬件的信息并创建动态的设备文件,作为核心模块被装载。/etc/udev.d目录保存了所有的当增加或者删除一个设备时可以应用的规则。D-bus是一个使用sysfs来实现一个信息总线守护进程的应用。他被用来广播系统事件,比如:新的硬件设备被添加或者打印队列改变,被一个称作messagebus的初始脚本正常启动。
The hald process is the daemon that maintains a database of the devices connected to the system in real time. The daemon connects to the D-Bus system message bus to provide an API that applications can use to discover, monitor, and invoke operations on devices.
hald进程是维护一个设备数据库实时连接到系统的守护进程。这个守护进程连接到D-bus系统信息总线来提供一个API。这个应用能用来发现,监视和调用设备上的操作。
本文介绍了系统架构中的BIOS及其重要性,包括硬件设置、启动设备选择、日期时间管理,以及如何通过/proc文件系统检查硬件资源使用情况。BIOS在启动时管理硬件,配置启动顺序,并提供低级别系统配置接口。在Linux系统中,可以通过/proc/dma和/proc/ioports查看硬件资源使用,以及使用lsmod等命令管理模块。此外,还简述了USB设备的连接方式、驱动分类和Linux内核对USB的支持。
9897

被折叠的 条评论
为什么被折叠?



