init.yaml file

The init.yaml file, also known as the init description, is used by the einit tool when the Einit initializing entity is created.

In the provided examples, the file containing the init description is named init.yaml, but it can have any name.

The init description has the following syntax:

  1. It begins with the reserved word entities, which is followed by a colon. Further, it must list all entities that need to be started after the operating system is loaded.
  2. The description of each entity begins with the following string:

    - name: <entity name>

  3. The optional reserved word path lets you define the name of the executable file in ROMFS (in the solution image) from which this entity will be started.

    path: <executable file name>

    By default, the entity will be started from a file in ROMFS with a name that matches the short name of the entity. For example, the Client and net.Client entities will be started from the Client file by default.

  4. If an entity must initiate requests to other entities, meaning it is a client of other entities, its connections must be listed. This list contains the names of server entities to which this entity can send requests, and the name of each connection. The list of connections begins with the reserved word connections, followed by a colon. Each element of the list of connections is described in the following format:

    - target: <server entity name>

    id: <connection name>

    A connection name can be presented as a string or as a constant from a header file {var: <constant name>[, include: <path to header file>]}.

    If an entity does not have connections with other entities or acts as the server in all of its connections, its list of connections should be left blank.

The connection name is used to receive the IPC handle required for initializing transport.

Example init descriptions

Below is an example of the init description of a solution containing two entities: client and server. A connection is always described only once: specifically, in the client entity section.

init.yaml

entities:

# The Client entity can send requests to the Server entity.

- name: Client

connections:

# Name of the entity to which the Client entity can send requests

- target: Server

# Name of the connection used for IPC messaging between entities

id: server_connection

# The Server entity operates in the Server role (responds to requests).

- name: Server

Please note the number of spaces preceding the reserved words.

The connection name in the example above may be indicated as a constant from the header file:

init.yaml

entities:

- name: Client

connections:

- target: Server

# The connection name is in the SERVER_CONN constant in the src/example.h file

id: {var: SERVER_CONN, include: src/example.h}

- name: Server

The examples above do not use the reserved word path, so the Client entity will be started from the file named Client, and the Server entity will be started from the file named Server.

This is how you can change the names of executable files from which these entities will be started:

init.yaml

entities:

- name: Client

path: cl

connections:

- target: Server

id: server_connection

- name: Server

path: sr

Here the Client entity will be started from the cl file, and the Server entity will be started from the sr file.

The following example demonstrates the startup of two entities from one file named server:

init.yaml

entities:

- name: Main_server

path: server

- name: Bk_server

path: server

...

Page top