bin+lib selfe-config

A seL4 configuration format, managed by a library

1 unstable release

0.2.1 Jan 21, 2022

#384 in Configuration

Download history 16/week @ 2023-08-12 9/week @ 2023-08-19 7/week @ 2023-08-26 11/week @ 2023-09-02 18/week @ 2023-09-09 12/week @ 2023-09-16 9/week @ 2023-09-23 15/week @ 2023-09-30 11/week @ 2023-10-07 17/week @ 2023-10-14 13/week @ 2023-10-21 15/week @ 2023-10-28 15/week @ 2023-11-04 12/week @ 2023-11-11 15/week @ 2023-11-18 16/week @ 2023-11-25

58 downloads per month
Used in 3 crates

Custom license



A seL4 configuration format, managed by a library.


Direct use of this library is largely not necessary. End users will usually just deal with the toml format when they need to tweak the version or compilation-options of the seL4 they wish to build against when using selfe-sys

Library Contents

model module

In addition to handling deserialization, serialization, and in-memory representation of a full::Full configuration model, the model module provides a contextualized::Contextualized type that narrows the configuration options to those applicable to a specific contextualized::Context.

compilation module

The compilation module provides the build_sel4 function for compiling either the seL4 client library or a seL4 kernel (and optionally-distinct root task artifact)

build_helpers module

build_helpers provides utilities for use in the build.rs files of libraries or applications that want to standardize on a shared configuration. End users may consider using this module to apply their sel4.toml configuration as Rust compile-time feature flags to improve portability.

In build.rs:

use selfe_config::build_helpers::*;

fn main() {
    /// Rerun this build script if any of the config-driving environment variables change

    /// Like it says on the tin, paying particular attention to the SEL4_CONFIG_PATH env-var
    let config = load_config_from_env_or_default();

    /// Tells cargo to build the current library with feature-flags set
    /// based on the content of the selected-or-default sel4.toml configuration

Toml Format

See default_config.toml for a minimal example of the format materialized as toml, or consider the following commented walkthrough.

# Location of the required source repositories: seL4 (kernel), seL4_tools (tools), and util_libs
# Any of these three may be specified using the `git` or `path` approach.
kernel = { git = "https://github.com/seL4/seL4" , tag = "10.1.1" }
tools = { git = "https://github.com/seL4/seL4_tools" , branch = "10.1.x-compatible" }
util_libs  = { path = "../misc/util_libs" }
util_libs  = { path = "../misc/util_libs" }

# seL4 kernel and library configuration properties go in [sel4.config.*] tables.
# These properties are ultimately passed to seL4's CMake build system.
# Such tables must only contain string, integer, or boolean properties.
# This table corresponds to seL4's notion of an 'arch', matching `model::Arch`
# for the in-memory representation. "x86" would be another reasonable table name.
KernelArch = 'arm'

# This table corresponds to seL4's notion of a 'sel4_arch', matching `model::SeL4Arch`
# for the in-memory representation. "aarch64" or "x86_64" would be other comparable names.
KernelSel4Arch = 'aarch32'
KernelArmSel4Arch = 'aarch32'

# This table corresponds to seL4's notion of a 'platform', matching `model::Platform`
# for the in-memory representation. Platform names are largely unrestricted.
KernelARMPlatform = 'imx6'
KernelHaveFPU = true

# The toml may contain tables for multiple arch/sel4_arch/platform options.
# The precise set of properties is settled through explicit contextualization.
KernelARMPlatform = 'whatever'

# The [sel4.config.debug] and [sel4.config.release] tables correspond to the
# project's expected compilation profile
KernelPrinting = true
KernelDebugBuild = true

KernelPrinting = false
KernelDebugBuild = false

# The [build.*] tables have names corresponding to seL4 platforms,
# and contain an optional `cross_compiler_prefix`, used when
# building libsel4 or seL4 kernels / root tasks.
cross_compiler_prefix = "arm-linux-gnueabihf-"

# For application/root task builds, please also supply the command
# necessary to create the project's root task, and the
# expected output location of that task, scoped to the
# platform and build profile  like [build.PLATFORM.debug]
# and [build.PLATFORM.release]
# These properties are used by the selfe build tool in particular,
# and are not relevant for libraries.
make_root_task = "cargo xbuild --target=armv7-unknown-linux-gnueabihf"
root_task_image = "target/armv7-unknown-linux-gnueabihf/debug/example"

# Note that the `make_root_task` property is technically optional
# if the creation of the root task image is managed at a different
# level of the toolchain.
make_root_task = "cargo xbuild --target=armv7-unknown-linux-gnueabihf --release"
root_task_image = "target/armv7-unknown-linux-gnueabihf/release/example"


A build and simulation tool for seL4 applications.

The selfe tool's job is to orchestrate the construction of seL4 applications.

It uses a sel4.toml file sitting in a project's root dir to establish a canonical configuration source and pipes that configuration, along with explicit output platform expectations down through the application's build steps.


~11K SLoC