都是Grub2背景图像惹的祸!

启动讨论 grub/grub2/syslinux/grub4dos/Lilo
头像
愿在天涯
帖子: 27
注册时间: 2009-10-07 18:12
联系:

都是Grub2背景图像惹的祸!

#1

帖子 愿在天涯 » 2009-11-06 17:28

自已参照以下的贴子viewtopic.php?t=236180和smallApple达人的附件(Grub2基础教程.pdf等)自行修改了自已的grub显示菜单.也基本上熟悉了引导菜单的原理。先把修改好的/boot/grub/grub.cfg给出来看看,好帮我解决后面的问题。

代码: 全选

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

### BEGIN /etc/grub.d/00_header ###
if [ -s /boot/grub/grubenv ]; then
  have_grubenv=true
  load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
  saved_entry=${prev_saved_entry}
  save_env saved_entry
  prev_saved_entry=
  save_env prev_saved_entry
fi
insmod jpeg
insmod png
insmod ntfs
insmod ext2
set root=(hd0,8)
search --no-floppy --fs-uuid --set dc383241-f1cd-4059-8843-f3eb403376cd
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
fi
if [ ${recordfail} = 1 ]; then
  set timeout=-1
else
  set timeout=3
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod ext2
set root=(hd0,8)
search --no-floppy --fs-uuid --set dc383241-f1cd-4059-8843-f3eb403376cd
insmod jpeg
if background_image /boot/images/moreblue-orbit-grub.jpg ; then
  set color_normal=black/black
  set color_highlight=magenta/black
else
  set menu_color_normal=white/black
  set menu_color_highlight=green/black
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "进入Ubuntu Karmic操作系统" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
	set quiet=1
	insmod ext2
	set root=(hd0,8)
	search --no-floppy --fs-uuid --set dc383241-f1cd-4059-8843-f3eb403376cd
	linux	/boot/vmlinuz-2.6.31-14-generic root=UUID=dc383241-f1cd-4059-8843-f3eb403376cd ro   quiet splash
	initrd	/boot/initrd.img-2.6.31-14-generic
}
menuentry "进入Ubuntu Karmic操作系统(修复模式)" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
	insmod ext2
	set root=(hd0,8)
	search --no-floppy --fs-uuid --set dc383241-f1cd-4059-8843-f3eb403376cd
	linux	/boot/vmlinuz-2.6.31-14-generic root=UUID=dc383241-f1cd-4059-8843-f3eb403376cd ro single 
	initrd	/boot/initrd.img-2.6.31-14-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "启动硬件内存检测" {
	linux16	/boot/memtest86+.bin
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "进入Windows 7 or Windows XP操作系统" {
	insmod ntfs
	set root=(hd0,1)
	search --no-floppy --fs-uuid --set 06d07950d07946c9
	chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
同上面链接的贴子里那位楼主童鞋(bbeikke)一样的问题,update-grub之后显示已Found背景图片,但开机依然没有显示。显然是图片有问题,但我想确认一下,参照了smallApple的说法,是开机的时候按c,然后background_image (hd0,8)/boot/images/more-blue-orbit-grub.jpg (说明一下,我的/分区是在sda8,至于/boo/images嘛,自设的,不一定非要是splashimages)。第一次我试过,确实是图片有问题,显示那个什么extra.......(没记下来,懒得用笔写,反正是图片超出什么什么的了....)。
第一个图片显示挂了,我参照bbeikke小童鞋的做法,输入转换图片命令:

代码: 全选

convert 源文件名 -resize 640x480! -colors 24 moreblue-orbit-grub.png 
哎,为啥子不起作图呢?反正我半天没看到生成什么。(后来才发现生成了,原因是那个鬼Dolphin资源管理器不会自动刷新。要按F5才会显示,汗~~)。所以很郁闷,打算换一张图,就又拷了一张图片到/boot/images里面了,也改名了。突然,我想啊,又要开机验证图片,那个叫烦啊,所以我直接在终端打入了grub命令准备在终端下验证,显示没有安装,所以就

代码: 全选

sudo apt-get install grub
.进入到了grub>命令下。然而,那个background_image .....什么什么命令不顶事,晕死了。然后退出了,想了想,找/etc/grub.d/下的几个文件改了改代码,觉得没啥好改了,就习惯性的sudo update-grub. 我靠~,出现下面的了:
###################
wjp@ThinkPad:/etc/grub.d$ sudo update-grub
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ...

Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N)

###################
然后我蒙了,grub2可是没有menu.lst的啊。点了下Y。再看一下,晕了:
####################
Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) y
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.31-14-generic
Found GRUB 2: /boot/grub/core.img
Found kernel: /boot/memtest86+.bin
Updating /boot/grub/menu.lst ... done

