LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 7287|回复: 21

给字符控制台加上背景图片 【转贴自LinuxFans.org Kuye兄著】

[复制链接]
发表于 2003-1-20 17:32:06 | 显示全部楼层 |阅读模式
给字符控制台加上背景图片

效果图在此:
http://www.linuxfans.org/nuke/modules/Forums/files/bootsplash.jpg <- 由 catoc 提供

原帖地址:
http://forums.gentoo.org/viewtopic.php?t=26494
http://www.linuxfans.org/nuke/mo ... =viewforum&f=37

详细方法:
OK OK, 为了咱们美丽而可爱的控制台背景,开工了 icon_smile.gif

核心源代码肯定是要地,如果不想自己手动修改内核的话还是老老实实用老版本的 2.4.19-r10 版 gentoo 内核:
代码:
emerge -a gentoo-sources

如果你很不喜欢在控制台上配置内核的话,还需要 tcl,这样便可以在 XWindow 下用 make xconfig 了
代码:
emerge -a gentoo-source tk


哦。。。召唤背景工具~~~~~

ftp://ftp.suse.com/pub/people/st ... /splashutil.tar.bz2
ftp://ftp.suse.com/pub/people/st ... bootsplash-config.c
ftp://ftp.suse.com/pub/people/st ... ootsplash-config.sh
ftp://ftp.suse.com/pub/people/st ... .4.19-vanilla.patch

DIYer 怎么能老拿别人做好的背景呢? 毛主席说得好:“自己动手,丰衣足食”,下个模板,咱们自己也做,拿自己照片做背景,肯定可以羡慕死一群人!(注释: geocities 好像都连不上去...)

http://www.geocities.com/kachaffeous/gentoo.jpg
http://www.geocities.com/kachaffeous/template.zip

OK, 开始做工具 - splash 了,把 splashutil.tar.bz2 解压缩到一个目录里,我这里用 ~/splash
代码:
# cd ~/splash
# tar xvjf splashutil.tar.bz2
splashutil/
splashutil/Makefile
splashutil/splash.c
splashutil/ChangeLog
splashutil/COPYING
# cd splashutil
# make
gcc -Os -Wall   -c -o splash.o splash.c
gcc -Os -Wall  -o splash  splash.o
strip splash
# cp splash /sbin/
# cd ..


然后需要用 bootsplash-config 和 bootsplash-config.sh 生成背景的配置文件,gentoo.jpg 不用说也知道是需要的背景啦,不过因为核心的图片解码器不具有缩放图片的功能,所以请事先将其用图形处理软件缩放到屏幕大小:

代码:
# gcc -o bootsplash-config bootsplash-config.c
# chmod +x bootsplash-config.sh
# ./bootsplash-config.sh
# mkdir -p /usr/share/splash/
# cp *.cfg /usr/share/splash/
# cp bootsplash-1024x768.cfg /usr/share/splash/bootsplash.cfg
# mv gentoo.jpg /usr/share/splash/bootsplash.jpg


go on... 给核心打补丁,不过因为原版补丁是 for 2.4.19 vanilla 核心的(vanilla 的意思好像是"原版核心",没有打 Gentoo 补丁),我们需要修改成 for 2.4.19 gentoo 核心 icon_smile.gif
召唤 vi~~~~ :
代码:
esc
:%s/2.4.19-vanilla/linux/g
:wq


开始打补丁了:
代码:
# cp *.patch /usr/src
# cd /usr/src
# patch -p0 < boot_splash_complete.2.4.19-vanilla.patch
patching file linux/include/video/fbcon.h     
patching file linux/drivers/video/fbcon.c     
patching file linux/drivers/video/fbcon-cfb16.c
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/Config.in   
Hunk #1 succeeded at 213 (offset 8 lines).   
Hunk #3 succeeded at 347 (offset 8 lines).
patching file linux/drivers/char/console.c
# cd linux


然后自己配置一下核心,其它不管,以下的内容必须编译进核心,编译成模块也不行!
Block Devices -> RAM disk 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

保存退出后开始编译了
代码:
#  make dep && make clean bzImage modules modules_install && mount /boot && cp arch/i386/boot/bzImage /boot/vmlinuz


漫长的 15-20分钟总算过去了,恭喜你,你还没完:
OK OK, 你现在应该已经拥有了:
一个 /sbin/splash 的命令
一个带有控制台背景支持的新核心
一个用于存放下面的背景相关文件的 /usr/share/splash 目录
bootsplash-1280x1024.cfg
bootsplash-1024x768.cfg
bootsplash-800x600.cfg
bootsplash.cfg
bootsplash.jpg

