mksys

mksys is the main Legato build tool and builds complete systems to update your target. It generates a "system bundle" update pack (.update file) to install and run on a target device.

System bundles are compressed archives containing a collection of apps, kernel objects and access control configuration settings that allow the apps to interact with the framework and each other.

The main input for mksys is an system definition (.sdef) file that contains these definitions:

  • apps to deploy to the target device
  • permitted inter-app communication
  • limits, environment variables, and configuration settings to add or override.
  • kernel objects to add new packages to the Linux OS.

mksys will parse the .sdef file, find the .adef or .app files for the apps, build or bundle the apps, generate on-target access control configuration settings, and bundle everything into a system bundle for atomic (all or nothing) installation on the target device.

mksys can also help to validate inter-app dependencies and conflicts, while mkapp can't because it only knows about the one app it's building. For example, certain typos in binding values won't be detected by mkapp and can cause your app to hang at start-up. mksys can catch these errors at build time.

See Definition Files for information on specifying what mksys should build and how to configure the .sdef to build a customize system.

See Tool Chain Configuration for information on how mksys decides what compilers, etc. to use.

Building a System

When you are creating multiple apps, customizing system settings or adding or removing platform services you will want to build your system to distribute for installation on a target.

To build a system for a particular target use mksys with the -t option to build for a particular target and then specify your system's .sdef file:

Example:

$ mksys -t wp85 mySystem.sdef

This will produce a file called mySystem.wp85.update which is a system package ready to install on a target. Use update to install the system on your target:

Example:

$ update mySystem.wp85.update 192.168.2.2

Usage

mksys provides flags to set the target, set build options, and specify additional search directories:

Command line parameters
  -C, --cflags, <string>
        (Multiple, optional) Specify extra flags to be passed to the C compiler.

  -L, --ldflags, <string>
        (Multiple, optional) Specify extra flags to be passed to the linker when linking
        executables.

  -X, --cxxflags, <string>
        (Multiple, optional) Specify extra flags to be passed to the C++ compiler.

  -d, --debug-dir, <string>
        (Optional) Generate debug symbols and place them in the specified directory.  Debug symbol
        files will be named with build-id

  -g, --generate-code
        (Optional) Only generate code, but don't compile, link, or bundle anything. The interface
        definition (include) files will be generated, along with component and executable main files
        and configuration files. This is useful for supporting context-sensitive auto-complete and
        related features in source code editors, for example.

  -i, --interface-search, <string>
        (Multiple, optional) Add a directory to the interface search path.

  -n, --dont-run-ninja
        (Optional) Even if a build.ninja file exists, ignore it, delete the staging area, parse all
        inputs, and generate all output files, including a new copy of the build.ninja, then exit
        without running ninja.  This is used by the build.ninja to to regenerate itself and any
        other files that need to be regenerated when the build.ninja finds itself out of date.

  -o, --output-dir, <string>
        (Optional) Specify the directory into which the final, built system file(ready to be
        installed on the target) should be put.

  -s, --source-search, <string>
        (Multiple, optional) Add a directory to the source search path.

  -t, --target, <string>
        (Optional) Set the compile target (e.g., wp85 or wp76xx).

  -v, --verbose
        (Optional) Set into verbose mode for extra diagnostic information.

  -w, --object-dir, <string>
        (Optional) Specify the directory into which any intermediate build artifacts (such as .o
        files and generated source code files) should be put.