QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 8183|回复: 6

[译] Boot Splash ....

[复制链接]
发表于 2003-7-23 15:26:24 | 显示全部楼层 |阅读模式
Boot Splash (background picture ala Suse)

     当你完成以下几步后你将会得到一个显示
在 tty 控制台的启动信息之上的 jpeg 图片。

备注:

     Bootsplash 已经升级到第 3 版(主题支持,进度条,静态背景)
     The bootsplash portion seems to work the same, the config file changed some and I'm trying to get the progress bar and silentjpeg figured out. <- 英文太差,这里不知道怎么翻译。。。
     
     点击这里获取引导画面
     如果你有任何问题请点击这里留言
     
     补丁和背景工具由 SUSE 开发小组制作。
     本文所介绍的方法造成的后果必须由用户自行负责。
     I take no responsiblity blah blah...
     Enjoy the tip, 如果你知道什么更好的办法请留言。
     
     
让我们开始吧...

下载 gentoo 核心源代码,我用的是 gentoo-source 2.4.20-r1,如果你需要使用 make xconfig 在 XWindow 中配置核心的话还需要 tk 包。
[code:1]emerge gentoo-source tk[/code:1]

然后让我们下载我们所需要的文件:

ftp://ftp.suse.com/pub/people/st ... 2.4.20-vanilla.diff
ftp://ftp.suse.com/pub/people/st ... splashutils.tar.bz2

这儿还有两个不是必须的文件:
http://www.geocities.com/kachaffeous/gentoo.jpg
http://geocities.com/kachaffeous/template.zip

让我们开始编译我们的工具,cd 到你所保存下载文件的目录里。
我的是 ~/splash。
这个 splash 命令可以生成初始化时的背景画面的 initrd.

[code:1]me@Blazen me $ cd ~/splash
me@Blazen splash $ tar xvjf splashutil.tar.bz2
splashutils/
splashutils/Makefile
splashutils/splash.c
splashutils/progress.c
splashutils/getkey.c
splashutils/fbresolution.c
splashutils/ChangeLog
splashutils/COPYING
me@Blazen splash $ cd splashutils
me@Blazen splashutils $ make
gcc -Os -Wall    splash.c   -o splash
gcc -Os -Wall    progress.c   -o progress
gcc -Os -Wall    fbresolution.c   -o fbresolution
gcc -Os -Wall    getkey.c   -o getkey
strip splash progress fbresolution getkey
me@Blazen splashutils $ cp splash /bin/
me@Blazen splashutils $ cd .. [/code:1]

创建一个背景图片目录并拷贝下面的配置文件到那个目录里。
[code:1] # ftp://ftp.suse.com/pub/people/stepan/bootsplash for
# 需要更多信息?欢迎联系 [email protected]

# 配置文件版本
version=3

# 是否显示图片?
state=1

# fgcolor 是文字前景色.
# bgcolor 是文字背景色(i.e. 透明).
fgcolor=7
bgcolor=0

# (tx, ty) 是字符窗口的 (x, y) pixels 坐标。
# tw/th 是字符窗口的 宽/高.
tx=40
ty=116
tw=944
th=612

# 字符信息输出参数
text_x=204
text_y=544
text_size=26
text_color=0xeef4ff

# 图片文件的完整名称 (推荐使用完整路径)
jpeg=/usr/share/splash/themes/SuSE/images/bootsplash-1024x768.jpg
silentjpeg=/usr/share/splash/themes/SuSE/images/silent-1024x768.jpg

# 启用进度条
progress_enable=1

# 背景
box silent noover  204 582 820 612 #04045498
box silent inter 204 583 204 611 #ffffff #ffffff #526bb0 #526bb0
box silent       204 583 820 611 #ffffff #ffffff #526bb0 #526bb0
# 黑色边框
box silent         204 582 820 582 #313234
box silent         204 612 820 612 #eef4ff
box silent         204 582 204 612 #313234
box silent         820 582 820 612 #eef4ff

# 字符盒子 (左,顶)
box     35 111  35 729 #313234
box     36  111 985 111 #313234
# (右,底)
box     985 112 985 729 #eef4ff
box     36 729 985 729 #eef4ff
# box itself
box noover 36 112 984 728 #04045498

overpaintok=1 [/code:1]

[code:1]me@Blazen splash $ mkdir -p /usr/share/splash/[/code:1]

