We want Unikraft to be as lightweight as possible. For that matter, the build system is designed to take only the absolute necessary pieces of code and bind them togheter.
The lifecycle of the construction of a Unikraft unikernel includes several distinct steps:
The above steps are displayed in the diagram. The Unikraft unikernel targets a specific platform and hardware architecture, which are set during the configuration step of the lifecycle.
Unikraft is a configurable operating system, where each component can be modified, configured, according to the user’s needs.
This configuration is done using a version of Kconfig, through the Config.uk files.
In these files, options are added to enable libraries, applications and different components of the Unikraft core.
The user can then apply those configuration options, using
make menuconfig, which generates an internal configuration file that can be understood by the build system, .config.
Once configured, the Unikraft image can be built, using
make, and run, using the appropriate method (Linux ELF loader, qemu-kvm, xen, others).
Configuration can be done in 3 ways:
$ make menuconfig
Adding a dependency in Config.uk for a component, so that the dependency gets automatically selected when the component is enabled.
This is done using
depends on and
select keywords in Config.uk.
The configuration gets loaded and the .config file is generated by running
$ make menuconfig
This type of configuration removes some configuration steps, but not all of them.
Writing the desired configuration in kraft.yaml. The configuration gets loaded and the .config file is generated by running
$ kraft configure
Once the application is configured, symbols are defined (eg.
CONFIG_ARCH_X86_64) in .config.
Those symbols are usable both in the C code, to include certain functionalities, only if they were selected in the configuring process, and in the actual building process, to include / exclude source files, or whole libraries.
This last thing is done in Makefile.uk, where source code files are added to libraries.
During the build process, all the
Makefile.uk files (from the Unikraft core and external libraries) are evaluated, and the selected files are compiled and linked, to form the Unikraft image.
The Unikraft core is the actual kernel code, and is comprised of several components:
The core, toghether with the external libraries, applications and platform codes, form the final Unikernel.
Feel free to ask questions, report issues, and meet new people.