基本概念 menu.lst有时候也叫grub.conf,但是/boot/grub/下会有一个名叫menu.lst的符号链接指向它。它是grub引导系统的配置文件。 基本选项 default 0 timeout 10 hidemenu color white/blue password --md5 $1$etSG6$LlxT8irAfAv5vYQn6tZUw1 default:后跟一个数字,指grub的默认启动项。也可以跟saved字样,这样的话,后面的savedefault就会起作用。 timeout:指定一个超时值,单位为秒,若用户在grub等待的超时时间范围内没有任何操作,则启动默认项。 hidemenu:若被设置则启动的时候默认不显示选项菜单,否则grub启动时自动显示选项菜单。 color:指定grub菜单的默认颜色。 password:指定一个密码,启用grub的密码保护。为安全起见,一般使用md5值,这个值可以使用grub-md5-crypt或者在grub shell中使用md5crypt生成。 一个启动Linux的菜单项 title Ubuntu, kernel 2.6.20-16-generic root (hd0,1) kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=3f784cd9-516f-4808-a601-b19356f6bdea ro quiet splash locale=zh_CN vga=0x318 initrd /boot/initrd.img-2.6.20-16-generic quiet savedefault 略解: title:指定此菜单项的名称,既在grub列表里的名称 root:指定启动分区,注意,编号从0开始:比如第一块硬盘的第一个分区应该是(hd0,0)。启动分区的编号可以使用fdisk -l查询,但是需要root权限。 kernel:指定启动的内核的绝对路径和名称,后边跟参数,一般来说root参数就是你的根文件系统,一定要有的,可以像范例中使用 uuit表示,也可以直接使用/dev/sda2或者/dev/hda1这样的表示。其实有root和kernel两行就可以启动linux了。 initrd:指定系统启动访问真正的根文件系统前,访问的ramdisk映象。具体可以参照 Linux2.6 内核的 Initrd 机制解析 quiet:安静模式?不显示启动过程中具体的信息(此项与内核参数中的quiet区别不明) savedefault:如果选择了这个启动项,那么下次启动时就用此项作为默认项。在前面设置为default saved时有效。 Linux kernel常用的参数 root:根文件系统的位置。 ro:可读写,当启动分区是JFS等格式时需要使用此参数使得系统可以在启动是存放日志。 quiet:安静模式,不显示启动详细信息。 splash:显示徽标。 locale:指定locale vga:指定framebuffer的显示模式。一般对应关系为: 640x480 800x600 1024x768 1280x1024 256 0x301 0x303 0x305 0x307 32k 0x310 0x313 0x316 0x319 64k 0x311 0x314 0x317 0x31A 16M 0x312 0x315 0x318 0x31B 启动Windows的菜单项 # 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 略解: title,root,savedefault同上。 makeactive:使此分区成为活动分区,Windows必须从活动分区启动,而且NT内核的启动分区一般应该为第一个主分区。 chainloader +1:告诉grub不要自己加载此操作系统,而使用这个分区上的加载器,比如ntldr。 晒晒我自己的menulist.ubuntu本来是有三个的我去了一个觉得没什么用,我本来想把recovery mode也去掉的.其实这些去了grub引导的时候都可以自己写,也没什么. title Ubuntu 8.10, kernel 2.6.27-7-generic uuid 5c5b2c70-3956-4170-b82b-3313638fabdd kernel /boot/vmlinuz-2.6.27-7-generic root=UUID=5c5b2c70-3956-4170-b82b-3313638fabdd ro splash initrd /boot/initrd.img-2.6.27-7-generic quiet title Ubuntu 8.10, kernel 2.6.27-7-generic (recovery mode) uuid 5c5b2c70-3956-4170-b82b-3313638fabdd kernel /boot/vmlinuz-2.6.27-7-generic root=UUID=5c5b2c70-3956-4170-b82b-3313638fabdd ro single initrd /boot/initrd.img-2.6.27-7-generic ### END DEBIAN AUTOMAGIC KERNELS LIST # This is a divider, added to separate the menu items below from the Debian # ones. title Other operating systems: root # This entry automatically added by the Debian installer for an existing # linux installation on /dev/sda7. title CentOS (2.6.18-92.el5) (on /dev/sda7) root (hd0,6) kernel /boot/vmlinuz-2.6.18-92.el5 ro root=LABEL=/ rhgb quiet initrd /boot/initrd-2.6.18-92.el5.img savedefault boot title Microsoft Window XP root (hd0,0) savedefault makeactive chainloader +1 |
grub 引导操作系统的程序
最新推荐文章于 2024-04-21 18:10:55 发布