让我们准备好给内核打补丁。
[code:1]me@Blazen splash $ vi *.diff [/code:1]

在 vi 中把补丁中的“2.4.20.orig”和“2.4.20”都替换成“linux”。
可以这样做:
[code:1]esc
:%s/linux-2.4.20.orig/linux/g
:%s/linux.2.4.20/linux/g
:wq[/code:1]

把补丁文件移动到 /usr/src:
[code:1]me@Blazen splash $ mv *.diff /usr/src/[/code:1]

运行 su 切换到 root 帐号:
[code:1]me@Blazen splash $ su - [/code:1]

以 root 帐号给内核打补丁并编译内核:
[code:1]root@Blazen splash # cd /usr/src/
root@Blazen src # patch -p0 < bootsplash-3.0.7-2.4.20-vanilla.diff
patch -p0 < bootsplash-3.0.7-2.4.20-vanilla.diff
patching file linux/drivers/char/console.c
patching file linux/drivers/char/keyboard.c
patching file linux/drivers/char/n_tty.c
patching file linux/drivers/video/Config.in
Hunk #1 succeeded at 232 (offset 10 lines).
Hunk #3 succeeded at 369 (offset 10 lines).
patching file linux/drivers/video/Makefile
patching file linux/drivers/video/fbcon-jpegdec.c
patching file linux/drivers/video/fbcon-jpegdec.h
patching file linux/drivers/video/fbcon-splash.c
patching file linux/drivers/video/fbcon-splash.h
patching file linux/drivers/video/fbcon-splash16.c
patching file linux/drivers/video/fbcon.c
patching file linux/include/video/fbcon.h
patching file linux/kernel/panic.c
root@Blazen src # cd linux
root@Blazen linux # make xconfig[/code:1]

现在配置内核的 gui 界面弹出了,你需要选择好关于你的特殊硬件的选项(我可不知道你有哪些硬件)
下面的选项需要编译进内核(而不是模块!)

Block Devices -> RAM disk support
Block Devices -> Loopback device support
Block Devices -> Initial RAM disk (initrd) support
Console Drivers -> Video mode selection support
Console Drives -> Frame-buffer support -> Support for frame buffer devices
Console Drives -> Frame-buffer support -> VESA VGA graphics console
Console Drives -> Frame-buffer support -> Use splash screen instead of boot logo

选择“Save and Exit”(保存并退出)

编译:
[code:1]root@Blazen linux #  make dep && make clean bzImage modules modules_install[/code:1]

15 至 20 分钟过后你可以安装你的新内核了。
我用 lilo 引导器,不太清楚关于 grub 的选项。
[code:1]root@Blazen linux # mount /boot
root@Blazen linux # cp arch/i386/boot/bzImage /boot/vmlinuz[/code:1]

现在我们已经有了:
    一个 /bin/splash 程序
    一个新编译好的内核
    一个 /usr/share/splash 目录,它里面有以下文件:
    bootsplash.cfg
    bootsplash.jpg
  
编辑 /etc/lilo.conf 类似于以下的内容:
[code:1]#menu-scheme=Wb
boot = /dev/hda
#prompt
map = /boot/System.map
lba32

#MENU
        image = /boot/vmlinuz
        read-only
        label = Blazen
        vga = 791
        root = /dev/hda3
        initrd=/boot/initrd[/code:1]

下面两行非常 *重要* :
vga = 791
initrd=/boot/initrd

vga=791 设置你的控制台运行于 1024x768 16bits 并且你的 /boot/initrd 已经包含了 splash 图片。

备注:
VGA 色深和解析度图表

色深-------640x480-----800x600-----1024x768-----1280x1024
256----------769----------771-----------773-------------775
32000-------784----------787-----------790-------------793
65000-------785----------788-----------791-------------794
16.7 Mill.----786----------789-----------792-------------795

现在制作 initrd 并升级 lilo。

备注:
图片无法缩放,所以请在使用前将图片缩放到理想分辨率。

在运行下面命令前请先确认 /boot 已经装载上
[code:1]root@Blazen boot # splash -s -f /usr/share/splash/bootsplash.cfg > /boot/initrd
root@Blazen boot # lilo
Added Blazen * [/code:1]

splash 程序将创建一个新的 initrd,并将 /usr/share/splash/bootsplash.jpg 加入其中。

