1. Trang chủ
  2. » Công Nghệ Thông Tin

Red Hat Linux Networking , System Administration (P23) pptx

30 241 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 30
Dung lượng 756,77 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Each mirror has a full archive of/pub/linux, the top-level kernel source directory, but it might not carry thesource code in both gzip and bzip2 compression formats.. If you down-loaded

Trang 1

Figure 27-1 The Linux Kernel Archives home page.

To locate a mirror near you, point your Web browser at www.kernel.org/mirrors, scroll down the alphabetically ordered list of countries, and clickyour country name to view a list of mirror sites in your country Figure 27-2,for example, shows part of the list of HTTP mirror sites in the United States

Figure 27-2 Linux kernel archive mirror sites in the United States.

Trang 2

The kernel’s archive mirror system is set up so that for each two-letter try code you can simply use the hostname http://www.country.kernel.org/or ftp.country.kernel.org to reach a mirror supporting that spe-cific country For example, in the United States, you would use the URLwww.us.kernel.orgin your Web browser Each mirror has a full archive of/pub/linux, the top-level kernel source directory, but it might not carry thesource code in both gzip and bzip2 compression formats The bzip2 formattakes less time to download than gzip format, but takes longer than gzip for-mat to decompress.

coun-After locating an archive that is near you, in network terms, download thedesired file using your Web browser or an FTP client By way of example, theinstructions that follow assume you use the standard FTP client in a terminalwindow, such as an xterm

1 Change directories to a directory to which you have write permission,for example, your home directory:

230 Anonymous access granted, restrictions apply.

3 Change directories to the FTP server’s kernel source code directory Theexact location of this directory varies from mirror to mirror, so youmight have to use the ls command to locate it

Trang 3

-rw-r r 1 mirror mirror 46585077 Apr 7 19:21 2.6.11.7.tar.gz

-rw-r r 1 mirror mirror 248 Apr 7 19:21 2.6.11.7.tar.gz.sign

-rw-r r 1 mirror mirror 248 Apr 7 19:21 2.6.11.7.tar.sign

9 Close the FTP session:

ftp> bye

After you have the archive file, verify the file’s integrity and unpack it asdescribed in the next section

Verifying and Unpacking the Archive

Before you unpack the archive, you should check its signature to make surethat it has not been tampered with Files placed in the Linux Kernel Archivesare OpenPGP-signed, and you can use these digital signatures to prove thatfiles you have downloaded from the kernel archive site really originated at theLinux Kernel Archives The current Linux Kernel Archives OpenPGP key isalways available from www.kernel.org/signature.html

The first step is to import the Linux Kernel Archive key With an active net connection, execute the following command:

Inter-# gpg keyserver wwwkeys.pgp.net recv-keys 0x517D0F0E

gpg: key 517D0F0E: public key “Linux Kernel Archives Verification Key <ftpadmin@ kernel.org>” imported

gpg: Total number processed: 1 gpg: imported: 1

This step adds the Linux Kernel Archive key to root’s public key ring Next,change directories to the directory in which you downloaded the source filesand execute the following commands, again as the root user, to verify the filesignature:

Trang 4

$ gpg verify linux-2.6.11.7.tar.bz2.sign linux-2.6.11.7.tar.bz2

gpg: Signature made Thu 07 Apr 2005 03:30:08 PM EDT using DSA key ID 517D0F0E gpg: Good signature from “Linux Kernel Archives Verification Key

<ftpadmin@kernel.org>”

Replace the filenames used in the preceding command with filenames thatreflect the files you downloaded As long as you see the two lines of outputshown in the example (beginning with gpg:), the file is authentic and has notbeen tampered with or modified Because you probably have not added atrusted path to the archive verification key, this command probably also gen-erates the following error message, which you can safely disregard:

gpg: checking the trustdb gpg: no ultimately trusted keys found gpg: WARNING: This key is not certified with a trusted signature!

gpg: There is no indication that the signature belongs to the owner.

Primary key fingerprint: C75D C40A 11D7 AF88 9981 ED5B C86B A06A 517D 0F0E

Now you are ready to unpack the archive If you downloaded a bzip2 mat archive file, execute the following command:

for$ bunzip2 c linux2.6.11.7.tar.bz2 | tar xf

