|
|
昨天研究了一下FrameBuffer。请大家批评:
1 首先说明什么是BootSplash和FrameBuffer?
以前的Linux内核引导系统就时,引导信息就直接输出到25x80控制台,这本没有什么不好。但是当把Linux作为桌面应用时,就希望向Windows那样用位图挡住这些信息,于是开源社区的大牛就动手了。“作就要做得比Windows更酷”大牛说,于是就有了FrameBuffer一种直接访问图形硬件的技术。BootSplash。BootSplash的确很酷,你可以按自己的喜好配置它。但对于普通用户这个工作似乎比较有难度,呵这就是Linux的精神吧:想酷你需要成为专家,太难?请使用发行版。
既然引导的时候就将屏幕的分辨率设置成了1024x768,进入控制台还有设回去?不。这样的控制台能容纳多少内容啊!然后还加上个背景图。一些人就这样抛弃了X。
2 内核对FrameBuffer的支持(以2.6内核为例子)。
Frame Buffer Driver一定要编译到Linux内核中,才能使用。所以一般来说要先重新编译内核。
#make menuconfig
Device Drivers > Graphics support:
Support for frame buffer devices
<*> VESA VGA graphics support
VESA driver type (vesafb-tng) --->
(HRESxVRES@FREQ) VESA default mode
# 自己设置分辨率和刷新率如(1024x768@80)
Device Drivers > Graphics support > Console display driver support:
Video mode selection support
<*> Framebuffer Console support
Device Drivers > Graphics support:
Support for the framebuffer splash
Device Drivers > Graphics support:
[ ] Enable Tile Blitting Support #不要选
你还需要支持RAM disk support :
Device Drivers > Block devices:
<*> RAM disk support
(4096) Default RAM disk size (kbytes) (NEW)
Initial RAM disk (initrd) support
#make && make modules_install
将bzImage拷贝到/boot,建议不要覆盖原来的,只是在Grub中多作一个选项
3 获取软件
如果是2.6内核建议使用splashutils,2.4内核使用bootsplash。
#emerge splashutils
你可以下载一些主题,主要是看看配置文件的格式
#emerge media-gfx/splash-themes-livecd
#emerge media-gfx/splash-themes-gentoo //45M有点大
4 设置自己的主题
现在在/etc/splash下就会有一些目录这些就是各种主题,但还不能直接用。建目录
#mkdir /etc/splash/mytheme
拷贝一个其他目录的cfg文件,也可以拷贝其它分辨率的配置文件
#cp /etc/splash/Gentoo-Hornet/config/bootsplash-1024x768.cfg \
/etc/splash/mytheme/1024x768.cfg
编辑文件。首先要清楚的一点是Splash有两种模式verbose和silent。
verbose模式将在你指定的box中显示引导的所有输出。
silent模式仅仅显示一个进度条,按F2才会显示引导信息。
# 版本号
version=1
# 是否显示背景
state=1
# fgcolor 文本的颜色
# bgcolor 文本的背景色 0表示透明
fgcolor=7
bgcolor=0
# (tx, ty) 文本输出区的左上角位置
# tw th 文本输出区的宽和高
tx=14
ty=14
tw=827
th=744
#verbose模式的背景图
jpeg=/etc/splash/mytheme/mytheme.jpg
#silent模式的背景图
silentjpeg=/etc/splash/mytheme/mytheme.jpg
#打开进度条
progress_enable=1
6 生成initrd文件
由于背景图一般不再/boot分区上所以,我们要把图形打包到initrd中,并把主题名称告诉内核
splash_geninitramfs -v -g /boot/fbsplash-mytheme-1024x768 -r 1024x768 mytheme
initrd 就是fbsplash-mytheme-1024x768
主题名称就是mytheme
5 配置grub.conf
有了前面的基础看懂这个配置就不难了:
要注意的是最好作一个不要splash的引导项,如果出了问题不至于无法进入系统。
default 0
timeout 10
splashimage=(hd0,0)/grub/splash.xpm.gz
title=Gentoo Linux 2.6.11
root (hd0,0)
kernel /boot/bzImage ro root=/dev/hda6 video=vesafb:ywrap,mtrr,1024x768-32@60 splash=verbose,fadein,theme:mytheme CONSOLE=/dev/tty1
initrd /boot/fbsplash-mytheme-1024x768
title=Gentoo Linux 2.6.11 (no splash)
root (hd0,0)
kernel /boot/bzImage ro root=/dev/hda6 |
|