给 Gentoo 装上启动画面
作者:Hily 原始链接:http://hily.me/blog/2008/10/gentoo_splash/
版权声明:可以转载,转载时务必以超链接形式标明文章原始出处和作者信息及版权声明
花了半天时间,总算成功地在 Gentoo 上面装好启动画面。
在安装过程中参考了许多网络资料,很杂很乱,因此直接导致数十次安装失败。
安装过程主要分三步:
安装过程稍不注意就会失败,因此一定要十分地细心。
使用 splash 需要 framebuffer,因此第一步要重新编译内核。
可选的 framebuffer 驱动有 vesafb 和 uvesafb,关于这部分的介绍可以参考 Gentoo 的文档: 配置引导程序。
最后还是在 uvesafb 的项目页中找到比较完整的安装说明:http://dev.gentoo.org/~spock/projects/uvesafb/。
以下是简要翻译一下编译配置的过程:
uvesafb 被包含在 gentoo-sources >= 2.6.23 以上版本中(我用的是 2.6.25)。如果使用的不是这些版本,那么就需要手动为内核打上 uvesafb 的补丁。补丁可以从 uvesafb 主页上下载(uvesafb-0.1-rc3-2.6.23-rc3.patch),下载后运行以下命令:
cd /usr/src/linux ; cat uvesafb-0.1-rc3-2.6.23-rc3.patch | patch -p1
以下是具体的配置编译安装过程:
- cd /usr/src/linux
- 运行 make menuconfig 配置内核,在 “Device Drivers” 部分勾选以下配置:
Connector - unified userspace <-> kernelspace linker
Graphics support --->
Support for frame buffer devices --->
Userspace VESA VGA graphics support体现在 /usr/src/linux/.config 文件里就是:
CONFIG_CONNECTOR=y
CONFIG_FB_UVESA=y - 编译内核: make
- 重新编译 klibc: emerge klibc
注意:因为 klibc 中也需要 uvesafb,所以需要重新编译。 - 安装 v86d: emerge v86d
v86d 用于配合 uvesafb 在用户空间执行操作。 - 重新配置内核。在 “General Setup” 部分选择以下项:
Initial RAM filesystem and RAM disk (initramfs/initrd) support
并把:
Initramfs source file(s)
设置为 /usr/share/v86d/initramfs 。
这样,体现在 /usr/src/linux/.config 文件里就是:CONFIG_INITRAMFS_SOURCE="/usr/share/v86d/initramfs"
- 重新编译内核: make,并安装。
- 添加 video=uvesafb:1024x768-32,mtrr:3,ywrap (或类似代码) 到 grub.conf 的 kernel 命令行中,重启系统后就可以使用 uvesafb 了
安装过程最好严格按照以上步骤,否则内核启动时可能出现类似以下的错误:
gentoo ~ # dmesg | grep uvesafb
Command line: root=/dev/md2 video=uvesafb:1680x1050-32,mtrr:3,ywrap,splash=silent,fadein
Kernel command line: root=/dev/md2 video=uvesafb:1680x1050-32,mtrr:3,ywrap,splash=silent,fadein
uvesafb: unrecognized option splash=silent
uvesafb: unrecognized option fadein
uvesafb: failed to execute /sbin/v86d
uvesafb: make sure that the v86d helper is installed and executable
uvesafb: Getting VBE info block failed (eax=0x4f00, err=-2)
uvesafb: vbe_init() failed with -22
uvesafb: probe of uvesafb.0 failed with error -22
另外要注意的是,uvesafb 分辨率的问题,uvesafb 驱动支持的分辨率都列在以下文件:
/sys/bus/platform/drivers/uvesafb/uvesafb.0/vbe_modes
请不要在 grub.conf 中设置 uvesafb 不支持的分辨率,否则你会感觉 uvesafb 没有生效。
如果找不到 /sys/bus/platform/drivers/uvesafb/uvesafb.0/vbe_modes 这个文件,说明你很可能在配置内核时没有配置Initramfs source file(s),请参考以上第 6 步。
fbcondecor,即 FrameBuffer Console Decoration,用于美化使用 FrameBuffer 的 Console。简单地说,uvesafb 提供了 Console 的容器,而 fbcondecor 负责装饰。
fbcondecor 前身是 fbsplash,关于 bootsplash, fbsplash, gensplash, fbcondecor 的关系请看这里:
http://dev.gentoo.org/~spock/projects/fbcondecor/
安装配置过程:
- cd /usr/src/linux
- 运行 make menuconfig 配置内核,在 “Device Drivers” 部分勾选以下配置:
Graphics support --->
Console display driver support --->
Framebuffer Console support
Support for the Framebuffer Console Decorations体现在 /usr/src/linux/.config 文件里就是:
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FB_CON_DECOR=y - 重新编译内核,并安装。
这部分相对前面两节来说,比较简单。
先安装 splash 工具:
emerge splashutils
再加上两套主题:
emerge splash-themes-livecd splash-themes-gentoo
接着使用 splash_manager 进行配置:
- 修改启动画面主题
- 切换当前使用的主题
- 测试 silent 模式(不显示文本加载信息)
splash_manager -c switch -t livecd-2007.0
执行后会自动修改 grub.conf 中的相关配置,类似以下:
title Gentoo Linux
root (hd0,0)
kernel /boot/kernel root=/dev/md2 video=uvesafb:1024x768-32,mtrr:3,ywrap splash=silent,fadein,theme:livecd-2007.0 console=tty1
initrd /boot/splash/initrd-spl-livecd-2007.0-all
最后要检查一下 grub.conf 是否有自动更新,因为我在配置时发现虽然提示“GRUB config file has been updated”,但 grub.conf 并没有更新,这种情况下需要手动修改 grub.conf。
splash_manager -c set -t livecd-2007.0 --tty=8
请注意不要在 X 环境下执行这个命令。
splash_manager -c demo -t livecd-2007.0 -m s --steps=100
请注意不要在 X 环境下执行这个命令。
有些主题会使屏幕左侧或其它部分的文字不可见,这可以通过修改相应的配置文件来解决。
splash 主题配置文件的安装目录是 /etc/splash/,如要修改 livecd-2007.0 在 1024x768 分辨率下的配置,修改以下配置文件即可:
/etc/splash/livecd-2007.0/1024x768.cfg
最后要把 splashutils 中的 fbcondecor 加到 boot 启动服务中:
rc-update add fbcondecor boot
如果觉得主题太少了,你还可以再装上 100 多套的主题:
emerge bootsplash-themes
好好享受去吧
-- EOF --


Vincent 说道:
2008年11月11日 10:50
你好,我想安装uvesafb
请问在ubuntu8.10下面可以按照这样子的方法安装么?
PS:gentoo-sources >= 2.6.23中的gentoo-sources是不是代表kernel>=2.6.23啊?
hilyjiang 说道:
2008年11月11日 11:04
to Vincent:
Ubuntu 用的包管理系统和 Gentoo 不一样,Ubuntu 是 apt-get,Gentoo 是 emerge。
不过配置编译内核的方法是一样的。
Vincent 说道:
2008年11月11日 13:49
看到官方网页中http://dev.gentoo.org/~spock/projects/uvesafb/
说:如果在其他的系统中,需要采用系统自带的安装方法或者make,make install这样子,我再找找哪里有包吧
谢谢答复
hilyjiang 说道:
2008年11月11日 14:43
to Vincent:
这么喜欢玩,不如试试 Gentoo 吧?