-This command decompresses the archive file using bunzip2 and pipes theoutput to the tar command, which extracts the archive The operation mighttake some time to complete because bzip2 compression and decompressiontakes longer than the more familiar and faster gzip compression If you down-loaded the gzip formatted archive, the proper command to use is:

$ gunzip c linux2.6.11.7.tar.gz | tar xf

-The result of either command is the same: a new directory named 2.6.11.7 in the directory in which you decompressed and extracted thearchive that contains version 2.6.11.7 of the Linux kernel source code

linux-Patching the Kernel

If you have already downloaded the main source code tree, you can save bothbandwidth and time by downloading and applying patches Patches containonly changes to the underlying files from one kernel version to the next Forexample, if you downloaded the 2.6.11.6 kernel source code tree, you do notneed to download the 2.6.11.7 source code, only the patch, which is named, inthis case, patch-2.6.11.7.bz2 If, alternatively, you have the source code for

Trang 5

version 2.6.11.3, you need to download four patches (patch-2.6.11.4.bz2,patch-2.6.11.5.bz2, patch-2.6.11.6.bz2, patch-2.6.11.7.bz2)and apply them in sequential order The following procedure illustrates theprocess, assuming you have already downloaded the necessary patch and sig-nature files and have verified their integrity using the method just described.

To apply the patches, change directories to the directory in which youunpacked the kernel source code So, for example, if you unpacked the kernelsource code in your home directory, change to that directory Next, execute thefollowing command for each patch file, in sequential order:

$ bunzip2 -c patch-2.6.11.N.bz2 | patch -p0

Replace N with the patch number of each patch you want to apply For thisexample, suppose you are patching from the kernel version 2.6.11.6 to 2.6.11.7.You need to apply the patch that takes you to version 2.6.11.7 So, you executethe following command:

$ bunzip2 -c patch-2.6.11.7.bz2 | patch -d linux-2.6.11.6 -p1

patching file Makefile patching file arch/ia64/kernel/fsys.S patching file arch/ia64/kernel/signal.c patching file arch/ppc/oprofile/op_model_fsl_booke.c

patching file net/netrom/nr_in.c patching file net/xfrm/xfrm_state.c patching file sound/core/timer.c patching file sound/pci/ac97/ac97_codec.c

The exact list of filenames varies from patch to patch, and some patcheschange more files than other patches do The result, however, is a kernel sourcetree updated to the latest version

Finally, execute the following two commands to ensure that you are ing with an unblemished source code tree:

if you are starting from scratch, you can skip this step, but it does no harm toinclude it, either You are ready, finally, to configure the kernel

Trang 6

Configuring the Kernel

As remarked at the beginning of this chapter, the kernel configuration processhas changed significantly Long-time Linux users will be pleased to know thatmake config, make oldconfig, and make menuconfig still work as theyalways have, albeit with more and different options Those who have usedmake xconfig, however, are in for a bit of a surprise The old Tk-based con-figuration tool has been replaced by kernel configuration interfaces based on

Qt and GTK+ When you start the X-based configuration process using makexconfig, the kernel configuration tool tries to load a Qt-based tool (namedqconfig) If the Qt toolkit isn’t found, the process stops with an error In thiscase, you should try make gconfig to invoke the GTK+-based kernel config-

uration tool If that fails, then you’ll need to use the ncuruses-based

configura-tion tool by executing the command make menuconfig

In addition to the new interfaces for the graphical configuration tool, thekernel configuration process is includes more useful targets and is generallymore user-friendly Table 27-1 lists the available kernel configuration targetsavailable in the new configuration system

Table 27-1 Kernel Configuration Targets

allmodconfig Creates a new configuration file selecting modules for all

options that can be built as modules allnoconfig Creates a new (minimal) configuration file by answering No

to all possible configuration options allyesconfig Creates a new configuration file by answering Yes to all

possible configuration options defconfig Creates a new configuration file using the default options gconfig Updates the kernel configuration file using a GTK+-based

graphical interface menuconfig Updates the kernel configuration file using an ncurses-

based text-mode GUI to present configuration options oldconfig Updates the kernel configuration file using the current

configuration, prompting only for previously unseen options xconfig Updates the kernel configuration file using a Qt-based

graphical interface

Trang 7

