Example build without using CMake

Below is an example of a script for building a basic example. This example contains a single application called Hello, which does not provide any endpoints.

The provided script is intended only for demonstrating the build commands being used.

build.sh

#!/bin/sh

# The SDK variable should specify the path to the KasperskyOS Community Edition installation directory.

SDK=/opt/KasperskyOS-Community-Edition-<version>

TOOLCHAIN=$SDK/toolchain

SYSROOT=$SDK/sysroot-aarch64-kos

PATH=$TOOLCHAIN/bin:$PATH

# Create the Hello.edl.h file from Hello.edl

# (The Hello program does not implement any endpoints, so there are no CDL or IDL files.)

nk-gen-c -I $SYSROOT/include Hello.edl

# Compile and build the Hello program

aarch64-kos-gcc -o hello hello.c

# Create the Kaspersky Security Module (ksm.module)

makekss --target=aarch64-kos \

--module=-lksm_kss \

--with-nkflags="-I $SDK/examples/common -I $SYSROOT/include" \

security.psl

# Create code of the Einit initializing program

einit -I $SYSROOT/include -I . init.yaml -o einit.c

# Compile and build the Einit program

aarch64-kos-gcc -I . -o einit einit.c

# Create loadable solution image (kos-qemu-image)

makeimg --target=aarch64-kos \

--sys-root=$SYSROOT \

--with-toolchain=$TOOLCHAIN \

--ldscript=$SDK/libexec/aarch64-kos/kos-qemu.ld \

--img-src=$SDK/libexec/aarch64-kos/kos-qemu \

--img-dst=kos-qemu-image \

Hello ksm.module

# Run solution under QEMU

qemu-system-aarch64 -m 1024 -serial stdio -kernel kos-qemu-image

Page top