multi_vfs_dhcpcd example
Example use of the kl.rump.Dhcpcd program.
The Dhcpcd program is an implementation of a DHCP client, which gets network interface parameters from an external DHCP server in the background and passes them to a virtual file system (hereinafter referred to as a VFS).
The example also demonstrates the use of different VFSes 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
VfsNetprogram is used for working with the network. - The
VfsRamfsandVfsSdCardFsprograms are used for working with the file system.
The Client program uses standard libc library functions for getting information on network interfaces (ioctl). 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.incontains a description of the backend file system that will be used in the solution:sdcardorramfs.A separate VFS program (
VfsSdCardFsorVfsRamfs, respectively) is used for each backend in the solution.- The
./resources/ramfs/etcand/resources/sdcard/etcdirectories contain configuration files for the VFS andDhcpcdprograms. The standarddhcpcd.confsyntax is used for thedhcpcdprogram 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_dhcpcd
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.