Custom Legato Image Generation

My goal is to create a custom image for a factory WP7702 where every layer is built from known sources. So far I have been successful rebuilding the modem firmware image and the Yocto kernel/rootfs image. The remaining piece I am struggling with is the Legato layer.

Specifically, I need to build a replacement for legato-squashfs.ubi.cwe that includes my primary application by default.

My application is defined by a single .adef file. My assumption was that I could create a custom .sdef that includes the default Legato system definition and then adds my application:

// custom.sdef
#include "$LEGATO_ROOT/default.sdef"

apps:
{
    $PA_CONFIG_ADEF
}

I then build the system using the Yocto SDK environment and mksys:

mksys -t wp77xx \
      -i $LEGATO_ROOT/interfaces/modemServices \
      -C "-O2 -Wno-unused-but-set-variable -Wno-unused-result" \
      custom.sdef

This produces a .update file that is approximately 9.1 MB. For comparison, the stock legato-squashfs.ubi.cwe appears to be about 7.1 MB.

I then convert the .update file into a CWE using systocwe, and finally merge the modem firmware CWE, the Yocto kernel/rootfs CWE, and the generated Legato CWE into a single image using swicwe.

The resulting image installs, but Sahara reports that the Legato image is too large.

My questions are:

  1. Is this the correct process for generating a replacement legato-squashfs.ubi.cwe?

  2. Is the additional ~2 MB likely causing the image to exceed the available Legato partition size?

  3. What is the recommended way to reduce the size of the generated Legato image?

  4. Is there an existing Sierra/Legato system definition that is used to generate the stock legato-squashfs.ubi.cwe, and if so, is it available for reference?

Any guidance would be appreciated.

Q1 and Q2: if you build a simple hello world application with same procedure, can it be run? If yes, then your procedure is correct. FYI, I used this method to build the legato.cwe together with my application:

Q3: you can use “more /proc/mtd” to check the current legato partition size. To enlarge the partition size, you need to contact distributor to get a tool or enable the AT!PARTITION command:

Q4: you can have a look here: