r1225 - trunk/src/host/devirginator
werner at sita.openmoko.org
werner at sita.openmoko.org
Fri Mar 2 22:15:44 CET 2007
Author: werner
Date: 2007-03-02 22:15:39 +0100 (Fri, 02 Mar 2007)
New Revision: 1225
Modified:
trunk/src/host/devirginator/Makefile
trunk/src/host/devirginator/setup.sh
Log:
setup.sh: added option -t to create a portable tarball (UNTESTED)
setup.sh: moved test whether file exists locally into "download"
setup.sh: added download of dfu-util and, optionally, openocd and openocd.cfg
Makefile: added tarball creation (UNTESTED)
Modified: trunk/src/host/devirginator/Makefile
===================================================================
--- trunk/src/host/devirginator/Makefile 2007-03-02 20:02:56 UTC (rev 1224)
+++ trunk/src/host/devirginator/Makefile 2007-03-02 21:15:39 UTC (rev 1225)
@@ -20,6 +20,13 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
+
+DIR=devirginator
+SCRIPTS=crc32.pl envedit.pl openocdcmd.pl scriptify.pl devirginate
+TARBALL=devirg-$(TARBALL_VERSION).tar.gz
+
+.PHONY: tarball
+
devirginate: config environment.in openocd.in u-boot.in \
setup.sh smiley.gz \
crc32.pl envedit.pl openocdcmd.pl scriptify.pl
@@ -41,3 +48,15 @@
@echo 'Please provide a "config" file.' 1>&2
@echo 'See "config.example" for details.' 1>&2
@exit 1
+
+tarball: $(TARBALL)
+
+$(TARBALL):
+ @[ ! -z "$(TARBALL_VERSION)" ] || \
+ { echo "Please set TARBALL_VERSION"; exit 1; }
+ cd .. && ln -sf $(DIR) $(DIR)-$(TARBALL_VERSION) && \
+ tar cfz $(DIR)/$(TARBALL) \
+ $(SCRIPTS:%=$(DIR)-$(TARBALL_VERSION)/%) \
+ $(DIR)-$(TARBALL_VERSION)/tmp/ || \
+ { rm -f $(DIR)-$(TARBALL_VERSION); exit 1; }
+ rm -f $(DIR)-$(TARBALL_VERSION)
Modified: trunk/src/host/devirginator/setup.sh
===================================================================
--- trunk/src/host/devirginator/setup.sh 2007-03-02 20:02:56 UTC (rev 1224)
+++ trunk/src/host/devirginator/setup.sh 2007-03-02 21:15:39 UTC (rev 1225)
@@ -30,6 +30,14 @@
download()
{
+ if [ -r "$2" ]; then
+ if $tarball; then
+ base="`basename \"$2\"`"
+ cp "$2" "tmp/$base"
+ eval $1=\"tmp/$base\"
+ fi
+ return
+ fi
index=tmp/index-${SNAPSHOT}.html
if [ ! -f $index ]; then
wget -O tmp/index "`dirname \"$2\"`/"
@@ -49,7 +57,11 @@
base="`basename \"$n\"`"
cd tmp
wget -N "$n" || { rm -f $base; exit 1; }
- eval $1=\"$PWD/$base\"
+ if $tarball; then
+ eval $1=\"tmp/$base\"
+ else
+ eval $1=\"$PWD/$base\"
+ fi
cd ..
}
@@ -77,8 +89,25 @@
# Locations
SPLASH=http://wiki.openmoko.org/images/c/c2/System_boot.png
+
+# --- Command line parsing ----------------------------------------------------
+
+
+usage()
+{
+ echo "usage: $0 [-t] [variable=value ...]" 1>&2
+ exit 1
+}
+
+
+tarball=false
+
for n in "$@"; do
- eval "$n"
+ case "$n" in
+ -t) tarball=true;;
+ *=*) eval "$n";;
+ *) usage;;
+ esac
done
@@ -88,13 +117,6 @@
. config
-# --- Check executables -------------------------------------------------------
-
-
-probe "$DFU_UTIL" -l
-probe telnet </dev/null
-
-
# --- Post configuration ------------------------------------------------------
@@ -108,27 +130,21 @@
if [ -z "$LOWLEVEL" ]; then
LOWLEVEL=${RELEASE_DIR}/lowlevel_foo-${PLATFORM}${BOARD}-'*'.bin
fi
-if [ ! -f "$LOWLEVEL" ]; then
- download LOWLEVEL "$LOWLEVEL"
-fi
+download LOWLEVEL "$LOWLEVEL"
# u-boot.bin
if [ -z "$UBOOT" ]; then
UBOOT=${RELEASE_DIR}/u-boot-${PLATFORM}${BOARD}-'*'.bin
fi
-if [ ! -f "$UBOOT" ]; then
- download UBOOT "$UBOOT"
-fi
+download UBOOT "$UBOOT"
# uImage.bin
if [ -z "$UIMAGE" ]; then
UIMAGE=${RELEASE_DIR}/uImage-2.6-'*'-fic-${PLATFORM}-'*'.bin
fi
-if [ ! -r "$UIMAGE" ]; then
- download UIMAGE "$UIMAGE"
-fi
+download UIMAGE "$UIMAGE"
## # modules.tar.gz
##
@@ -153,18 +169,59 @@
if [ -z "$ROOTFS" ]; then
ROOTFS=${RELEASE_DIR}/openmoko-devel-image-fic-${PLATFORM}-'*'.rootfs.jffs2
fi
-if [ ! -r "$ROOTFS" ]; then
- download ROOTFS "$ROOTFS"
-fi
+download ROOTFS "$ROOTFS"
-
# Splash screen
if [ ! -f "$SPLASH" ]; then
download SPLASH "$SPLASH"
fi
+# dfu-util
+#
+# Search priority:
+# - direct file
+# - command in local PATH
+# - URL
+#
+if [ ! -r "$DFU_UTIL" ]; then
+ if found="`which \"$DFU_UTIL\" 2>/dev/null`"; then
+ DFU_UTIL="$found"
+ fi
+fi
+download DFU_UTIL "$DFU_UTIL"
+chmod +x "$DFU_UTIL"
+# openocd
+
+if [ ! -z "$OPENOCD" ]; then
+ if [ ! -r "$OPENOCD" ]; then
+ if found="`which \"$OPENOCD\" 2>/dev/null`"; then
+ OPENOCD="$found"
+ fi
+ fi
+ download OPENOCD "$OPENOCD"
+ chmod +x "$OPENOCD"
+fi
+
+if [ ! -z "$OPENOCD_CONFIG" ]; then
+ download OPENOCD_CONFIG "$OPENOCD_CONFIG"
+fi
+
+# Set default for TARBALL_VERSION
+
+if [ -z "$TARBALL_VERSION" ]; then
+ TARBALL_VERSION="$SNAPSHOT"
+fi
+
+
+# --- Check executables -------------------------------------------------------
+
+
+probe "$DFU_UTIL" -l
+probe telnet </dev/null
+
+
# --- Stage 1: OpenOCD script -------------------------------------------------
@@ -198,6 +255,7 @@
# --- Stage 1: smiley splash screen -------------------------------------------
+
export OMDIR
make smiley.gz
mv smiley.gz tmp/
@@ -295,17 +353,41 @@
# --- Done --------------------------------------------------------------------
+if $tarball; then
+ make tarball TARBALL_VERSION="$TARBALL_VERSION"
cat <<EOF
-------------------------------------------------------------------------------
Your devirginator is now ready.
+To install it on a new machine,
+
+- copy the file devirg-${TARBALL_VERSION}.tar.gz to the new machine
+- tar xfz devirg-${TARBALL_VERSION}.tar.gz
+- cd devirginator-${TARBALL_VERSION}
+
To set up a device,
- connect it to power and JTAG
- switch it on
- run ./devirginate
-- wait until the smiley appears (takes about 1-2 minutes)
+- follow the progress, as described in README
-------------------------------------------------------------------------------
EOF
+else
+cat <<EOF
+-------------------------------------------------------------------------------
+
+Your devirginator is now ready.
+
+To set up a device,
+
+- connect it to power and JTAG
+- switch it on
+- run ./devirginate
+- follow the progress, as described in README
+
+-------------------------------------------------------------------------------
+EOF
+fi
More information about the commitlog
mailing list