Skip to main content

Module spec

Module spec 

Source
Expand description

TOML image-specification schema and the build driver.

A spec describes what to put in an image declaratively. Two shapes:

  1. Bare filesystem — a top-level [filesystem] table. The whole image is one ext2/3/4 filesystem with no partition table. This is the genext2fs replacement.

    [filesystem]
    type = "ext4"
    source = "./rootfs"
    block_size = 1024
    rootdevs = "minimal"
  2. Partitioned disk image — an [image] table plus [[partitions]] entries. Partitions are laid out 1 MiB-aligned in declaration order; exactly one may use size = "remaining" (and it must be last). Each partition optionally carries a nested [partitions.filesystem] table whose ext filesystem is formatted to fill the partition.

Sizes accept a human suffix: 512, 4KiB, 256MiB, 1GiB, 2GB (decimal KB/MB/GB and binary KiB/MiB/GiB; bare numbers are bytes).

Structs§

FilesystemSpec
Filesystem configuration. Used both as the top-level [filesystem] table (bare-FS mode) and as the nested [partitions.filesystem] table.
ImageSpec
Disk-level options for a partitioned image.
PartitionSpec
One partition in a Spec::partitions list.
Spec
Top-level parsed spec. Exactly one of filesystem / image must be set.

Functions§

build
Build the image described by spec into the file at output.
parse_size
Parse a human-readable size string into bytes. Accepts a bare integer (bytes), or a number followed by a unit: KB/MB/GB/TB (decimal, ×1000) or KiB/MiB/GiB/TiB (binary, ×1024). Case-insensitive.