Legato not installed using fwupdate

Does the lefwkro partition only contain the Legato Framework?
I mean by that, does it not contain any of the application code we’ve written?

When you download application to it by .update, it will install in userapp partition

And when the application is bundled with the framework as the output of mksys and systocwe, is all of it written in lefwkro or are the apps written into userapp?

for the application embedded in legato.cwe, it will be installed in /mnt/legato which is the lefwkro partition

thanks ok. So if we never use update, the userapp partition is never used?

you can use userapp partition as file storge.
e.g.
/home/root

Is there a way to unlock at!partition?

You need to contact distributor to get a tool

Btw, what is the relationship of at!partition to current issue?

Btw, what is the relationship of at!partition to current issue?

The current issue is that mtd14 is now too small after a bad block appeared. Increasing the size of the partition would allow to have a bad block and still have enough space for legato

Alternatively, is there a way to increase the compression of squashfs when building legato?

Have you tried to format that partition?

Do you expect it to remove bad block? It has been marked bad by the fwupdate process after failing to write or erase the block.

Is that a known issue?

i don’t know if it helps or damages the module, i never met such problem before

Is it possible to apply compression to the legato image when using systocwe?

I’ve been saving space where I could (using -s with systocwe saved significant space), but now I think the squashfs compression is likely the next best way to reduce the size.

Here I see compress is set to 0. Do you have some documentation on how to improve the compression?

not sure if swicwe can help on compressing the image:


owner@ubuntu:~/Yocto/tools/swicwe/linux64$ ./swicwe --full-help
swicwe (version 1.8.1)
Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.

Usage:
swicwe <--LCWE|--YCWE|--ACWE|--BCWE|--MCWE|--CONT|--REPL| -P> [-Z] [-F] [-R] [-X] [-x] [<image type>...] [<image name>...] [-o <output cwe file>]

Commands and options:
--LCWE:           set to generate Legato CWE file.
                  If no 'image type' specified will assume '--framework legato.* -o legato[z].cwe'.
                  output CWE filename defaulted to legato[z].cwe if not specified.
--YCWE:           set to generate Yocto CWE file. If no or less 'image type' specified will assume'.
                  '--lk appsboot-yocto.mbn --kernel kernel --rootfs rootfs -o yocto[z].cwe'.
                  output CWE filename defaulted to yocto[z].cwe if not specified.
--ACWE:           set to generate application CWE file, which contains Legato and Yocto images. If no or less 'image type' specified will assume
                  '--lk appsboot-yocto.mbn --kernel kernel --rootfs rootfs --framework legato.* -o yocto-legato[-z].cwe'.
                  output CWE filename defaulted to yocto-legato[-z].cwe if not specified.
--BCWE:           set to generate bootloader CWE file. If no or less 'image type' specified will assume.
                  '--sbl2 sbl2.mbn --rpm rpm.mbn -o boot[z].cwe'.
                  output CWE filename defaulted to boot[z].cwe if not specified.
--MCWE:           set to generate modem CWE file. If no or less 'image type' specified will assume.
                  '--dsp1 dsp1.mbn --dsp2 dsp2.mbn --dsp3 dsp3.mbn -o modem[z].cwe'.
                  output CWE filename defaulted to modem[z].cwe if not specified.