快动起你的手指重新启动看看吧!
祝好运 。。。。。。

启动后你可以用下面的命令添加背景画面:
[code:1]splash -s -u 1 /usr/share/splash/bootsplash.cfg[/code:1]

这将会更新第二个控制台的背景画面(Ctrl-Alt-F2),你可以将它插入进初始化(init)脚本中...

要想在启动时自动更新其它的控制台的背景画面时可以按下面的方法做:
[code:1]cd /usr/share/splash
for i in tty2 tty3 tty4 tty5 tty6; do mkdir $i ; cp boot* $i ; done[/code:1]

添加下面的内容到 /etc/conf.d/local.start:
[code:1]/bin/splash -s -u 1 /usr/share/splash/tty2/bootsplash.cfg         
/bin/splash -s -u 2 /usr/share/splash/tty3/bootsplash.cfg         
/bin/splash -s -u 3 /usr/share/splash/tty4/bootsplash.cfg         
/bin/splash -s -u 4 /usr/share/splash/tty5/bootsplash.cfg         
/bin/splash -s -u 5 /usr/share/splash/tty6/bootsplash.cfg[/code:1]

备注:你可以拷贝不同的图片于不同的目录,这样你可以在不同编号的控制台使用不同的背景画面。

reboot and enjoy!

======================
kuye: 昨晚 down 了好几篇文章,在北京呆着孤独+郁闷,一篇一篇翻译。。。。
我的 ADSL 是限 40 小时/月的,这些文章都是  save as 到硬盘上才开始翻译。。。源地址都忘记了。。。
发表于 2003-7-28 14:27:16 | 显示全部楼层
这篇文章有几个错误,照着他做有点问题
(不是指翻译问题,原文就有问题,我照着作没成功,后来自己做的)
现在我们已经有了:
一个 /bin/splash 程序
一个新编译好的内核
一个 /usr/share/splash 目录,它里面有以下文件:
bootsplash.cfg
bootsplash.jpg

# 图片文件的完整名称 (推荐使用完整路径)
jpeg=/usr/share/splash/themes/SuSE/images/bootsplash-1024x768.jpg
silentjpeg=/usr/share/splash/themes/SuSE/images/silent-1024x768.jpg


路径不同,splash时会提示语法错误

现在配置内核的 gui 界面弹出了,你需要选择好关于你的特殊硬件的选项(我可不知道你有哪些硬件)  
下面的选项需要编译进内核(而不是模块!)

Block Devices -> RAM disk support
Block Devices -> Loopback device support
Block Devices -> Initial RAM disk (initrd) support
Console Drivers -> Video mode selection support
Console Drives -> Frame-buffer support -> Support for frame buffer devices
Console Drives -> Frame-buffer support -> VESA VGA graphics console
Console Drives -> Frame-buffer support -> Use splash screen instead of boot logo

Loopback device support 可以编译称module

此外,gentoo的kernel已经打过补丁了,不需要手工打补丁
最后gentoo用户可以用ACCEPT_KEYWORDS="~x86" emerge bootsplash安装
他会编译splash并且有现成的jpg和cfg文件
回复

使用道具 举报

 楼主| 发表于 2003-7-28 18:53:07 | 显示全部楼层
嗯,感谢你的指出!

Linux 的相关文章都不能只看一篇,要同时看好几篇才能找到真正的方法。
介于是译文所以我还是不进行改动了。
回复

使用道具 举报

发表于 2005-9-6 21:44:16 | 显示全部楼层
ftp://ftp.suse.com/pub/people/stepan/bootsplash/rpm-sources/bootsplash/splashutils.tar.bz2

我看到ftp://ftp.suse.com/pub/people下面已经没有stepan这个子目录了,哪里去找splashutils.tar.bz2这个文件?
回复

使用道具 举报

发表于 2005-9-8 12:48:01 | 显示全部楼层
天, 两年前的帖子了, 如果你用的是gentoo, 现在它的名字叫gensplash, emerge 一下就有了, splashutils是有的, 一样emerge就ok了
回复

使用道具 举报

发表于 2006-7-12 13:18:52 | 显示全部楼层
splash 不错!
回复

使用道具 举报

发表于 2006-7-12 15:17:46 | 显示全部楼层
去年回的贴子,今天竟然还有人回贴,hehe
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-4-18 17:11 , Processed in 0.101406 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表