Peios Learn
Documentation

Peios

Peios Peios Kernel Universal Directory Project

Developer Tools

Trail Acta Provium clackatoo CAF GCSL Pekit

Applications

Framewright

Standards and Conventions

Standards and Conventions Peios Specifications
Peios Kernel

Peios build tools

Single-page view · as markdown

Data Generators

Peios Kernel / Kernel development / Peios build tools

Run commands from the kernel repository root. Generated outputs are reviewed alongside their source inputs; a check command should not replace them.

KMES event tables #

Edit the kernel event catalog in peios/packages/data/evman/*.evman, then run:

pekit run generate_kmes_events
pekit test kmes_event_table

The generator writes security/pkm/kmes/event_types.h and event_types.rs. Commit the catalog and generated tables together. It preserves matching C/Rust IDs, event names, tiers, default enablement, and the registry-policy lookup tree. IDs are kernel-internal; event records carry names. The current enabled mask supports at most 64 event types, and generation rejects a larger catalog.

The test checks for stale tables without rewriting them and exercises generator validation. CI runs it alongside the style, Cargo, and ABI checks. Python 3.11 or newer can also run python3 peios/gen-kmes-event-table.py directly; add --check for read-only drift detection. No old PKM checkout is required.

Port-reservation seed #

peios/gen-port-reservations-seed.py regenerates the security descriptors in peios/packages/data/regim/port-reservations.reg. It derives the bindLowPorts capability SID and emits the PORT_BIND | READ_CONTROL grants for the existing seed entries. The registry file must already exist; this updates its descriptors and capability comment rather than creating a registry tree from nothing.

pekit run generate_port_seed
python3 peios/gen-port-reservations-seed.py --check
pekit test data_generators

The Python entry point also accepts --output PATH for an existing seed file. --check reports drift and exits unsuccessfully without rewriting it.

Unicode case-folding tables #

peios/generate-casefold-table.py reads a supplied Unicode CaseFolding.txt. It requires --input and at least one of --out (Rust) or --go-out (Go). The maintained input version is Unicode 16.0.0, with SHA-256 6f1f9c588eb4a5c718d9e8f93b782685e5c7fec872cf05e8e6878053599e09bb. The generator records the input hash; it does not fetch or enforce that pin. Only common and simple mappings, statuses C and S, define registry identity. Full and Turkic mappings are excluded.

python3 peios/generate-casefold-table.py \
    --input /path/to/CaseFolding.txt --unicode-version 16.0.0 \
    --out security/pkm/lcs/lcs_core/casefold_table.rs \
    --go-out /path/to/loregd/internal/fold/casefold_table.go

Choose the Go destination in the maintained loregd checkout and update both consumers from the same input. There is no --check mode: generate into temporary files for comparison when reviewing drift. The Go path is an explicit output, not an implicit dependency on a sibling repository.

ML-DSA KUnit vectors #

peios/generate-kacs-kunit-mldsa-vectors.py requires OpenSSL 3.5 or later with ML-DSA support. It creates a fresh ML-DSA-65 test key on each invocation and writes public key, message, and signature fixtures for KACS. The temporary private key is discarded. These are test vectors, not release signing credentials.

python3 peios/generate-kacs-kunit-mldsa-vectors.py \
    --out security/pkm/kacs/kunit_mldsa_vectors.h
pekit test mldsa_vectors

Regeneration deliberately replaces randomized fixtures; it is not a reproducible drift check. Review the generated header and run the affected KUnit tests.

Build-generated trust table and configuration checks #

Despite its name, peios/generate-keys.py does not generate a signing keypair. It converts a supplied ML-DSA-65 public key into the built-in KACS header. --pubkey-hex accepts a 1,952-byte public key encoded as hexadecimal; --out selects the header. --allow-empty permits a terminator-only table for test builds. The production build supplies peios/keys/dev-tcb.hex; the KUnit profile explicitly selects an empty table. peios/build.sh performs this step inside the build container, without modifying the checkout.

peios/verify-config.sh PATH_TO_CONFIG checks the resolved configuration's security invariants, including ML-DSA, lockdown, LSM, and firmware policy. The build runs it after resolving the configuration. See Building Peios for the public trust inputs and the distinction between development and release outputs.

Other generators #

ABI regeneration covers compiled Rust bindings. Documentation maintenance covers generated reference tables. These have different outputs and checks.

Companion source and binary inputs #

A companion project must distinguish the kernel source used for ABI headers from the built image used for a guest run. Use that project's maintained header-selection interface and record the selected source revision. Expose include/uapi/pkm to host compilation rather than replacing the host libc's Linux headers with the entire raw kernel header tree.

Keep the image hash, resolved configuration, and build.json with guest logs. A matching source path alone does not prove that the supplied image was built from it. The consolidated C SDK owns its current ABI-check instructions; retired libpeios and librsi checkout paths are not required by this guide.

Host checks and guest qualification #

The host-side checks leave maintained source inputs unchanged:

pekit test kmes_event_table data_generators kunit_runner qualification_build

The KUnit runner checks use a controlled emulator substitute to exercise verdict handling. The qualification build check compiles the guest programs. Neither result establishes that a real kernel passed those guest tests. Guest Qualification covers image inputs, signing fixtures, timeouts, and retained runtime evidence.

Style tooling

Peios Kernel / Kernel development / Peios build tools

Run commands from the kernel repository root. Follow peios/CODING_STYLE.md and Peios Standards and Conventions for the underlying rules.

The kernel carries the subset of the central Peios style tooling that it needs. It works from this checkout alone. peios/style/ORIGIN.json records central configuration hashes and adaptations; update the snapshot deliberately when policy changes.

Setup and use #

Use x86_64 Linux. Setup needs Python 3.14.4 with venv/pip, network access, and rustfmt installed for Rust 1.83.0 and 1.98.1. The existing build wrappers still support Python 3.11; the newer Python version belongs to the style tools.

rustup toolchain install 1.83.0 --profile minimal --component rustfmt
rustup toolchain install 1.98.1 --profile minimal --component rustfmt --component clippy
python3 peios/style.py setup

python3 peios/style.py check
python3 peios/style/test_style.py
pekit run format
pekit run style_review HEAD

Select Python 3.14.8 for the setup command. It installs exact, hash-locked wheels and binaries in ~/.cache/peios/kernel-style/<lock-identity>. Set PEIOS_STYLE_CACHE to relocate that cache. Setup does not install Rust or change the default toolchain. Checks verify tools and fail if setup is missing; checks never download dependencies or repair source. A check can be run directly with python3 peios/style.py check; formatting with python3 peios/style.py format.

pekit test style style_tool runs the same checks in a sandbox, with the tools pekit installs from the same locks (style.gcsl), so nothing of the host's is used: Python 3.14.8, the locked wheels, shfmt, shellcheck, and rustfmt for both pinned Rust toolchains.

Scope and gates #

peios/style/scope.json lists owned roots, individual integration headers, and exclusions with reasons. Run python3 peios/style.py inventory to inspect the selected files. New supported source files under an owned root are discovered automatically. When adding an independently owned root, update this scope.

Included: Peios subsystems under security/pkm, fs/stratafs, and net/ntfe; their owned integration/UAPI headers; Peios build wrappers; this tooling; and the Cargo workspace and tests. Generated constants, event tables, test vectors, Unicode tables and ABI types stay generated. The separate, active documentation migration is temporarily excluded; its style integration is still outstanding.

Blocking checks are formatter stability, Ruff, mypy, ShellCheck and the selected buildifier checks. C uses clang-format 18.1.8 and the inherited .clang-format. Kernel Rust uses rustfmt 1.83.0 and .rustfmt.toml, preserving module/import order as approved for Peios source. Host Rust uses rustfmt 1.98.1 and each Cargo crate's edition. Formatters receive one file at a time; Rust formatting does not traverse into excluded child modules. Python uses the common 3.11 syntax profile and package-local import roots. Mypy does not reuse incremental results.

style-review runs the checked-out kernel's checkpatch against a chosen Git base. It reports findings without imposing checkpatch's whole policy as a merge gate. Git/tool failures still fail the command. Untracked additions are not in a Git diff; the owned-file style check covers their formatting. The command does not modify code. Review inheritance changes in their surrounding upstream context.

Soft width/function-size/nesting guidance, names, ownership, interfaces and performance remain review responsibilities. Compiler checks and KUnit retain their normal build commands. No full-kernel clang-tidy policy is introduced.

CI #

.github/workflows/style.yml installs the same pins and runs the same style, command regression, Cargo, C ABI, KMES event-table, data-generator, KUnit runner, and qualification-build checks directly on pushes and pull requests. PRs also receive advisory checkpatch output against the merge commit's first parent. Actions are pinned to reviewed release commit IDs, credentials are not persisted, and the workflow has read-only repository permission.

Making the workflow job a required merge check is a separate repository-settings action; the workflow file does not establish branch protection. The workflow does not claim a kernel build or VM test.

Peios Learn — documentation for Peios software.

Built with Trail.