--CONT:           set to concatenate CWE files.
--REPL:           set to replace CWE files.
-Z:               set to compress mode for output CWE file.
-F:               set to generate forward full-FOTA CWE file.
-R:               set to generate reverse full-FOTA CWE file.
-P:               set to parse the input CWE file.
-X:               set to parse psb of the input FOTA CWE file.
-x:               set to parse the input FOTA CWE file.
image type:       specify the type(s) of the input image, options:
                  -a:                 application CWE file (including Legato and Yocto ones) when do CWE concatenation, doesn't coexist with -l|-y.
                  -b:                 bootloader CWE file when do CWE concatenation.
                  -l:                 Legato CWE file when do CWE concatenation, doesn't coexist with -a.
                  -m:                 modem CWE file when do CWE concatenation.
                  -y:                 Yocto CWE file when do CWE concatenation, doesn't coexist with -a.
                  -f:                 (full or delta) FOTA CWE file when do CWE concatenation.
                  --af:               application CWE file (including Legato and Yocto forward ones) when do CWE concatenation, doesn't coexist with -lr|-yr.
                  --bf:               bootloader forward CWE file when do CWE concatenation.
                  --lf:               Legato forward CWE file when do CWE concatenation, doesn't coexist with -ar.
                  --mf:               modem forward CWE file when do CWE concatenation.
                  --yf:               Yocto forward CWE file when do CWE concatenation, doesn't coexist with -ar.
                  --ar:               application CWE file (including Legato and Yocto reverse ones) when do CWE concatenation, doesn't coexist with -lr|-yr.
                  --br:               bootloader reverse CWE file when do CWE concatenation.
                  --lr:               Legato reverse CWE file when do CWE concatenation, doesn't coexist with -ar.
                  --mr:               modem reverse CWE file when do CWE concatenation.
                  --yr:               Yocto reverse CWE file when do CWE concatenation, doesn't coexist with -ar.
                  --fr:               (full or delta) FOTA reverse CWE file when do CWE concatenation.
                  --lk:               LK bootloader image when generate Yocto CWE file from LK, defaulted to 'appsboot-yocto.mbn'.
                  --kernel:           kernel image when generate Yocto CWE file from kernel, defaulted to 'kernel'.
                  --rootfs:           root file system image when generate Yocto CWE file from rootfs, defaulted to 'rootfs'.
                  --framework:        Legato framework image when generate Legato CWE file from framework, defaulted to 'legato.*'.
                  --application:      Legato user application image when generate Legato CWE file from application.
                  --dsp1:             DSP1 image when generate modem CWE from dsp1, defaulted to 'dsp1.mbn'.
                  --dsp2:             DSP2 image when generate modem CWE from dsp2, defaulted to 'dsp2.mbn'.
                  --dsp3:             DSP3 image when generate modem CWE from dsp3, defaulted to 'dsp3.mbn'.
                  --rpm:              RPM image when generate bootloader CWE from rpm, defaulted to 'rpm.mbn'.
                  --part:             QPAR image when generate bootloader CWE from partition table.
                  --sbl1:             SBL1 image when generate bootloader CWE from sbl1.
                  --sbl2:             SBL2 image when generate bootloader CWE from sbl2, defaulted to 'sbl2.mbn'.
                  --lk_rev:           LK bootloader image when generate reverse full-FOTA Yocto CWE file from LK, defaulted to 'appsboot-yocto_rev.mbn'.
                  --kernel_rev:       kernel image when generate reverse full-FOTA Yocto CWE file from kernel, defaulted to 'kernel_rev'.
                  --rootfs_rev:       root file system image when generate reverse full-FOTA Yocto CWE file from rootfs, defaulted to 'rootfs_rev'.
                  --framework_rev:    Legato framework image when generate reverse full-FOTA Legato CWE file from framework, defaulted to 'legato_rev.*'.
                  --application_rev:  Legato user application image when generate reverse full-FOTA Legato CWE file from application.
                  --dsp1_rev:         DSP1 image when generate reverse full-FOTA modem CWE from dsp1, defaulted to 'dsp1_rev.mbn'.
                  --dsp2_rev:         DSP2 image when generate reverse full-FOTA modem CWE from dsp2, defaulted to 'dsp2_rev.mbn'.
                  --dsp3_rev:         DSP3 image when generate reverse full-FOTA modem CWE from dsp3, defaulted to 'dsp3_rev.mbn'.
                  --rpm_rev:          RPM image when generate reverse full-FOTA bootloader CWE from rpm, defaulted to 'rpm_rev.mbn'.
                  --part_rev:         QPAR image when generate reverse full-FOTA bootloader CWE from partition.
                  --sbl1_rev:         SBL1 image when generate reverse full-FOTA bootloader CWE from sbl1.
                  --sbl2_rev:         SBL2 image when generate reverse full-FOTA bootloader CWE from sbl2, defaulted to 'sbl2_rev.mbn'.
                  -v:                 specify the version of output CWE file.
                  --pid:              specify the product id of CWE file.
                  --lk_cwe:           LK cwe image when do concatenate CWE concatenation, just for mdm9x40.
                  --file:             file CWE file when do CWE concatenation.
image name:       set to the name(s) of input image.
output CWE file:  set to the name output image.


Examples:
Generate Legato CWE file:
swicwe --LCWE [-Z] [-F] [-R] [--framework <image>] [--application <image>] [-v <version>] [--pid <product id>] [-o <cwe file>]
swicwe --LCWE -Z
swicwe --LCWE --framework legato-image.ar7.yaffs2
swicwe --LCWE --application userapp.yaffs2 --pid A911 -o uapp.cwe
swicwe --LCWE -Z --framework legato-image.ar7.yaffs2 --application userapp.yaffs2 -o legato-uapp-z.cwe
swicwe --LCWE -F -Z --framework legato-image.ar7.yaffs2 -o fota-legato-uapp-z.cwe
swicwe --LCWE -R -Z --framework legato-image.ar7.yaffs2 --framework_rev legato-image_rev.ar7.yaffs2 -o fota-legato-reverse.cwe
swicwe --LCWE --pid 9X40 --framework legato-image.ar759x.yaffs2 -o legato-mdm9x40.cwe

