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

Red Hat Linux Networking , System Administration (P23) pptx

30 240 0

Đ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

Nội dung

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 click your 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. 624 Chapter 27 35_599496 ch27.qxd 8/30/05 7:35 PM Page 624 The kernel’s archive mirror system is set up so that for each two-letter coun- 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 URL www.us.kernel.org in your Web browser. Each mirror has a full archive of /pub/linux, the top-level kernel source directory, but it might not carry the source code in both gzip and bzip2 compression formats. The bzip2 format takes less time to download than gzip format, but takes longer than gzip for- mat to decompress. After locating an archive that is near you, in network terms, download the desired file using your Web browser or an FTP client. By way of example, the instructions that follow assume you use the standard FTP client in a terminal window, such as an xterm. 1. Change directories to a directory to which you have write permission, for example, your home directory: $ cd ~ 2. Open an FTP session to the archive site you selected and log in as the anonymous user using your email address as the password: $ ftp ftp.us.kernel.org Connected to ftp.us.kernel.org. 220 mirror.services.wisc.edu FTP server ready. User (ftp.us.kernel.org:(none)): ftp 331 Anonymous login ok, send your complete email address as your password. Password: 230 Anonymous access granted, restrictions apply. 3. Change directories to the FTP server’s kernel source code directory. The exact location of this directory varies from mirror to mirror, so you might have to use the ls command to locate it. ftp> cd /pub/linux/kernel 4. Change directories to the v2.6 directory: ftp> cd v2.6 5. Execute the following command to see a listing of the full source code trees for the 2.6 kernel series (the listing is truncated to preserve space): ftp> ls linux-2.6.* -rw-r r 1 mirror mirror 37099602 Apr 7 19:21 linux- 2.6.11.7.tar.bz2 -rw-r r 1 mirror mirror 248 Apr 7 19:21 linux- 2.6.11.7.tar.bz2.sign Upgrading and Customizing the Kernel 625 35_599496 ch27.qxd 8/30/05 7:35 PM Page 625 -rw-r r 1 mirror mirror 46585077 Apr 7 19:21 linux- 2.6.11.7.tar.gz -rw-r r 1 mirror mirror 248 Apr 7 19:21 linux- 2.6.11.7.tar.gz.sign -rw-r r 1 mirror mirror 248 Apr 7 19:21 linux- 2.6.11.7.tar.sign 6. Identify the file to download. For this demonstration, download the 2.6.11.7 archive file in bzip2 format, that is, linux-2.6.11.7.tar.bz2. 7. Make sure that you are in binary download format: ftp> binary 8. Use the following commands to download the archive file and its PGP signature file (linux-2.6.11.7.tar.bz2.sign): ftp> get linux-2.6.11.tar.bz2 ftp> get linux-2.6.11.tar.bz2.sign 9. Close the FTP session: ftp> bye After you have the archive file, verify the file’s integrity and unpack it as described in the next section. Verifying and Unpacking the Archive Before you unpack the archive, you should check its signature to make sure that it has not been tampered with. Files placed in the Linux Kernel Archives are OpenPGP-signed, and you can use these digital signatures to prove that files you have downloaded from the kernel archive site really originated at the Linux Kernel Archives. The current Linux Kernel Archives OpenPGP key is always available from www.kernel.org/signature.html. The first step is to import the Linux Kernel Archive key. With an active Inter- net connection, execute the following command: # 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 files and execute the following commands, again as the root user, to verify the file signature: 626 Chapter 27 35_599496 ch27.qxd 8/30/05 7:35 PM Page 626 $ 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 that reflect the files you downloaded. As long as you see the two lines of output shown in the example (beginning with gpg:), the file is authentic and has not been tampered with or modified. Because you probably have not added a trusted 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 for- mat archive file, execute the following command: $ bunzip2 -c linux-2.6.11.7.tar.bz2 | tar -xf - This command decompresses the archive file using bunzip2 and pipes the output to the tar command, which extracts the archive. The operation might take some time to complete because bzip2 compression and decompression takes 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 linux-2.6.11.7.tar.gz | tar -xf - The result of either command is the same: a new directory named linux- 2.6.11.7 in the directory in which you decompressed and extracted the archive that contains version 2.6.11.7 of the Linux kernel source code. Patching the Kernel If you have already downloaded the main source code tree, you can save both bandwidth and time by downloading and applying patches. Patches contain only changes to the underlying files from one kernel version to the next. For example, if you downloaded the 2.6.11.6 kernel source code tree, you do not need to download the 2.6.11.7 source code, only the patch, which is named, in this case, patch-2.6.11.7.bz2. If, alternatively, you have the source code for Upgrading and Customizing the Kernel 627 35_599496 ch27.qxd 8/30/05 7:35 PM Page 627 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 the process, 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 you unpacked the kernel source code. So, for example, if you unpacked the kernel source code in your home directory, change to that directory. Next, execute the following 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 this example, 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 execute the 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 patches change more files than other patches do. The result, however, is a kernel source tree updated to the latest version. Finally, execute the following two commands to ensure that you are work- ing with an unblemished source code tree: $ mv linux-2.6.11.6 linux-2.6.11.7 $ cd linux-2.6.11.7 $ make mrproper The mv command renames the directory from linux-2.6.11.6 to linux-2.6.11.7 to reflect the correct kernel version. The command make mrproper removes any detritus remaining from previous kernel compiles — if you are starting from scratch, you can skip this step, but it does no harm to include it, either. You are ready, finally, to configure the kernel. 628 Chapter 27 35_599496 ch27.qxd 8/30/05 7:35 PM Page 628 Configuring the Kernel As remarked at the beginning of this chapter, the kernel configuration process has changed significantly. Long-time Linux users will be pleased to know that make config, make oldconfig, and make menuconfig still work as they always have, albeit with more and different options. Those who have used make 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 make xconfig, the kernel configuration tool tries to load a Qt-based tool (named qconfig). If the Qt toolkit isn’t found, the process stops with an error. In this case, 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, the kernel configuration process is includes more useful targets and is generally more user-friendly. Table 27-1 lists the available kernel configuration targets available in the new configuration system. Table 27-1 Kernel Configuration Targets TARGET DESCRIPTION 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 Upgrading and Customizing the Kernel 629 35_599496 ch27.qxd 8/30/05 7:35 PM Page 629 There are many more kernel build targets than those listed in Table 27-1. A new 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 allnoconfig and press Enter. The allmodconfig target is handy if you want a small, statically linked kernel with all of your devices and subsystems built as modules. However, if you do use the allmodconfig target, make sure that support for your root file system, /, is either included in your initrd (see “Creating an Initial RAM Disk” later in this chapter) or is compiled into your kernel, or you won’t be able to boot the kernel because the kernel won’t know how to access the root file system. The oldconfig target is especially handy when you upgrade to newer ker- nel releases. Suppose, for example, that you have a custom compiled 2.6.11.6 kernel but you want to upgrade to 2.6.11.7. After applying the patch, you want to rebuild the kernel but don’t want to have to go through the entire kernel configuration process again. This is where the oldconfig target helps. After you upgrade the kernel, run make oldconfig. The configuration process pre- serves the existing configuration choices and only prompts you to configure new 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 ker- nel location, /usr/src/linux. Accordingly, the rest of this chapter assumes that 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 because the kernel headers against which glibc, the system C library was built, reside in /usr/src/linux, so when you install updated kernel source code, partic- ularly header files, you run the risk of having kernel headers that are out of 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 directory because you don’t have to mess with running as root. That’s right, you don’t have to be root to build the kernel. You only need root access for the postbuild steps, 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 consider using an existing kernel configuration file as a starting point for your custom 630 Chapter 27 35_599496 ch27.qxd 8/30/05 7:35 PM Page 630 configuration. If you are using kernel source code from kernel.org or one of its mirrors, you have a couple of options. For most architectures, you can look for files named defconfig or defconfig.mumble in the arch directory hier- archy. Each defconfig file represents a default configuration (hence the name, defconfig) with a standard, reasonably well-tested set of features and sane defaults for the specified architecture. As of kernel version 2.6.11.7, there were 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 execut- ing the following command in the top-level kernel source directory: $ make defconfig This command creates a new configuration file using the defaults in the defconfig file for your architecture. This creates a known starting point for your customized configuration file. Upgrading and Customizing the Kernel 631 35_599496 ch27.qxd 8/30/05 7:35 PM Page 631 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 processors For example, the Intel IA-64 architecture has six different configuration files because there are (as version 2.6.11.7), six supported IA-64 platforms: ■■ ia64/configs/bigsur_defconfig — A configuration suitable for systems compliant with the IA-64 Developer Interface Guide (DIG) ■■ ia64/configs/sim_defconfig — A configuration suitable for the IA-64 simulator ■■ ia64/configs/sn2_defconfig — A configuration suitable for SN2- based SGI Altix systems ■■ ia64/configs/tiger_defconfig — Another configuration suit- able for DIG-compliant systems ■■ ia64/configs/zx1_defconfig — A configuration suitable for HP’s ZX1 and SX1000 IA-64 systems ■■ ia64/defconfig — A “generic” configuration suitable for any sup- ported IA-64 system To use one of the platform-specific configuration files, copy it into the top- level kernel source directory as .config and then execute the command make oldconfig to create a starting point for further customization. For example, if you are configuring a kernel for an HP SX1000 IA-64 system (lucky you!), execute the following commands: $ cp arch/ia64/configs/zx1_defconfig .config $ make oldconfig 632 Chapter 27 35_599496 ch27.qxd 8/30/05 7:35 PM Page 632 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 corresponding feature is disabled; a check mark indicates that the corresponding feature is enabled; 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 is running) without needing to restart the system. LKMs are used to provide drivers and other kernel functionality that isn’t always needed and so doesn’t need to be compiled into the kernel. Compiling drivers as LKMs rather than compiling them into the kernel makes the resulting kernel smaller, use less memory, 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 fea- 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 which options depend on others. However, you can view some dependency information by selecting Option ➪ Show Debug Info. You can use this limited dependency information (and the help text, which is visible even for disabled features) to find the required options or features manually. Figure 27-3 Viewing the xconfig kernel configuration tool. Upgrading and Customizing the Kernel 633 35_599496 ch27.qxd 8/30/05 7:35 PM Page 633 [...]... system, make sure that Support for paging of anonymous memory (swap) is enabled because this option enables the kernel’s use of virtual memory, which allows the kernel to use disk-based devices and swap files as RAM Similarly, most systems on which 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. .. detection, which in turn enable PCI-X 2.0 to stay current with respect to the latest networking and technology advances, such as iSCSI and InfiniBand is covered by a different kernel subsystem Unless you have server class hardware or another type of system that has on on-board PCI hotplug controller, need to use CardBus, or have a laptop that requires hotplug support for proper docking station support, you... I20 support Networking Support The Networking support section enables you to configure a wide array of networking options for your system If you intend to use any sort of network 649 650 Chapter 27 device or feature, enable Networking support Under Networking options, select the features and protocols you intend to use For example, if you want to use programs like tcpdump, a packet sniffer that facilitates... have a SCSI-only system (in which case you should jump ahead to the next section, “SCSI Device Support”) In fact, anything that appears to be or that acts like an IDE disk, such as CompactFlash, requires IDE support Enable Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support if you have any IDE devices that you want to use — if you want to boot from such a device, like an IDE disk drive, build support... 1394/FireWire Support As you might know, FireWire, more formally known by its specification document, IEEE 139 4, is a high-speed serial bus for connecting disks, digital cameras, scanners, and other external peripherals to your system It is comparable in purpose to USB, but not as widely used on PC hardware as it is on Apple hardware If you have a FireWire device you want to use, enable IEEE 1394 (FireWire)... though, so if you can’t replace the data on your laptop, don’t use it CPU Frequency scaling enables the kernel to issue instructions that slows the CPU (actually, to reduce the CPU’s clock speed) in a notebook computer when it is not in use The purpose, obviously, is to reduce power consumption and, thus, prolong battery life If you enable this option, you will need to select the appropriate CPU so the... support, however, you can disable dummy net driver support The configuration sections for specific classes of network devices, such as ARCnet, Ethernet (10 or 100 Mbit ), Ethernet (1000 Mbit ), Token Ring devices, PCMCIA network device support, and so on, enable you to configure support for such devices if you need it Although you can probably skip or ignore the dialog boxes for devices you do not use, it... specific processor (and, in some cases, processor features) in your system The information you provide here is used to configure the kernel and to configure Upgrading and Customizing the Kernel the build process itself to generate code that takes advantage of specific CPU features If you need to compile a kernel for another system, select the CPU for the target system, not the host (the system on which you... applications to work Rather, the Linux kernel’s ATAPI drivers are finally capable of writing CDs This means that if you have an IDE ATAPI CD-R or CD-RW, you don’t have to enable SCSI emulation support (known colloquially by the name of the corresponding kernel module, ide-scsi ), SCSI CDROM support, and SCSI generic support (the latter two are in the SCSI device support section, discussed next ), resulting in a... commands Notice that in many cases, CPU frequency scaling requires ACPI support, which is another reason to use ACPI instead of APM Bus Options The bus options section of the kernel configuration is hardly a page-turning read In short, if you need support for one of the listed data busses, enable that support Some items do bear additional explanation, however For example, more and more computer systems these . glibc, the system C library was built, reside in /usr/src /linux, so when you install updated kernel source code, partic- ularly header files, you run the risk of having kernel headers that are. Software Suspend, the Linux version of the suspend-to-disk fea- ture available on most notebook computer that are running, ahem, another operating system. It is still experimental, though, so if you. location, /usr/src /linux. Accordingly, the rest of this chapter assumes that you build the kernel in a subdirectory of your home directory, for exam- ple, /home/kwall/kernel. Using /usr/src/linux

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

TỪ KHÓA LIÊN QUAN