core/append-verity
Append a detached verity hash tree to a data image.
Append a detached verity hash tree to a data image.
Inputs
-
image -
Kind: file
Original data image authenticated by the hash tree.
-
hash-tree -
Kind: file
Detached verity image including its superblock.
Parameters
-
alignment -
Default:
4096Power-of-two byte alignment of the hash area, at least 512. Must suit the hash block size.
Outputs
-
image -
Kind: file
Data image followed by alignment padding and the verity hash image.
-
hash-offset -
Kind: file
Hash-area byte offset as decimal text.
-
data-size -
Kind: file
Original data length in bytes as decimal text, excluding padding and hashes.
Execution
-
Environment
-
Rugix Bakery
-
Source epoch
-
Consumed
-
Output cache
-
Allowed
Behavior
Package a data image and its detached dm-verity hash tree in one artifact. The combined image contains the original data, zero-filled alignment padding, and the hash-tree image, including its verity superblock.
Supply a hash tree generated for the exact data image, for example with
core/dm-verity. Keep that rule’s root-hash output for the authenticated boot
metadata. alignment defaults to 4096 bytes and must be a power of two of at
least 512 bytes that suits the hash block size.
| Output | Contents |
|---|---|
image | Combined data and verity image |
hash-offset | Byte offset of the appended hash area, as decimal text |
data-size | Original data length in bytes, excluding padding and hashes, as decimal text |
The data image and hash tree must both be nonempty. A consuming boot flow must
authenticate the root hash and the geometry used to open the combined image.
core/verified-cmdline embeds the offset and data length in boot arguments for
the core verified-root contract.
Example
For example, append authentication data to a prepared filesystem image:
uses = "core/append-verity"
inputs.image = { path = "system.squashfs" }
inputs.hash-tree = { path = "verity.img" }
Save the invocation as build-rule.toml and run
./run-bakery bake rule build-rule.toml build/result.