Adding some flexibility in jails

Currently, the default jail contents are being built according to a small list of possible systems. These defaults are all hardcoded into framework/c/src/supervisor/app.c. But if Legato is going to be deployable of a wide variety of Linux systems it needs to be more flexible than this. On Debian, for instance, the default libraries come from /lib64, /lib, and /lib/x86_64-linux-gnu. Various distros may have other conventions, and it may be impossible to anticipate them all.

As a starting point for discussion, I’ll make a suggestion.

  1. Given a target name of whatever, the build system should look for the environment variable WHATEVER_DEFAULT_IMPORTS. If present, it should be a list of strings: each string is the absolute path of a file to be imported by default into any jail built by that version of Supervisor.

  2. …something magic happens…

  3. When building the supervisor application, the explicit jail imports should be detected. The file app.c should replace the DefaultSystemLinks array with something along the lines of for each file $F:

     {.src='$F', .dest='$(dirname $F)/' }
    

    This means generating a part of app.c, and I don’t know how Sierra is going to feel about that. But we’re generating code for components already, so this isn’t a big leap.

Obviously, I’ve skipped something between steps 1 and 3, and that’s what needs to be figured out. Preferably, the same mechanism should be used for the currently supported systems (including the guessed systems), so we avoid a patchwork of defines.

We would still have a framework that worked on a lot of different systems, but could be easily customized for non-standard distros and currently unsupported systems.