uzbek-plus/b9/b9c/b9c-boot.sh
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

53 lines
5.7 KiB
Bash

#!/bin/sh
# 480s side, B9C boot K MODE (derived from b8f-boot.sh). MODE=ram: RESET-held power-on -> lk1st fastboot -> `fastboot boot` B9C RAM image.
# MODE=cold: normal power-on (no RESET, no fastboot) -> lk2nd extlinux from eMMC cache. Script only observes + reads over telnet;
# nothing is written to eMMC. Visual display checks need the operator. Adds display/fbcon/getty/console checks to the B8F snapshot.
K=$1; MODE=$2; case "$MODE" in ram|cold) ;; *) echo "usage: $0 K ram|cold"; exit 2;; esac
cd ~/doc/modem/jz08-aurora; O=logs/b9/b9c/$MODE$K; mkdir -p $O; IMG=b9/b9c/out/aurora-b9c.img
A=$O/host-actions.txt; act() { echo "$(date -u +%H:%M:%S.%3N) $*" | tee -a $A; }
tn() { { sleep 1; sed "s/\$/\r/" "$1"; sleep $2; } | ncat 172.16.42.1 23 | tr -d "\000\r"; }
OLD=$(ps -eo pid,cmd | grep "[u]artlog.py /dev/ttyUSB0" | awk '{print $1}'); [ -n "$OLD" ] && kill $OLD; sleep 1
U=logs/uart/b9c-$MODE$K-$(date +%Y%m%d-%H%M%S); setsid nohup python3 tools/uartlog.py /dev/ttyUSB0 $U > $U.stderr 2>&1 < /dev/null &
if [ $MODE = ram ]; then
echo "fa855e1c84763861d8b2f6bd7ed669e8ab625aa42178317883fabff39dec4fce $IMG" | sha256sum -c || exit 1
act "B9C $MODE$K: waiting for fastboot <EMMC_SERIAL> (power off >= 90 s, then RESET held + battery -> USB)"
if fastboot devices 2>/dev/null | grep -q <EMMC_SERIAL>; then act "already in fastboot - wait for power-off"; until ! fastboot devices 2>/dev/null | grep -q <EMMC_SERIAL>; do sleep 1; done; fi
i=0; until fastboot devices 2>/dev/null | grep -q <EMMC_SERIAL>; do i=$((i+1)); [ $i -ge 600 ] && { act "ABORT: no fastboot"; exit 1; }; sleep 2; done
act "fastboot present"; { fastboot boot $IMG 2>&1; echo "rc=$?"; } | tee -a $A
else
act "B9C $MODE$K: waiting for the board to go away (power off >= 90 s), then normal power-on WITHOUT RESET"
until ! ping -c1 -W1 172.16.42.1 >/dev/null 2>&1; do sleep 1; done; act "board unreachable (powered off)"
until ping -c1 -W1 172.16.42.1 >/dev/null 2>&1; do fastboot devices 2>/dev/null | grep -q <EMMC_SERIAL> && { act "ABORT: board is in fastboot - RESET was held?"; exit 1; }; sleep 1; done
fi
i=0; until ping -c1 -W1 172.16.42.1 >/dev/null 2>&1; do i=$((i+1)); [ $i -ge 180 ] && { act "ABORT: NCM not up"; cp $U.log $O/uart.log; exit 1; }; sleep 1; done; act "NCM ping ok"
R=$(grep -a "rtc-pm8xxx.*setting system clock" $U.log | tail -1 | sed -n 's/.*(\([0-9]*\)).*/\1/p'); C=B; [ -n "$R" ] && [ "$R" -lt 40 ] && C=A; act "RTC at boot ${R:-?} s -> class $C"
printf 'cat /proc/device-tree/model; echo; uname -r; grep -E "START OK|FAIL in|rollback" /run/aurora-modem/lifecycle.log | tail -1\n' > $O/.w
i=0; until tn $O/.w 3 | grep -qE "^\[[0-9.]+\] .*(=== START OK|FAIL in|rollback)"; do i=$((i+1)); [ $i -ge 80 ] && { act "no START OK/FAIL after ~12 min"; break; }; sleep 6; done
tn $O/.w 3 | grep -aE "Aurora|aurora-b8|START OK|FAIL" | tee -a $A
printf 'grep -E "AP ENABLED|FAIL" /run/aurora-wifi/wifi.log | tail -1\n' > $O/.a
i=0; until tn $O/.a 3 | grep -qE "^\[[0-9.]+\] (=== AP ENABLED|FAIL)"; do i=$((i+1)); [ $i -ge 20 ] && { act "no AP ENABLED/FAIL after ~3 min"; break; }; sleep 6; done
act "wifi: $(tn $O/.a 3 | grep -E '^\[[0-9.]+\] (=== AP ENABLED|FAIL)' | tail -1)"
printf 'grep -E "SNTP (check|STEP|: )" /run/aurora-modem/lifecycle.log | tail -2\n' > $O/.s
i=0; until tn $O/.s 3 | grep -qE "^\[[0-9.]+\] SNTP"; do i=$((i+1)); [ $i -ge 15 ] && break; sleep 4; done; act "sntp: $(tn $O/.s 3 | grep -E '^\[[0-9.]+\] SNTP' | tail -2 | tr '\n' ' ')"
cat > $O/.c <<'C'
echo SNAP-BEGIN; cat /proc/uptime; date -u; cat /proc/device-tree/model; echo; uname -a; cat /proc/cmdline
echo ---time; cat /run/aurora-modem/time-set; grep -E "TIME|SNTP" /run/aurora-modem/lifecycle.log | tail -4
echo ---modem; /etc/init.d/aurora-modem status
echo ---wifi; /etc/init.d/aurora-wifi status; echo ---wifilog; cat /run/aurora-wifi/wifi.log; cat /run/aurora-wifi/service.log; echo ---hostapdlog; cat /run/aurora-wifi/hostapd.log
for r in /sys/class/remoteproc/*; do echo "RP $(cat $r/name)=$(cat $r/state)"; done; iw dev
echo ---dmesg-wifi; dmesg | grep -iE "wcn36xx|wcnss|a204000|cfg80211|aurora-wifi|crash|watchdog"
echo ---ping; ping -c4 -W3 -I wwan0 77.88.8.8 | tail -2
echo ---display; /etc/init.d/aurora-display status; cat /run/aurora-display/display.log; cat /run/aurora-display/service.log
echo ---consoles; cat /sys/class/tty/console/active; for v in /sys/class/vtconsole/vtcon*; do echo "$v $(cat $v/bind) $(cat $v/name)"; done; ls -l /proc/[0-9]*/fd/0 2>/dev/null | grep -E "ttyMSM0|tty1|console" | sed "s/.* \/proc/\/proc/"
echo ---getty; hostname; ps | grep -E "[g]etty|[c]ttyhack| sh$"
echo ---fb; ls -l /dev/dri/card0 /dev/fb0; for f in name bits_per_pixel virtual_size stride; do echo "fb0 $f=$(cat /sys/class/graphics/fb0/$f)"; done; cat /sys/class/drm/card0-SPI-1/enabled /sys/class/drm/card0-SPI-1/dpms
echo ---regs; for r in /sys/class/regulator/regulator.*; do n=$(cat $r/name); case $n in l6|l17) echo "$n $(cat $r/state) $(cat $r/microvolts) users=$(cat $r/num_users)";; esac; done
echo ---bl; for f in bl_power brightness actual_brightness; do echo "bl $f=$(cat /sys/class/backlight/backlight/$f)"; done
echo ---dmesg-display; dmesg | grep -iE "drm|panel|mipi|spi_qup|78b8000|fbcon|Console: |frame buffer|backlight|aurora-display|l17"
echo ---display-errors; dmesg | grep -iE "drm|panel|mipi|spi0|fbcon|backlight|aurora-display" | grep -ciE "err|fail|timeout|warn"
echo ---emmc; awk "{print \"w=\"\$5\" s=\"\$7}" /sys/block/mmcblk0/stat
echo SNAP-END
C
tn $O/.c 25 > $O/snapshot.txt; act "snapshot: $(grep -c SNAP-END $O/snapshot.txt) end markers; $(grep -E '^RP a204' $O/snapshot.txt)"
printf 'dmesg > /tmp/dm.txt; nc -l -p 9881 < /tmp/dm.txt &\n' > $O/.d; tn $O/.d 3 >/dev/null; sleep 1; ncat --recv-only 172.16.42.1 9881 > $O/dmesg.full
cp $U.log $O/uart.log; act "B9C $MODE$K END - operator visual check next"