mirror of https://github.com/rusefi/wideband.git
Linux scripts update and improve (#127)
* tools: linux update scripts: more verbose, more checks * tools: can_update: more checks, help
This commit is contained in:
parent
c2e28dd24a
commit
dd9e9b94d1
|
@ -1,26 +1,60 @@
|
|||
#!/bin/bash
|
||||
|
||||
help()
|
||||
{
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo " can_update.sh board [interface]"
|
||||
echo " Default interface is can0"
|
||||
exit -1;
|
||||
}
|
||||
|
||||
if [ ! -d tools ]; then
|
||||
echo "Please run this script from firmware directory, not tools!"
|
||||
help
|
||||
fi
|
||||
|
||||
if [ -z $1 ]; then
|
||||
echo "Please provide board name as argunment"
|
||||
help
|
||||
fi
|
||||
|
||||
IFACE=can0
|
||||
|
||||
if [ ! -z $1 ]; then
|
||||
IFACE=$2
|
||||
fi
|
||||
|
||||
if [ ! -d /sys/class/net/$IFACE ]; then
|
||||
echo "Interface $IFACE is not exist"
|
||||
help
|
||||
fi
|
||||
|
||||
if [ $(</sys/class/net/$IFACE/operstate) != up ]; then
|
||||
echo "CAN interface $IFACE is not UP"
|
||||
echo " You may want to bring up $IFACE first"
|
||||
echo " ip link set $IFACE type can bitrate 500000 ; ifconfig $IFACE up"
|
||||
help
|
||||
fi
|
||||
|
||||
FW_FILE=deliver/$1/wideband_update.srec
|
||||
|
||||
# This script will try to flash/update RusEFI part of firmware over can0 interface.
|
||||
if [ ! -f $FW_FILE ]; then
|
||||
echo "FW_FILE $FW_FILE not found"
|
||||
help
|
||||
fi
|
||||
|
||||
# This script will try to flash/update RusEFI part of firmware over can interface.
|
||||
#
|
||||
# You may want to bring can0 interface up first:
|
||||
# You may want to bring can interface up first. For can0:
|
||||
# sudo ip link set can0 type can bitrate 500000 ; sudo ifconfig can0 up
|
||||
# Sometimes (after communication errors) you may like to restart interface with:
|
||||
# make sure that you have termination resistor
|
||||
# sudo ifconfig can0 down; sudo ip link set can0 type can bitrate 500000 ; sudo ifconfig can0 up
|
||||
|
||||
# sudo apt-get install can-utils
|
||||
# candump can0
|
||||
|
||||
# project root
|
||||
cd ..
|
||||
|
||||
/sbin/ifconfig can0 | grep RUNNING
|
||||
|
||||
#echo This script assumes that you are using can0 interface and it is ready, otherwise read comments inside
|
||||
#echo This script assumes that you are using $IFACE interface and it is ready, otherwise read comments inside
|
||||
#echo This script assumes that you have BootCommander somewhere in your PATH, otherwise read comments inside
|
||||
#BootCommander -t=xcp_can -d=can0 $FW_FILE
|
||||
#BootCommander -t=xcp_can -d=$IFACE $FW_FILE
|
||||
|
||||
# OR
|
||||
# You can build it from sources with:
|
||||
|
@ -29,4 +63,11 @@ cd ..
|
|||
# (cd ext/openblt/Host/Source/BootCommander/ ; mkdir build ; cd build ; cmake .. ; make -j )
|
||||
# And run:
|
||||
|
||||
ext/openblt/Host/BootCommander -t=xcp_can -d=can0 $FW_FILE
|
||||
if [ ! -f ext/openblt/Host/BootCommander ]; then
|
||||
echo "Please build BootCommander first!"
|
||||
echo "Run: (cd ext/openblt/Host/Source/LibOpenBLT/ ; mkdir build ; cd build ; cmake .. ; make -j )"
|
||||
echo "Run: (cd ext/openblt/Host/Source/BootCommander/ ; mkdir build ; cd build ; cmake .. ; make -j )"
|
||||
help
|
||||
fi
|
||||
|
||||
ext/openblt/Host/BootCommander -t=xcp_can -d=$IFACE $FW_FILE
|
||||
|
|
|
@ -1,12 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! -d tools ]; then
|
||||
echo "Please run this script from firmware directory, not tools!"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if [ -z $1 ]; then
|
||||
echo "Please provide board name as argunment"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
FW_FILE=deliver/$1/wideband_update.srec
|
||||
|
||||
if [ ! -f $FW_FILE ]; then
|
||||
echo "FW_FILE $FW_FILE not found"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# This script will try to flash/update RusEFI part of firmware over UART interface.
|
||||
#
|
||||
n
|
||||
# project root
|
||||
cd ..
|
||||
|
||||
#echo This script assumes that you have BootCommander somewhere in your PATH, otherwise read comments inside
|
||||
#BootCommander -t=xcp_rs232 -d=/dev/ttyUSB0 -b=115200 $FW_FILE
|
||||
|
@ -18,4 +29,10 @@ cd ..
|
|||
# (cd ext/openblt/Host/Source/BootCommander/ ; mkdir build ; cd build ; cmake .. ; make -j )
|
||||
# And run:
|
||||
|
||||
if [ ! -f ext/openblt/Host/BootCommander ]; then
|
||||
echo "Please build BootCommander first!"
|
||||
echo "Run: (cd ext/openblt/Host/Source/LibOpenBLT/ ; mkdir build ; cd build ; cmake .. ; make -j )"
|
||||
echo "Run: (cd ext/openblt/Host/Source/BootCommander/ ; mkdir build ; cd build ; cmake .. ; make -j )"
|
||||
fi
|
||||
|
||||
ext/openblt/Host/BootCommander -t=xcp_rs232 -d=/dev/ttyUSB0 -b=115200 $FW_FILE
|
||||
|
|
Loading…
Reference in New Issue