Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

9.7. GRUB 菜​​​​​​​单​​​​​​​配​​​​​​​置​​​​​​​文​​​​​​​件​​​​​​​

The configuration file (/boot/grub/grub.conf), which is used to create the list of operating systems to boot in GRUB's menu interface, essentially allows the user to select a pre-set group of commands to execute. The commands given in 第 9.6 节 “GRUB 命​​​​​​​令​​​​​​​” can be used, as well as some special commands that are only available in the configuration file.

9.7.1. 配​​​​​​​置​​​​​​​文​​​​​​​件​​​​​​​结​​​​​​​构​​​​​​​

GRUB 菜​​​​​​​单​​​​​​​界​​​​​​​面​​​​​​​配​​​​​​​置​​​​​​​文​​​​​​​件​​​​​​​是​​​​​​​ /boot/grub/grub.conf。​​​​​​​为​​​​​​​菜​​​​​​​单​​​​​​​界​​​​​​​面​​​​​​​设​​​​​​​置​​​​​​​全​​​​​​​局​​​​​​​参​​​​​​​数​​​​​​​的​​​​​​​命​​​​​​​令​​​​​​​位​​​​​​​于​​​​​​​这​​​​​​​个​​​​​​​文​​​​​​​件​​​​​​​的​​​​​​​顶​​​​​​​部​​​​​​​,后​​​​​​​面​​​​​​​的​​​​​​​内​​​​​​​容​​​​​​​是​​​​​​​菜​​​​​​​单​​​​​​​里​​​​​​​列​​​​​​​出​​​​​​​的​​​​​​​每​​​​​​​个​​​​​​​操​​​​​​​作​​​​​​​系​​​​​​​统​​​​​​​或​​​​​​​者​​​​​​​内​​​​​​​核​​​​​​​。​​​​​​​
下​​​​​​​面​​​​​​​是​​​​​​​一​​​​​​​个​​​​​​​很​​​​​​​简​​​​​​​单​​​​​​​的​​​​​​​ GRUB 菜​​​​​​​单​​​​​​​配​​​​​​​置​​​​​​​文​​​​​​​件​​​​​​​,它​​​​​​​用​​​​​​​来​​​​​​​引​​​​​​​导​​​​​​​Red Hat Enterprise Linux或​​​​​​​者​​​​​​​ Microsoft Windows 2000:
default=0 
timeout=10 
splashimage=(hd0,0)/grub/splash.xpm.gz 
hiddenmenu 
title Red Hat Enterprise Linux Server (2.6.18-2.el5PAE)         
root (hd0,0)         
kernel /boot/vmlinuz-2.6.18-2.el5PAE ro root=LABEL=/1 rhgb quiet       
initrd /boot/initrd-2.6.18-2.el5PAE.img

# section to load Windows 
title Windows         
rootnoverify (hd0,0)         
chainloader +1
这​​​​​​​个​​​​​​​文​​​​​​​件​​​​​​​使​​​​​​​ GRUB 建​​​​​​​立​​​​​​​了​​​​​​​一​​​​​​​个​​​​​​​把​​​​​​​Red Hat Enterprise Linux作​​​​​​​为​​​​​​​缺​​​​​​​省​​​​​​​操​​​​​​​作​​​​​​​系​​​​​​​统​​​​​​​的​​​​​​​菜​​​​​​​单​​​​​​​,并​​​​​​​在​​​​​​​ 10 秒​​​​​​​后​​​​​​​自​​​​​​​动​​​​​​​启​​​​​​​动​​​​​​​它​​​​​​​。​​​​​​​每​​​​​​​个​​​​​​​操​​​​​​​作​​​​​​​系​​​​​​​统​​​​​​​条​​​​​​​目​​​​​​​都​​​​​​​包​​​​​​​括​​​​​​​了​​​​​​​两​​​​​​​部​​​​​​​分​​​​​​​内​​​​​​​容​​​​​​​,以​​​​​​​及​​​​​​​针​​​​​​​对​​​​​​​于​​​​​​​系​​​​​​​统​​​​​​​磁​​​​​​​盘​​​​​​​分​​​​​​​区​​​​​​​表​​​​​​​的​​​​​​​命​​​​​​​令​​​​​​​。​​​​​​​

注意

注​​​​​​​意​​​​​​​,default 被​​​​​​​设​​​​​​​置​​​​​​​为​​​​​​​一​​​​​​​个​​​​​​​整​​​​​​​数​​​​​​​。​​​​​​​这​​​​​​​指​​​​​​​定​​​​​​​了​​​​​​​ GRUB 配​​​​​​​置​​​​​​​文​​​​​​​件​​​​​​​里​​​​​​​的​​​​​​​第​​​​​​​一​​​​​​​个​​​​​​​ title 行​​​​​​​。​​​​​​​在​​​​​​​前​​​​​​​面​​​​​​​的​​​​​​​例​​​​​​​子​​​​​​​里​​​​​​​,如​​​​​​​果​​​​​​​要​​​​​​​把​​​​​​​ Windows 设​​​​​​​置​​​​​​​为​​​​​​​缺​​​​​​​省​​​​​​​选​​​​​​​项​​​​​​​,你​​​​​​​可​​​​​​​以​​​​​​​把​​​​​​​ default=0 修​​​​​​​改​​​​​​​为​​​​​​​ default=1。​​​​​​​
Configuring a GRUB menu configuration file to boot multiple operating systems is beyond the scope of this chapter. Consult 第 9.9 节 “其​​​​​​​它​​​​​​​资​​​​​​​料​​​​​​​” for a list of additional resources.