init.yaml.in template
The init.yaml.in template is used to automatically generate a part of the init.yaml file prior to building the Einit program using CMake tools.
When using the init.yaml.in template, you do not have to manually add descriptions of system programs and the IPC channels for connecting to them to the init.yaml file.
The init.yaml.in template must contain the following data:
- Root
entitieskey. - List of all applications included in the solution.
- For applications that use an IPC mechanism, you must specify a list of IPC channels that connect this application to other applications.
The IPC channels that connect this application to other applications are either indicated manually or specified in the CMakeLists.txt file for this application using the
EXTRA_CONNECTIONSproperty.To specify a list of IPC channels that connect this application to system programs that are included in KasperskyOS Community Edition, the following macros are used:
@INIT_<program name>_ENTITY_CONNECTIONS@– during the build, this is replaced with the list of IPC channels containing all system programs that are linked to the application. Thetargetandidfields are filled according to theconnect.yamlfiles from KasperskyOS Community Edition located in/opt/KasperskyOS-Community-Edition-<version>/sysroot-aarch64-kos/include/<system program name>).This macro needs to be used if the application does not have connections to other applications but instead connects only to system programs. This macro adds the root
connectionskey.@INIT_<program name>_ENTITY_CONNECTIONS+@– during the build, the list of IPC channels containing all system programs that are linked to the application is added to the manually defined list of IPC channels. This macro does not add the rootconnectionskey.This macro needs to be used if the application has connections to other applications that were manually indicated in the
init.yaml.intemplate.
- The
@INIT_<program name>_ENTITY_CONNECTIONS@and@INIT_<program name>_ENTITY_CONNECTIONS+@macros also add the list of connections for each program defined in theEXTRA_CONNECTIONSproperty when building this program. - If you need to pass
main()function arguments defined in theEXTRA_ARGSproperty to a program when building this program, you need to use the following macros:@INIT_<program name>_ENTITY_ARGS@– during the build, this is replaced with the list of arguments of themain()function defined in theEXTRA_ARGSproperty. This macro adds the rootargskey.@INIT_<program name>_ENTITY_ARGS+@– during the build, this macro adds the list ofmain()function arguments defined in theEXTRA_ARGSproperty to the list of manually defined arguments. This macro does not add the rootargskey.
- If you need to pass the values of environment variables defined in the
EXTRA_ENVproperty to a program when building this program, you need to use the following macros:@INIT_<program name>_ENTITY_ENV@– during the build, this is replaced with the dictionary of environment variables and their values defined in theEXTRA_ENVproperty. This macro adds the rootenvkey.@INIT_<program name>_ENTITY_ENV+@– during the build, this macro adds the dictionary of environment variables and their values defined in theEXTRA_ENVproperty to the manually defined variables. This macro does not add the rootenvkey.
@INIT_EXTERNAL_ENTITIES@– during the build, this macro is replaced with the list of system programs linked to the application and their IPC channels,main()function arguments, and values of environment variables.
Example init.yaml.in template
init.yaml.in
entities:
- name: ping.Client
connections:
# The "Client" program can query the "Server".
- target: ping.Server
id: server_connection
@INIT_Client_ENTITY_CONNECTIONS+@
@INIT_Client_ENTITY_ARGS@
@INIT_Client_ENTITY_ENV@
- name: ping.Server
@INIT_Server_ENTITY_CONNECTIONS@
@INIT_EXTERNAL_ENTITIES@
When building the Einit program from this template, the following init.yaml file will be generated:
init.yaml
entities:
- name: ping.Client
connections:
# The "Client" program can query the "Server"
- target: ping.Server
id: server_connection
- target: kl.VfsEntity
id: {var: _VFS_CONNECTION_ID, include: vfs/defs.h}
args:
- "-v"
env:
VAR1: VALUE1
- name: ping.Server
connections:
- target: kl.VfsEntity
id: {var: _VFS_CONNECTION_ID, include: vfs/defs.h}
- name: kl.VfsEntity
path: VFS
args:
- "-f"
- "fstab"
env:
ROOTFS: ramdisk0,0 / ext2