Expand description
TOML image-specification schema and the build driver.
A spec describes what to put in an image declaratively. Two shapes:
-
Bare filesystem — a top-level
[filesystem]table. The whole image is one ext2/3/4 filesystem with no partition table. This is thegenext2fsreplacement.[filesystem] type = "ext4" source = "./rootfs" block_size = 1024 rootdevs = "minimal" -
Partitioned disk image — an
[image]table plus[[partitions]]entries. Partitions are laid out 1 MiB-aligned in declaration order; exactly one may usesize = "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§
- Filesystem
Spec - Filesystem configuration. Used both as the top-level
[filesystem]table (bare-FS mode) and as the nested[partitions.filesystem]table. - Image
Spec - Disk-level options for a partitioned image.
- Partition
Spec - One partition in a
Spec::partitionslist. - Spec
- Top-level parsed spec. Exactly one of
filesystem/imagemust be set.
Functions§
- build
- Build the image described by
specinto the file atoutput. - 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) orKiB/MiB/GiB/TiB(binary, ×1024). Case-insensitive.