There are many more kernel build targets than those listed in Table 27-1 Anew kernel build target is help (as in, make help), which shows all of the pos-sible targets you can use.

To use one of these targets, or options, change directories to the top level of

the kernel source tree and type make target, replacing target with the

option you want to use For example, to use the allnoconfig option, type

make allnoconfigand press Enter

The allmodconfig target is handy if you want a small, statically linkedkernel with all of your devices and subsystems built as modules However, ifyou do use the allmodconfig target, make sure that support for your rootfile system, /, is either included in your initrd (see “Creating an Initial RAMDisk” later in this chapter) or is compiled into your kernel, or you won’t beable to boot the kernel because the kernel won’t know how to access the rootfile system

The oldconfig target is especially handy when you upgrade to newer nel releases Suppose, for example, that you have a custom compiled 2.6.11.6kernel but you want to upgrade to 2.6.11.7 After applying the patch, you want

ker-to rebuild the kernel but don’t want ker-to have ker-to go through the entire kernelconfiguration process again This is where the oldconfig target helps Afteryou upgrade the kernel, run make oldconfig The configuration process pre-serves the existing configuration choices and only prompts you to configurenew options added in the upgrade from 2.6.11.6 to 2.6.11.7

It is unnecessary and ill-advised to build your kernel in the traditional nel location, /usr/src/linux Accordingly, the rest of this chapter assumesthat you build the kernel in a subdirectory of your home directory, for exam-ple, /home/kwall/kernel Using /usr/src/linux is a bad idea becausethe kernel headers against which glibc, the system C library was built, reside

ker-in /usr/src/lker-inux, so when you ker-install updated kernel source code, ularly header files, you run the risk of having kernel headers that are out of

partic-sync with the C library’s object files The kernel headers must match the C

library files or bedlam will ensue

As a practical matter, it is easier to build the kernel in a nonsystem directorybecause you don’t have to mess with running as root That’s right, you don’thave to be root to build the kernel You only need root access for the postbuildsteps, which include installing the kernel, installing the modules, and updat-ing the GRUB configuration file

Selecting a Kernel Configuration File

If you are unfamiliar with kernel configuration, you might want to considerusing an existing kernel configuration file as a starting point for your custom

Trang 8

configuration If you are using kernel source code from kernel.org or one of itsmirrors, you have a couple of options For most architectures, you can look forfiles named defconfig or defconfig.mumble in the arch directory hier-archy Each defconfig file represents a default configuration (hence thename, defconfig) with a standard, reasonably well-tested set of features andsane defaults for the specified architecture As of kernel version 2.6.11.7, therewere 210 defconfig files, some of which are:

arch/mips/defconfig arch/i386/defconfig arch/sparc/defconfig arch/um/defconfig arch/sparc64/defconfig arch/m68knommu/defconfig arch/sh/defconfig

arch/cris/arch-v10/defconfig arch/cris/defconfig

arch/arm26/defconfig arch/m68k/defconfig arch/ia64/defconfig arch/alpha/defconfig arch/ppc64/defconfig arch/parisc/defconfig arch/h8300/defconfig arch/m32r/oaks32r/defconfig.nommu arch/m32r/mappi/defconfig.up arch/m32r/mappi/defconfig.smp arch/m32r/mappi/defconfig.nommu arch/m32r/opsput/defconfig.opsput arch/m32r/m32700ut/defconfig.m32700ut.smp arch/m32r/m32700ut/defconfig.m32700ut.up arch/m32r/defconfig

arch/m32r/mappi2/defconfig.vdec2 arch/sh64/defconfig

arch/x86_64/defconfig arch/s390/defconfig

If your architecture or platform has a defconfig, you can use it by ing the following command in the top-level kernel source directory:

execut-$ make defconfig

This command creates a new configuration file using the defaults in thedefconfigfile for your architecture This creates a known starting point foryour customized configuration file

Trang 9

Some processor architectures have multiple platforms For these systems,you’re looking for a configuration file that is closest to your system The place

to look is arch/ARCH/configs, where (as of kernel 2.6.11.7) ARCH is one of

■■ arm— ARM processors

■■ ia64— Intel IA64 (Itanium) processors

■■ m68k— Motorola 68xxx processors

■■ mips— MIPS processors

■■ parisc— HP PA-RISC processors

