hello_from_rust example
This example demonstrates how to let your KasperskyOS-based solution include a simple program that was developed based on Rust and built using the Cargo build system and package manager.
Example directory in the SDK
The code of the example and build scripts are available at the following path:
List of programs
The solution includes the Hello
application, which prints a message to the standard error output. This program was developed using the Rust language.
Initialization description
The solution initialization description file named init.yaml
is generated during the solution build process based on the following template:
./einit/src/init.yaml.in
Security policy description
The security.psl
file contains the solution security policy description and is generated based on the following template during the solution build process:
./einit/src/security.psl.in
During the solution build, the @INIT_EXTERNAL_ENTITIES@
macro in the security.psl.in
template is replaced with a list of system programs that are included in the KasperskyOS SDK. For more details, refer to security.psl.in template.
The solution security policy description in this example allows any interaction between different processes and between processes and the kernel. This solution security policy is used to simplify the example. It would be unacceptable to apply such a policy in a real-world solution.
Resources
The directory ./resources
contains an EDL description of the Hello
program.
The directory ./vendor
contains the libraries and their metadata required for managing dependencies in Rust-based projects that are built using the Cargo build system.
Operating scenario
The Hello
program prints the message Hello, world!
to standard error.
Building and running the example
The CMake build system from the KasperskyOS SDK is used during the solution build. The Hello
program is built using the Cargo build system, which is also included in the SDK. During the solution build process, the add_custom_command()
command in the ./hello/CMakeLists.txt
file executes the command cargo build
, which builds the executable file of the Hello
program. This file is included in a solution as an imported executable file via the add_executable()
command.
See Building and running examples section.