operations capa

operations-boot-media

Compiles a declarative TargetSpec into bootable media. Two rootfs sources -- unwrap-and-rewrap an official layered image, or build a minimal system from a mirror -- crossed with the medium it lands on, so a new appliance is a config rather than a fifth build script. Every refusal this crate makes was a real failure first.

Compiles a declarative TargetSpec into bootable media. Two rootfs sources -- unwrap-and-rewrap an official layered image, or build a minimal system from a mirror -- crossed with the medium it lands on, so a new appliance is a config rather than a fifth build script. Every refusal this crate makes was a real failure first.

Tieroperations
Rolepipeline
Pathcrates/operations/boot-media
Edition2021
Targetsrebuild-ir3001, operations_boot_media, artifact, build, plan, write
Public items19 across 0 modules
Tests49

What it is for

operations-boot-media — a declarative spec compiled into bootable media.

The ir3001 stick was built by hand twice on 2026-08-18: once, and then again because a single package was missing from the first. A procedure carried out twice by hand is one that should have been a program, so this is that program (rule 14), and every refusal below is a failure that actually happened rather than one that was imagined.

Two rootfs sources, neither privileged:

Inherits the vendor's kernel, firmware and installer, which is what a stick booting unknown hardware needs.

nothing, which is what a fixed-hardware appliance wants. bootusb has used it four times over.

Crossed with the Medium it lands on, because source and medium are independent — and every hand-written build script in the estate fixes both, which is why there are four of them.

The pure planning here is separated from the subprocess edge on purpose: the decisions are what is worth testing, and they are testable without a disk, a mirror, or an hour.

Capabilities

crate root

operations-boot-media — a declarative spec compiled into bootable media.

Item
pub const FAT32_MAX_FILE_BYTES: u64
fn plan(spec : & TargetSpec) -> Result <BuildPlan, BootMediaError>
fn build <S : CommandSink + ? Sized>(plan : & BuildPlan, work_dir : & str, sink : & mut S,) -> Result <(), BootMediaError>
fn parse_boot_params(report : & str) -> Vec <String>
fn verify_built_rootfs(spec : & TargetSpec, listing : & str) -> Result <(), BootMediaError>

BootMediaError

operations-boot-media — a declarative spec compiled into bootable media.

Item
pub enum BootMediaError

BuildPlan

operations-boot-media — a declarative spec compiled into bootable media.

Item
pub struct BuildPlan
BuildPlan :: fn top_layer_name(& self) -> String

BuildStep

operations-boot-media — a declarative spec compiled into bootable media.

Item
pub enum BuildStep

CommandSink

operations-boot-media — a declarative spec compiled into bootable media.

Item
pub trait CommandSink

DestinationFs

operations-boot-media — a declarative spec compiled into bootable media.

Item
pub enum DestinationFs
DestinationFs :: fn can_hold_rootfs(self) -> bool

InjectedFile

operations-boot-media — a declarative spec compiled into bootable media.

Item
pub struct InjectedFile

Medium

operations-boot-media — a declarative spec compiled into bootable media.

Item
pub enum Medium

PackageProof

operations-boot-media — a declarative spec compiled into bootable media.

Item
pub struct PackageProof
PackageProof :: fn new(package : & str, proof_path : & str) -> Self

RootfsSource

operations-boot-media — a declarative spec compiled into bootable media.

Item
pub enum RootfsSource

TargetSpec

operations-boot-media — a declarative spec compiled into bootable media.

Item
pub struct TargetSpec
fn extraction_order(spec : & TargetSpec) -> Option <Vec <String>>

How to use it

From `examples/rebuild-ir3001.rs`:


use operations_boot_media::{
    build, plan, verify_built_rootfs, DestinationFs, DriveIdentity, InjectedFile, Medium,
    PackageProof, ProcessSink, RootfsSource, TargetSpec,
};