■■ ppc— PowerPC 32-bit processors

■■ ppc64— PowerPC 64-bit processors

■■ sh— SuperH processors

■■ sh64— SuperH 64-bit processorsFor example, the Intel IA-64 architecture has six different configuration filesbecause there are (as version 2.6.11.7), six supported IA-64 platforms:

■■ ia64/configs/bigsur_defconfig— A configuration suitable forsystems compliant with the IA-64 Developer Interface Guide (DIG)

■■ ia64/configs/sim_defconfig— A configuration suitable for theIA-64 simulator

■■ ia64/configs/sn2_defconfig— A configuration suitable for based SGI Altix systems

SN2-■■ ia64/configs/tiger_defconfig— Another configuration able for DIG-compliant systems

suit-■■ ia64/configs/zx1_defconfig— A configuration suitable for HP’sZX1 and SX1000 IA-64 systems

■■ ia64/defconfig— A “generic” configuration suitable for any ported IA-64 system

sup-To use one of the platform-specific configuration files, copy it into the level kernel source directory as config and then execute the command

top-make oldconfig to create a starting point for further customization Forexample, if you are configuring a kernel for an HP SX1000 IA-64 system (luckyyou!), execute the following commands:

$ cp arch/ia64/configs/zx1_defconfig config

$ make oldconfig

Trang 10

Configuring the Kernel with xconfig

To start configuring a kernel, change directories to the top level of your kernel

source directory, type make xconfig, and press Enter After a few seconds,

you should see a screen resembling Figure 27-3

For each configuration option, a blank box indicates that the correspondingfeature is disabled; a check mark indicates that the corresponding feature isenabled; a dot indicates that it will be compiled as a module A module, specif-

ically, a loadable kernel module, or LKM, is a section of kernel code that can be

inserted into and removed from the kernel dynamically (while the system isrunning) without needing to restart the system LKMs are used to providedrivers and other kernel functionality that isn’t always needed and so doesn’tneed to be compiled into the kernel Compiling drivers as LKMs rather thancompiling them into the kernel makes the resulting kernel smaller, use lessmemory, and load faster

To change an option, click the box to cycle through the three states

In some cases, you might not see an option, such as a device driver or a ture that should be present If this occurs, select Option ➪ Show All Options.Currently, xconfig does not include a cross reference to help you identify

fea-which options depend on others However, you can view some dependency

information by selecting Option ➪ Show Debug Info You can use this limiteddependency information (and the help text, which is visible even for disabledfeatures) to find the required options or features manually

Figure 27-3 Viewing the xconfig kernel configuration tool.

Trang 11

To get the most information about various kernel configuration options,select Option ➪ Show Name to show the name of the kernel configurationoption as it appears in the configuration file, Option ➪ Show Data to show thevalue of the kernel configuration options, and Option ➪ Show Range to showthe range of possible values for kernel configuration options.

