定制GRUB启动画面

Fedora每日一篇
Fedora系统启动界面一般是GRUB的启动画面或菜单。该画面的背景图像是Fedora artTeam提供的系统文件/boot/grub/splash.xpm.gz来自软件包Fedora-logos。
定制启动画面,可以用你最喜欢的照片或是其他logo,
1. 准备合适的图像文件;该图像文件为满足640x480像素最多14色的图像格式的文件,因为启动器使用的VGA模式分别率为640x480 16色,而2个颜色是留给文本的,所以图像只能用14色,如果是用GIMP编辑器编辑图像的话,首先确保图像大小是640x480,而后在菜单图像->模式->索引 给最大颜色数14的值。
2. 保存文件到/boot/grub使用后缀名为.xpm.gz
3. 编辑/boot/grub/grub.conf文件,splashimage指令应该指向我们的新文件,(hdx,Y)是GRUB的硬盘分区表示方法,大致的(hd0,0)表示第一块硬盘的第一分区,

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/concord3/f8root
# initrd /initrd-version.img
#boot=/dev/md0
default=0
timeout=5
splashimage=(hd0,0)/grub/myimage.xpm.gz
hiddenmenu
title Fedora (2.6.23.15-137.fc8)
root (hd0,0)
kernel /vmlinuz-2.6.23.15-137.fc8 ro root=/dev/concord3/f8root rhgb quiet
initrd /initrd-2.6.23.15-137.fc8.img
title Fedora (2.6.23.14-115.fc8)
root (hd0,0)
kernel /vmlinuz-2.6.23.14-115.fc8 ro root=/dev/concord3/f8root rhgb quiet
initrd /initrd-2.6.23.14-115.fc8.img

重启系统。

XPM是GRUB所用的文件格式,比较特殊的地方是:它是C代码的片段,这种代码包含ascii到颜色的转换表而图像本身是ASCII图像。可以用gzip解压缩该文件并用文本工具查看该文件。

一些小技巧:

  • 选择包含颜色比较少的图像,以免丢失过多的图像信息;
  • GRUB使用白色字符显示菜单内容,应尽量避免使用过亮的颜色;

Comments

Popular posts from this blog

RPM Build Tips!

关于.rpmnew和.rpmsave文件

Linux block device commands