Unikraft is a highly modular library operating system designed for the cloud. It's high degree of modularization allows for extreme customization and specialization. As such, its tooling should not interfere with the user's desire to support such customization. Towards increasing the unikernel's developer's ability to customize the build whilst simultaneously systemitizing the process of retrieving, organizing and generally facilitating the build of a unikernel based on Unikraft and its many components, the supported tooling, kraft, should allow for the injection of the user's environment and or additional toolchain requirements.
Feature request summary
This project is designed to better facilitate the dynamic injection of user provided variables into Unikraft's build system through the addition of a dynamically configured toolchain towards greater customization of the unikernel build through the use of its command-line companion client tool, kraft. This manifests itself as an injection into KraftKit's core configuration system and must propagate across the codebase appropriately.
Distinct results of this addition would enable, but are not limited to: alternating the GNU Compiler Collection (GCC) version, providing alternative compile-time flags, and more.
This project tracks the addition of a map to the internal configuration system entitled toolchain which sets the values of programs that are ultimately passed to Unikraft's build system.
The addition is first made as an entry to the KraftKit config structure in
type KraftKit struct {
[...]
+ Toolchain map[string]string `yaml:"toolchain" long:"toolchain" usage:"Set specific global programs in Unikraft's build system"
[...]
}
These values need to be passed any make invocations as in-line variables via the option make.WithVar in relevant parts of KraftKit's commands that interact with the build, namely in cmd/kraft/build/build.go since it is in these files that access to the map is possible via config.G[config.KraftKit](ctx).Toolchain.
Additionally, the specific entry for CC should be added as default during the installation process, i.e. the user should be asked whether they want to change the default value for CC which should be set to gcc.
A sample change to the user's configuration could look something like:
The same top-level toolchain should also be added as a directive/element into the Kraftfile, with the ability to specify it per-target.
Such configuration changes, when applied to KraftKit's configuration system, would allow for the dynamic injection of toolchain arguments via command-line flags, e.g. during the the construction of a unikernel binary image:
### Steps
- [x] Test building an application via `make`
- [x] Try passing different toolchain options to the `make` command
- [ ] Try to hardcode-inject a toolchain option within the kraftkit `make` package. See if it works as expected, or needs redesigning
- [ ] Introduce the Toolchain global config variable as hinted above
- [ ] Introduce the toolchain kraftfile element (see https://github.com/unikraft/kraftkit/pull/1463 https://github.com/unikraft/kraftkit/pull/1286 for suggestions how to do things)
- [ ] Introduce cli options/commands to set/list toolchain variables
Overview
Unikraft is a highly modular library operating system designed for the cloud. It's high degree of modularization allows for extreme customization and specialization. As such, its tooling should not interfere with the user's desire to support such customization. Towards increasing the unikernel's developer's ability to customize the build whilst simultaneously systemitizing the process of retrieving, organizing and generally facilitating the build of a unikernel based on Unikraft and its many components, the supported tooling,
kraft
, should allow for the injection of the user's environment and or additional toolchain requirements.Feature request summary
This project is designed to better facilitate the dynamic injection of user provided variables into Unikraft's build system through the addition of a dynamically configured
toolchain
towards greater customization of the unikernel build through the use of its command-line companion client tool,kraft
. This manifests itself as an injection into KraftKit's core configuration system and must propagate across the codebase appropriately.Distinct results of this addition would enable, but are not limited to: alternating the GNU Compiler Collection (GCC) version, providing alternative compile-time flags, and more.
This project tracks the addition of a map to the internal configuration system entitled
toolchain
which sets the values of programs that are ultimately passed to Unikraft's build system.The addition is first made as an entry to the
KraftKit
config structure inThese values need to be passed any
make
invocations as in-line variables via the optionmake.WithVar
in relevant parts of KraftKit's commands that interact with the build, namely incmd/kraft/build/build.go
since it is in these files that access to the map is possible viaconfig.G[config.KraftKit](ctx).Toolchain
.Additionally, the specific entry for
CC
should be added as default during the installation process, i.e. the user should be asked whether they want to change the default value forCC
which should be set togcc
.A sample change to the user's configuration could look something like:
The same top-level
toolchain
should also be added as a directive/element into theKraftfile
, with the ability to specify it per-target.Such configuration changes, when applied to KraftKit's configuration system, would allow for the dynamic injection of toolchain arguments via command-line flags, e.g. during the the construction of a unikernel binary image:
Additional context
Such a configuration system will enable KraftKit users to pass in additional flags to Unikraft's build system following the merge of https://github.com/unikraft/unikraft/pull/957