Building and running the net2 example

Building and running the net2 example is analogous to building and running the net example, with the following distinctions:

The build scheme for the net2 example looks as follows:

Building the net_client entity

When building the net_client entity, it must be linked to the vfs_remote library:

x86_64-pc-kos-gcc -o net_client -L $SDK/sysroot-x86_64-pc-kos/lib net_client.c -lvfs_remote

Hereinafter: SDK=/opt/KasperskyOS-StarterKit-<version>.

Building the net_server program

The net_server must be built using the standard gcc compiler in Linux:

gcc -o net_server net_server.c

Building the initializing entity

Building the einit entity will require a net_client.edl.h file, which needs to be generated using the NK compiler:

nk-gen-c -I $SDK/sysroot-x86_64-pc-kos/include net_client.edl

The code of the initializing entity (einit.c) is generated by using the einit tool:

einit -I $SDK/sysroot-x86_64-pc-kos/include -I . init.yaml -o einit.c

Building the einit initializing entity:

x86_64-pc-kos-gcc -I . -o einit einit.c

Building a solution image

Now you just need to build a solution image containing the KasperskyOS kernel image (kos-qemu), and the net_client, vfs_entity, and einit entities:

makeimg --target=x86_64-pc-kos \

--sys-root=$SDK/sysroot-x86_64-pc-kos \

--with-toolchain=$SDK/toolchain \

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

--img-src=$SDK/libexec/x86_64-pc-kos/kos-qemu \

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

net_client $SDK/sysroot-x86_64-pc-kos/bin/vfs_entity

The einit entity does not need to be indicated because it will be automatically included in the solution image.

Running the net2 example

To run the built solution image under QEMU, run the following command:

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

To run the net_server program in a Linux host operating system, run the command in a separate terminal window:

./net_server

Building and running the net2 example using the build.sh script containing all of the above commands The net_server program is run in a separate terminal window.

Page top