diff --git a/spi_check.py b/spi_check.py index d0fef97..8c6a2cc 100755 --- a/spi_check.py +++ b/spi_check.py @@ -19,18 +19,20 @@ Exit codes: Usage: rk3588_spi_check.py """ -import struct +import argparse, hashlib, struct import sys IDBL_OFFSET = 0x8000 RKNS_MAGIC = 0x534E4B52 # "RKNS" LE — rkspi boot header +TPL_OFFSET = 0x8800 # plaintext DDR blob (TPL) starts here in rkspi layout +TPL_ENTRY = bytes.fromhex("01000014") # first 4 bytes of the RK3588 DDR blob entry PAYLOAD_END = 0x60000 # stock u-boot places next section here def die(code, msg): print(f"FAIL: {msg}", file=sys.stderr) sys.exit(code) -def main(path): +def main(path, blob_path=None): with open(path, "rb") as f: data = f.read() print(f"SPI image: {path} size=0x{len(data):x} ({len(data)} B)") @@ -63,11 +65,33 @@ def main(path): flag_like = struct.unpack_from("