diff --git a/recipes-connectivity/ublox-gsm-fw-update/files/TOBY-L210-03S-01_FW16.19_A01.02_IP_UFWUPD_1K.bin b/recipes-connectivity/ublox-gsm-fw-update/files/TOBY-L210-03S-01_FW16.19_A01.02_IP_UFWUPD_1K.tar.gz similarity index 89% rename from recipes-connectivity/ublox-gsm-fw-update/files/TOBY-L210-03S-01_FW16.19_A01.02_IP_UFWUPD_1K.bin rename to recipes-connectivity/ublox-gsm-fw-update/files/TOBY-L210-03S-01_FW16.19_A01.02_IP_UFWUPD_1K.tar.gz index d9aefe3..306f9eb 100644 Binary files a/recipes-connectivity/ublox-gsm-fw-update/files/TOBY-L210-03S-01_FW16.19_A01.02_IP_UFWUPD_1K.bin and b/recipes-connectivity/ublox-gsm-fw-update/files/TOBY-L210-03S-01_FW16.19_A01.02_IP_UFWUPD_1K.tar.gz differ diff --git a/recipes-connectivity/ublox-gsm-fw-update/files/gsm-fw-update b/recipes-connectivity/ublox-gsm-fw-update/files/gsm-fw-update index ae2df7d..2594f82 100755 --- a/recipes-connectivity/ublox-gsm-fw-update/files/gsm-fw-update +++ b/recipes-connectivity/ublox-gsm-fw-update/files/gsm-fw-update @@ -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 diff --git a/recipes-connectivity/ublox-gsm-fw-update/ublox-gsm-fw-update.bb b/recipes-connectivity/ublox-gsm-fw-update/ublox-gsm-fw-update.bb index 174212c..228dd47 100644 --- a/recipes-connectivity/ublox-gsm-fw-update/ublox-gsm-fw-update.bb +++ b/recipes-connectivity/ublox-gsm-fw-update/ublox-gsm-fw-update.bb @@ -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} = " \