GRUB2官方文档翻译项目2-04

启动讨论 grub/grub2/syslinux/grub4dos/Lilo
回复
kin3z
帖子: 56
注册时间: 2011-11-01 14:22

GRUB2官方文档翻译项目2-04

#1

帖子 kin3z » 2015-05-12 10:33

4 Booting
4 启动
*********

GRUB can load Multiboot-compliant kernels in a consistent way, but for some free operating systems you need to use some OS-specific magic.
GRUB能以一致的方式加载遵守多启动引导的内核,但对于一些free操作系统你需要使用一些OS所特定的戏法(意指技巧)。

4.1 How to boot operating systems
4.1 如何引导操作系统
=================================

GRUB has two distinct boot methods. One of the two is to load an operating system directly, and the other is to chain-load another boot loader which then will load an operating system actually. Generally speaking, the former is more desirable, because you don't need to install or maintain other boot loaders and GRUB is flexible enough to load an operating system from an arbitrary disk/partition. However, the latter is sometimes required, since GRUB doesn't support all the existing operating systems natively.
GRUB有两种截然不同的引导方式。其中一种是直接地加载操作系统,而另一种实际上是以链式加载另一个引导加载器然后去加载一个操作系统。一般而言,前者是更可取的,因为你不需要去安装或维护其他引导载入程序并且GRUB能够灵活地去加载来自任意的磁盘/分区上的操作系统。然而,某些时候后者是必须的,因为BRUB本身不能支持现有的所有操作系统。

4.1.1 How to boot an OS directly with GRUB
4.1.1 GRUB是如何直接引导到OS(OS:Operating Systems-操作系统)
------------------------------------------

Multiboot (*note Multiboot Specification: (multiboot)Top.) is the native format supported by GRUB. For the sake of convenience, there is also support for Linux, FreeBSD, NetBSD and OpenBSD. If you want to boot other operating systems, you will have to chain-load them (*note Chain-loading::).
多重引导(注:多重引导规范:(多重引导)前部分。)对于GRUB来说是与生俱来就被支持的格式(术语为:原生(native format-原生格式))。为了方便理解,也可以为支持Linux,FreeBSD,NetBSD和OpenBSD。如果你需要启动其他类型的操作系统,你将必须使用链式加载(chain-load)去启动它们(注:链式-加载器)。

FIXME: this section is incomplete.
留意这里:这只是一部分而不是全部。


1. Run the command 'boot' (*note boot::).
1.运行以下命令 'boot' (注:引导)。

However, DOS and Windows have some deficiencies, so you might have to use more complicated instructions. *Note DOS/Windows::, for more information.
然而,DOS和Windows有一些不足之处,所以你可能需要使用到更复杂的指令。注:DOS/Windows::,获取更多相关信息。

4.1.2 Chain-loading an OS
4.1.2 链式-加载 操作系统
-------------------------

Operating systems that do not support Multiboot and do not have specific support in GRUB (specific support is available for Linux, FreeBSD, NetBSD and OpenBSD) must be chain-loaded, which involves loading another boot loader and jumping to it in real mode.
操作系统完全不支持GRUB的多重引导与特性(特性支持只适合于Linux,FreeBSD,NetBSD和OpenBSD)的时候,必须用到链式-加载,它涉及到加载另一个引导加载器并且跳转到实(址)模式(实模式-为汇编内容:此方式的CPU最大寻址为1MB,逻辑段最大为64KB,数据总线最大为20位,一般用16位的寄存器如:8086CPU)。

The 'chainloader' command (*note chainloader::) is used to set this up. It is normally also necessary to load some GRUB modules and set the appropriate root device. Putting this together, we get something like this, for a Windows system on the first partition of the first hard disk:
命令"chainloader"(注:链式加载器)是用于启用设置的。通常它还需要加载一些GRUB的模块和设置好适当的引导设备。把它们放到一起,我们得到了(以下)这些,适合于Windows系统并且它在第一个硬盘的第一个分区:

menuentry "Windows" {
insmod chain
insmod ntfs
set root=(hd0,1)
chainloader +1
}


On systems with multiple hard disks, an additional workaround may be required. *Note DOS/Windows::.
系统上有多个硬盘,可能需要额外的解决方案。*注:DOS/Windows::.

Chain-loading is only supported on PC BIOS and EFI platforms.
链式-加载器只是支持PCBIOS和EFI平台。

4.2 Loopback booting
4.2 Loopback booting(回路引导)
====================

