[aadk-commits] dbailey: uClinux/trunk r160 - /uClinux/trunk/uClinux-dist/vendors/Digium/S800...

aadk-commits at lists.digium.com aadk-commits at lists.digium.com
Tue Feb 20 12:20:54 MST 2007


Author: dbailey
Date: Tue Feb 20 13:20:53 2007
New Revision: 160

URL: http://svn.digium.com/view/aadk?view=rev&rev=160
Log:
Changed the flashupdate script to be able to get the image via wget
Created bootloaderupdate to allow for the reFLASH of the u-boot bootloader 

Added:
    uClinux/trunk/uClinux-dist/vendors/Digium/S800I/scripts/bootloaderupdate   (with props)
Modified:
    uClinux/trunk/uClinux-dist/vendors/Digium/S800I/scripts/flashupdate

Added: uClinux/trunk/uClinux-dist/vendors/Digium/S800I/scripts/bootloaderupdate
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/vendors/Digium/S800I/scripts/bootloaderupdate?view=auto&rev=160
==============================================================================
--- uClinux/trunk/uClinux-dist/vendors/Digium/S800I/scripts/bootloaderupdate (added)
+++ uClinux/trunk/uClinux-dist/vendors/Digium/S800I/scripts/bootloaderupdate Tue Feb 20 13:20:53 2007
@@ -1,0 +1,56 @@
+#!/bin/sh
+PID=$$
+# Script for reflashing uCLinux image to SPI FLASH 
+if [ "$1" = "" ]; then
+	echo "Usage: bootloaderupdate <imageURL>"
+	echo "       OR bootloaderupdate tftp <hostname> [<filename>]"
+	exit 1
+fi
+
+# Get the image from the source
+if [ "$1" = "tftp" ]; then
+	HOST=$2
+	if [ "$3" = "" ]; then
+			FILENAME=uImage
+	else
+			FILENAME=$3
+	fi
+	echo "Downloading $FILENAME from host $HOST"
+	tftp -l /tmp/image-${PID}.bin -r ${FILENAME} -g ${HOST}
+	if [ "$?" != "0" ]; then 
+		echo "TFTP Download of Bootloader failed!"
+		rm -f /tmp/image-${PID}.bin
+		exit 1
+	fi
+else
+	FILEURL=$1
+	echo "Downloading URL ${FILEURL}"
+	wget ${FILEURL} -O /tmp/image-${PID}.bin
+	if [ "$?" != "0" ]; then 
+		echo "wget Download of Bootloader failed!"
+		rm -f /tmp/image-${PID}.bin
+		exit 1
+	fi
+fi
+
+FILESIZE=`ls -l /tmp/image-${PID}.bin | cut -c 30-42 | xargs basename`
+echo "Downloaded bootloadere /tmp/image-${PID} is size ${FILESIZE}"
+
+echo "Save Previous Environment"
+nvram dump /tmp/env-${PID}.txt
+echo "Writing bootloader to FLASH...  DO NOT REBOOT!!!"
+dd bs=65536 if=/tmp/image-${PID}.bin of=/dev/mtd1 conv=sync 2>/dev/null
+echo -n "Verifying flash..."
+if cmp /tmp/image-${PID}.bin /dev/mtd1 2>&1 | grep -q -i EOF; then
+	echo "PASSED"
+else
+	echo "FAILED"
+	cmp /tmp/image-${PID}.bin /dev/mtd1
+fi
+echo "Finished writing bootloader to FLASH..."
+echo "Updating Environment..."
+rm -f /tmp/image-${PID}.bin
+# Restore the old copy of the environment 
+nvram store /tmp/env-${PID}.txt
+rm -f /tmp/env-${PID}.txt
+

Propchange: uClinux/trunk/uClinux-dist/vendors/Digium/S800I/scripts/bootloaderupdate
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: uClinux/trunk/uClinux-dist/vendors/Digium/S800I/scripts/bootloaderupdate
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uClinux/trunk/uClinux-dist/vendors/Digium/S800I/scripts/bootloaderupdate
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: uClinux/trunk/uClinux-dist/vendors/Digium/S800I/scripts/flashupdate
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/vendors/Digium/S800I/scripts/flashupdate?view=diff&rev=160&r1=159&r2=160
==============================================================================
--- uClinux/trunk/uClinux-dist/vendors/Digium/S800I/scripts/flashupdate (original)
+++ uClinux/trunk/uClinux-dist/vendors/Digium/S800I/scripts/flashupdate Tue Feb 20 13:20:53 2007
@@ -1,42 +1,60 @@
 #!/bin/sh
 PID=$$