wjp@ThinkPad:/etc/grub.d$
####################
完了!我一想啊,这下update-grub就把我以前花大半心血改的grub菜单又还原了,而且还是不搭调的grub.一不像一,二不像二的了。我看了下menu.lst。真是恨死了。恨死了!太长了,就不贴menu.lst了。
一气之下,sudo apt-get remove grub 删了它。这下好了,update-grub命令没了。哭~~无语!我被挂起了,不知炸整了。。。。(还好开机菜单没有变,但update-grub没了,我以后也没法改了。)
这下彻底挂起了,我茫然找不着路了。这叫什么来着的,偷鸡不成,反蚀把米?陪了夫人又折bing?
背景图片没搞成,还断了路了。

所以,现在,敬请高手,过来人,小朋友都过来瞧瞧,我这下一步怎魔办?还有那个转换图片的命令确实有用不?顺便告诉我下背景图片的要求,限制是怎么一回事,举个例子把1280x800的高像素图片转换成合格的一下。我到现在还是没背景。教程里也没有具体的解释操作。只是说放一张图片而已。


放一下我想用的背景图吧,在附件。
SOS
附件
grub背景图。
grub背景图。
头像
愿在天涯
帖子: 27
注册时间: 2009-10-07 18:12
联系:

Re: 都是Grub2背景图像惹的祸!

#2

帖子 愿在天涯 » 2009-11-06 17:29

smallApple现身吧...
头像
daf3707
论坛版主
帖子: 12731
注册时间: 2007-06-13 15:57
来自: 在他乡

Re: 都是Grub2背景图像惹的祸!

#3

帖子 daf3707 » 2009-11-06 17:37

先把grub阉了.安装grub2

代码: 全选

sudo apt-get remove grub;sudo apt-get install grub2

代码: 全选

sudo update-grub
你显示图片之前要加载图片模块才行
建议你安装源里的图片,有十几张吧。

代码: 全选

sudo apt-get install grub2-splashimages 
如我的,把下面的加入到 timeout那行下面。不想每次更改的话,参见小苹果的文档。
insmod tga
background_image /usr/share/images/grub/Plasma-lamp.tga
这是一个眼睛的背景。
头像
smallapple
论坛版主
帖子: 7868
注册时间: 2009-03-28 15:12

Re: 都是Grub2背景图像惹的祸!

#4

帖子 smallapple » 2009-11-06 17:38

sudo apt-get remove grub

sudo apt-get install grub2
不然哪来grub用。
看你的grub.cfg 没有 background_image ....的 :em06 :em06 :em06

你的图片我得测试下
头像
愿在天涯
帖子: 27
注册时间: 2009-10-07 18:12
联系:

Re: 都是Grub2背景图像惹的祸!

#5

帖子 愿在天涯 » 2009-11-06 17:51

Thanks You all! 原来还有一个sudo apt-get install grub2啊,不说不知道,一说还....觉得自已好s..晕了。试下,试好了,报喜报感谢。
头像
愿在天涯
帖子: 27
注册时间: 2009-10-07 18:12
联系:

Re: 都是Grub2背景图像惹的祸!

#6

帖子 愿在天涯 » 2009-11-06 17:54

