Skip to content

Latest commit

 

History

History

example

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Abseil library for KasperskyOS usage example

This solution is based on an example from Abseil C++ Quickstart With CMake. It prints the message Joined string: foo-bar-baz to the standard output. The difference between this solution and the base example is that it uses the previously built and installed Abseil library. It is assumed that the Abseil library is installed in the default installation directory <project_directory>/kos/install, where project_directory is the directory with the source files. If the Abseil library is not found in the default installation path, it will be built and installed in this directory. More usage examples can be found in the Abseil C++ Programming Guides.

This solution uses the dynamic variant of the Abseil library. To build a static variant of the library, use the initialize_platform command with the FORCE_STATIC parameter. For additional details regarding this command, please refer to the platform library.

Table of contents

Solution overview

List of programs

  • Hello—Program that joins the strings foo, bar, baz and prints the resulting string to the standard output
  • BlobContainer—Program that loads dynamic libraries used by other programs into shared memory
  • EntropyEntity—Random number generator
  • VfsSdCardFs—Program that supports the SD Card file system
  • SDCard—SD Card driver
  • BSP—Driver for configuring pin multiplexing parameters (pinmux)

Initialization description

Statically created IPC channels
  • example.Hellokl.BlobContainer
  • kl.BlobContainerkl.VfsSdCardFs
  • kl.VfsSdCardFskl.drivers.SDCard
  • kl.VfsSdCardFskl.bc.BlobContainer
  • kl.VfsSdCardFskl.EntropyEntity
  • kl.EntropyEntitykl.bc.BlobContainer
  • kl.drivers.SDCardkl.drivers.BSP
  • kl.drivers.SDCardkl.bc.BlobContainer
  • kl.drivers.BSPkl.BlobContainer

The ./einit/src/init.yaml.in template is used to automatically generate part of the solution initialization description file init.yaml. For more information about the init.yaml.in template file, see the KasperskyOS Community Edition Online Help.

Security policy description

The ./einit/src/security.psl.in template is used to automatically generate part of the security.psl file using CMake tools. The security.psl file contains part of a solution security policy description. For more information about the security.psl file, see Describing a security policy for a KasperskyOS-based solution.

⬆ Back to Top

Getting started

Prerequisites

To install KasperskyOS Community Edition SDK and run examples on QEMU or the Raspberry Pi hardware platform, make sure you meet all the System requirements listed in the KasperskyOS Community Edition Developer's Guide.

Building and running the example

The example is built using the CMake build system, which is provided in the KasperskyOS Community Edition SDK.

There are environment variables that affect the build of the example:

  • SDK_PREFIX specifies the path to the installed version of the KasperskyOS Community Edition SDK. The value of this environment variable must be set.
  • TARGET specifies the target platform. (Currently only the aarch64-kos platform is supported.)

Run the following command:

$ SDK_PREFIX=/opt/KasperskyOS-Community-Edition-<version> [TARGET="aarch64-kos"] ./cross-build.sh <platform>,

where:

  • version specifies the latest version number of the KasperskyOS Community Edition SDK.
  • platform can take one of the following values: qemu for QEMU or rpi for Raspberry Pi 4 B.

For example, review the following command:

$ SDK_PREFIX=/opt/KasperskyOS-Community-Edition-<version> ./cross-build.sh qemu

The command builds the example and runs the KasperskyOS-based solution image on QEMU. The solution image is based on the SDK found in the /opt/KasperskyOS-Community-Edition-<version> path, where version is the latest version number of the KasperskyOS Community Edition SDK.

QEMU

Running cross-build.sh creates a KasperskyOS-based solution image that includes the example. The kos-qemu-image solution image is located in the ./build/einit directory.

The cross-build.sh script both builds the example on QEMU and runs it.

⬆ Back to Top

Raspberry Pi 4 B

Running cross-build.sh creates a KasperskyOS-based solution image that includes the example and a bootable SD card image for Raspberry Pi 4 B. The kos-image solution image is located in the ./build/einit directory. The rpi4kos.img bootable SD card image is located in the ./build directory.

  1. To copy the bootable SD card image to the SD card, connect the SD card to the computer and run the following command:

$ sudo dd bs=64k if=build/rpi4kos.img of=/dev/sd[X] conv=fsync,

where [X] is the final character in the name of the SD card block device.

  1. Connect the bootable SD card to the Raspberry Pi 4 B.
  2. Supply power to the Raspberry Pi 4 B and wait for the example to run.

You can also use an alternative option to prepare and run the example:

  1. Prepare Raspberry Pi 4 B and a bootable SD card to run the example by following the instructions in the KasperskyOS Community Edition Online Help.
  2. Run the example by following the instructions in the KasperskyOS Community Edition Online Help

CMake input files

./hello/CMakeLists.txt—CMake commands for building the Hello program.

./einit/CMakeLists.txt—CMake commands for building the Einit program and the solution image.

./CMakeLists.txt—CMake commands for building the solution.

Usage

After running the example, the message Joined string: foo-bar-baz should be displayed in the standard output.

⬆ Back to Top

© 2024 AO Kaspersky Lab