[PATCH] modules/bootanim: easily customize boot animation

martin.langhoff at gmail.com martin.langhoff at gmail.com
Fri Mar 18 16:55:33 EDT 2011


From: Martin Langhoff <martin at laptop.org>

---
 modules/bootanim/README                         |   27 +++++++++
 modules/bootanim/kspost.30.nochroot.bootanim.sh |   14 +++++
 modules/bootanim/prepare.90.bootanim.sh         |   70 +++++++++++++++++++++++
 3 files changed, 111 insertions(+), 0 deletions(-)
 create mode 100644 modules/bootanim/README
 create mode 100644 modules/bootanim/kspost.30.nochroot.bootanim.sh
 create mode 100644 modules/bootanim/prepare.90.bootanim.sh

diff --git a/modules/bootanim/README b/modules/bootanim/README
new file mode 100644
index 0000000..ac86abd
--- /dev/null
+++ b/modules/bootanim/README
@@ -0,0 +1,27 @@
+This module replaces the boot animation images.
+
+To use...
+
+ - Install netpbm-progs
+
+ - Install olpc-bootanim-tools from 
+   http://dev.laptop.org/~dsd/public_rpms/f14/olpc-bootanim-tools-2.13-1.fc14.i686.rpm
+
+ - Download the tarball or zip from http://dev.laptop.org/git/users/dsd/olpc-bootanim/
+   -- extract the images from the "images" subdirectory
+
+ - Prepare an images directory with your customized images -- the relevant files are
+   the frame*.png files and ul_warning.png . You must include them all in your custom
+   images directory.
+
+ - Add a section to your ini file:
+
+     [bootanim]
+     imgdir=/path/to/your/images-directory
+
+   for example, if it is a 'bootanim' directory next to your
+   ini file, use
+
+     [bootanim]
+     imgdir=%(oob_config_dir)s/bootanim
+
diff --git a/modules/bootanim/kspost.30.nochroot.bootanim.sh b/modules/bootanim/kspost.30.nochroot.bootanim.sh
new file mode 100644
index 0000000..aab272b
--- /dev/null
+++ b/modules/bootanim/kspost.30.nochroot.bootanim.sh
@@ -0,0 +1,14 @@
+# Copyright (C) 2009 One Laptop Per Child
+# Licensed under the terms of the GNU GPL v2 or later; see COPYING for details.
+
+. $OOB__shlib
+
+cache=$cachedir/bootanim
+
+STATIC_IMAGES="frame00.565 ul_warning.565"
+FILES="$STATIC_IMAGES deltas"
+
+for f in $FILES; do
+    echo "cp $cache/$f \$INSTALL_ROOT/usr/share/boot-anim/"  
+done
+echo 'chmod 644 $INSTALL_ROOT/usr/share/boot-anim/*'
diff --git a/modules/bootanim/prepare.90.bootanim.sh b/modules/bootanim/prepare.90.bootanim.sh
new file mode 100644
index 0000000..6abb0e5
--- /dev/null
+++ b/modules/bootanim/prepare.90.bootanim.sh
@@ -0,0 +1,70 @@
+# Copyright (C) 2009 One Laptop Per Child
+# Licensed under the terms of the GNU GPL v2 or later; see COPYING for details.
+
+. $OOB__shlib
+
+imgdir=$(read_config bootanim imgdir)
+cache=$cachedir/bootanim
+cacheframes=$cachedir/bootanim-frames
+
+STATIC_IMAGES="frame00.png ul_warning.png"
+FRAME_IMAGES="frame00.png frame01.png frame02.png frame03.png 
+	frame04.png frame05.png frame06.png frame07.png frame08.png frame09.png 
+	frame10.png frame11.png frame12.png frame13.png frame14.png frame15.png 
+	frame16.png frame17.png frame18.png frame19.png frame20.png frame21.png 
+	frame22.png frame23.png frame24.png frame25.png ul_warning.png"
+
+if [ -n "$imgdir" -a -e "$imgdir" ]; then
+    if [ ! -x '/usr/bin/ppmto565.py' -o ! -x '/usr/bin/calcdelta' ]; then 
+	echo Please install olpc-bootanim-tools >&2
+	exit 1
+    fi
+    if [ ! -x '/usr/bin/pngtopnm' ]; then 
+	echo Please install netpbm-progs >&2
+	exit 1
+    fi
+    mkdir -p "$cache"
+    mkdir -p "$cacheframes"
+    for img in $STATIC_IMAGES; do
+	src=$imgdir/$img
+	target=$cache/${img%.*}.565
+
+	# like make
+	if [ ! -e "$target" -o "$src" -nt "$target" ];then
+	    echo "Processing $src"
+	    pngtopnm "$src" | ppmto565.py -o "$target.tmp"
+	    mv "$target.tmp" "$target"
+	fi
+    done
+
+    rebuilddelta=0
+    for img in $FRAME_IMAGES; do
+	src=$imgdir/$img
+	target=$cacheframes/${img%.*}.565
+
+	# like make
+	if [ ! -e "$target" -o "$src" -nt "$target" ];then
+	    echo "Processing $src"
+	    pngtopnm "$src" | ppmto565.py -o "$target.tmp"
+	    mv "$target.tmp" "$target"
+	    rebuilddelta=1
+	fi
+    done
+    if [ "$rebuilddelta" == 1 -o ! -e "$cache/deltas" ];then
+	echo "Creating delta sequence"
+	# unfortunately, 
+	tmpdir="/tmp/oob_bootanim.$$"
+	mkdir -p "$tmpdir"
+	pushd "$tmpdir"
+	for img in $FRAME_IMAGES; do
+	    echo $cacheframes/${img%.*}.565 >> frames
+	done
+        # calcdelta reads a 'frames' file listing
+        # the files to process
+	echo calcdelta frames
+	calcdelta frames
+	mv deltas $cache/
+	popd
+	rm -fr "$tmpdir"
+    fi
+fi
\ No newline at end of file
-- 
1.6.2.5




More information about the Devel mailing list