To simplify the process of preparing the solution's boot image using the make
build system, you can use the build.mk
template from KasperskyOS Community Edition. The template file is located at the following path:
/opt/KasperskyOS-Community-Edition-<version>/common/build.mk
To prepare a make
build system using the build.mk
template, do the following in the Makefile
build script:
targets
variable. In the variable value, list all applications included in the solution, separating them with a space. You are not required to specify the Einit
or kl.core.Core
applications because they are processed separately.targets
variable, specify the values for the following variables:<application-name>-objects
– list of object files of the application. You must list all object files.The names of object files are taken from the names of the entity source files according to the following rules:
*.c → *.o
*.idl → *.idl.o
*.cdl → *.cdl.o
*.edl → *.edl.o
<application-name>-ldflags
– list of flags passed to the linker. If the entity uses the virtual file system, you must pass the flags specified in the LIBVFS_REMOTE
variable.<application-name>-base
– application load address in hexadecimal. If this variable is not specified, the address is assigned automatically. Use this variable for debugging the application.This same address is passed to the debugger using the following command, which can be added to the .gdbinit file:
add-symbol-file <application-name> <application-load-address>
ROMFS-FILES
variable. In the variable value, list the files while separating them with blank spaces. If you are using the virtual file system, you must pass the file specified in the VFS_ENTITY
variable.include /opt/KasperskyOS-Community-Edition-<version>/common/build.mk
The build.mk
template file has the following build targets:
When started, the QEMU emulator may capture the mouse and will indicate this in the title bar of the emulator window.
Make sure that TCP/IP port 1234 is open by using the netstat -anput
command, for example.
Port 1234 is monitored by the gdbserver program, which is used for remote debugging of applications and is part of the QEMU emulator.
When using the gdb debugger, you must use hardware breakpoints (hbreak). The QEMU emulator used in the examples is started with the -enable-kvm
key, which makes it impossible to use regular breakpoints.
add-symbol-file <application-name> <application-load-address>
target remote localhost:1234
Example
This example uses the make build system. In addition to the actions executed in the build.mk template, in the build script you must specify the Hello
application and the list of object files of this application. The load address is specified for solution debugging purposes.
Makefile
# List of applications for the build.
targets = hello
# List of object files of the Hello application
hello-objects = hello.o hello.edl.o
# Load address of the Hello entity (in hex)
hello-base = 800000
# Include template with general build rules.
include ../common/build.mk
To start the make build system, run the make hello
command.
To run the hello example while in the folder /opt/KasperskyOS-Community-Edition-<version>/examples/hello
, run the make
command.