2 Commits

Author SHA1 Message Date
test0r f760f08300 spi_check: +TPL plaintext verification and optional --blob byte-match
Discovered the rkspi wrapper format during offline RC4 probing:
the RKNS-wrapper sector at 0x8000 is plaintext. Zero padding
fills 0x8200..0x85FF. Encoded metadata sits at 0x8600. The TPL
(DDR blob) starts at 0x8800 in plaintext -- not RC4 encrypted
as I first guessed.

New checks:
  - TPL entry signature (0x01 0x00 0x00 0x14 = b +4 skipping header)
    at offset 0x8800 -- catches silent TPL corruption
  - optional --blob <path>: byte-by-byte compare SPI[0x8800:+len(blob)]
    against a reference DDR blob file, reports sha256 + first-diff
    offset on mismatch

Validated against stock SPI with stock blob (PASS, sha 13c04c4f),
patched SPI with patched blob (PASS, sha 85799151), and the
cross-pair (FAIL with diagnostics).

Closes the remaining gap in phase-1 static validation -- now
we catch not just |image has no idbloader| but also |image has
the wrong DDR bytes|.
2026-04-15 15:55:29 +02:00
test0r 3a90236231 spi_check: pre-flash RK3588 idbloader sanity check
Would have caught today|s 3-brick cycle (all-fb, midlate-fb, early-fb
bricked GenBook identically). Patched SPI images had 0xFF in the
entire idbloader region because u-boot|s mkimage silently failed
to produce idbloader-spi.img when the DDR blob grew by 548 bytes.

Static-only — no emulation yet. Phase 1 of the broader test-harness
task. Phase 2 will extend ddr_emu2 to execute TPL from SPI image
with stubbed MMIO.
2026-04-15 14:03:46 +02:00