OK, 咱们用 grub 的和 lilo 其实都差不多。都是给核心传递一些 vga 和 video 参数罢了:
编辑 /etc/lilo.conf 如以下内容,相关配置请按自己情况修改:
代码:
#menu-scheme=Wb
boot = /dev/hda
#prompt
map = /boot/System.map
lba32

#MENU
        image = /boot/vmlinuz
        read-only
        label = Gentoo
        vga = 791
        root = /dev/hda3
        initrd=/boot/initrd

grub 的可以参考一下我的(我的 initrd 是链接到 initrd-2.4.19-gentoo-r10.new 上的):
代码:
title Gentoo Linux 1.4 -- 2.4.19-r10 (with background)
kernel (hd0,0)/vmlinuz-2.4.19-gentoo-r10.new root=/dev/hda5 vga=791 video=vesa:1024x768@70
initrd=/initrd-2.4.19-gentoo-r10.new


非常非常重要的两行一定要有!!!
代码:
vga = 791
initrd=/boot/initrd

vga=791 是将控制台甚至为 1024x768x256 色,不推荐用 792(1024x768x16M)
initrd 就是你想要的背景文件内容了

附上: VGA 代码和分辨率的对照表
代码:
depth------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,并且更新 mbr 中的 Linux loader
代码:
# splash -s -f /usr/share/splash/bootsplash.cfg > /boot/initrd
# lilo
Added Gentoo *


OK, 如果你想在 tty1 下使用背景时就可以运行
代码:
# splash -s -u 1 /usr/share/splash/bootsplash.cfg

-u 后面就是控制台号码,如果你想在第 100 个控制台下使用背景当然也可以用 -u 100 icon_razz.gif

ft... 这样每次开机都要一个一个设置太累了,让它在每次启动后自动在每个控制台上加上背景 icon_wink.gif
代码:
# cd /usr/share/splash
# for i in tty2 tty3 tty4 tty5 tty6; do mkdir $i ; cp boot* $i ; done
# echo '/bin/splash -s -u 1 /usr/share/splash/tty2/bootsplash.cfg' >> /etc/conf.d/local.start
# echo '/bin/splash -s -u 2 /usr/share/splash/tty3/bootsplash.cfg' >> /etc/conf.d/local.start
# echo '/bin/splash -s -u 3 /usr/share/splash/tty4/bootsplash.cfg' >> /etc/conf.d/local.start
# echo '/bin/splash -s -u 4 /usr/share/splash/tty5/bootsplash.cfg' >> /etc/conf.d/local.start
# echo '/bin/splash -s -u 5 /usr/share/splash/tty6/bootsplash.cfg' >> /etc/conf.d/local.start

这样一来你可以在 /usr/share/splash/tty? 下放入不同的 jpg 图片,就可以让每个控制台显示不同的背景画面了,hoho ^_^

OK, 完成,重新启动吧
如果无法显示请用 dmesg 检查一下是否有以下内容:
代码:
# dmesg
Looking for splash picture.... found (1024x768, 27481 bytes).
Splash status on console 1 changed to on
Looking for splash picture.... found (1024x768, 89306 bytes).
Splash status on console 2 changed to on
Looking for splash picture.... found (1024x768, 68567 bytes).
Splash status on console 3 changed to on
Looking for splash picture.... found (1024x768, 66762 bytes).
Splash status on console 4 changed to on
Looking for splash picture.... found (1024x768, 59607 bytes).
Splash status on console 5 changed to on


enjoy your new terminal icon_smile.gif

附录1: 背景图片完了就玩一下背景动画吧 ^_^
这里有可以在控制台背景上播放 mng 动画的工具:
ftp://ftp.suse.com/pub/people/st ... g/fbmngplay.tar.bz2
然后:
代码:
#emerge libmng
#tar xjvf fbmngplay.tar.bz2
*cd to where you unpacked the tar file*
# make fbmngplay
# cp fbmngplay /bin/

fbmngplay 的使用方法基本和 splash 命令差不多,详细情况请参考 --help, 这里就不多说

附录2: cfg 修改简易教程
代码:
# 设置文件版本
version=2

# 需要现实图片吗? <- 不显示花那么多功夫干嘛?
state=1

# fgcolor 是文字颜色
# bgcolor 是文字背景颜色(默认透明)。
fgcolor=4
bgcolor=0

# (tx, ty) 是文字窗口以 pixels 为单位的坐标.
# tw/th is 是文字窗口以 pixels 为单位的宽高.
tx=91
ty=161
tw=840
th=544

