您的位置:首页 > 其它

用Bootsplash 实现手机开关机动画

2007-05-28 21:03 281 查看
用Bootsplash 实现手机开关机动画

转载时请注明出处和作者联系方式:http://blog.csdn.net/absurd

作者联系方式:李先静<xianjimli at hotmail dot com>

更新时间:2007-5-26

现在手机的开关机过程比较慢长,为了不至于让用户等得不耐烦,为了避免用户在不耐烦时做些误操作,也为了美观,手机在开关机时显示动画已经成为惯例了。最近要做Linux手机开关机动画,花了点时间去研究Bootsplash,这里做个笔记。

1. 下载软件包。

http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.21.tar.bz2
ftp://ftp.bootsplash.org/pub/bootsplash/rpm-sources/bootsplash/bootsplash-3.1.tar.bz2 ftp://ftp.bootsplash.org/pub/bootsplash/kernel/bootsplash-3.1.6-2.6.21.diff.gz
http://www.bootsplash.de/files/themes/Theme-Fedora.tar.bz2

(主题文件可以根据需要下载)

2. 编译内核

tar jxf linux-2.6.21.tar.bz2

gzip -d bootsplash-3.1.6-2.6.21.diff.gz

cd linux-2.6.21

patch -p1 <../bootsplash-3.1.6-2.6.21.diff

make menuconfig

保证下列配置正常

Device Drivers

Graphics support

<*> Support for frame buffer devices

[*] VESA VGA graphics support

Console display driver support

<*> Framebuffer Console support

Bootsplash configuration

[*] Bootup splash screen

make; make modules_install;make install

3. 编译工具

tar jxvf bootsplash-3.1.tar.bz2

cd bootsplash-3.1/Utilities

make

(编译mng.c时,会成现几个编译错误,手工修改过来)

cp fbresolution fbmngplay fbtruetype splash splashpbm /sbin

splash -s –f /etc/bootsplash/themes/Fedora/config/bootsplash-1024x768.cfg>/boot/bootsplash

cd ../Scripts/

cp * /etc/rc.d

4. 生成主题数据文件

mkdir -p /etc/bootsplash/themes

tar jxvf Theme-Fedora.tar.bz2 -C /etc/bootsplash/themes/

5. 生成initrd

mkdir temp

cd temp

cp /boot/initrd-2.6.21.img ../initrd.gz

gzip -d ../initrd.gz

cpio -i <../initrd

cp /boot/bootsplash .

find . | cpio -c -o > ../initrd-2.6.21-splash.img

gzip ../initrd-2.6.21-splash.img

cp ../initrd-2.6.21-splash.img.gz /boot/initrd-2.6.21-splash.img

6. 增加grub menu配置文件

title Fedora Core (2.6.21) splash

root (hd0,6)

kernel /boot/vmlinuz-2.6.21 ro root=LABEL=/ vga=0x317 splash=silent

initrd /boot/initrd-2.6.21-splash.img

7. 修改splash.sh

把THEME修改为实际的主题名。

THEME="No bootsplash theme selected"

à

THEME="Fedora"

8. 修改/etc/rc.d/rc

l 先做个备份:

cd /etc/rc.d/

cp rc rc.bak

(蓝色部分为新增脚本)

l 声明splash.sh中需要变量。

# check a file to be a correct runlevel script

check_runlevel ()

{

# Check if the file exists at all.

[ -x "$1" ] || return 1

is_ignored_file "$1" && return 1

return 0

}

export progress=0

export sscripts=0

export kscripts=0

for item in /etc/rc.d/rc3.d/S*;do

sscripts=$(($sscripts + 1))

done

for item in /etc/rc.d/rc3.d/K*;do

kscripts=$(($sscripts + 1))

done

l 设置关机进度条。

# First, run the KILL scripts.

for i in /etc/rc$runlevel.d/K* ; do

check_runlevel "$i" || continue

# Check if the subsystem is already up.

subsys=${i#/etc/rc$runlevel.d/K??}

[ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] /

|| continue

# Bring the subsystem down.

if LC_ALL=C egrep -q "^..*init.d/functions" $i ; then

$i stop

else

action $"Stopping $subsys: " $i stop

fi

progress=$(($progress+ 1))

/etc/rc.d/splash.sh 2>/dev/nul

done

l 设置开机进度条。

# Now run the START scripts.

for i in /etc/rc$runlevel.d/S* ; do

check_runlevel "$i" || continue

# Check if the subsystem is already up.

subsys=${i#/etc/rc$runlevel.d/S??}

[ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] /

&& continue

# If we're in confirmation mode, get user confirmation

if [ -f /var/run/confirm ]; then

confirm $subsys

test $? = 1 && continue

fi

update_boot_stage "$subsys"

# Bring the subsystem up.

if [ "$subsys" = "halt" -o "$subsys" = "reboot" ]; then

export LC_ALL=C

exec $i start

fi

if LC_ALL=C egrep -q "^..*init.d/functions" $i /

|| [ "$subsys" = "single" -o "$subsys" = "local" ]; then

$i start

else

action $"Starting $subsys: " $i start

fi

progress=$(($progress+ 1))

/etc/rc.d/splash.sh 2>/dev/nul

done

重新起动就OK了。

(测试环境:Fedora Core release 6 (Zod))

参考资源:

http://www.ibm.com/developerworks/cn/linux/l-k26initrd/index.html

http://www.bootsplash.org/

http://soft.yesky.com/os/lin/111/2011111.shtml

~~end~~
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: