defaultenv: add xmodem support for update
the default mode is tftp to do not change the default behavior Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
3b8942faa0
commit
de1823f74e
|
@ -10,14 +10,16 @@ if [ ! -e "$part" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [ x$ip = xdhcp ]; then
|
||||
dhcp
|
||||
fi
|
||||
if [ x$mode = xtftp ]; then
|
||||
if [ x$ip = xdhcp ]; then
|
||||
dhcp
|
||||
fi
|
||||
|
||||
ping $eth0.serverip
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "Server did not reply! Update aborted."
|
||||
exit 1
|
||||
ping $eth0.serverip
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "Server did not reply! Update aborted."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
unprotect $part
|
||||
|
@ -30,6 +32,12 @@ erase $part
|
|||
echo
|
||||
echo "flashing $image to $part"
|
||||
echo
|
||||
tftp $image $part
|
||||
|
||||
if [ x$mode = xtftp ]; then
|
||||
tftp $image $part
|
||||
else
|
||||
loadb -f $image -c
|
||||
cp $image $part
|
||||
fi
|
||||
|
||||
protect $part
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "usage: $0 -t <kernel|rootfs> -d <nor|nand> [-f imagename] -c"
|
||||
echo "usage: $0 -t <kernel|rootfs> -d <nor|nand> [-m tftp|xmodem] [-f imagename] -c"
|
||||
echo "update tools."
|
||||
echo ""
|
||||
echo "options"
|
||||
echo " -c to check the crc32 for the image and flashed one"
|
||||
echo ""
|
||||
echo "type update -t kernel -d <nor|nand> [-f imagename] to update kernel into flash"
|
||||
echo "type update -t rootfs -d <nor|nand> [-f imagename] to update rootfs into flash"
|
||||
echo "default mode is tftp"
|
||||
echo "type update -t kernel -d <nor|nand> [-m tftp|xmodem] [-f imagename] to update kernel into flash"
|
||||
echo "type update -t rootfs -d <nor|nand> [-m tftp|xmodem] [-f imagename] to update rootfs into flash"
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
type=""
|
||||
device_type=""
|
||||
check=n
|
||||
mode=tftp
|
||||
|
||||
while getopt "ht:d:f:c" Option
|
||||
while getopt "ht:d:f:m:c" Option
|
||||
do
|
||||
if [ ${Option} = t ]; then
|
||||
type=${OPTARG}
|
||||
|
@ -16,6 +17,8 @@ elif [ ${Option} = f ]; then
|
|||
imagename=${OPTARG}
|
||||
elif [ ${Option} = c ]; then
|
||||
check=y
|
||||
elif [ ${Option} = m ]; then
|
||||
mode=${OPTARG}
|
||||
else
|
||||
. /env/bin/_update_help
|
||||
exit 0
|
||||
|
@ -45,6 +48,12 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [ x${mode} != xtftp ] && [ x${mode} != xxmodem ] ; then
|
||||
echo "unsupported mode ${mode}."
|
||||
. /env/bin/_update_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. /env/bin/_update
|
||||
if [ x${check} = xy ]; then
|
||||
crc32 -f $image -F $part
|
||||
|
|
Loading…
Reference in New Issue