fn main() {
    let work = std::env::args().nth(1).unwrap_or_else(|| {
        eprintln!("usage: rebuild-ir3001 <work-dir>");
        std::process::exit(2);
    });

    let src = std::env::var("BOOT_MEDIA_SRC_ISO").unwrap_or_else(|_| {
        format!(
            "{}/ir3001-preserve/xubuntu-24.04.4-desktop-amd64.iso",
            std::env::var("HOME").unwrap_or_default()
        )
    });

Module structure

No public modules: the crate root is its whole surface.

Public surface

`crate root`

ItemWhat it is
pub enum RootfsSourceWhere a root filesystem comes from.
pub enum MediumWhat the built filesystem is written onto.
pub enum DestinationFsThe filesystem the build's working tree is assembled on
DestinationFs :: fn can_hold_rootfs(self) -> boolWhether a Linux root filesystem can be represented here at all.
pub struct InjectedFileOne file placed into the built tree.
pub struct PackageProofA package, and the one path whose presence in the built tree proves it arrived.
PackageProof :: fn new(package : & str, proof_path : & str) -> SelfDeclare a package and its proof together.
pub struct TargetSpecWhat to build.
pub struct BuildPlanA validated plan
BuildPlan :: fn top_layer_name(& self) -> StringThe layer the repack replaces — the top of the stack, which is the live layer
pub const FAT32_MAX_FILE_BYTES: u64FAT32's file-size ceiling: 4 GiB minus one byte
pub enum BuildStepWhich stage of the build a failure came from.
pub trait CommandSinkRuns one command, given as an argument vector
pub enum BootMediaErrorWhy a spec is not buildable.
fn plan(spec : & TargetSpec) -> Result <BuildPlan, BootMediaError>Validate a spec into a BuildPlan, or say precisely why it cannot be built
fn build <S : CommandSink + ? Sized>(plan : & BuildPlan, work_dir : & str, sink : & mut S,) -> Result <(), BootMediaError>Execute a validated plan, issuing one command per step through sink
fn parse_boot_params(report : & str) -> Vec <String>Turn xorriso -indev <image> -report_el_torito as_mkisofs output into argv elements
fn extraction_order(spec : & TargetSpec) -> Option <Vec <String>>The order layers must be extracted in, or None when the source has no layers
fn verify_built_rootfs(spec : & TargetSpec, listing : & str) -> Result <(), BootMediaError>Check that the rootfs the build produced contains what the spec promised

Re-exports. Exported here, defined elsewhere.

ExportDefined in
ProcessSinkexec::ProcessSink
{DriveIdentity,IdentityError,IR_PORT_RANGE}identity::{DriveIdentity,IdentityError,IR_PORT_RANGE}
{plan_drive_write,DriveWriteError,DriveWriteSpec}write::{plan_drive_write,DriveWriteError,DriveWriteSpec}

Boundary

Reaches into foundation.

Shares tier operations with 40 other crates: operations-approval-workflow, operations-assessments, operations-block-imaging, operations-browser-agent-worker, operations-camera-discovery, operations-camera-liveview, operations-camera-registry, operations-compliance, … (40 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)operations
Architectural role (taxonomy)pipeline
Locationcrates/operations/boot-media
Vocabulary in force (lexicon)current

Tier flow. Which tiers this crate's own edges cross.

flowchart LR
  n_operations["operations"] --> n_foundation["foundation"]

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`foundation-bounded-io`foundationnoalways
`operations-device-safety`operationsnoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
thiserror^2noalways

Development. None.

Build. None.

Depended on by. Nothing in this workspace.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  SELF["operations-boot-media"]
  SELF -->|runtime| n_foundation_bounded_io["foundation-bounded-io"]
  SELF -->|runtime| n_operations_device_safety["operations-device-safety"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
examplerebuild-ir3001`examples/rebuild-ir3001.rs`
liboperations_boot_media`src/lib.rs`
testartifact`tests/artifact.rs`
testbuild`tests/build.rs`
testplan`tests/plan.rs`
testwrite`tests/write.rs`

Error model

Error typeNamed by
BootMediaErrorbuild, plan, verify_built_rootfs

Operational characteristics

PropertyEvidence
async public surfacenone detected
async runtimenone detected
database accessnone detected
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

No workspace crate depends on this one.

Verification

KindCount
Unit tests7
Integration tests42
Examples1
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root16120

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc1919
Public modules with a //! block00
pie showData
    title Public items with rustdoc
    "Documented" : 19
    "No rustdoc detected" : 0

Metrics

MetricValue
Rust source files4
Source lines1382
Code lines920
Public API items19
Public modules0
Tests49
Examples1
Cargo features0
Direct runtime dependencies3
Workspace reverse dependencies0
pie showData
    title Public API by kind
    "constant" : 1
    "enum" : 5
    "function" : 5
    "method" : 3
    "struct" : 4
    "trait" : 1
pie showData
    title Rust source composition
    "Code" : 920
    "Blank or comment" : 462

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

Todas las operations · Manual