embdgen.plugins.content.VerityContent

class embdgen.plugins.content.VerityContent.VerityContent[source]

Bases: BinaryContent

dm-verity hashed content

Calculates the hashes for the content and writes them directly after the content (block aligned).

Additionally a metadata file is generated, that contains the all values required, to open the verity device. This file can be parsed by CominitContent (from embdgen-cominit), to generate cominit metadata.

CONTENT_TYPE = 'verity'
content: BinaryContent

The payload content of the partition

metadata: Path

A path to a file, where the metadata is written to.

This is in the same format as the output of veritysetup.

salt: str | None = None

Salt to use for verity hashes. This can be useful, to generate reproducible images

algorithm: str = 'sha256'

Hash algorithm to use (defaults to sha256)

data_block_size: SizeType = 4096 B

Size of data blocks (defaults to 4096)

hash_block_size: SizeType = 4096 B

Size of hash blocks (defaults to 4096)

use_internal_implementation: bool = True

If set to false, veritysetup is used, otherwise a pure python solution is used, to generate the hash tree.

property hash_file
prepare() None[source]

Prepare content

This should calculate the size of the content and generate any files / information required by the owning class.

do_write(file: BufferedIOBase)[source]