Generate Yocto CWE file:
swicwe --YCWE [-Z] [-F] [-R] [--lk <image>] [--kernel <image>] [--rootfs <image>] [-v <version>] [--pid <product id>] [-o <cwe file>]
swicwe --YCWE
swicwe --YCWE --lk appsboot-yocto.mbn --kernel kernel --rootfs rootfs -o yocto.cwe
swicwe --YCWE --kernel kernel -v 06.03.00 --pid A911 -o kernel.cwe
swicwe --YCWE -Z --kernel kernel-test -o kernelz.cwe
swicwe --YCWE -F -Z --lk appsboot-yocto.mbn --kernel kernel --rootfs rootfs -o fota-yocto.cwe
swicwe --YCWE -R -Z --lk appsboot-yocto.mbn --lk_rev appsboot-yocto_rev.mbn -o fota-yocto-reverse.cwe
swicwe --YCWE --kernel boot-yocto-mdm9x40.img --rootfs mdm9x40-image-minimal-swi-mdm9x40.2k.yaffs2 -o yocto-mdm9x40.cwe

Generate application (Legato+Yocto) CWE file (just for mdm9x15):
swicwe --ACWE [-Z] [-F] [-R] [--lk <image>] [--kernel <image>] [--rootfs <image>] [-v <version>] [--pid <product id>] [--framework <image>] [--application <image>] [-o <cwe file>]
swicwe --ACWE --lk appsboot-yocto.mbn --kernel kernel --rootfs rootfs --framework legato-image.ar7.yaffs2 --application userapp.yaffs2 -o yocto.cwe
swicwe --ACWE -Z --rootfs rootfs --framework legato-image.ar7.yaffs2 --pid A911 -o rootfs-framework-z.cwe
swicwe --ACWE -F -Z --lk appsboot-yocto.mbn --kernel kernel -o fota-yocto.cwe
swicwe --ACWE -R -Z --lk --kernel kernel --kernel_rev kernel_rev --framework legato-image.ar7.yaffs2 --framework_rev legato-image_rev.ar7.yaffs2 -o fota-yocto-reverse.cwe

Generate bootloader CWE file:
swicwe --BCWE [-Z] [-F] [-R] [--sbl1 <image>] [--sbl2 <image>] [--rpm <image>] [-v <version>] [--pid <product id>] [-o <cwe file>]
swicwe --BCWE
swicwe --BCWE --sbl2 sbl2.mbn --rpm rpm.mbn -v 06.03.00  -o boot.cwe
swicwe --BCWE --part partition_nand_9x15_sierra_ar_4g.xml.mbn --sbl1 sbl1.mbn --sbl2 sbl2.mbn --rpm rpm.mbn -o boot_partition_update.cwe
swicwe --BCWE -F --part partition_nand_9x15_sierra_ar_4g.xml.mbn --sbl1 sbl1.mbn --sbl2 sbl2.mbn --rpm rpm.mbn -o fota-boot_partition_update.cwe
swicwe --BCWE -R --sbl1 sbl1.mbn --sbl1 sbl1.mbn -o fota-boot-reverse.cwe
swicwe --BCWE --pid 9X40 --lk lk.mbn -o lk.cwe
swicwe --BCWE --pid 9X40 --tz tz.mbn --sbl1 sbl1.mbn --rpm rpm.mbn --lk lk.mbn -o boot_mdm9x40.cwe

Generate modem CWE file:
swicwe --MCWE [-Z] [-F] [-R] [--dsp1 <image>] [--dsp2 <image>] [--dsp3 <image>] [-v <version>] [--pid <product id>] [-o <cwe file>]
swicwe --MCWE -Z --dsp1 dsp1.mbn --dsp2 dsp2.mbn --dsp3 dsp3.mbn -o modemz.cwe
swicwe --MCWE -F -Z --dsp1 dsp1.mbn --dsp2 dsp2.mbn -o fota-modem.cwe
swicwe --MCWE -Z -R --dsp1 dsp1.mbn --dsp1_rev dsp1_rev.mbn --dsp2 dsp2.mbn --dsp2_rev dsp2_rev.mbn -o fota-modemz-reverse.cwe
swicwe --MCWE -Z
swicwe --MCWE --dsp2 dsp2.mbn NON-HLOS.ubi -o modem-mdm9x40.cwe

