CMakeLists.txt file for building the Einit program

The CMakeLists.txt file for building the Einit initializing program must contain the following commands:

Example CMakeLists.txt file for building the Einit program

CMakeLists.txt

project (einit)

# Connect the library containing solution image build scripts.

include (platform/image)

include (${KL_SDK_ROOT_PATH}/common/build-sd-image.cmake)

# Set the linker and compiler flags.

project_header_default ("STANDARD_GNU_17:YES" "STRICT_WARNINGS:NO")

# Define the CONNECTIONS_CFG_FILE variable containing the path to the init.yaml.in template.

set (CONNECTIONS_CFG_FILE "src/init.yaml.in")

# Define the SECURITY_PSL variable containing the path to the security.psl.in template.

set (SECURITY_PSL "src/security.psl.in")

# Configure the VFS program.

# By default, the VFS program is not mapped to a program implementing a block device.

# If you need to use a block device, such as ata from the ata component,

# you must define this device in the blkdev::entity_REPLACEMENT variable

# For more information about exported variables and properties of the VFS program,

# see /opt/KasperskyOS-Community-Edition-<version>/sysroot-*-kos/lib/cmake/vfs/vfs-config.cmake

# find_package(ata)

# set_target_properties (vfs_entity::entity PROPERTIES blkdev::entity_REPLACEMENT ata::entity)

# In the simplest case, you do not need to interact with a drive.

# For this reason, we set the value of the blkdev::entity_REPLACEMENT variable equal to an empty string

set_target_properties (vfs_entity::entity PROPERTIES blkdev::entity_REPLACEMENT "")

# Define the ENTITIES variable with a list of executable files of programs.

# It is important to include all programs that are part of the project, except the Einit program.

# Please note that the name of the executable file of a program must

# match the name of the target indicated in add_executable() in the CMakeLists.txt file for building this program.

set(ENTITIES

vfs_entity::entity

Hello

)

# Create the build target named kos-image, which is a solution image for the hardware platform.

build_kos_hw_image (kos-image

EINIT_ENTITY EinitHw

CONNECTIONS_CFG ${CONNECTIONS_CFG_FILE}

SECURITY_PSL ${SECURITY_PSL}

IMAGE_FILES ${ENTITIES}

)

# Create a build target named sd-image that can be used to create an SD-card image

# for running a solution on the hardware platform.

build_sd_image (sd-image

KOS_IMAGE_TARGET kos-image

)

# Create the build target named kos-qemu-image, which is a solution image for QEMU.

build_kos_qemu_image (kos-qemu-image

EINIT_ENTITY EinitQemu

CONNECTIONS_CFG ${CONNECTIONS_CFG_FILE}

SECURITY_PSL ${SECURITY_PSL}

IMAGE_FILES ${ENTITIES}

)

Page top