GRUB is able to read from an image (be it one of CD or HDD) stored on any of its accessible storages (refer to *note loopback:: command). However the OS itself should be able to find its root. This usually involves running a userspace program running before the real root is discovered. This is achieved by GRUB loading a specially made small image and passing it as ramdisk to the kernel. This is achieved by commands 'kfreebsd_module', 'knetbsd_module_elf', 'kopenbsd_ramdisk', 'initrd' (*note initrd::), 'initrd16' (*note initrd::), 'multiboot_module', 'multiboot2_module' or 'xnu_ramdisk' depending on the loader. Note that for knetbsd the image must be put inside miniroot.kmod and the whole miniroot.kmod has to be loaded. In kopenbsd payload this is disabled by default. Aditionally behaviour of initial ramdisk depends on command line options. Several distributors provide the image for this purpose or it's integrated in their standard ramdisk and activated by special option. Consult your kernel and distribution manual for more details. Other loaders like appleloader, chainloader (BIOS, EFI, coreboot), freedos, ntldr and plan9 provide no possibility of loading initial ramdisk and as far as author is aware the payloads in question don't support either initial ramdisk or discovering loopback boot in other way and as such not bootable this way. Please consider alternative boot methods like copying all files from the image to actual partition. Consult your OS documentation for more details.
GRUB能够读取一个镜像(无论是CD还是HDD)来自储存它的任何可访问储存设备中(参考*注:loopback::command)。但是操作系统本身则应该能够找到它自己的引导。这通常涉及运行这个用户指定程序前必须清楚并访问真正的root引导位置。这是通过GRUB载入一个特制的小镜像并且载入内存虚拟盘作为内核。这些实现自命令"kfreebsd_module","knetbsd_module_elf","kopenbsd_ramdisk","initrd"(注:initrd),"initrd16"(注:initrd),"multiboot_module","multiboot2_module"或"xnu_ramdisk"及其相关依赖的加载。在kopenbsd里的有效负载默认是关闭的,另外去初始内存虚拟盘的行为依赖于命令行选项。一些发行商提供了用于这一目的的单独镜像或者它已集成了标准内存虚拟盘并且通过特殊选项来激活,请查询你的内核和公布手册获得更多细节。另外一些加载程序可能是苹果加载器,链式加载器(BIOS,EFI,coreboot),freedos,ntldr和plan9不可能提供加载初始化的内存虚拟盘并且作者也意识到有效负载的问题不能支持任何一个初始化内存虚拟盘或者通过一些找出地址引导的方法都是不能实现引导的。请参考备选的引导方法从镜像里复制所有的文件到实际的分区。请查询你的内核和公布手册获得更多细节。


4.3 Some caveats on OS-specific issues
4.3 一些 OS-特性 问题的注意事项
======================================

Here, we describe some caveats on several operating systems.
在这里,我们以一些操作系统去描述那些警告。

4.3.1 GNU/Hurd
4.3.1 GNU/Hurd
--------------

Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there is nothing special about it. But do not forget that you have to specify a root partition to the kernel.
因为 GNU/Hurd 是多重引导-遵守的,所以很容易就引导它;这没什么特别的。但是别忘记了你必须去指定一个内核的根分区。

1. Set GRUB's root device to the same drive as GNU/Hurd's. The command 'search --set=root --file /boot/gnumach.gz' or similar may help you (*note search::).
1.把那些GNU/Hurd所在的驱动器设置为GRUB的根设备。命令为"search --set=root --file /boot/gnumach.gz" 或其他你需要的相关帮助(*注:搜索)。

2. Load the kernel and the modules, like this:
2. 加载内核模块,如下:
grub> multiboot /boot/gnumach.gz root=device:hd0s1
grub> module /hurd/ext2fs.static ext2fs --readonly \
--multiboot-command-line='${kernel-command-line}' \
--host-priv-port='${host-port}' \
--device-master-port='${device-port}' \
--exec-server-task='${exec-task}' -T typed '${root}' \
'$(task-create)' '$(task-resume)'
grub> module /lib/ld.so.1 exec /hurd/exec '$(exec-task=task-create)'


3. Finally, run the command 'boot' (*note boot::).
3. 最后,运行命令 "boot" (注:引导)。

4.3.2 GNU/Linux
4.3.2 GNU/Linux
---------------

It is relatively easy to boot GNU/Linux from GRUB, because it somewhat resembles to boot a Multiboot-compliant OS.
他是相对容易从GRUB去引导GNU/Linux,因为它有点类似于引导一个遵从多重引导规范的系统。

1. Set GRUB's root device to the same drive as GNU/Linux's. The command 'search --set=root --file /vmlinuz' or similar may help you (*note search::).
1. 设置GRUB的根设备为GNU/Linux所在的驱动器。命令为 "search --set=root --file /vmlinuz" 或其他你需要的相关帮助(*注:搜索)。

2. Load the kernel using the command 'linux' (*note linux::):
2. 通过命令"linux"去加载内核 (*注:linux):
grub> linux /vmlinuz root=/dev/sda1

