How to Install Sierra firmware within OpenWRT CLI?


#1

I understand typically the firmware upgrades are done via having the module attached to a windows PC using a USB mini-pcie adapter, and sierra drivers are installed and then the firmware is flashed to the module via a simple executable install.

Are there procedures to do something similar while the module is installed in an openwrt router…so without having to take out the module and use a usb-minipcie adapter?


#2

You can update via Linux, but may need to compile SW software, and then install into OpenWRT. There is also firmware update functionality (specifically for MC74XX I believe) built into QMI on Linux (dl can probably speak to the minimum kernel version required). But this then assumes you are using QMI and not MBIM on OpenWRT.

Also, depending on your device, there may be size issues as the firmware packages are quite large (relative to a router’s memory).

To quote SW: "For Linux use the Binaries download packages. This is a zip file containing a CWE and NVU files that should be used in conjunction with the ‘Firmware_Download’ application (or equivalent API’s in an application) contained in the Linux SDK SampleApps "


#3

Much appreciated for the reply.


#4

The updater in libqmi does not really depend on a specific kernel version, and it supports older modems as well (both MC73xx and MC77xx). It supports both QMI and MBIM mode, using the QMI-in-MBIM service.

Aleksander provides OpenWrt packages for libqmi and libmbim, as well as ModemManager:
bitbucket.org/aleksander0m/modemmanager-openwrt

I don’t know the exact hardware requirements, but as you said: You’ll probably need a some free flash and RAM to use it.

And the usual disclaimer: This is community software provided on a best effort basis. If you want official SWI support for your embedded platform, then you should use the GobiSerial and GobiNet drivers along with the SWI QMI SDK. It includes firmware update tools and should run just fine on many OpenWrt platforms.


#5

And a real example upgrading a EM7455 running in MBIM mode (with QMI over MBIM) in an OpenWRT based system:

# qmicli -d /dev/cdc-wdm0 -p --dms-set-firmware-preference="02.24.03.00,002.023_000,ATT"
# qmicli -d /dev/cdc-wdm0 -p --dms-set-operating-mode=offline
# qmicli -d /dev/cdc-wdm0 -p --dms-set-operating-mode=reset
    (wait for single ttyUSB0 to appear)
# qmi-firmware-update -t /dev/ttyUSB0 --update-qdl \
    /tmp/firmware-EM7455/SWI9X30C_02.24.03.00.cwe \
    /tmp/firmware-EM7455/SWI9X30C_02.24.03.00_ATT_002.023_000.nvu
  downloading cwe image: SWI9X30C_02.24.03.00.cwe (64.4 MB)...
  finalizing download... (may take more than one minute, be patient)
  successfully downloaded in 73.46s (877.1 kB/s)
  downloading cwe image: SWI9X30C_02.24.03.00_ATT_002.023_000.nvu (11.1 kB)...
  finalizing download... (may take more than one minute, be patient)
  successfully downloaded in 0.06s (200.2 kB/s)
  rebooting in normal mode...
  firmware update operation finished successfully

# qmicli -d /dev/cdc-wdm0 -p --dms-swi-get-current-firmware
[/dev/cdc-wdm0] Successfully retrieved current firmware:
  Model: EM7455
  Boot version: SWI9X30C_02.24.03.00
  AMSS version: SWI9X30C_02.24.03.00
  SKU ID: 1102527
  Package ID: unknown
  Carrier ID: 4
  Config version: 002.023_000

MC7455 running with OpenWRT on Raspebbry Pi
#6

Alexsander…I don’t see these options on x86_64 on debian strech. I have libqmi-utils 1.16.2-1.

dms-set-firmware-preference
qmi-firmware-update

EDIT: Nevermind, I am getting 1.18 from testing repo (buster).


#7

I am getting this error:

qmi-firmware-update -t /dev/ttyUSB0 --update-qdl /tmp/SWI9X30C_02.24.05.06_Generic_002.026_000_1/SWI9X30C_02.24.05.06.cwe /tmp/SWI9X30C_02.24.05.06_Generic_002.026_000_1/SWI9X30C_02.24.05.06_GENERIC_002.026_000.nvu 

error: error creating device: unexpected response received in dload sdp: 0x70

UPDATE: Nevermind, ran the steps a few times and the modem was at the right “window” to accept the update command:

Package from here: https://source.sierrawireless.com/resources/airprime/minicard/74xx/fw/swi9x30c_02,-d-,24,-d-,05,-d-,06_generic_002,-d-,026_000

qmicli -d /dev/cdc-wdm0 -p --dms-set-firmware-preference="02.24.05.06,002.026_000,GENERIC"
qmicli -d /dev/cdc-wdm0 -p  --dms-set-operating-mode=offline
qmicli -d /dev/cdc-wdm0 -p  --dms-set-operating-mode=reset

