[转帖]图形化的grub2──grub2-graphical

启动讨论 grub/grub2/syslinux/grub4dos/Lilo
头像
高_默
帖子: 163
注册时间: 2008-12-30 19:29

[转帖]图形化的grub2──grub2-graphical

#1

帖子 高_默 » 2009-06-10 8:59

本文来至:http://hi.baidu.com/jiyeqian/blog/item/ ... 7a476.html

安装使用 grub22009年04月27日 星期一 下午 07:45前几天,看到linuxtoy有一篇关于grub2的文章于是试了一下,安装上了,但是有一些其他的心得,写下来。
图片

图片

这部分来自linuxtoy:
传 说 GRUB 2 支持很多格式的背景,比如 JPEG、PND、TGA 等格式,支持 24 色,支持 800×600、1024×768,支持中文菜单显示。于是,受诱惑,安装了一下,但由于网上资料少,自己配置找的比较辛苦。不过还好,基本搞定了。写下 来,做个笔记。
1. 安装 GRUB 2。我用的是 Debian Lenny,安装相当简单,直接执行:
apt-get install grub2
系统依赖装上 grub-pc 和 grub-common,安装过程中提示:

GRUB upgrade scripts have detected a GRUB Legacy setup in /boot/grub.
In order to replace the Legacy version of GRUB in your system, it is
recommended that /boot/grub/menu.lst is adjusted to chainload GRUB 2
from your existing GRUB Legacy setup. This step may be automaticaly
performed now.

It’s recommended that you accept chainloading GRUB 2 from menu.lst, and
verify that your new GRUB 2 setup is functional for you, before you
install it directly to your MBR (Master Boot Record).

In either case, whenever you want GRUB 2 to be loaded directly from MBR,
you can do so by issuing (as root) the following command:
upgrade-from-grub-legacy

小解释:这个提示是说装 GRUB 2 时侦测到你有旧的 GRUB 设置,系统将采用旧的设置来引导,新的 GRUB 2 暂时会成为旧 GRUB 的一个项目引导,当你确定 GRUB 2 可以正常使用后,运行 upgrade-from-grub-legacy,旧的 GRUB 会消失,只留 GRUB 2 的菜单。

Chainload from menu.lst?

将 GRUB 2 用旧的配置 menu.lst 引导?这里建议使用。

