| 用Bootsplash制作Linux全图形启动界面 |
|
Linux的各种发行版在启动时基本上都有两种模式:silent mode和verbose mode。verbose模式下会打印极为详尽的启动信息,比如挂载文件系统,加载光驱,激活网络服务等等,而silent模式则屏蔽掉这些信息。 bootsplash工具可以将一张图片放在silent模式下的虚拟控制台上,从而使Linux用户看到一个全画面的启动过程。另外一个工具是 gensplash,比bootsplash要稍微复杂一些,不过功能更为强大,设计也更为合理——它将一些非必要的元素从kernel space挪出来,放在user space来做。 网络上关于bootsplash(启动动画)的使用基本上是基于Linux的 SuSe发行版进行讨论的——开发这组工具的作者说他们的工作平台是SuSe。gensplash则是基于Linux的Gentoo发行版进行讨论的。当然这些两组工具都可以通过适当的改动应用于Linux的其它发行版。 现在我们进入正题。http://www.bootsplash.org网站上说,bootsplash的内核补丁针对2.4.18--2.4.22和2.6.0-test9,这个消息很旧了,可以到http://www.bootsplash.de站点查看bootsplash所提供的各个版本的内核补丁,然后确定你所用的Linux内核版本,选择一个补丁下载。 我的内核是2.4.20-8,下载补丁bootsplash-3.0.7-2.4.20.vanilla.diff。补丁中的3.0.7是 bootsplash工具的版本号,我们下载bootsplash-3.0.7.tar.bz2,再下载所要用的主题Theme- NewLinux.tar.bz2,关于材料的准备就完成了。这些都可以在上面的提及的网站上找到。如果你的内核没有相应补丁,那么可以选择一个版本的内核源代码,打上补丁后,编译一个新的内核。 如果没有编译过内核,可以到网上查找相关资料,对照着练习一下。当然,我们需要root的权限。 第一步 修改/usr/include目录下的三个符号链接:asm,scsi,linux(mv asm asm.bak,mv scsi scsi.bak,mv linux linux.bak),如果没有,则要新建。在编译内核时,用到这些链接所指向的一些头文件。我在/usr/src目录下建了一个名为linux的链接指向同一层的内核源代码目录linux-2.4.20-8(这样以后再编译不同版本内核时,只需修改/usr/src目录下的linux符号链接就可以了)。(命令ln -s linux-2.4.20-8 linux),然后进入/usr/include目录,分别执行ln -s /usr/src/linux/include/asm-i386 asm;ln -s /usr/src/linux/include/linux linux;ln -s /usr/src/linux/include/scsi scsi。 第二步 打补丁,假设补丁在/usr/src/linux目录下(不在的话加上路径即可)。patch -p1 第三步 设定核心:make menuconfig。确定下列选项被编译进内核而不是被编译成模块。 对于2.4.x内核: Code maturity level options --->; # Prompt for development and/or incomplete code/drivers Processor type and features --->; # MTRR (Memory Type Range Register) support Block Devices ->; # Loopback device support # RAM disk support (4096) Default RAM disk size # Initial RAM disk (initrd) support Console Drivers ->; # VGA text console # Video mode selection support Console Drivers ->; Frame-buffer support ->; # Support for frame buffer devices # VESA VGA graphics console # Use splash screen instead of boot logo 对于2.6.x内核: Code maturity level options --->; # Prompt for development and/or incomplete code/drivers Processor type and features --->; # MTRR (Memory Type Range Register) support Device Drivers --->; Block devices --->; <*>; Loopback device support <*>; RAM disk support (4096) Default RAM disk size # Initial RAM disk (initrd) support Graphics support --->; # Support for frame buffer devices # VESA VGA graphics support Console display driver support --->; # Video mode selection support <*>; Framebuffer Console support Bootsplash configuration --->; # Bootup splash screen 第四步 a>; make mkproper 清除旧的设定 b>; make dep 产生依赖 c>; make bzImage 编译内核 d>; make modules modules_install 编译模块 e>; cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage-2.4.20 第五步 安装bootsplash的工具软件和主题图片 # tar jxvf /patch/bootsplash-3.0.7.tar.bz2 # tar jxvf /patch/Theme-NewLinux.tar.bz2 # cd bootsplash-3.0.7/Utilities # make all # cp fbmngplay fbresolution fbtruetype splash /sbin # cd ../../ 下面这几步必须要做,不然在用splash命令时就会出现类似下面的错误:splash:/etc/bootsplash/themes/Linux/images/silent-800x600.jpg不存在。这个其实是由于主题的配置文件中做了绝对路径设定。 # mkdir /etc/bootsplash # mkdir /etc/bootsplash/themes # cp -a NewLinux /etc/bootsplash/themes/
|
||||