#sel4 #configuration #toml-config #format #build #managed #user

bin+lib selfe-config

由库管理的 seL4 配置格式

1 个不稳定版本

0.2.1 2022年1月21日

#859配置


3 个 Crates 中使用

自定义许可证

81KB
2K SLoC

selfe-config

由库管理的 seL4 配置格式。

使用方法

直接使用此库通常是不必要的。最终用户在需要调整使用 selfe-sys 构建针对 seL4 的版本或编译选项时,通常会处理 toml 格式

库内容

model 模块

除了处理 full::Full 配置模型的反序列化、序列化和内存表示外,model 模块还提供了一个 contextualized::Contextualized 类型,该类型将配置选项缩小到适用于特定 contextualized::Context 的选项。

compilation 模块

compilation 模块提供了 build_sel4 函数,用于编译 seL4 客户端库或 seL4 内核(以及可选的根任务工件)

build_helpers 模块

build_helpers 为希望采用共享配置的库或应用程序的 build.rs 文件提供了实用工具。最终用户可以考虑使用此模块将他们的 sel4.toml 配置作为 Rust 编译时功能标志来提高可移植性。

在 build.rs 中

use selfe_config::build_helpers::*;

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

    /// 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
    config.print_boolean_feature_flags();
}

Toml 格式

有关以 toml 格式实现的最小示例,请参阅 default_config.toml,或考虑以下注释说明。

# 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.
[sel4]
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.
[sel4.config.arm]
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.
[sel4.config.aarch32]
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.
[sel4.config.sabre]
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.
[sel4.config.some-other-platform]
KernelARMPlatform = 'whatever'

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

[sel4.config.release]
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.
[build.sabre]
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.
[build.sabre.debug]
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.
[build.sabre.release]
make_root_task = "cargo xbuild --target=armv7-unknown-linux-gnueabihf --release"
root_task_image = "target/armv7-unknown-linux-gnueabihf/release/example"

selfe

seL4 应用的构建和仿真工具。

selfe 工具的任务是编排 seL4 应用的构建。

它使用位于项目根目录中的 sel4.toml 文件来建立标准的配置源,并通过应用程序的构建步骤将配置以及明确的输出平台期望传递下去。

依赖关系

~235–600KB
~12K SLoC