[Debian] grub 菜单配置文件的说明
- 什么是grub
- grub是一个操作系统引导器,具备引导多个操作系统的能力
- 为什么是grub
- grub的行为可以由配置文件控制,同时又具有一个类似于bash的控制台环境,这使得它具有非常强大和灵活的控制能力。很多Linux发行版都选择将它作为默认的引导器。
- Debian and grub
- 自动更新的机制
- /sbin/update-grub
 /sbin/update-grub 是 Debian 系统中的一个脚本,它读取 /boot/grub/menu.lst文件的配置,根据一些参数自动重新生成grub启动菜单。
- /etc/kernel-img.conf
 这个配置文件也是 Debian 所特有的,它是在安装或删除内核时,供内核软件包所带的脚本读取,来完成安装内核所需要的一些步骤。
 示例:- do_initrd = yes
 postinst_hook = /sbin/update-grub
 postrm_hook = /sbin/update-grub
 
- do_initrd = yes
- 1,安装(/删除)内核后,自动产生(/删除)相应的 initrd.img 文件
 2,内核安装完成后,调用 /sbin/update-grub 以更新启动菜单
 3,内核卸载完成后,调用 /sbin/update-grub 以更新启动菜单
- Debian中grub配置菜单的说明
 # menu.lst - See: grub(8), info grub, update-grub(8)# grub-install(8), grub-floppy(8),
 # grub-md5-crypt, /usr/share/doc/grub
 # and /usr/share/doc/grub-doc/.
 ## default num
 # 将第num条设置为默认启动。条目计数从0开始,如果没有设置的话,默认就是第0条。
 #
 # 你可以用 'saved' 来代替数字。在这种情况下,默认项就是由命令 'savedefault'
 # 保存的项
 default saved
 ## timeout sec
 # 设置默认项(一般是最开始的那一条)自动启动之前等待的时间,单位是秒。
 timeout 5
 # Pretty colours
 color cyan/blue white/ blue
 ## password ['--md5'] passwd
 # If used in the first section of a menu file, disable all interactive editing
 # control (menu entry editor and command-line) and entries protected by the
 # command 'lock'
 # e.g. password topsecret
 # password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
 # password topsecret
 #
 # examples
 #
 # title Windows 95/98/NT/2000
 # root (hd0,0)
 # makeactive
 # chainloader +1
 #
 # title Linux
 # root (hd0,1)
 # kernel /vmlinuz root=/dev/hda2 ro
 #
 #
 # 将毋需变动的启动信息放到 AUTOMAGIC KERNEL LIST 之前或之后
 # (注:意思是 AUTOMAGIC KERNEL LIST 之间的内容由 update-grub
 # 这条命令来维护,如果你用本配置文件的话,其间的中文注释都会被替换掉)
 ### BEGIN AUTOMAGIC KERNELS LIST
 ## 在 AUTOMAGIC KERNELS LIST 标记之间的行,除了以下的默认的选项外,
 ## 都会被 debian 的 update-grub 脚本所修改
 ## 不要去掉注释,只需要修改以符合你的需求
 ## ## Start Default Options ##
 ## 启动选项的默认内核参数
 ## 如果你想为特定的内核指定特定的参数,请使用kopt_x_y_z
 ## 其中 x.y.z 是内核的版本号。副版本号可以忽略。
 ## 示例: kopt=root=/dev/hda1 ro
 # kopt=root=/dev/hda3 ro vga=791 quiet
 ## grub 所在的根设备
 ## (注:应当是指/boot/grub所在的磁盘分区,
 ## 因为有时 / 和 /boot 并不在同一个分区上)
 ## 示例: groot=(hd0,0)
 # groot=(hd0,2)
 ## 是否需要 update-grub 创建供选择的启动选项
 ## (注:即创建同一内核的不同启动参数的选项)
 ## 示例: alternative=true
 ## alternative=false
 # alternative=true
 ## 是否需要 update-grub 锁定供选择的启动选项
 ## 示例: lockalternative=true
 ## lockalternative=false
 # lockalternative=false
 ## altoption 选项的启动参数
 ## 可以有多项 altoptions
 ## 示例: altoptions=(extra menu suffix) extra boot options
 ## altoptions=(recovery mode) single
 # altoptions=(recovery mode) single
 ## 控制允许多少个内核启动项可以放到 menu.lst 里面
 ## 只对内核的第一项计数,而不包括同一内核的可选项
 ## 示例: howmany=all
 ## howmany=7
 # howmany=all
 ## 是否需要 update-grub 创建 memtest86 的启动选项
 ## 示例: memtest86=true
 ## memtest86=false
 # memtest86=true
 ## ## End Default Options ##
 title Debian GNU/Linux, kernel 2.6.13- 1-k7
 root (hd0,2)
 kernel /boot/vmlinuz-2. 6.13-1-k7 root=/dev/hda3 ro vga=791 quiet
 initrd /boot/initrd.img- 2.6.13-1-k7
 savedefault
 boot
 title Debian GNU/Linux, kernel 2.6.13- 1-k7 (recovery mode)
 root (hd0,2)
 kernel /boot/vmlinuz-2 .6.13-1-k7 root=/dev/hda3 ro vga=791 quiet single
 initrd /boot/initrd.img-2.6.13-1-k7
 savedefault
 boot
 title Debian GNU/Linux, kernel 2.6 .12-1-k7
 root (hd0,2)
 kernel /boot/vmlinuz-2.6.12-1-k7 root=/dev/hda3 ro vga= 791 quiet
 initrd /boot/initrd.img-2.6.12- 1-k7
 savedefault
 boot
 title Debian GNU/Linux, kernel 2 .6.12-1-k7 (recovery mode)
 root (hd0,2)
 kernel /boot/vmlinuz-2.6.12-1 -k7 root=/dev/hda3 ro vga=791 quiet single
 initrd /boot/initrd.img-2.6 .12-1-k7
 savedefault
 boot
 ### END DEBIAN AUTOMAGIC KERNELS LIST
 # 这一条只是分隔符,是为了将它后面的和 Debian 的区分开来
 title Other operating systems:
 root
 # This entry automatically added by the Debian installer for a non-linux OS
 # on /dev/hda1
 title Microsoft Windows XP Professional
 root (hd0,0)
 savedefault
 makeactive
 chainloader +1
http://grub.enbug.org/FrontPage
评论