+# Script for reflashing uCLinux image to SPI FLASH 
 if [ "$1" = "" ]; then
-	echo "Usage: flashupdate <hostname> [filename]"
+	echo "Usage: flashupdate <imageURL>"
+	echo "       OR flashupdate tftp <hostname> [<filename>]"
 	exit 1
 fi
-HOST=$1
-if [ "$2" = "" ]; then
-        FILENAME=uImage
+
+# Get the image from the source
+if [ "$1" = "tftp" ]; then
+	HOST=$2
+	if [ "$3" = "" ]; then
+			FILENAME=uImage
+	else
+			FILENAME=$3
+	fi
+	echo "Downloading $FILENAME from host $HOST"
+	tftp -l /tmp/image-${PID}.bin -r ${FILENAME} -g ${HOST}
+	if [ "$?" != "0" ]; then 
+		echo "TFTP Download of firmware failed!"
+		rm -f /tmp/image-${PID}.bin
+		exit 1
+	fi
 else
-        FILENAME=$2
+	FILEURL=$1
+	echo "Downloading URL ${FILEURL}"
+	wget ${FILEURL} -O /tmp/image-${PID}.bin
+	if [ "$?" != "0" ]; then 
+		echo "wget Download of firmware failed!"
+		rm -f /tmp/image-${PID}.bin
+		exit 1
+	fi
 fi
-echo "Downloading ${FILENAME} from ${HOST}"
-if tftp -l /tmp/image-${PID}.bin -r ${FILENAME} -g ${HOST}; then
-	FILESIZE=`ls -l /tmp/image-${PID}.bin | cut -c 30-42 | xargs basename`
-	echo "Downloaded firmware of size ${FILESIZE}"
+
+# Commit the image to FLASH 
+FILESIZE=`ls -l /tmp/image-${PID}.bin | cut -c 30-42 | xargs basename`
+echo "Downloaded firmware /tmp/image-${PID} is size ${FILESIZE}"
 #	echo "Stopping Asterisk..."
 #	asterisk -rx "stop now"
 #	echo "Unloading driver..."
 #	rmmod sx00i
-	echo "Writing firmware to FLASH...  DO NOT REBOOT!..."
-	dd bs=65536 if=/tmp/image-${PID}.bin of=/dev/mtd3 conv=sync 2>/dev/null
-	echo -n "Verifying flash..."
-	if cmp /tmp/image-${PID}.bin /dev/mtd3 2>&1 | grep -q -i EOF; then
-		echo "PASSED"
-	else
-		echo "FAILED"
-		cmp /tmp/image-${PID}.bin /dev/mtd3
-	fi
-	echo "Finished writing firmware to FLASH...  Updating NVRAM..."
-	rm -f /tmp/image-${PID}.bin
-	nvram dump /tmp/nvram-${PID}.txt
-	cat /tmp/nvram-${PID}.txt | grep -v "readsize=" > /tmp/nvram-${PID}.new
-	printf "readsize=%x\\n" ${FILESIZE} >> /tmp/nvram-${PID}.new
-	nvram store /tmp/nvram-${PID}.new
-	rm -f /tmp/nvram-${PID}.new
-	rm -f /tmp/nvram-${PID}.txt
+echo "Writing firmware to FLASH -- DO NOT REBOOT!!!!..."
+dd bs=65536 if=/tmp/image-${PID}.bin of=/dev/mtd3 conv=sync 2>/dev/null
+echo -n "Verifying FLASH..."
+if cmp /tmp/image-${PID}.bin /dev/mtd3 2>&1 | grep -q -i EOF; then
+	echo "PASSED"
 else
-	echo "Download of firmware failed!"
-	rm -f /tmp/image-${PID}.bin
+	echo "FAILED"
+	cmp /tmp/image-${PID}.bin /dev/mtd3
 fi
-
+echo "Finished writing firmware to FLASH -- Updating NVRAM..."
+rm -f /tmp/image-${PID}.bin
+# Place the size of image into u-boot environment so it knows # bytes to load 
+nvram dump /tmp/nvram-${PID}.txt
+cat /tmp/nvram-${PID}.txt | grep -v "readsize=" > /tmp/nvram-${PID}.new
+printf "readsize=%x\\n" ${FILESIZE} >> /tmp/nvram-${PID}.new
+nvram store /tmp/nvram-${PID}.new
+rm -f /tmp/nvram-${PID}.new
+rm -f /tmp/nvram-${PID}.txt



More information about the aadk-commits mailing list