KasperskyOS Community Edition 1.3

build_sd_image library

The build_sd_image library is included in the KasperskyOS SDK and contains the build_sd_image() command. This command is declared in the file named /opt/KasperskyOS-Community-Edition-<version>/common/build-sd-image.cmake.

build_sd_image(IMAGE_NAME ...)

The command creates a CMake target for building an SD card image for running a solution on the hardware platform.

Parameters:

  • IMAGE_NAME – name of the CMake target for building an SD card image for running the solution on the hardware platform. Required parameter.
  • KOS_IMAGE_TARGET – name of the CMake target for building a solution image for the hardware platform that will be added to the SD card image.
  • KOS_COPY_PATH – path to the directory where the solution image for the hardware platform will be copied before it is added to the SD card image.
  • IMAGE_FS – path to the root directory of the file system that will be used for the SD card image. Default value: ${CMAKE_BINARY_DIR}/hdd.
  • OUTPUT_IMAGE_NAME – name of the SD card image.
  • DISK_SIZE – size of the created SD card image in megabytes. Default value: 1024 MB.
  • PARTITION_CMD – set of parameters that will be used to create and configure partitions in the SD card image. Separate the parameters with a space.

Example call:

include (${KL_SDK_ROOT_PATH}/common/build-sd-image.cmake) set (IMAGE_FS "${CMAKE_BINARY_DIR}/hdd") set (IMAGE_PART1_FS "${IMAGE_FS}/part1") set (IMAGE_PART2_FS "${IMAGE_FS}/part2") set (DISK_IMAGE hdd.img) build_sd_image (sd-image KOS_IMAGE_TARGET kos-image KOS_COPY_PATH ${IMAGE_PART1_FS} IMAGE_FS ${IMAGE_FS} DISK_SIZE 512 OUTPUT_IMAGE_NAME ${DISK_IMAGE} PARTITION_CMD -p1 ${IMAGE_PART1_FS} -%1 50 -f1 fat32 -p2 ${IMAGE_PART2_FS} -%2 50 -f2 ext4)