To save your changes, click the floppy disk icon on the toolbar to save theconfiguration to the default file, config, in the kernel directory (or selectFile ➪ Save from the menu To save your changes to a different file, selectFile ➪ Save As from the menu and type a filename in the dialog box You canload an existing configuration by clicking the folder icon on the toolbar or byselecting File ➪ Load from the menu and selecting the configuration file youwant to use

Configuring the Kernel with menuconfig

If you prefer to use a text-based configuration tool, type make menuconfig to

configure the kernel configuration using an ncurses-based text menu interface.The configuration options are the same as those provided by xconfig, but theinterface itself is slightly different The initial screen resembles Figure 27-4.The following list shows the keystrokes you can use:

■■ Use the arrow keys to move the blue highlight cursor up and downthe menu

■■ Highlighted letters indicate hotkeys

■■ To select an item, press Enter.

■■ Submenus are indicated by ->

■■ To enable a configuration option, press y or the spacebar Pressing the

spacebar repeatedly will cycle through all of the possible options for asingle configuration item

■■ To disable a configuration option, press n.

■■ Configuration items preceded by angle brackets (<>) can be built asmodules

■■ Press m to build options as modules.

■■ Press ? or use the Help button to view the help text for a given option.

■■ Press the Tab key to move the cursor from the menu to the buttons atthe bottom and to move between the buttons

For example, use the arrow key to move the cursor down to the Processortype and features -> selection Then press Enter to open the submenu, which

is shown in Figure 27-5

Trang 12

Figure 27-4 Viewing the menuconfig kernel configuration tool.

Figure 27-5 The Processor type and features submenu.

The Generic x86 support, HPET Timer Support, and Machine Check tion options have * next to them, meaning these options have been enabled.Most of other options have not been included or enabled, but Toshiba Laptopsupport and Dell laptop support have <M>, meaning that support for thesefeatures will be built as loadable modules The Check for nonfatal errors onAMD Athlon/Duron/Intel Pentium option has empty <>, meaning that thissupport can be built as a modules (by pressing m) or it can be built into the ker-

Excep-nel by typing y or pressing the spacebar.

Trang 13

Many of the submenus have submenus of their own In Figure 27-5, forexample, the Processor family (Pentium Pro) -> option indicates the existence

of a subsubmenu, as it were If you highlight this option and press Enter,

you’ll see Figure 27-6, the Processor Family menu

When you have completed the configuration process, use the Exit button toexit the configuration menus Before it exits, menuconfig gives you theoption to save the changes, as shown in Figure 27-7

Figure 27-6 The Processor family submenu.

Figure 27-7 Saving the kernel configuration in menuconfig.

Trang 14

Highlight the Yes button, and press Enter to save the new configuration (or

No to abandon it) and exit menuconfig See the next section for informationabout the kernel’s various configuration options

Reviewing the Configuration Options

The following sections describe many of the configuration options available as

of kernel version 2.6.11.7 If you need additional information beyond what isprovided by the help text in the tool itself or in this chapter, the kernel shipswith a large amount of documentation in the form of text files in the Docu-mentation subdirectory of the kernel directory As a matter of convenience, forthe rest of this chapter, the phrase “the kernel directory” refers to the top level

of the directory in which you unpacked the kernel source code

Code Maturity Level Options

Some kernel features and drives might not be fully tested The Code maturitylevel options section enables you to choose whether you even see options thatare known or suspected to have problems If you enable Prompt for develop-ment and/or incomplete code/drivers, you will see the associated configura-tion options elsewhere in the interface Clearing this check box ensures thatyou will not be prompted for them This option also makes obsolete driversavailable, that is, old drivers that have been replaced by something else or thatmight be removed in a future kernel release Disable this option on productionsystems or if you don’t want to deal with broken devices drivers Enable thisoption if you enjoy living on the edge or if you need support for a device or akernel feature for which stable drivers are not yet available

General Setup

The General setup options enable allow you to set global kernel characteristicsand enable kernel features that don’t fit neatly into the other categories TheLocal version - append to kernel release option enables you to add a string tothe end of the kernel release that identifies your custom kernel This string will

be shown when you execute the command uname -r It is a good idea to usethis when you build custom kernels so that you can quickly distinguishbetween the stock kernels provided by Red Hat or the Fedora Project and yourown To set this value, double-click the label to create a small, editable text boxunder the Value column of the display (See Figure 27-8.)

Trang 15

Figure 27-8 Changing a string value in xconfig.

Type your local version string and then press Enter

If you are configuring a kernel for a desktop or server system, make surethat Support for paging of anonymous memory (swap) is enabled because thisoption enables the kernel’s use of virtual memory, which allows the kernel touse disk-based devices and swap files as RAM Similarly, most systems onwhich you will run Fedora Core or RHEL should have System V IPC enabled.IPC, which stands for Interprocess Communication, allows programs running

on a Linux system to share data using message queues, semaphores, or sharedmemory POSIX Message Queues are a variant of the message queues that pro-vide functionality not available in standard System V message queues Youcan usually disable this option because few Linux applications use POSIXmessage queues

BSD Process Accounting enables programs to request the kernel to maintainprocess accounting information This bookkeeping information includes:

■■ Average memory usage— The average amount of memory the processused

■■ Blocks read and written— The number of disk blocks read or written

■■ Chars transferred— The number of characters read or written

■■ Command name— The command line used to start the process

■■ Controlling terminal— The terminal (TTY or PTY) on which theprocess ran, if any

■■ Elapsed time— The total time the process ran

■■ Exit code— The process’s exit code

Ngày đăng: 07/07/2014, 09:20

TỪ KHÓA LIÊN QUAN