|
实践机器:Gentoo X86_64 gentoo-sources-2.6.28-r1
关键字:bootsplash, framebuffer, vesafb
一.内核配置
1.开启framebuffer的支持,以下为必须选项
- Device Drivers --->
- Graphics support --->
- <*> Support for frame buffer devices --->
- [*] VESA VGA graphics support
- Console display driver support --->
- <*> Framebuffer Console support
- [*] Support for the Framebuffer Console Decorations
复制代码
下面这个选项一般X用户都已开启
- Processor type and features --->
- [*] MTRR (Memory Type Range Register) support
复制代码
只要能用fbterm,或mplayer播放视频、fbida查看图片等任一依赖framebuffer
的工具就可以知道framebuffer支持已经打开了
正确使用vesafb应该在dmesg有其信息
- dmesg | grep vesafb
- [ 0.000000] Command line: root=/dev/sda2 rootfstype=ext4 quiet vga=865 video=vesafb:mtrr:3 splash=silent,fadein,theme:natural_gentoo console=tty1
- [ 0.000000] Kernel command line: root=/dev/sda2 rootfstype=ext4 quiet vga=865 video=vesafb:mtrr:3 splash=silent,fadein,theme:natural_gentoo console=tty1
- [ 0.404665] vesafb: framebuffer at 0xd5000000, mapped to 0xffffc20004100000, using 8000k, total 14336k
- [ 0.404672] vesafb: mode is 1280x800x32, linelength=5120, pages=1
- [ 0.404676] vesafb: scrolling: redraw
- [ 0.404681] vesafb: Truecolor: size=8:8:8:8, shift=24:16:8:0
复制代码
2.需加载initramfs/initrd的支持
- General setup --->
- [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
- () Initramfs source file(s)
复制代码
如果不能加载initrd的话,framebuffer将只能做到console decoration而没有开关机的loading画面
3.在bootsplash界面时可以按F2切换verbose模式
- Device Drivers --->
- Input Device Support --->
- <*> Event Interface
复制代码
二.软件包安装
1.splashutils工具
USE="mng png fbcondecor" emerge splashutils
mng和png为支持splash themes images需要,fbcondecor即framebuffer console decoration
命令euse -i fbcondecor的解释
[- ] fbcondecor (media-gfx/splashutils):
Support for the fbcondecor kernel patch.
其实是在splashutils中是增加一个rc脚本来启动fbsplash
splashutils的依赖之一为klibc,而不同版本的klibc编译时依赖特定版本的内核源码,如目前的1.5.12-r1需要2.6.26的kernel源码。
当然这些它是自动完成的,我是解释一下klibc要下载几十MB源代码的原因。
2.主题包
emerge media-gfx/splash-themes-gentoo
20080914版本(keywords为~x86或~amd64)包含natural_gentoo, gentoo, emergence主题
emerge media-gfx/splash-themes-livecd
可安装2004.3~2007.0各个版本,目前最新版是livecd-2007.0主题
三.主题与grub参数
1.选择主题
ls /etc/splash可以看到已安装的可用主题,本例使用natural_gentoo
2.制作initrd镜像
# /usr/sbin/splash_geninitramfs -g /boot/initrd -r 1280x800 -v natural_gentoo
-g指定生成的镜像文件路径
-r可以指定只生成特定分辨率的镜像,需要所用主题能提供的
ls /etc/splash/natural_gentoo/
1024x768.cfg 1280x800.cfg 1600x1200.cfg 800x600.cfg
1280x1024.cfg 1440x900.cfg 1680x1050.cfg images
3.grub.conf设置
用你喜爱的编辑器编辑 /boot/grub/grub.conf
在kernel一行中参照我的例子编辑,重点在kernel和initrd两行
- default=0
- timeout=0
- hiddenmenu
- title Gentoo Linux 2.6.28-r1
- root (hd0,0)
- kernel /bzImage root=/dev/sda2 rootfstype=ext4 quiet vga=865 video=vesafb:ywrap,mtrr:3 splash=silent,fadein,theme:natural_gentoo console=tty1
- initrd /initrd
复制代码
bzImage为内核,更多的人会命名为如gentoo-kernel-2.6.18-r1的形式
root=/dev/sda2是我的根目录 rootfstype指定ext4格式可以避免kernel加载时分别尝试ext2,ext3等其支持的格式
quiet参数不显示内核加载信息,即dmesg的前一段
vga=865是1280x800-32的表示方法,可以改为vga=791(1024x768),vga=869(1440x900)等,把vga=791(经典型号?)搜索一下并结合需要测试可以找到更多选择
因为在我的14寸小屏终端上用1280x800比1440x900舒服,所以选择了865;众所周知,这影响不了X的1440x900
video=vesafb:ywrap,mtrr:3
ywrap是一个卷屏(scroll)加速选项,还可以是ypan,redraw(依次速度递减)等,这个设置对我没效果,貌似是使用vesafb-tng和uvesafb设置这个才有作用。
dmesg | grep scroll
[ 0.404771] vesafb: scrolling: redraw
mtrr:3中的3可参考这个表,越低越安全,越高越快,3最合适,在我的尝试中好像只可以是3或不是3,设置为3时cat /proc/mtrr可以看到有多出reg03这一行,设置为其它就只有reg00~reg02。
- 0 - Disabled (equivalent to nomtrr) (default)
- 1 - Uncacheable
- 2 - Write-back
- 3 - Write-combining
- 4 - Write-through
复制代码
下面引自kernel相应介绍
- Enabling write-combining allows bus write transfers to be combined
- into a larger transfer before bursting over the PCI/AGP bus.
- This can increase performance of image write operations 2.5 times or more.
复制代码
说到mtrr设置为3可神奇了,在scrolling依然是redraw的情况下仍可以提高二倍多的scroll速度,有兴趣的可以运行time dmesg尝试,当然也可以time cat个大文件。
除此之外,在我的T61上设置后还可以在bootsplash刚好100%时启动X(xdm加到rc中的情况下),即看不到终端的任何东西,感觉就像是fedora10的什么技术。
于是这一段我的设置后来改为了仅为video=vesafb:mtrr:3
splash=silent,fadein,theme:natural_gentoo
silent或verbose选择是默认显示进度条画面还是显示有背景的终端;建议加上fadein,淡出显示splash;theme指定主题,即前面选择的natural_gentoo
console=tty1或CONSOLE=/dev/tty1
重定向kernel和initscript输出信息的终端,有这个才能让bootsplash的进度条正确完成。
initrd /initrd,和/bzImage一样,可以/boot/initrd,因为/boot下有个boot软链接指向/boot
initrd使内核加载时运行制作好的镜像,关于内核启动加载initrd,initramfs以及怎么自己制作程序镜像让内核可以加载,建议查看相关文档。
4.fbcondecor
记得要rc-update add fbcondecor,这个脚本的作用可以看dmesg,它把fb背景应用到每一个终端
- dmesg | grep fbcondecor
- [ 0.593238] fbcondecor: console 0 using theme 'natural_gentoo'
- [ 0.670568] fbcondecor: switched decor state to 'on' on console 0
- [ 14.223007] fbcondecor: console 1 using theme 'natural_gentoo'
- [ 14.279603] fbcondecor: switched decor state to 'on' on console 1
- [ 14.388608] fbcondecor: console 2 using theme 'natural_gentoo'
- [ 14.446137] fbcondecor: switched decor state to 'on' on console 2
- [ 14.505730] fbcondecor: console 3 using theme 'natural_gentoo'
- [ 14.566159] fbcondecor: switched decor state to 'on' on console 3
- [ 14.625255] fbcondecor: console 4 using theme 'natural_gentoo'
- [ 14.681741] fbcondecor: switched decor state to 'on' on console 4
- [ 14.740266] fbcondecor: console 5 using theme 'natural_gentoo'
- [ 14.798652] fbcondecor: switched decor state to 'on' on console 5
- [ 1121.703854] fbcondecor: console 0 using theme 'natural_gentoo'
- [ 1121.723619] fbcondecor: switched decor state to 'on' on console 0
- #前两句是由initrd产生,后面两句是从X切换到tty1由fbcondecor重新生成
复制代码
四.参考
http://www.linuxsir.cn
http://www.gentoo-wiki.com
我的内核配置文件: https://docs.google.com/Doc?id=dttt8m6_5crvw9fg9
Thinkpad T61 7663
感谢百度和google,感谢接受折腾的机器。 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|