nvme_blockdevice example

This example demonstrates the use of a PCI Express solid-state storage device that supports the NVMe (Non-Volatile Memory Express) protocol. The block device driver is used to access the storage device.

The solid state drive is connected to the Radxa ROCK 3A hardware platform via the M.2 M-key connector.

Example directory in the SDK

The code of the example and build scripts are available at the following path:

/opt/KasperskyOS-Community-Edition-<platform>-<version>/examples/nvme_blockdevice

List of programs

When you build an example for the target hardware platform, platform-specific drivers are automatically included in the solution:

Initialization description

The solution initialization description file named init.yaml is generated during the solution build process based on the ./einit/src/init.yaml.in template. Macros in @INIT_*@‌ ‌format contained in the template are automatically expanded in the resulting init.yaml file. For more details, refer to init.yaml.in template.

Security policy description

The security.psl file contains a description of a security policy for a KasperskyOS-based solution and is located in the ./einit/src directory. The declarations in the PSL file are provided with comments that explain the purpose of these declarations.

Operating scenario

The NvmeBlockdevice program performs the following actions:

  1. Initializes the block device driver.
  2. Lists all detected block devices.
  3. Opens the first block device that supports the NVMe interface, and displays information about this device.
  4. Writes 64 MB of data to an open device starting with the first block, and displays the time (in ms) spent on this operation.
  5. Performs a Flush operation on an open device.
  6. Reads 64 MB of data from an open device and displays the time spent on this operation.
  7. Erases the data written on the device and displays the time spent on this operation.
  8. Closes the device and deinitializes the drivers.

Building and running the example

Before running the example on the hardware platform, you must build the drivers according to the instructions in the section Building drivers for the Radxa ROCK 3A hardware platform.

The CMake system, which is included with KasperskyOS Community Edition, is used to build and run the example.

This example is intended to run only on Radxa ROCK 3A.

See Building and running examples section.

Page top