qmi-firmware-update -t /dev/ttyUSB0 --update-qdl /tmp/SWI9X30C_02.24.05.06_Generic_002.026_000_1/SWI9X30C_02.24.05.06.cwe /tmp/SWI9X30C_02.24.05.06_Generic_002.026_000_1/SWI9X30C_02.24.05.06_GENERIC_002.026_000.nvu 
downloading cwe image: SWI9X30C_02.24.05.06.cwe (64.4 MB)...
finalizing download... (may take more than one minute, be patient)
successfully downloaded in 73.73s (873.9 kB/s)
downloading cwe image: SWI9X30C_02.24.05.06_GENERIC_002.026_000.nvu (3.9 kB)...
finalizing download... (may take more than one minute, be patient)
successfully downloaded in 0.05s (74.1 kB/s)
rebooting in normal mode...
firmware update operation finished successfully


qmicli -d /dev/cdc-wdm0 -p --dms-swi-get-current-firmware
[/dev/cdc-wdm0] Successfully retrieved current firmware:
	Model: EM7455
	Boot version: SWI9X30C_02.24.05.06
	AMSS version: SWI9X30C_02.24.05.06
	SKU ID: 1102717
	Package ID: unknown
	Carrier ID: 1
	Config version: 002.026_000

at!image?
TYPE SLOT STATUS LRU FAILURES UNIQUE_ID   BUILD_ID
FW   1    GOOD   1   0 0      ?_?         02.05.07.00_?
FW   2    GOOD   2   0 0      ?_?         02.08.02.00_?
FW   3    GOOD   3   0 0      ?_?         02.24.05.06_?
FW   4    EMPTY  0   0 0                  
Max FW images: 4
Active FW image is at slot 3

TYPE SLOT STATUS LRU FAILURES UNIQUE_ID   BUILD_ID
PRI  FF   GOOD   0   0 0      002.026_000 02.24.05.06_GENERIC
Max PRI images: 50

ati
Manufacturer: Sierra Wireless, Incorporated
Model: EM7455
Revision: SWI9X30C_02.24.05.06 r7040 CARMD-EV-FRMWR2 2017/05/19 06:23:09
MEID: XXXXXXXXXXX
IMEI: XXXXXXXXXXXXX
IMEI SV: 12
FSN: XXXXXXXXXXXX
+GCAP: +CGSM

Also, I did change the USBPID and PRIID using some info from here: https://forum.pfsense.org/index.php?topic=123828.0. Mine was a Lenovo branded card with USBPID 9079 and PRIID 9905228 which was for a “Lenovo-Tablet”.

AT!ENTERCND="A710"
AT!USBPID=9071,9070
AT!USBVID=1199
AT!PRIID="9904609","002.026","GENERIC"

at!priid?
PRI Part Number: 9904609
Revision: 002.026
Customer: GENERIC

Carrier PRI: 9999999_9904609_SWI9X30C_02.24.05.06_00_GENERIC_002.026_000

Thank you very much Alexsander. I beat myself up with the Firmware_Download program in Sample_Apps as per Sierra Wireless instructions but even though it said it was successful, the image never went to the modem (none of the slots show it) as slot 3 now shows it with you update program


#8

Hi,

I follow the same procedure as shown by the experts here, but after I finished the firmware upgrade, I could no longer access LTE or send qmicli command to MC7455.
Whenever I sent qmicli command to MC7455, I received this weild error: “couldn’t create client for the ‘dms’ service: CID allocation failed in the CTL client: Transaction timed out”.
Then I have to reload the firmware by windows exe method. And the module is back to normally working.
Only after I upgrade the firmware by qmi-firmware-update, the module stopped working.

Please anyone can give me a hint.
Thank you.
Tony.


#9

Hi,

Thank you for all the information provided in this thread. I am configuring my MC7455 with a OpenWRT running on a Raspberry Pi and I am having difficulties installing modem manager on it. I went through Aleksander’s git for the modem manager but a bit confused with how feeds work.

I am pretty new with the Linux Environment so any help would be greatly appreciated.


#10

Add his feed to feeds.conf.default in your openwrt build environment then just update and install. In make menuconfig select the modemmanager packages.


#11

Hi,

Thanks for your response. I noticed that I would need the libqmi and libmbim installed on my OpenWRT. How can I get these packages? I have the uqmi package installed on my openwrt right now.


#12

The modemmanager package has libmbim and libqmi as dependencies so it will auto check those in menuconfig. To find them and make sure just use the / key and search for them and it will show you where they are at in menuconfig.


#13

