feat(factory): add local flashing toolkit and secure OTA defaults

This commit is contained in:
admin
2026-03-02 01:57:39 +08:00
parent 809fcf6548
commit 3d3c3ebac2
27 changed files with 5260 additions and 4 deletions

View File

@@ -0,0 +1,53 @@
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from typing import Optional, Tuple
@dataclass(frozen=True)
class DeviceCheckConfig:
crypt_cnt_fields: Tuple[str, ...]
secure_boot_field: str
secure_boot_expected: Optional[bool]
crypt_cnt_expect: Optional[str]
flash_key_purpose_match: Optional[str]
secure_boot_key_purpose_match: Optional[str]
key_read_disable_field: str
@dataclass(frozen=True)
class FlashPrivateConfig:
chip: str
baud: str
bin_dir: Path
layout: list[Tuple[str, str]]
app_bin_name: str
app_partition_offset: str
flash_args: dict
device_check: DeviceCheckConfig
ui: dict
@dataclass(frozen=True)
class FlashSource:
offset: int
path: Path
name: str
@dataclass
class FlashEntryReport:
name: str
offset: int
size: int
sha256: str
readback_sha256: Optional[str]
verified: Optional[bool]
@dataclass
class FlashReport:
entries: list[FlashEntryReport]
readback_ok: bool
readback_errors: list[str]