uzbek-plus/b9/b9a/lkmem.py
q 4a7224c41f B9: built-in display (ST7735S SPI) in Linux and persistent B9C cache
- B9A: read-only audit of stock LK/DT: the panel is an ST7735S 128x128 on SPI (BLSP1 QUP4,
  16 MHz, mode 3, D/C GPIO116, RESET GPIO118), backlight = PM8916 MPP4 current sink 40 mA.
- B9B: upstream panel-mipi-dbi with the stock init sequence as firmware; MPP4 sink via pinctrl
  + gpio-backlight; first light with correct colours/orientation/offsets.
- B9C: fbcon (6x8, 21x16) on tty1 + getty, UART console kept, aurora-display service;
  cache B9C b9ce13c9 written and verified, cold boots with LTE + Wi-Fi + display.
- B9L (RAM only): lk2nd second stage with an msm8916 SPI panel port shows a picture before Linux.
- Sanitizer: whitelist for b8/ and b9/.
2026-10-03 01:45:02 +03:00

19 lines
794 B
Python

#!/usr/bin/env python3
"""B9A read-only helper: dump words / strings / bytes from stock lk.bin (base 0x8f600000).
usage: lkmem.py lk.bin w ADDR N | s ADDR | b ADDR N"""
import sys, struct
BASE=0x8f600000
d=open(sys.argv[1],'rb').read()
def w(a): return struct.unpack_from('<I',d,a-BASE)[0]
def s(a):
o=a-BASE
if not (0<=o<len(d)): return None
e=d.find(b'\0',o); t=d[o:e]
return t.decode('latin1') if t and all(32<=c<127 or c in (9,10) for c in t) else None
k=sys.argv[2]; a=int(sys.argv[3],16)
if k=='w':
for i in range(int(sys.argv[4])):
v=w(a+4*i); st=s(v) if BASE<=v<BASE+len(d) else None
print(f'{a+4*i:08x}: {v:08x} {v:10d}' + (f' -> {st!r}' if st else ''))
elif k=='s': print(repr(s(a)))
elif k=='b': print(d[a-BASE:a-BASE+int(sys.argv[4])].hex(' '))