Here’s a little script I cooked up to automate the process (used it successfully on a Turris Omnia with a MC7430 installed and the most recent firmware from Sierra):

#! /bin/sh
device=/dev/cdc-wdm0
fullmodeusb=/dev/ttyUSB2
bootmodeusb=/dev/ttyUSB0
unsafe=
# uncomment this to enable unsafe mode
#unsafe=--ignore-mm-runtime-check

echo Locating firmware files...
ncwe=$(ls *.cwe 2>/dev/null|wc -l)
nnvu=$(ls *.nvu 2>/dev/null|wc -l)
if [ \( $ncwe -ne 1 \) -o \( $nnvu -ne 1 \) ]; then
  echo Couldn\'t find the firmware update files
  echo make sure exactly one .cwe and one .nvu are present
  exit
fi
cwe=$(ls *.cwe|xargs)
nvu=$(ls *.nvu|xargs)
fwamssflavor=$(echo $cwe|sed -r 's,_.*,,')
fwamssvs=$(echo $cwe|sed -r 's,^[^_]+_(.+)\.cwe,\1,')
fwbootflavor=$(echo $nvu|sed -r 's,_.*,,')
fwbootvs=$(echo $nvu|sed -r 's,^[^_]+_([^_]+)_.*,\1,')
fwedition=$(echo $nvu|sed -r 's,^[^_]+_[^_]+_([^_]+).*,\1,')
fwconfigvs=$(echo $nvu|sed -r 's,^[^_]+_[^_]+_[^_]+_(.*)\.nvu,\1,')
echo "  Using CWE: ./$cwe"
echo "  Using NVU: ./$nvu"
echo "  versions: device=$fwamssflavor boot=$fwbootvs amss=$fwamssvs config=$fwconfigvs edition=$fwedition"
if [ "$fwamssflavor" != "$fwbootflavor" ]; then
  echo "ERROR! BOOT belongs to a different device ($fwbootflavor)."
  echo "This is *very* likely to brick the modem. Aborting..."
  exit
fi
if [ \( -z "$fwamssflavor" \) -o \( -z "$fwamssvs" \) -o \( -z "$fwbootvs" \) -o \( -z "$fwconfigvs" \) -o \( -z "$fwedition" \) ]; then
  echo "ERROR! Cannot detect the exact update versions."
  echo "Aborting..."
  exit
fi
echo ""

echo "Detecting modem firmware..."
tmp=$(mktemp)
if ! qmicli -d $device -p --dms-swi-get-current-firmware 2>/dev/null >$tmp; then
  echo Couldn\'t query the current firmware using $device
  exit
fi
model=$(cat $tmp|grep Model:|awk '{print $2}')
sku=$(cat $tmp|grep 'SKU ID:'|awk '{print $3}')
boot=$(cat $tmp|grep 'Boot version:'|awk '{print $3}')
amss=$(cat $tmp|grep 'AMSS version:'|awk '{print $3}')
configvs=$(cat $tmp|grep 'Config version:'|awk '{print $3}')
rm -f $tmp
amssflavor=$(echo $amss|sed -r 's,_.*,,')
amssvs=$(echo $amss|sed -r 's,^[^_]+_,,')
bootflavor=$(echo $boot|sed -r 's,_.*,,')
bootvs=$(echo $boot|sed -r 's,^[^_]+_,,')
echo "  Found $model (SKU $sku) on $device"
echo "  versions: device=$amssflavor boot=$bootvs amss=$amssvs config=$configvs"
if [ "$amssflavor" != "$bootflavor" ]; then
  echo "ERROR! BOOT belongs to a different ($bootflavor)."
  echo "This is *seriously* wrong. Aborting..."
  exit
fi
if [ \( -z "$amssflavor" \) -o \( -z "$amssvs" \) -o \( -z "$bootvs" \) -o \( -z "$configvs" \) ]; then
  echo "ERROR! Cannot detect the exact installed versions."
  echo "Aborting..."
  exit
fi
if [ "$amssflavor" != "$fwamssflavor" ]; then
  echo "ERROR! update files are for a different device."
  echo "This is *very* likely to brick the modem. Aborting..."
  exit
fi
if [ \( "$amssvs" = "$fwamssvs" \) -a \( "$bootvs" = "$fwbootvs" \) ]; then
  echo "NOTE. Update already installed."
  echo "Noting to do..."
  exit
fi
echo ""

echo Rebooting modem into bootloader mode...
echo "  # qmi-firmware-update -w $device $unsafe -b"
qmi-firmware-update -w $device $unsafe -b 2>&1 | sed 's,^,  ,'
echo -n "(waiting for the modem to disappear..."
t=0
while [ $t -le 30 ]; do
  if [ ! -e $fullmodeusb ]; then
    echo " OK)"
    break;
  fi
  t=$(( t + 1 ))
  echo -n "."
  sleep 1
