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.
Hello
—Program that joins the stringsfoo
,bar
,baz
and prints the resulting string to the standard outputBlobContainer
—Program that loads dynamic libraries used by other programs into shared memoryEntropyEntity
—Random number generatorVfsSdCardFs
—Program that supports the SD Card file systemSDCard
—SD Card driverBSP
—Driver for configuring pin multiplexing parameters (pinmux)
Statically created IPC channels
example.Hello
→kl.BlobContainer
kl.BlobContainer
→kl.VfsSdCardFs
kl.VfsSdCardFs
→kl.drivers.SDCard
kl.VfsSdCardFs
→kl.bc.BlobContainer
kl.VfsSdCardFs
→kl.EntropyEntity
kl.EntropyEntity
→kl.bc.BlobContainer
kl.drivers.SDCard
→kl.drivers.BSP
kl.drivers.SDCard
→kl.bc.BlobContainer
kl.drivers.BSP
→kl.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.
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.
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.
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 theaarch64-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 orrpi
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.
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.
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.
- 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.
- Connect the bootable SD card to the Raspberry Pi 4 B.
- 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:
- 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.
- Run the example by following the instructions in the KasperskyOS Community Edition Online Help
./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.
After running the example, the message Joined string: foo-bar-baz
should be displayed in the
standard output.
© 2024 AO Kaspersky Lab