ublox-gsm-fw-update: Put all firmware data in an archive file
It avoids hardwritten data like md5 and fw version in the script itself. BugzID: 60230
This commit is contained in:
parent
3d94a73f3f
commit
70e60e2815
Binary file not shown.
|
|
@ -1,8 +1,31 @@
|
|||
#!/bin/sh
|
||||
TTY_DEVICE=/dev/ttyACM0
|
||||
FW_VERSION="16.19"
|
||||
FW_MD5="3ab67be42a797549699bf2f22f84860d"
|
||||
FW_PATH="/lib/firmware/TOBY-L210-03S-01_FW${FW_VERSION}_A01.02_IP_UFWUPD_1K.bin"
|
||||
FW_PATH="/lib/firmware/TOBY-L210-03S-01_FW16.19_A01.02_IP_UFWUPD_1K.tar.gz"
|
||||
|
||||
# Check if firmware has been provided as argument
|
||||
if [ x != x"$1" ]; then
|
||||
FW_PATH=$1
|
||||
fi
|
||||
|
||||
TMP_PATH="/tmp/gsm-firmware"
|
||||
rm -rf $TMP_PATH
|
||||
mkdir -p $TMP_PATH
|
||||
tar xzf "$FW_PATH" -C $TMP_PATH
|
||||
XFILE_PATH=$TMP_PATH/firmware.bin
|
||||
FW_MD5=$(cat $TMP_PATH/md5)
|
||||
FW_VERSION=$(cat $TMP_PATH/version)
|
||||
|
||||
# Make sure that data are correct
|
||||
if [ ! -f $XFILE_PATH ]; then
|
||||
echo "Firmware file does not exist: $XFILE_PATH"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
md5_len=$(echo -n "$FW_MD5" | wc -c)
|
||||
if [ "32" -ne "$md5_len" ]; then
|
||||
echo "MD5 has not the right length: $FW_MD5, length: $md5_len"
|
||||
exit -2
|
||||
fi
|
||||
|
||||
systemctl status ModemManager > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
|
|
@ -20,11 +43,11 @@ printf '\r\nAT+CGMR\r\n' > $TTY_DEVICE
|
|||
grep -B3 -m 1 "OK" < $TTY_DEVICE | grep "$FW_VERSION"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Already on last FW"
|
||||
echo "The modem is already running the same FW version"
|
||||
else
|
||||
echo "Upgrading Firmware"
|
||||
printf "AT+UFWUPD=${FW_MD5}\r\n" > $TTY_DEVICE
|
||||
sx -k "$FW_PATH" < $TTY_DEVICE > $TTY_DEVICE
|
||||
sx -k "$XFILE_PATH" < $TTY_DEVICE > $TTY_DEVICE
|
||||
|
||||
echo "Restarting modem config script"
|
||||
systemctl restart ublox-gsm-config
|
||||
|
|
|
|||
|
|
@ -8,19 +8,20 @@ LIC_FILES_CHKSUM="file://${COREBASE}/meta/files/common-licenses/Proprietary;md5=
|
|||
RDEPENDS_${PN} = "coreutils lrzsz"
|
||||
|
||||
SRC_URI = " \
|
||||
file://TOBY-L210-03S-01_FW16.19_A01.02_IP_UFWUPD_1K.bin \
|
||||
file://TOBY-L210-03S-01_FW16.19_A01.02_IP_UFWUPD_1K.tar.gz;unpack=0 \
|
||||
file://gsm-fw-update \
|
||||
"
|
||||
|
||||
|
||||
|
||||
S = "${WORKDIR}"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${bindir}
|
||||
install -m 0755 gsm-fw-update ${D}${bindir}/
|
||||
|
||||
install -d ${D}${nonarch_base_libdir}/firmware/
|
||||
install -m 0644 TOBY-L210-03S-01_FW16.19_A01.02_IP_UFWUPD_1K.bin ${D}${nonarch_base_libdir}/firmware/
|
||||
install -d ${D}${nonarch_base_libdir}/firmware/
|
||||
install -m 0644 TOBY-L210-03S-01_FW16.19_A01.02_IP_UFWUPD_1K.tar.gz ${D}${nonarch_base_libdir}/firmware/
|
||||
}
|
||||
|
||||
FILES_${PN} = " \
|
||||
|
|
|
|||
Loading…
Reference in New Issue