r4421 - trunk/src/host/devirginator

werner at docs.openmoko.org werner at docs.openmoko.org
Fri May 9 17:00:39 CEST 2008


Author: werner
Date: 2008-05-09 17:00:39 +0200 (Fri, 09 May 2008)
New Revision: 4421

Modified:
   trunk/src/host/devirginator/mknor
Log:
The changes below make it a bit easier to fit mknor into scripts and to
select alternative configurations.

mknor: added general option parsing
mknor: new option -s splash_image to change the splash image file
mknor: new option -D to add definitions for envedit



Modified: trunk/src/host/devirginator/mknor
===================================================================
--- trunk/src/host/devirginator/mknor	2008-05-09 14:22:32 UTC (rev 4420)
+++ trunk/src/host/devirginator/mknor	2008-05-09 15:00:39 UTC (rev 4421)
@@ -44,17 +44,38 @@
 
 usage()
 {
-    echo "usage: $0 [-o outfile ] u-boot" 1>&2
+cat <<EOF 1<&2
+usage: $0 [-o outfile] [-s splash_image] [-D define ...] u-boot
+
+  -o outfile       write NOR image to specified file. Default: nor.bin
+  -s splash_image  use the specified splash image. Default: tmp/System_boot.png
+  -D define        pass definition to envedit
+EOF
     exit 1
 }
 
 
 out=nor.bin
-if [ "$1" = -o ]; then
-    [ ! -z "$2" ] || usage
-    out="$2"
-    shift 2
-fi
+splash=tmp/System_boot.png
+defines=
+
+while [ ! -z "$*" ]; do
+    case "$1" in
+        -o)	shift
+		[ ! -z "$1" ] || usage
+		out="$1";;
+        -s)	shift
+		[ ! -z "$1" ] || usage
+		splash="$1";;
+        -D)	shift
+		[ ! -z "$1" ] || usage
+		defines="$defines -D $1";;
+        -*)	usage;;
+	*)	break;;
+    esac
+    shift
+done
+
 [ ! -z "$1" -a -z "$2" ] || usage
 uboot="$1"
 
@@ -66,12 +87,12 @@
 echo READY.
 EOF
 
-pngtopnm tmp/System_boot.png |
+pngtopnm "$splash" |
   pamcut 0 145 480 240 |
   ../splash/splashimg.pl -pnm - |
   gzip -9 >_splash
 
-./envedit.pl -D GTA02 -D NOR_ENV -f environment.in -o _env
+./envedit.pl -D GTA02 -D NOR_ENV $defines -f environment.in -o _env
 
 ./blink.pl \
   "$uboot"@0 \





More information about the commitlog mailing list