Port Legacy Apps

This topic provides general info on porting legacy apps to Legato.

There's also specific info available to Port Legacy C App.

Sandboxed App

High-level steps for porting your app to Legato:

  • Build the app’s executables and libraries using the legacy program’s build system, but using the appropriate cross-build tool chain.
  • Create an .adef file for your app.
  • Leave the executables: section in .adef empty (or omit that section entirely).
  • Include files to be installed as part of the app (executables, libraries, configuration files, devices, etc.) in the files: subsection of the bundles: section of the .adef file.
  • Use the requires: section of the .adef file to include files and directories that need to be imported into the sandbox from the target’s file system.
  • Add run: lines in the processes: section in the .adef to define processes that should run in the app.
  • Run mkapp on the .adef file to create the app bundle (i.e., .update file) to be installed on the target.

An app bundle (.update file) produced like this can be installed exactly the same as any other Legato app bundle.

Detailed info:

Definition Files
helloWorld
Port Legacy C App

Here's a foo.adef sample (for application foo) with executables bar1 and bar2 needing library lib1. The application name should be the same as the .adef file name:

bundles:
{
file:
{
[x] bar1 /bin/
[x] bar2 /bin/
[r] lib1 /lib/
}
}
 
processes:
{
run:
{
(bar1)
(bar2)
}
}

To bundle everything into an app, run:

mkapp foo.adef -t [target]

where [target] is something like "ar7" or "wp85".

The app bundle file can be installed using the update tool.

Note
Other app settings (e.g., faultAction) can also be set in the .adef files. See Application Definition .adef.

Porting Apps with Root Access

This method is necessary if your legacy apps require root privileges or access to system resources like /proc. It means your app will be ported as a non-sandboxed Legato app.

In the .adef file, turn-off sandboxing:

sandboxed: false
Note
It can sometimes be easier to begin porting an application with sandboxing turned off and, when you have it working, turn sandboxing on and fix the resulting permissions issues by importing required files into your app using the .adef requires section.