Concatenate CWE files:
swicwe --CONT <[[-a <cwe image>]|[-l <cwe image>][-y <cwe image>]] [-m <cwe image>] [-v <version>] [--pid <product id>] [-b <cwe image>]>
                [--file <cwe image>] [-f <cwe image>] [-o <[spkg][-boot[z]][-modem[z]][-yocto[z]][-legato[z]][-file][-fota]>.cwe]
swicwe --CONT -a yocto-legato-z.cwe -m modem.cwe -b boot.cwe -o spkg-boot-modem-yoctoz-legatoz.cwe
swicwe --CONT -a yocto-legato-z.cwe -m modem.cwe -b boot.cwe -f fota.cwe -o foto-boot-modem-yoctoz-legatoz.cwe
swicwe --CONT -f fota.cwe --pid A911 -o foto-fota.cwe
swicwe --CONT -l legatoz.cwe -f full-fota.cwe -o foto-legato-fota.cwe
swicwe --CONT -l legatoz.cwe -y yoctoz.cwe -f delta-fota.cwe -o foto-legato-yocto-fota.cwe
swicwe --CONT --lf fota-legato-forward.cwe --yr fota-yocto-forward.cwe --f delta-fota-forward.cwe -o foto-legato-yocto-fota-forward.cwe
swicwe --CONT --lr fota-legato-reverse.cwe --yr fota-yocto-reverse.cwe --fr delta-fota-reverse.cwe -o foto-legato-yocto-fota-reverse.cwe
swicwe --CONT --pid 9X40 -b boot-mdm9x40.cwe -l legato-mdm9x40.cwe -y yocto-mdm9x40.cwe -m modem-mdm9x40.cwe -o spkg-boot-modem-yocto-legato.cwe
swicwe --CONT --pid 9X40 -b boot-mdm9x40.cwe -l legato-mdm9x40.cwe -y yocto-mdm9x40.cwe -m modem-mdm9x40.cwe --lk_cwe lk.cwe -o spkg-boot-modem-yocto-legato.cwe
swicwe --CONT --pid 9X40 -b boot.cwe -l legato.cwe -y yocto.cwe -m modem.cwe --file file.cwe -o spkg-boot-modem-yocto-legato-file.cwe

Concatenate CWE files:
swicwe --REPL <[[-i <spk image>]|[-l <cwe image>][-y <cwe image>]] [-m <cwe image>] [-v <version>] [--pid <product id>] [-b <cwe image>]>
                [-o <[boot[z]][-modem[z]][-yocto[z]][-legato[z]]>.spk]
swicwe --REPL -i boot-modem-yocto-legato-file.spk -b boot.cwe -o boot-modem-yocto-legato-file-replace.spk
swicwe --REPL -i boot-modem-yocto-legato-file.spk -l legato.cwe -o boot-modem-yocto-legato-file-replace.spk
swicwe --REPL -i boot-modem-yocto-legato-file.spk -y yocto.cwe -o boot-modem-yocto-legato-file-replace.spk
swicwe --REPL -i boot-modem-yocto-legato-file.spk -m modem.cwe -o boot-modem-yocto-legato-file-replace.spk

Parse CWE file
swicwe -P <cwe image>
swicwe -P yocto-legato-z.cwe

Parse psb of FOTA CWE file
swicwe -X <full-FOTA/delta-FOTA image>
swicwe -X full-fota.cwe

Parse FOTA cwe file
swicwe -x <full-FOTA/delta-FOTA image>
swicwe -x full-fota.cwe

Reducing the size of the legato system allowed to recover the unit.

In conclusion to this issue:

  • Our legato system (including apps) was fitting the partition, but the first bad block declared in the memory led to not having enough space for it
  • Although that unit cannot be recovered without flashing over USB, reducing the size of the legato system should allow to prevent the problem in further updates (bad blocks are declared during updates, when the partition is erased then written again)
  • One of the simplest way to gain space was to strip the binary when building with systocwe, using the -s parameter
  • For our application, the partition can now have up to 7 bad blocks and still have enough space for the firmware (instead of 0)

Here are useful commands to monitor the states of the bad blocks in the memory:
cat /proc/mtd lists the partitions and their name
mtdinfo -M /dev/mtd14 shows the details of mtd14 partition including any bad blocks