done
if [ -e $fullmodeusb ]; then
  echo " FAILED! - timeout)"
  echo "  # qmicli -d $device -p --dms-get-operating-mode"
  qmicli -d $device -p --dms-get-operating-mode 2>&1 | sed 's,^,  ,'
  echo "Aborting..."
  exit
fi
echo -n "(waiting for the boot interface to appear..."
t=0
while [ $t -le 30 ]; do
  if [ -e $bootmodeusb ]; then
    echo " OK)"
    break;
  fi
  t=$(( t + 1 ))
  echo -n "."
  sleep 1
done
if [ ! -e $bootmodeusb ]; then
  echo " FAILED - timeout)"
  echo "Aborting..."
  exit
fi
if [ -e $fullmodeusb ]; then
  echo " FAILED - boot skipped, normal reboot happened)"
  echo "Aborting. Please retry..."
  exit
fi
echo ""

echo "Updating modem..."
echo "# qmi-firmware-update -t $bootmodeusb $unsafe --update-qdl \\"
echo "    ./$cwe \\"
echo "    ./$nvu"
qmi-firmware-update -t $bootmodeusb $unsafe --update-qdl $cwe $nvu
echo -n "(waiting for the modem to re-appear..."
t=0
while [ $t -le 30 ]; do
  if [ -e $device ]; then
    echo " OK)"
    break;
  fi
  t=$(( t + 1 ))
  echo -n "."
  sleep 1
done
if [ ! -e $device ]; then
  echo " FAILED! - timeout)"
  echo "Aborting..."
  exit
fi
echo ""

echo "Querying modem..."
echo -n "(waiting for the modem to finish boot..."
t=0
while [ $t -le 180 ]; do
  if qmicli -d $device -p --dms-swi-get-current-firmware 2>/dev/null > $tmp; then
    echo " OK)"
    break;
  fi
  t=$(( t + 1 ))
  echo -n "."
  sleep 1
done
if ! qmicli -d $device -p --dms-swi-get-current-firmware 2>/dev/null > $tmp; then
  echo " FAILED! - timeout)"
  echo "Run \"qmicli -d $device -p --dms-swi-get-current-firmware\" later..."
else
  echo "  # qmicli -d $device -p --dms-swi-get-current-firmware"
  cat $tmp | sed 's,^,  ,'
fi
echo ""

echo "All done."

Sample output log:

Locating firmware files...
  Using CWE: ./SWI9X30C_02.30.03.00.cwe
  Using NVU: ./SWI9X30C_02.30.03.00_GENERIC_002.046_001.nvu
  versions: device=SWI9X30C boot=02.30.03.00 amss=02.30.03.00 config=002.046_001 edition=GENERIC

Detecting modem firmware...
  Found MC7430 (SKU 1102477) on /dev/cdc-wdm0
  versions: device=SWI9X30C boot=02.14.03.00 amss=02.14.03.00 config=002.012_000

Rebooting modem into bootloader mode...
  # qmi-firmware-update -w /dev/cdc-wdm0 --ignore-mm-runtime-check -b
  reseter operation finished successfully
(waiting for the modem to disappear................ OK)
(waiting for the boot interface to appear.... OK)

Updating modem...
# qmi-firmware-update -t /dev/ttyUSB0 --ignore-mm-runtime-check --update-qdl \
    ./SWI9X30C_02.30.03.00.cwe \
    ./SWI9X30C_02.30.03.00_GENERIC_002.046_001.nvu
downloading cwe image: SWI9X30C_02.30.03.00.cwe (64.5 MB)...
finalizing download... (may take more than one minute, be patient)
successfully downloaded in 52.63s (1.2 MB/s)
downloading cwe image: SWI9X30C_02.30.03.00_GENERIC_002.046_001.nvu (3.2 kB)...
finalizing download... (may take more than one minute, be patient)
successfully downloaded in 0.05s (60.1 kB/s)
rebooting in normal mode...
firmware update operation finished successfully
(waiting for the modem to re-appear.............. OK)

Querying modem...
(waiting for the modem to finish boot..... OK)
  # qmicli -d /dev/cdc-wdm0 -p --dms-swi-get-current-firmware
  [/dev/cdc-wdm0] Successfully retrieved current firmware:
        Model: MC7430
        Boot version: SWI9X30C_02.30.03.00
        AMSS version: SWI9X30C_02.30.03.00
        SKU ID: 1102477
        Package ID: unknown
        Carrier ID: 1
        Config version: 002.012_000

All done.

I hope this helps others just like this page helped me :slight_smile: