-
Notifications
You must be signed in to change notification settings - Fork 1
Models
Zack Didcott edited this page Apr 7, 2025
·
2 revisions
Models are the foundation for converting raw binary data into OOP data structures.
Most of the higher-level models are taken directly from igelsdk.h, with added methods to assist data handling.
BaseBytesModel provides an abstract base class, with concrete methods for handling bytes, shared across various models.
BaseDataModel is the parent class for all higher-level models.
For these models to be instantiated directly from bytes, they must define fields with metadata containing the size of bytes to read.
To set default values when instantiating models from nothing with new, add the default value to the metadata of the field.
All model classes are dataclasses, with fields for each attribute.
- Stores section header, partition block, hash block and payload
- Contains a
__post_init__magic dataclass method to parse payload into additional data groups - Has methods to calculate hash, split into or extract data, such as partition extents, from sections
- Stores partition header and extent information; the actual extent payload is stored at the beginning of the section payload, and can span multiple sections
- Provides methods to parse partition and extent information
- Data group to store hash header, excludes and values
- Implements calculating hashes, getting digest values and verifying signatures
- See Verification for more information
- Stores basic boot information and boot registry entries
- Legacy format uses
\n-separatedkey=valuepairs, terminated byEOF - New format uses fixed-size entry models with a 2-byte flag to indicate size and continuation
- Stores directory information to look-up locations of partitions efficiently, without linearly searching the entire filesystem
- Find:
- Partition descriptor by partition minor
- Fragment descriptor by partition descriptor attribute (
first_fragment) - First section of partition by fragment descriptor attribute (
first_section)
- See directory.c for more background information
- Stores extent information from bootsplash partition
- Contains bootsplash header, list of bootsplash information models and payload
- Provides method to obtain
PIL.Image.Imageinstances from payload
- Stores cryptographic information in header alongside encrypted payload
- Provides methods to handle encryption and compression of writable extent filesystems
- See Encrypted Partitions for more information