Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time

Concepts

This page is going to elaborate on some important concepts in autokernel.

Modules

Modules are blocks in the autokernel configuration which are used to write the actual kernel configuration. A module can :ref:`set<directive-module-set>` symbol values, :ref:`merge<directive-module-merge>` external kconf files, :ref:`assert<directive-module-assert>` expressions, :ref:`use<directive-module-use>` (include) other modules and :ref:`add commandline<directive-module-add-cmdline>` strings. They are intended to provide a level of encapsulation for groups of symbols.

Example module

Pinning symbol values

The first important concept is pinning. As soon as a symbol's value is changed or observed, it will be pinned, meaning the value is then fixed. In the beginning, all symbols will start with their default values, as specified by the kernel's Kconfig.

Successive assigments to these symbols will become hard errors, if they would change the pinned value. This allows modules to use logic based on symbol values, without imposing implicit ordering constraints, or surprise pitfalls down the road. Wrong ordering will lead to errors instead of silently breaking previous assumptions.

Note

Conflicts are always errors. This ensures that the same conditions always has the same outcome, no matter where it stands in the configuration.

Pinning Examples

Conflict Example

Implicit vs. explicit changes

There are explicit and implict assignments of symbol values. All direct assignments via set are explicit. An implicit assignment occurrs, when an explicit assignment triggers a change in a symbols that depends on the assigned symbol.

Note

Explicit changes will pin the value of a symbols, while implicit changes do not.

Implicit assignments also occurr when using the :ref:`directive-module-merge` statement. They can also be forced by using :ref:`try set<directive-module-set>` instead of just set. This should only be used in special occasions, like when you want to set a new default value for a symbol while still allowing the user to override it.

Correct usage of try set

It's a common pattern to use try set directly followed by a conditional on the same symbol. This way you can ensure a module works with either setting, but add a default in case the user didn't care:

Warning

Do not use try set to resolve conflicts! A conflict always means that there is something wrong with your configuration or ordering. Only use try set to set new defaults.

Explicit assignments

Implicit assignments