The build scheme for the net example looks as follows:
Building the net_client and net_server entities
When building the net_client
and net_server
entities, they 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
x86_64-pc-kos-gcc -o net_server -L $SDK/sysroot-x86_64-pc-kos/lib net_server.c -lvfs_remote
Hereinafter: SDK=/opt/KasperskyOS-StarterKit-<version>
.
Building the initializing entity
Building the einit
entity will require the net_client.edl.h
and net_server.edl.h
files that need to be generated using the NK compiler:
nk-gen-c -I $SDK/sysroot-x86_64-pc-kos/include net_client.edl
nk-gen-c -I $SDK/sysroot-x86_64-pc-kos/include net_server.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
, net_server
, 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 net_server $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 net 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
Building and running the net example using the build.sh script containing all of the above commands
Page top