Menu Close
Red Hat Training
A Red Hat training course is available for Red Hat Enterprise Linux
9.2. GRUB
GNU GRand Unified Boot loader(GRUB)是允许在系统引导时选择已安装的操作系统或内核的程序。它也允许用户把参数传给内核。
9.2.1. GRUB 和 x86 引导过程
This section discusses the specific role GRUB plays when booting an x86 system. For a look at the overall boot process, refer to 第 30.2 节 “对引导过程的详细介绍”.
GRUB 在下列阶段把它自己载入内存:
- The Stage 1 or primary boot loader is read into memory by the BIOS from the MBR[4]. The primary boot loader exists on less than 512 bytes of disk space within the MBR and is capable of loading either the Stage 1.5 or Stage 2 boot loader.
- 如果有需要,第 1.5 阶段的引导装载程序由第一阶段的引导装载程序读入内存。 某些硬件在进入第二阶段引导装载程序之前,要求一个中间步骤。当
/boot/
分区处于硬盘的 1024 柱面之上,或者使用 LBA 模式时,这就会发生。第 1.5 阶段引导装载程序位于/boot/
分区或者是 MBR 和/boot/
分区的一小部分空间里。 - 第二阶段或第二级的引导装载程序被读入内存。 第二级引导装载程序显示 GRUB 菜单和命令环境。这个界面允许用户选择引导哪个内核或操作系统、把参数传递给内核、或者查看系统参数。
- 第二级的引导装载程序把操作系统或内核,以及
/boot/sysroot/
里的内容读入内存。 一旦 GRUB 决定启动哪个操作系统或者内核,它就会把它载入内存并把机器的控制权交给那个操作系统。
这个引导Red Hat Enterprise Linux的方法被称作 direct loading,这是因为引导装载程序直接装载操作系统。在引导装载程序和内核之间没有中间步骤。
其他操作系统使用的引导过程可能有所不同。例如,Microsoft® Windows® 操作系统,以及其他的操作系统,都使用 chain loading 的方式装载。在这种方式下,MBR 指向存放操作系统的分区的第一个扇区,找到所需的文件来引导操作系统。
GRUB 支持 direct 和 chain 装载这两种方式,这使它几乎可以引导任何操作系统。
警告
During installation, Microsoft's DOS and Windows installation programs completely overwrite the MBR, destroying any existing boot loaders. If creating a dual-boot system, it is best to install the Microsoft operating system first.