core/image-ext4
Create an ext4 image from a directory tree.
Create an ext4 image from a directory tree.
Inputs
-
tree -
Kind: directory
Directory tree to populate the filesystem.
Parameters
-
size -
Default:
0Capacity in bytes. Zero sizes the image from the tree and shrinks it after population.
-
label -
Default:
""Filesystem label. Empty leaves the label unset.
-
uuid -
Default:
""Filesystem UUID. Empty derives a stable UUID from the normalized input archive.
-
block-size -
Default:
4096Filesystem block size in bytes.
-
reserved-percent -
Default:
0Percentage of blocks reserved for the superuser.
-
mkfs-options -
Default:
""Additional mkfs.ext4 arguments, separated with shell-style quoting.
Outputs
-
image -
Kind: file
Populated ext4 filesystem image.
Execution
-
Environment
-
Rugix Bakery
-
Source epoch
-
Consumed
-
Output cache
-
Allowed
Behavior
Automatic sizing reserves space for file data and inodes, populates the
filesystem, and shrinks it with resize2fs. Choose an explicit capacity when a
deployment needs a fixed slot size. A tree that does not fit fails the build.
The default UUID and directory hash seed come from a sorted archive of the input
tree with normalized timestamps. Set uuid when another component needs a
particular filesystem identity. The rule does not select a root partition, boot
scheme, or update slot.
The build source epoch fixes filesystem creation, access, and change times and clamps file modification times. It defaults to zero. Identical input contents and metadata, parameters, source epoch, and Rugix Bakery tooling produce identical image bytes, including with automatic sizing.
Additional mkfs-options use shell-style quoting to separate arguments. Rugix
Bakery does not perform shell expansion. Options that request random values or
current timestamps override the rule’s reproducible defaults.
Example
For example, package a prepared root filesystem:
uses = "core/image-ext4"
inputs.tree = { path = "prepared-root" }
parameters.label = "system"
Save this invocation as root.toml and run
./run-bakery bake rule root.toml build/root. The image appears at
build/root/image.
For this rule, the source epoch must be between 0 and 4294967295 Unix
seconds (inclusive), as required by the filesystem tooling.