#! /bin/sh # # usage: rbld ?-b? MINIRC=dfl # set a minicom config name SCRIPT=/tmp/runscript # read man runscript TIMOUT=300 # max. 5 min to upload BINARY=0 # default format is elf, or s-rec # use -b option for binary format test -z ${1} && exit 1 # quite die test ".${2}" == ".-b" && BINARY=1 echo -n 'Press [Enter] when target is reset, ^C to abort load '; read # read man runscript cat > ${SCRIPT} << __eof timeout ${TIMOUT} rbprompt: send "\003\c" expect { "RedBoot>" goto start timeout 1 goto rbprompt } start: send "lo -m y\c" if ${BINARY} > 0 send " -r -b %{FREEMEMLO}" send "" ! sz -vv ${1} __eof minicom ${MINIRC} -S ${SCRIPT}