summaryrefslogtreecommitdiff
path: root/morphology.txt
blob: d8b4130b8b41fcb7d04f97c3ef6113643f7092f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Morphology files define how Baserock builds artifacts of different types. There are three types - identified by the `kind` field (see below) - corresponding to the three types of Baserock artifact:; `systems`, `strata`, and `chunks`.

`system` and `stratum` morphology files live in the 'morphs' git repository

`chunk` morphology files live in a branch of the user's choice (as specified in the strata morphology file), in a chunk, at the top level. They are optional for chunks that Baserock natively knows how to build.

The following **required** field common to all morphologies:

* `kind`: the type of thing being built (system, stratum, chunk).
* `name`: the name of the thing; for strata this is the same as the morphology file, for chunks it is the same as the base name of the repository.

The following **optional** field is common to all morphologies:

* `description`: a human-readable string describing the morphology.

The following **optional** fields, are specific to `chunk` morphologies:

* `build-system`: if the program is built using a build system known to  `morph`, you can set this field and avoid having to set the various  `*-commands` fields; only `autotools` is currently known; the commands that the build system specifies can be overridden.
* `configure-commands`: a list of shell commands to run at the configuration phase of a build.
* `build-commands`: a list of shell commands to run to build (compile) the project.
* `test-commands`: a list of shell commands to run unit tests and other non-interactive tests on the built but un-installed project.
* `install-commands`: a list of shell commands to install the built project; the install should go into the directory named in the `DESTDIR` environment variable, not the actual system.
* `max-jobs`: a string to be given to `make` as the argument to the `-j` option to specify the maximum number of parallel jobs; the only sensible  value is `"1"` (including the quotes), to prevent parallel jobs running at all; parallel jobs are only used during the `build-commands` phase, since the other phases are often not safe when run in parallel; `morph` picks a default value based on the number of CPUs on the host system.
* `chunks`: a key/value map of lists of regular expressions; 
  the key is the name of a binary chunk, the regexps match the pathnames that  will be included in that chunk; the patterns match the pathnames that get installed by `install-commands` (the whole path below `DESTDIR`); every file  must be matched by at least one pattern; by default, a single chunk gets created, named according to the morphology, and containing all files.

The following **optional** fields, are specific to `strata` morphologies:

* `build-depends`: a list of strings, each of which refers to another stratum that the current stratum depends on. This list may be omitted or empty if the stratum does not depend on anything else.
* `chunks`: a list of key/value mappings, where each mapping corresponds to a chunk to be included in the stratum; the mappings may use the following keys: 
    + `name` is the name of the chunk.
    + `repo` is the repository in which to find it (defaults to chunk name).
    + `ref` identifies the commit to use (typically a branch name, but any tree-ish git accepts is ok).
    + `morphology` is the name of the morphology to use and is optional. 
  In addition to these keys, each of the sources MUST specify a list of build dependencies using the `build-depends` field. This field may be omitted to make the source depend on all other chunks that are listed earlier in the `chunks` list. The field may be an empty list to indicate that the chunk does not depend on anything else in the same stratum. To specify one or  more chunk dependencies, `build-depends` needs to be set to a list that contains the names of chunks that the source depends on in the same stratum. These names correspond to the values of the `name` fields of the other chunks.

The following **required** fields are specific to `system` morphologies:

* `disk-size`: size of the disk image to be created. The size may be suffixed with 'G', 'M' or 'K' for gigabytes, megabytes and kilobytes respectively.
* `strata`: a list of stratum names to include in the system image; these are specified similarly to the `chunks` section of the `strata` morphology.
* `arch`: a description of the target architecture, e.g. 'arm' or 'x86_64'.
* `system-kind`: either 'rootfs-tarball' for a tarball or 'syslinux-disk' to produce a bootable image.

Fields with keys unknown to Morph are silently ignored.