mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
python/firmware: support bootloader headers
This commit is contained in:
parent
7e6b39cd8e
commit
6cd976fdee
@ -86,6 +86,11 @@ class ToifMode(Enum):
|
||||
grayscale = b"g"
|
||||
|
||||
|
||||
class HeaderType(Enum):
|
||||
FIRMWARE = b"TRZF"
|
||||
BOOTLOADER = b"TRZB"
|
||||
|
||||
|
||||
class EnumAdapter(c.Adapter):
|
||||
def __init__(self, subcon, enum):
|
||||
self.enum = enum
|
||||
@ -160,7 +165,7 @@ VersionLong = c.Struct(
|
||||
|
||||
FirmwareHeader = c.Struct(
|
||||
"_start_offset" / c.Tell,
|
||||
"magic" / c.Const(b"TRZF"),
|
||||
"magic" / EnumAdapter(c.Bytes(4), HeaderType),
|
||||
"header_len" / c.Int32ul,
|
||||
"expiry" / c.Int32ul,
|
||||
"code_length" / c.Rebuild(
|
||||
|
Loading…
Reference in New Issue
Block a user