af2649b795
The _update script does not check the return value of erasing a partiton or flashing the image to the device. Added this check to get a evaluable return value from the update script. Signed-off-by: Teresa Gámez <t.gamez@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
51 lines
723 B
Bash
51 lines
723 B
Bash
#!/bin/sh
|
|
|
|
if [ -z "$part" -o -z "$image" ]; then
|
|
echo "define \$part and \$image"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -e "$part" ]; then
|
|
echo "Partition $part does not exist"
|
|
exit 1
|
|
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
|
|
fi
|
|
fi
|
|
|
|
if [ x$mode = xxmodem ]; then
|
|
loadb -f $image -c
|
|
if [ $? -ne 0 ] ; then
|
|
echo "loadb failed or cancelled! Update aborted."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
unprotect $part
|
|
|
|
echo
|
|
echo "erasing partition $part"
|
|
echo
|
|
erase $part || exit 1
|
|
|
|
echo
|
|
echo "flashing $image to $part"
|
|
echo
|
|
|
|
if [ x$mode = xtftp ]; then
|
|
tftp $image $part || exit 1
|
|
else
|
|
cp $image $part || exit 1
|
|
fi
|
|
|
|
protect $part
|