Adding dynamic libraries to a KasperskyOS-based solution image

To add dynamic libraries to the KasperskyOS-based solution image, use PACK_DEPS_COPY_ONLY ON, PACK_DEPS_LIBS_PATH, and PACK_DEPS_COPY_TARGET parameters in the CMake commands build_kos_qemu_image() and build_kos_hw_image().

Example:

set(RESOURCES ${CMAKE_SOURCE_DIR}/resources)

set(FSTAB ${RESOURCES}/fstab)

set(DISK_IMG ${CMAKE_CURRENT_BINARY_DIR}/ramdisk0.img)

set(RESOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../resources)

set(EXT4_PART_DIR ${CMAKE_CURRENT_BINARY_DIR}/../system_hdd)

set_target_properties(${vfs_ENTITY} PROPERTIES

EXTRA_ARGS

" - \"-f\"

- \"fstab\""

EXTRA_ENV

" ROOTFS: ramdisk0 / ext4 0"

${blkdev_ENTITY}_REPLACEMENT "${ramdisk_ENTITY};${sdcard_ENTITY}")

add_custom_target(copy-so)

add_custom_command(OUTPUT ${DISK_IMG}

COMMAND ${CMAKE_COMMAND} -E copy_directory ${RESOURCES_DIR}/rootdir ${EXT4_PART_DIR}

COMMAND mke2fs -v -d ${EXT4_PART_DIR} -t ext4 ${DISK_IMG} 40M

DEPENDS copy-so

COMMENT "Creating disk image '${DISK_IMG}' from files in '${EXT4_PART_DIR}' ...")

build_kos_hw_image(kos-image

...

IMAGE_FILES ${ENTITIES_LIST} ${FSTAB} ${DISK_IMG}

PACK_DEPS_COPY_ONLY ON

PACK_DEPS_LIBS_PATH ${EXT4_PART_DIR}/lib

PACK_DEPS_COPY_TARGET copylibs)

if(PLATFORM_SUPPORTS_DYNAMIC_LINKING)

add_dependencies(copy-so copylibs)

endif()

The solution program-dependent dynamic libraries are added to a storage device image (for example, one with an ext4 file system) that will be included into the solution image.

Dynamic libraries that are loaded into memory by calling the dlopen() function of the POSIX interface are not added to the solution image.

The build system does the following:

Page top