代码里面有一段:
insmod jpeg
if background_image /boot/images/moreblue-orbit-grub.jpg ; then
set color_normal=black/black
set color_highlight=magenta/black
else
set menu_color_normal=white/black
set menu_color_highlight=green/black
fi
这个就是background_image的了
头像
smallapple
论坛版主
帖子: 7868
注册时间: 2009-03-28 15:12

Re: 都是Grub2背景图像惹的祸!

#7

帖子 smallapple » 2009-11-06 18:07

愿在天涯 写了:代码里面有一段:
insmod jpeg
if background_image /boot/images/moreblue-orbit-grub.jpg ; then
set color_normal=black/black
set color_highlight=magenta/black
else
set menu_color_normal=white/black
set menu_color_highlight=green/black
fi
这个就是background_image的了
看到了,用这个语法,那个图片一定要放在/boot/images/下面,文件名必须是 moreblue-orbit-grub.jpg
头像
Emie_Yu
帖子: 404
注册时间: 2007-09-20 11:49
来自: Wuhan,Mars
联系:

Re: 都是Grub2背景图像惹的祸!

#8

帖子 Emie_Yu » 2009-11-06 18:09

这个背景图我喜欢 :em11
back to Ubuntu + Opera + Chrome
Blogbus : It's Flying!Welcome!!!
Twitter : just say whatever whenever you want
Wakoopa : discover new softs & games
Last.fm : share your tastes & find new songs
头像
smallapple
论坛版主
帖子: 7868
注册时间: 2009-03-28 15:12

Re: 都是Grub2背景图像惹的祸!

#9

帖子 smallapple » 2009-11-06 18:21

你这个图片格式有问题,用 gimp 转化下就可以了,另外你的cfg 设置 set gfxmode=640x480,图片也要为 640x480的,不然显示不全。
图片格式可以是png tga或jpeg,分辨率为640x480 800x600和1027x768,色深为 16位或24位。
640x480
3.jpg
1024x768
4.jpg
头像
愿在天涯
帖子: 27
注册时间: 2009-10-07 18:12
联系:

Re: 都是Grub2背景图像惹的祸!

#10

帖子 愿在天涯 » 2009-11-06 18:29

smallapple 写了:
愿在天涯 写了:代码里面有一段:
insmod jpeg
if background_image /boot/images/moreblue-orbit-grub.jpg ; then
set color_normal=black/black
set color_highlight=magenta/black
else
set menu_color_normal=white/black
set menu_color_highlight=green/black
fi
这个就是background_image的了
看到了,用这个语法,那个图片一定要放在/boot/images/下面,文件名必须是 moreblue-orbit-grub.jpg
恩,这个知道了。感谢提供的已做好的图片附件,现在已经可以完美显示了。
ryoohki
帖子: 3249
注册时间: 2008-10-28 20:18

Re: 都是Grub2背景图像惹的祸!

#11

帖子 ryoohki » 2009-11-06 19:11

...这个背景不方便用...
头像
冲浪板
论坛版主
帖子: 7513
注册时间: 2007-05-06 8:19

Re: 都是Grub2背景图像惹的祸!

#12

帖子 冲浪板 » 2009-11-07 12:46

手放下,先
头像
lordsidious
帖子: 229
注册时间: 2008-07-25 18:50

Re: 都是Grub2背景图像惹的祸!

#13

帖子 lordsidious » 2009-12-15 21:48

宽屏笔记本有办法么?分辨率怎么设?
头像
yehyun
帖子: 179
注册时间: 2006-10-11 23:29

Re: 都是Grub2背景图像惹的祸!

#14

帖子 yehyun » 2010-01-02 22:49

不错,顶一下
/)/) (\/)︵
(-.-)(·_ _ )~
在Ubuntu中进步
头像
x1z1h1
帖子: 14
注册时间: 2009-12-13 18:21

Re: 都是Grub2背景图像惹的祸!

#15

帖子 x1z1h1 » 2010-01-02 22:58

:em06 我的 ubuntu 9.10 貌似没/boot/images 这个 文件 难道 我自己 建个 就行? :em20 小白就是这么可爱~~ :em06
回复