Einit initializing program
When a solution is started, the KasperskyOS kernel finds the executable file named Einit (initializing program) in the solution image and runs this executable file. The initializing program performs the following operations:
A process of the initializing program belongs to the Einit class.
The KasperskyOS SDK includes the einit tool, which generates the C-language source code of the initializing program. This tool is used by the CMake build system, which also compiles the einit.c file into the Einit executable file and includes this executable in the solution image.
You are not required to create formal specification files for the initializing program. These files are automatically generated and applied when building the solution. However, the Einit process class must be specified in the solution security policy description.
The einit tool generates the source code of the initializing program based on the formal specifications of solution components and the init description, which consists of a text file that is usually named init.yaml.
Init description (init.yaml)
An init description contains data in YAML format. This data identifies the following:
The order in which processes are started does not depend on the order in which they are listed in the init description, but the order can be defined by using the before and after keys (see the table below).
This data consists of a dictionary with the entities key containing a list of dictionaries of processes (see Example init descriptions). Process dictionary keys are presented in the table below.
You can create an init description manually or automatically. In the second case, you need to prepare the init.yaml.in template from which the build system will create an init description.
Process dictionary keys in an init description
Key |
Required |
Value |
|---|---|---|
|
Yes |
Process class name (from the EDL description). |
|
No |
Process name. If this name is not specified, the process class name will be used. Each process must have a unique name. You can start multiple processes of the same class if they have different names. |
|
No |
Name of the executable file in ROMFS (in the solution image). If this name is not specified, the process class name (without prefixes and dots) will be used. For example, processes of the You can start multiple processes from the same executable file. |
|
No |
Process IPC channel dictionaries list. This list defines the statically created IPC channels whose client IPC handles will be owned by the process. The list is empty by default. (In addition to statically created IPC channels, processes can also use dynamically created IPC channels.) |
|
No |
List of program startup parameters ( |
|
No |
Dictionary of program environment variables. The keys in this dictionary are the names of environment variables. The maximum size of an environment variable value is 65524 bytes. |
|
No |
Determines the order in which processes are started. You must specify a list of names of processes that should be started after starting this process. |
|
No |
Determines the order in which processes are started. You must specify a list of names of processes that must be started before starting this process. |
|
No |
Sign used to determine that the process has started successfully. Syntax options:
or
or
Parameter
The The
Usage examples: wait_for: ready wait_for: { event: ready, timeout: 100ms } wait_for: event: ready timeout: 100ms For more details, refer to Example init descriptions. |
Process IPC channel dictionary keys are presented in the table below.
IPC channel dictionary keys in an init description
Key |
Required |
Value |
|---|---|---|
|
Yes |
IPC channel name, which can be set as a fixed value or as a link such as
|
|
Yes |
Name of the process that will own the server handle of the IPC channel. |
The init description may also contain the mount_romfs key, which specifies the name of the mount point of the additional romfs.1 file system before starting the processes. This allows you to start processes from binary files located in the romfs.1 file system. The romfs.1 file system will be unmounted after the Einit process ends. Usage example:
mount_romfs:
"romfs.1": "romfs/1"
Page top