Update of /cvsroot/blob/blob/utils
In directory usw-pr-cvs1:/tmp/cvs-serv4658/utils
Added Files:
upload.sh
Log Message:
Added a script to automate uploading/flashing of images. There was a similar
script floating around a couple of months ago - this one is pretty much the
same, just a bit more user friendly and allows more image types, etc.
--- NEW FILE: upload.sh ---
#!/bin/sh
# Written by Abraham van der Merwe
# Last updated: 2002/02/04
#
# This script is based on a script I got from someone
# (Wookey?) a couple of months ago. I just can't remember
# who it is :P
#
# The script does the tedious job of setting serial port
# speeds and uploading files. The sleeps allow blob to keep
# up without screen corruption on serial speed changes.
#
# Todo:
#
# 1. Make flashing optional
# 2. Add optional "boot" parameter
# usage: set_9600 <device>
function set_9600()
{
sleep 1
stty 1:0:cbd:0:3:1c:7f:15:4:5:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0 < $1
sleep 1
}
# usage: set_115200 <device>
function set_115200()
{
sleep 1
stty 1:0:1cb2:0:3:1c:7f:15:4:5:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0 < $1
sleep 1
}
# usage: upload <name> <filename> <device>
function upload()
{
local uu
uu=$(tempfile -p upload)
cat $2 | uuencode $2 > $uu
echo "Starting $1 upload"
set_9600 $3
echo "download $1" > $3
set_115200 $3
dd if=$uu > $3
rm -f $uu
set_9600 $3
echo "flash $1" > $3
set_9600 $3
}
# usage: help
function help()
{
echo "usage: ${0/*\//} [-d DEVICE] [-k KERNEL] [-r RAMDISK] [-b BLOB] [-p PARAM]"
echo
echo " By default, /dev/ttyS0 is used"
echo
exit 1
}
dev=/dev/ttyS0
i=$#
[[ $i -lt 2 || $1 -eq "--help" ]] && help
while [[ $i -ne 0 ]]
do
[[ $# -lt 2 ]] && help
case $1 in
"-d") dev=$2 ;;
"-k") upload kernel $2 $dev ;;
"-r") upload ramdisk $2 $dev ;;
"-b") upload blob $2 $dev ;;
"-p") upload param $2 $dev ;;
*) help ;;
esac
shift 2
i=$(($i-2))
done
|