The following Linux command line was extracted from the `kopt’ parameter │
│ in GRUB Legacy’s menu.lst. Please verify that it is correct, and modify
│ it if necessary.
│ Linux command line:
│ │

这里不大了解,不过我是没输入任何东西自己确定的。
2. 安装完成后,重启。你会发现 GRUB 菜单有点不同了,上面有 GRUB 2 的项目,在中间还有段提示,当你确定 GRUB 2 能正常使用后,使用 upgrade-from-grub-legacy。不能引导的话,下面保留有原来的 GRUB 设置,可以直接使用。

使用 upgrade-from-grub-legacy 命令后,将删除原来的 menu.lst 项目。
3. GRUB 2 的设置有所变化,不是原来的 menu.lst,而是 /boot/grub/grub.cfg。
4. 看看 grub.cfg,学习下这个文件(注意,默认情况下 /boot/grub/grub.cfg 为只读文件,修改的话,请先 chmod +w /boot/grub/grub.cfg)

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/update-grub using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###

set default=0
#默认为 0,就是排第一个的项目。

set timeout=5
#等待时间

set root=(hd0,7)
#设置 root 分区

search –fs-uuid –set 15d9bbc2-a1be-400c-883b-0b038a8174e0

if font /usr/share/grub/ascii.pff ; then
#这里的 ascii.pff 为默认的字体,不支持中文,如果
#要中文支持,请改为 unicode.pff

set gfxmode=1024×768 #默认为 640×480
#设置分辨率,这个建议跟你想设定的图片大小一致

insmod gfxterm
#插入模块 gfxterm,当你前面设置为 unicode.pff 后,这个终端支持中文显
#示,它还支持 24 位图像

insmod vbe
#插入 vbe 模块,GRUB 2 引入很多模块的东西,要使用它,需要在这里加入

insmod png
#比如我们要想他显示 png 的图像做 GRUB 2 的背景,需要添加前面这行

insmod jpeg
#添加 jpg 支持。在 /boot/grub 下可查看模块,带 .mod 的文件

insmod tga
#如果要使用 tga 的图片做背景的话,gurb2-themes 里就是这种文件

terminal gfxterm
#设置 GRUB 2 终端为 gfxterm

background_image /boot/grub/111.png
#设置背景图片

fi

### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###

set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
#这两行为 Debian 下的菜单颜色设置,如果默认的话
#你会发现背景完全被蓝色挡住了,你需要修改 blue
#你可以改为 black,这样背景就会出现

### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_hurd ###

### END /etc/grub.d/10_hurd ###

### BEGIN /etc/grub.d/10_linux ###

set root=(hd0,7)

search –fs-uuid –set 15d9bbc2-a1be-400c-883b-0b038a8174e0

menuentry “Debian GNU/Linux, linux 2.6.26-1-amd64″ {

linux /boot/vmlinuz-2.6.26-1-amd64 root=UUID=15d9bbc2-a1be-400c-883b-0b038a8174e0 ro
initrd /boot/initrd.img-2.6.26-1-amd64

}
#这里的 root=xxxx 也可以使用 /dev/hdax 来代替。
#当你的系统无法启动,而又不想打那么长的话。
#在 GRUB 2 启动时的命令行里,使用 (hd 加 tab 键可以看到分区和 uuid 号

menuentry “Debian GNU/Linux, linux 2.6.26-1-amd64 (single-user mode)” {

linux /boot/vmlinuz-2.6.26-1-amd64 root=UUID=15d9bbc2-a1be-400c-883b-0b038a8174e0 ro single
initrd /boot/initrd.img-2.6.26-1-amd64

}
#默认的 GRUB 2 好像没添加 Windows 的项目,这样添加

menuentry “启动 Windows”
#菜单名字
{

set root=(hd0,1)
#设置 Windows 分区,这里要注意 GRUB 2 是硬盘从 0,分区从 1 开始

chainloader +1
#原来的 GRUB 是 hd0,0 开始

}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/30_os-prober ###

### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###

# This file is an example on how to add custom entries

### END /etc/grub.d/40_custom ###

下面是我的一些心得:
1. 安装完重启后,我的无法进入系统,原因是原来的grub不是用boot(hd0,7)这样选择分区,所以无法进入系统,进入系统方法,在grub倒计时 时,选择你的要进入的linux系统,按e键,开始对其进行编辑,将原来的boot那行改为boot (hd0,x) #x是你系统的分区
确定,然后用修改的那个选项启动,就可以了,进入后执行upgrade-from-grub-legacy就ok了,下一次就不会出现那种问题了。
2. 在 linux /boot/vmlinuz-2.6.26-1-amd64 root=UUID=15d9bbc2-a1be-400c-883b-0b038a8174e0 这一行后面加上"ro quiet vga=791 splash"选项使其变为 linux /boot/vmlinuz-2.6.26-1-amd64 root=UUID=15d9bbc2-a1be-400c-883b-0b038a8174e0 ro quiet vga=791 splash(需要安装splashy)
这样系统启动时,会是操作系统的logo和进度条,不加的话会是完全的字符启动界面。

参考:

http://gale.yo2.cn/tag/grub2/

http://splashy.alioth.debian.org/wiki/faq
头像
终极星魂
帖子: 87
注册时间: 2009-02-07 23:30

Re: [转帖]图形化的grub2──grub2-graphical

#2

帖子 终极星魂 » 2009-06-10 9:16

好贴,收藏
$ ubuntu++
心中无敌者,无敌于天下
coleetas
帖子: 29
注册时间: 2007-10-31 20:47

Re: [转帖]图形化的grub2──grub2-graphical

#3

帖子 coleetas » 2009-07-03 22:28

终极星魂 写了:好贴,收藏
me2
onelynx
帖子: 817
注册时间: 2008-11-13 16:03

Re: [转帖]图形化的grub2──grub2-graphical

#4

帖子 onelynx » 2009-07-03 22:35

支持 EXT4 了没?
头像
paaboo
帖子: 27
注册时间: 2006-11-25 13:54
来自: 福建

Re: [转帖]图形化的grub2──grub2-graphical

#5

帖子 paaboo » 2009-07-26 22:23

好的~~ :em01
满天相思雨
--------------------------
AMD 4400+
NVIDIA 8600 gs
DDR2 4G
SUMSUNG 20'
SATA 200G
UBUNTU 9.04
一点浩然气@夏天
头像
wangdu2002
帖子: 13284
注册时间: 2008-12-13 19:39
来自: 物华天宝人杰地灵

Re: [转帖]图形化的grub2──grub2-graphical

#6

帖子 wangdu2002 » 2009-07-26 22:34

写得很详细,比我转的好用,顶之。 :em11
行到水穷处,坐看云起时。
海内生明月,天涯共此夕。
--------------------吾本独!
头像
arvan
帖子: 190
注册时间: 2005-08-02 18:04
来自: Lanzhou
联系:

Re: [转帖]图形化的grub2──grub2-graphical

#7

帖子 arvan » 2009-08-22 17:46

mark这个帖子。

非常好。
Jonathan Swift - "May you live every day of your life."
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: [转帖]图形化的grub2──grub2-graphical

#8

帖子 eexpress » 2009-08-22 21:39

只是会慢得不可忍受
● 鸣学
头像
123826776
帖子: 51
注册时间: 2008-11-01 3:02
来自: 水星

Re: [转帖]图形化的grub2──grub2-graphical

#9

帖子 123826776 » 2009-10-27 19:43

好经验.新手打标记.
爱走.心碎.人憔悴...

喝不尽的杯中酒.斩不尽的心中愁...

问世间情为何物.只叫人伤碎心.痛彻骨...
bean
帖子: 238
注册时间: 2008-06-03 12:25

Re: [转帖]图形化的grub2──grub2-graphical

#10

帖子 bean » 2009-10-27 20:58

这个是基于Colin以前写的图形补丁,速度非常慢。我重新构建了一个的菜单系统,速度很快,而且可以非常灵活的定制。感兴趣的可以到时空论坛里看看:

http://bbs.znpc.net/viewthread.php?tid= ... a=page%3D1
lovecn
帖子: 16
注册时间: 2009-05-20 12:44

Re: [转帖]图形化的grub2──grub2-graphical

#11

帖子 lovecn » 2009-10-29 12:08

为什么升级到9.10了还是grub1。5
头像
非主流1987
帖子: 427
注册时间: 2008-05-09 23:50

Re: [转帖]图形化的grub2──grub2-graphical

#12

帖子 非主流1987 » 2009-10-29 12:22

:em04 很好很强大的东西·····mark一个····
头像
comfanter
帖子: 190
注册时间: 2009-05-02 14:51

Re: [转帖]图形化的grub2──grub2-graphical

#13

帖子 comfanter » 2009-10-29 12:24

很好看
jay_djy
帖子: 6
注册时间: 2009-05-21 12:42

Re: [转帖]图形化的grub2──grub2-graphical

#14

帖子 jay_djy » 2009-10-30 11:51

很漂亮,怎么改成那样啊
头像
isSuS
帖子: 223
注册时间: 2008-11-28 22:22
来自: /广西/钦州

Re: [转帖]图形化的grub2──grub2-graphical

#15

帖子 isSuS » 2009-10-30 11:56

很强力的样子,先顶再阅 :em11
回复