Contents
CMake libraries in KasperskyOS Community Edition
This section contains a description of the libraries that are provided in KasperskyOS Community Edition for automatically building a KasperskyOS-based solution.
platform library
The platform
library contains the following commands:
initialize_platform()
is the command for initializing theplatform
library.project_header_default()
is a command for indicating the linker and compiler flags for the current project.
These commands are used in CMakeLists.txt
files for the Einit program and application software.
nk library
This section contains a description of the commands and macros of the CMake
library for working with the NK compiler.
generate_edl_file()
This command is declared in the file /opt/KasperskyOS-Community-Edition-<version>toolchain/share/cmake/Modules/platform/nk2.cmake
.
generate_edl_file(NAME ...)
This command generates an EDL file containing a description of the process class.
Parameters:
NAME
is the name of the process class. Required parameter.PREFIX
is the name of the global module associated with the EDL file. The name of the project must be indicated in this parameter.EDL_COMPONENTS
is the name of the component and its instance that will be included in the EDL file. For example:EDL_COMPONENTS "env: kl.Env"
. To include multiple components, you need to use multipleEDL_COMPONENTS
parameters.SECURITY
is the qualified name of the security interface method that will be included in the EDL file.OUTPUT_DIR
is the directory in which the EDL file will be created. The default directory is${CMAKE_CURRENT_BINARY_DIR}
.OUTPUT_FILE
is the name of the EDL file being created. The default name is${OUTPUT_DIR}/${NAME}.edl
.
This command exports the EDL_FILE
variable and sets it equal to the path to the generated EDL file.
Example call:
generate_edl_file(${ENTITY_NAME} EDL_COMPONENTS "env: kl.Env")
For an example of using this command, see the article titled "CMakeLists.txt files for building application software".
Page topnk_build_idl_files()
This command is declared in the file /opt/KasperskyOS-Community-Edition-<version>toolchain/share/cmake/Modules/platform/nk2.cmake
.
nk_build_idl_files(NAME ...)
This command creates a CMake
target for generating .idl.h
files for one or more defined IDL files using the NK compiler.
Parameters:
NAME
is the name of theCMake
target for building.idl.h
files. If a target has not yet been created, it will be created by usingadd_library()
with the specified name. Required parameter.NOINSTALL
– if this option is specified, files will only be generated in the working directory but will not be installed in global directories:${CMAKE_BINARY_DIR}/_headers_ ${CMAKE_BINARY_DIR}/_headers_/${PROJECT_NAME}
.NK_MODULE
is the global module associated with the interface. The name of the project must be indicated in this parameter.WORKING_DIRECTORY
is the working directory for calling the NK compiler, which by default is the following:${CMAKE_CURRENT_BINARY_DIR}
.DEPENDS
refers to the additional build targets on which the IDL file depends.To add multiple targets, you need to use multiple
DEPENDS
parameters.IDL
is the path to the IDL file for which the idl.h file is being generated. Required parameter.To add multiple IDL files, you need to use multiple
IDL
parameters.If one IDL file imports another IDL file, idl.h files need to be generated in the order necessary for compliance with dependencies (with the most deeply nested first).
NK_FLAGS
are additional flags for the NK compiler.
Example call:
nk_build_idl_files (echo_idl_files NK_MODULE "echo" IDL "resources/Ping.idl")
For an example of using this command, see the article titled "CMakeLists.txt files for building application software".
Page topnk_build_cdl_files()
This command is declared in the file /opt/KasperskyOS-Community-Edition-<version>toolchain/share/cmake/Modules/platform/nk2.cmake
.
nk_build_cdl_files(NAME ...)
This command creates a CMake
target for generating .cdl.h
files for one or more defined CDL files using the NK compiler.
Parameters:
NAME
is the name of theCMake
target for building.cdl.h
files. If a target has not yet been created, it will be created by usingadd_library()
with the specified name. Required parameter.NOINSTALL
– if this option is specified, files will only be generated in the working directory but are not installed in global directories:${CMAKE_BINARY_DIR}/_headers_ ${CMAKE_BINARY_DIR}/_headers_/${PROJECT_NAME}
.IDL_TARGET
is the target when building.idl.h
files for IDL files containing descriptions of endpoints provided by components described in CDL files.NK_MODULE
is the global module associated with the component. The name of the project must be indicated in this parameter.WORKING_DIRECTORY
is the working directory for calling the NK compiler, which by default is the following:${CMAKE_CURRENT_BINARY_DIR}
.DEPENDS
refers to the additional build targets on which the CDL file depends.To add multiple targets, you need to use multiple
DEPENDS
parameters.CDL
is the path to the CDL file for which thecdl.h
file is being generated. Required parameter.To add multiple CDL files, you need to use multiple
CDL
parameters.NK_FLAGS
are additional flags for the NK compiler.
Example call:
nk_build_cdl_files (echo_cdl_files IDL_TARGET echo_idl_files NK_MODULE "echo" CDL "resources/Ping.cdl")
For an example of using this command, see the article titled "CMakeLists.txt files for building application software".
Page topnk_build_edl_files()
This command is declared in the file /opt/KasperskyOS-Community-Edition-<version>toolchain/share/cmake/Modules/platform/nk2.cmake
.
nk_build_edl_files(NAME ...)
This command creates a CMake
target for generating an .edl.h
file for one defined EDL file using the NK compiler.
Parameters:
NAME
is the name of theCMake
target for building an.edl.h
file. If a target has not yet been created, it will be created by usingadd_library()
with the specified name. Required parameter.NOINSTALL
– if this option is specified, files will only be generated in the working directory but are not installed in global directories:${CMAKE_BINARY_DIR}/_headers_ ${CMAKE_BINARY_DIR}/_headers_/${PROJECT_NAME}
.CDL_TARGET
is the target when building.cdl.h
files for CDL files containing descriptions of components of the EDL file for which the build is being performed.IDL_TARGET
is the target when building .idl.h files for IDL files containing descriptions of interfaces of the EDL file for which the build is being performed.NK_MODULE
is the global module associated with the EDL file. The name of the project must be indicated in this parameter.WORKING_DIRECTORY
is the working directory for calling the NK compiler, which by default is the following:${CMAKE_CURRENT_BINARY_DIR}
.DEPENDS
refers to the additional build targets on which the EDL file depends.To add multiple targets, you need to use multiple
DEPENDS
parameters.EDL
is the path to the EDL file for which the edl.h file is being generated. Required parameter.NK_FLAGS
are additional flags for the NK compiler.
Example calls:
nk_build_edl_files (echo_server_edl_files CDL_TARGET echo_cdl_files NK_MODULE "echo" EDL "resources/Server.edl")
nk_build_edl_files (echo_client_edl_files NK_MODULE "echo" EDL "resources/Client.edl")
For an example of using this command, see the article titled "CMakeLists.txt files for building application software".
Page topimage library
This section contains a description of the commands and macros of the CMake
library named image
that is included in KasperskyOS Community Edition and contains solution image build scripts.
build_kos_hw_image()
This command is declared in the file /opt/KasperskyOS-Community-Edition-<version>toolchain/share/cmake/Modules/platform/image.cmake
.
build_kos_hw_image(NAME ...)
This command creates a CMake
target for building a solution image that can then be used to build the image for the hardware platform using make
.
Parameters:
NAME
is the name of theCMake
target for building a solution image. Required parameter.PERFCNT_KERNEL
– use the kernel with performance counters if it is available in KasperskyOS Community Edition.EINIT_ENTITY
is the name of the executable file that will be used to start theEinit
program.EXTRA_XDL_DIR
refers to additional directories to include when building theEinit
program.CONNECTIONS_CFG
is the path to the init.yaml file or init.yaml.in template.SECURITY_PSL
is the path to the security.psl file or security.psl.in template.KLOG_ENTITY
is the target for building theKlog
system program, which is responsible for the security audit. If the target is not specified, the audit is not performed.IMAGE_BINARY_DIR_BIN
is the directory for the final image and other artifacts. The default directory isCMAKE_CURRENT_BINARY_DIR
.IMAGE_FILES
are the executable files of applications and system programs (except theEinit
program) and any other files to be added to the ROMFS image.To add multiple applications or files, you can use multiple
IMAGE_FILES
parameters.<path to files>
are free parameters likeIMAGE_FILES
.
Example call:
build_kos_hw_image ( kos-image
EINIT_ENTITY EinitHw
CONNECTIONS_CFG "src/init.yaml.in"
SECURITY_CFG "src/security.cfg.in"
IMAGE_FILES ${ENTITIES})
For an example of using this command, see the article titled "CMakeLists.txt files for building the Einit program".
Page topbuild_kos_qemu_image()
This command is declared in the file /opt/KasperskyOS-Community-Edition-<version>toolchain/share/cmake/Modules/platform/image.cmake
.
build_kos_qemu_image(NAME ...)
This command creates a CMake
target for building a solution image that can then be used to build the image for QEMU using make
.
Parameters:
NAME
is the name of theCMake
target for building a solution image. Required parameter.PERFCNT_KERNEL
– use the kernel with performance counters if it is available in KasperskyOS Community Edition.EINIT_ENTITY
is the name of the executable file that will be used to start theEinit
program.EXTRA_XDL_DIR
refers to additional directories to include when building theEinit
program.CONNECTIONS_CFG
is the path to theinit.yaml
file or init.yaml.in template.SECURITY_PSL
is the path to thesecurity.psl
file or security.psl.in template.KLOG_ENTITY
is the target for building theKlog
system program, which is responsible for the security audit. If the target is not specified, the audit is not performed.QEMU_FLAGS
are additional flags for running QEMU.IMAGE_BINARY_DIR_BIN
is the directory for the final image and other artifacts. It matchesCMAKE_CURRENT_BINARY_DIR
by default.IMAGE_FILES
are the executable files of applications and system programs (except theEinit
program) and any other files to be added to the ROMFS image.To add multiple applications or files, you can use multiple
IMAGE_FILES
parameters.<path to files>
are free parameters likeIMAGE_FILES
.
Example call:
build_kos_qemu_image ( kos-qemu-image
EINIT_ENTITY EinitQemu
CONNECTIONS_CFG "src/init.yaml.in"
SECURITY_CFG "src/security.cfg.in"
IMAGE_FILES ${ENTITIES})
For an example of using this command, see the article titled "CMakeLists.txt files for building the Einit program".
Page top