multi_vfs_ntpd example

August 2, 2023

ID multi_vfs_ntpd_example

This example shows how to use an external NTP server in KasperskyOS. The kl.Ntpd program is included in KasperskyOS Community Edition and is an implementation of an NTP client, which gets time parameters from external NTP servers in the background and passes them to the KasperskyOS kernel.

The example also demonstrates the use of various virtual file systems (VFS) in a single solution. The example uses different VFS to access the functions for working with the file system and functions for working with the network:

  • The VfsNet program is used for working with the network.
  • The VfsRamfs and VfsSdCardFs programs are used for working with the file system.

The Client program uses standard libc library functions for getting time data. These functions are converted into queries to the VFS program via IPC.

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

Supplied resources

The following configuration files are included in the example:

  • ./resources/include/config.h.in contains a description of the backend file system that will be used in the solution: sdcard or ramfs.

    A separate VFS program (VfsSdCardFs or VfsRamfs, respectively) is used for each backend in the solution.

  • The ./resources/ramfs/etc and /resources/sdcard/etc directories contain configuration files for the VFS and Ntpd programs. The standard ntpd.conf syntax is used for the ntpd program configuration.

Example files

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

/opt/KasperskyOS-Community-Edition-<version>/examples/multi_vfs_ntpd

Building and running example

To run an example on QEMU, go to the directory containing the example, build the example and run the following commands:

$ cd build/einit

# Before running the following command, be sure that the path to

# the directory with the qemu-system-aarch64 executable file is saved in

# the PATH environment variable. If it is not there,

# add it to the PATH variable.

$ qemu-system-aarch64 -m 2048 -machine vexpress-a15 -nographic -monitor none -sd sdcard0.img -kernel kos-qemu-image

See also Building and running examples section.

Did you find this article helpful?
What can we do better?
Thank you for your feedback! You're helping us improve.
Thank you for your feedback! You're helping us improve.