If you need to specify some kernel parameters, just append them to the command. For example, to set 'acpi' to 'off', do this:
如果你需要规定一些内核参数,只要将它们添加到命令后面。例如,要设置"acpi"为"off",这样做:
grub> linux /vmlinuz root=/dev/sda1 acpi=off
See the documentation in the Linux source tree for complete information on the available options.
请看完整的Linux原始资料信息文档与可用的选项设置。

With 'linux' GRUB uses 32-bit protocol. Some BIOS services like APM or EDD aren't available with this protocol. In this case you need to use 'linux16'
"linux"的GRUB使用 32-bit 协议。一些BIOS服务如APM或EDD是不可用在这样的协议。在这种情况下,你需要使用"linux16"
grub> linux16 /vmlinuz root=/dev/sda1 acpi=off

3. If you use an initrd, execute the command 'initrd' (*note initrd::) after 'linux':
3.如果你使用一个初始化RAM磁盘(initrd),在"linux"命令后面执行这个命令"initrd" (注:initrd):
grub> initrd /initrd
If you used 'linux16' you need to use 'initrd16':
如果你使用"linux16"你需要使用"initrd16":
grub> initrd16 /initrd

4. Finally, run the command 'boot' (*note boot::).
4. 最后,运行命令 "boot" (*注:引导)。

*Caution:* If you use an initrd and specify the 'mem=' option to the kernel to let it use less than actual memory size, you will also have to specify the same memory size to GRUB. To let GRUB know the size, run the command 'uppermem' _before_ loading the kernel. *Note uppermem::, for more information.
*注意:* 如果你使用一个初始化RAM磁盘并且指定内核的 "mem=" 选项让它使用小于实际内存大小,你将还必须指定GRUB相同的内存大小。同上让GRUB知道大小,在加载内核之前运行命令"uppermem"。*注:uppermem,得到更多信息。

4.3.3 DOS/Windows
4.3.3 DOS/Windows
-----------------

GRUB cannot boot DOS or Windows directly, so you must chain-load them (*note Chain-loading::). However, their boot loaders have some critical deficiencies, so it may not work to just chain-load them. To overcome the problems, GRUB provides you with two helper functions.
GRUB不能直接引导DOS或Windows,所以你必须链式-加载它们(*注:chain-loading)。然而,它们的引导加载器有一些关键缺陷,所以只是链式-加载它们也可能不工作。为了克服这些问题,GRUB为你提供了两个helper功能。

If you have installed DOS (or Windows) on a non-first hard disk, you have to use the disk swapping technique, because that OS cannot boot from any disks but the first one. The workaround used in GRUB is the command 'drivemap' (*note drivemap::), like this:
如果你已经把DOS(或Windows)安装了但不是在第一个硬盘上,你必须使用磁盘交换技术,因为这些系统不能够启动自除第一磁盘意外的任何磁盘。GRUB使用的解决方案是命令"drivemap"(注:drivemap),像这样:
drivemap -s (hd0) (hd1)
This performs a "virtual" swap between your first and second hard drive.
这里"虚拟"地执行你的第一和第二硬盘之间的交换。
*Caution:* This is effective only if DOS (or Windows) uses BIOS to access the swapped disks. If that OS uses a special driver for the disks, this probably won't work.
*注意:* 这只有效于DOS(或Windows)通过BIOS去使用被调换了的磁盘。如果那OS使用了特殊的驱动器作为磁盘,这可能不会工作。

Another problem arises if you installed more than one set of DOS/Windows onto one disk, because they could be confused if there are more than one primary partitions for DOS/Windows. Certainly you should avoid doing this, but there is a solution if you do want to do so. Use the partition hiding/unhiding technique.
另一个问题为如果你安装更多的不止一套DOS/Windows到一个硬盘上,因为如果有一个以上的DOS/Windows主分区可能会引起它们的混肴。当然你应该避免这样做,但这有一个解决方案,如果你想这样做。使用分区躲藏/反躲藏技术。

If GRUB "hides" a DOS (or Windows) partition (*note parttool::), DOS(or Windows) will ignore the partition. If GRUB "unhides" a DOS (or Windows) partition, DOS (or Windows) will detect the partition. Thus,if you have installed DOS (or Windows) on the first and the second partition of the first hard disk, and you want to boot the copy on the first partition, do the following:
如果GRUB"躲藏(hides)"一个DOS(或Windows)分区(*注:parttool),DOS(或Windows)将忽略这个分区。如果GRUB"反躲藏(unhides)"一个DOS(或Windows)分区,DOS(或Windows)将检测这个分区。由此,如果有安装过DOS(或Windows)在第一个硬盘的第一和第二分区上,而你需要引导这个副本到第一分区,执行以下操作:
partto ol (hd0,1) hidden-
parttool (hd0,2) hidden+
set root=(hd0,1)
chainloader +1
parttool ${root} boot+
boot

回复