# 该选项用于隐藏 SuSE Linux 7.3 的“企鹅”? <- ??? 可能是指左上角的企鹅 logo,搞错可别怪我
# (px, py) 是企鹅位置的坐标
# pw/ph 是企鹅的宽高
#px=82
#py=157
#pw=859
#ph=552

# (pr, pg, pb) 是企鹅填充区域的颜色
#pr=240
#pg=240
#pb=240

# 背景图片的完整路径
jpeg=/usr/share/splash/bootsplash.jpg


颜色对照表:
代码:
fgcolor #--------------color
0----------------------black
1----------------------blue
2----------------------green
3----------------------teal
4----------------------red
5----------------------purple
6----------------------brown
7----------------------grayish white
8----------------------grayish black
9----------------------light blue
10--------------------Bright Green
11--------------------Bright Cyan
12--------------------Bright Red
13--------------------Bright Magenta
14--------------------Yellow
15--------------------Bright White


相关下载:
SuSE 的 splash : http://www.geocities.com/kachaffeous/splash.tgz
SuSE 的 mng : http://www.geocities.com/kachaffeous/mngfiles.tgz
SuSE 的 boot splash 主题: ftp://ftp.suse.com/pub/people/st ... uSE-classic.tar.bz2

鸣谢:
第一个: 我们最最最可爱的 catoc,多谢他在得到了这么个好东东的时候还记得将其共享出来 ^_^
第二个: Gentoo Linux <- 一句话概括:"爱你爱到骨头里"
第三个: 自然是公社,提供了我一个不错的,扮演唐僧的好地方
第四个: 就是你! 对.... 别东张西望了,就是盯着屏幕顶着瞌睡看到现在的你,废话太多,您辛苦啦!
如果发现本文有什么不妥或者使用中有什么疑问请去这张帖子里一起研究 icon_smile.gif

广告:
欢迎大家体验 SuSE 高性能 Linux
也欢迎大家去 Gentoo Linux 及其讨论区淘金."
发表于 2003-1-23 15:44:39 | 显示全部楼层

Re: 给字符控制台加上背景图片 【转贴自LinuxFans.org Kuye兄著】

最初由 Debentoo Gao 发布
附录1: 背景图片完了就玩一下背景动画吧 ^_^
这里有可以在控制台背景上播放 mng 动画的工具:
ftp://ftp.suse.com/pub/people/stepa...mngplay.tar.bz2
然后:
代码:
#emerge libmng
#tar xjvf fbmngplay.tar.bz2
*cd to where you unpacked the tar file*
# make fbmngplay
# cp fbmngplay /bin/

fbmngplay 的使用方法基本和 splash 命令差不多,详细情况请参考 --help, 这里就不多说


好不容易搞出来一张MNG图。发现问题:
1.fbmngplay的用法基本和splash命令差不多----没发现哪里差不多啊!
2.用fbmngplay filename.mng那根本不是背景播放,是覆盖在命令行输出之上的。感觉就是一个mng图片查看程序。
哪位仁兄搞定过,可否弄个截图啥的?
 楼主| 发表于 2003-1-23 17:45:29 | 显示全部楼层

顶一下:)

请高手赐教
发表于 2003-1-23 18:27:08 | 显示全部楼层
给一篇文章,你自己研究一下:
http://linux01.gwdg.de/suse/ftp. ... plash/README.themes
发表于 2003-1-24 20:50:33 | 显示全部楼层
很有意思的东西
发表于 2003-6-7 01:08:05 | 显示全部楼层

链接不可用!

链接不可用!
ftp://ftp.suse.com/pub/people/st ... /splashutil.tar.bz2
ftp://ftp.suse.com/pub/people/st ... bootsplash-config.c
ftp://ftp.suse.com/pub/people/st ... ootsplash-config.sh
ftp://ftp.suse.com/pub/people/st ... .4.19-vanilla.patch
文件目录被改变,已找到splashutil.tar.bz2和boot_splash_complete.2.4.19-vanilla.patch文件但找不到bootsplash-config.c,bootsplash-config.sh两个文件。
不知有没有别的链接,或把它贴出来(这两个文件应该是文本文件吧!)
。:thank
发表于 2003-6-7 07:37:03 | 显示全部楼层
不知道65赫兹的刷新率 眼睛是否受的了 :)
发表于 2003-6-12 17:34:05 | 显示全部楼层
如果是lcd,就没问题,呵呵
发表于 2003-6-12 19:22:19 | 显示全部楼层
cool,占系统多吗
发表于 2004-6-23 09:17:42 | 显示全部楼层
这是什么意思?
打入splash命令结果是
#/sbin/splash /etc/bootsplash/themes/Linux/config/bootsplash-1024x768.cfg

/proc/splash: no such file or directory
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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