X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=master%2Fopt%2Fscript%2Fflash_fe306;fp=master%2Fopt%2Fscript%2Fflash_fe306;h=423b6d4b9be1e0a01ba8247259852ab233e60ad9;hb=757c2d98b5969ec1b1bebab0cdf552b6c5698ad3;hp=0000000000000000000000000000000000000000;hpb=2cb6a627e61a5bf8f1eec7e68f0e34d48672a083;p=debian6500.git diff --git a/master/opt/script/flash_fe306 b/master/opt/script/flash_fe306 new file mode 100755 index 0000000..423b6d4 --- /dev/null +++ b/master/opt/script/flash_fe306 @@ -0,0 +1,83 @@ +#!/bin/bash + +# parameters +# +# ============================================================================ +# +# Copyright (C) THALES. All rights reserved +# Author: Laurent Mazet +# +# 2014-10-06 V1.0 : Creation +# +# ============================================================================ + +DRY= +FIRMWARE=/opt/trc6500/config/code_metier/libHwCtrl/Bitstream +LIST="application.out production.bin ts12_fp_pano.bin ts22_fp_pano.bin firmware.out" +HOST= +TRC6500_SCRIPT_DIR=$(dirname $0) + +# help function + +function usage () { + echo "usage: $PROGNAME [-d] [-f dir] [-h] [-i host] [-l list]" + echo " -d: dry mode" + echo " -f: firmware directory ($FIRMWARE)" + echo " -h: help message" + echo " -i: board hostname (or ip)" + echo " -l: list of firmware ($LIST)" + exit $@ + } + +# formating functions + +function title () { echo -e "\033[0;1m$*\033[0;0m"; } +function pass () { echo -e "\033[1;32m$*\033[0;0m"; } +function warn () { echo -e "\033[1;33m$*\033[0;0m"; } +function fail () { echo -e "\033[1;31m$*\033[0;0m"; } + +# argument processing + +while [ $# -gt 0 ]; do + case "$1" in + -d) DRY=yes;; + -f) shift; FIRMWARE=$1;; + -h) usage 0;; + -i) shift; HOST=$1;; + -l) shift; LIST=$1;; + *) usage 1;; + esac + shift +done + +# check host + +[ "$HOST" ] || ping -c 1 $HOST >&/dev/null || \ + { fail "Can't connect '$HOST'"; exit 1; } + +# check firmware + +for f in $LIST; do + [ -f $FIRMWARE/$f ] || { fail "Can't find '$FIRMWARE/$f'"; exit 1; } +done + +# check mode + +protect="" +[ "$DRY" = yes ] && protect="!echo" + +# flash firmware + +title "flash fe306 '$HOST'" + +ftp -n <