Yocto - Legato start sequence

Legato version: 16.01.2
Legato Linux source: Legato-Dist-Source-mdm9x15-SWI9X15Y_07.08.03.00

Questions about the tree installation and the startup sequence of Legato.

After building my Yocto virt-arm firmware image for QEMU, I meet some problem with the legato startup sequence.

It may be a misunderstanding on my part. I would like to discuss philosophy Legato installation within the image.

legato-af recipe create the following directory structure in the image:

  • /mnt/flash
  • /mnt/legato with apps, mnt, system, usr directories.

legato-init recipe provides the startup scripts (startlegato.sh and startlegato-compat.sh):

startlegato.sh script checks if the /mnt/legato/start file exist.
=> If the file not exist, it is an older version, it runs the old startup script startlegato-compat.sh.
But NO “/mnt/legato/start” file is created by the legato-af recipe.
So legato 16.01.2 is “considered an old version”.
I think there is an error.
What is the legato version number to distinguish between a new and old startup sequence ?

startlegato-compat.sh script starts all fg_xx_scripts.
In the fg_00_BindMount script file:

First, it test if the “/mnt/legato/usr/local/bin/legato” exists.

if [ -f /mnt/legato/usr/local/bin/legato ]
then
INSTALL_BASE=/mnt/legato
else
INSTALL_BASE=/mnt/flash
fi

Or the legato binaries are installed in the “/mnt/legato/system/bin” directory by legato-af framework.

The fg_00_BindMount script create mount points with the wrong variable INSTALL_BASE.

Remapping /home → /mnt/flash/home
Remapping /usr/local → /mnt/flash/usr/local
Remapping /opt → /mnt/flash/opt
Remapping /etc/ld.so.conf → /var/run/ld.so.conf
Remapping /etc/profile → /var/run/profile

That is why I will like discuss to the philosophy of legato framework start sequence with you.
Temporarily, so I created a new script to start legato.

Hi,

so the rootfs only provides a “bootstrap” for the Legato init sequence.

Two images are have some Legato content on WP85:

  • a rootfs (for instance, mdm9x15-image-minimal-swi-mdm9x15.2k.ubi): contains some bootstrapping code provided by legato-init
  • a legato partition (for instance, legato-image.wp85.ubi): contains all framework and apps code as built by legato-image

These two images are usually packaged into CWE files, such as “yocto-legato_wp85.cwe” (which contains kernel+rootfs+legato).

There is no content from legato-af in the rootfs image.
However, the legato-image recipe packages content produced by legato-af into a legato image.

So the structure that you see in /mnt/legato actually comes from another partition, that can be updated independently.

As a side note, the legato init sequence has been deeply reworked for the next release as to make it faster, and avoid the problems that you have encountered.

[quote]startlegato.sh script checks if the /mnt/legato/start file exist.
=> If the file not exist, it is an older version, it runs the old startup script startlegato-compat.sh.
But NO “/mnt/legato/start” file is created by the legato-af recipe.
So legato 16.01.2 is “considered an old version”.
I think there is an error.
What is the legato version number to distinguish between a new and old startup sequence ?[/quote]

That is correct, the legato startup script determines which version of legato (old or new) to start based on the existence of the start “executable” in /mnt/legato.
Legato 16.01.2 is considered the new version. If you flash the 16.01.2 Legato image, it will update /mnt/legato which will include the “start” executable.

As mentioned by CoRfr, two changes have been in 16.01.2 to have legato running:

  1. rootfs - startlegato.sh (support old and new legato).
  2. legato - introduction of “start” executable that will start the legato framework.

If /mnt/legato/start does not exist, but you have the updated startlegato.sh script. It might mean you have only updated the rootfs but not legato yet.
However even so, it should still be able to start the ‘old’ legato… Do you know what was the last version of legato you had installed?