uzbek-plus/b10/b10b3/b10b3t-boot.sh
q 58dcb3d121 B10: battery charging — PM8916 LBC supervisor v4 (CHARGE/HOLD, FAULT safe clamp to 4.00 V) and persistent B10B-5 cache
- LBC supervisor v1..v4 (linux/patches/b10b3-lbc-supervisor-v3.patch + b10/b10b3/lbc-v3-to-v4-fault-clamp.diff):
  CHARGING 4.20 V/450 mA -> HOLD 4.05 V after 60 min CV -> battery -> new cycle on USB insert; FAULT = VDD_MAX 4.00 V clamp
- RAM tests C/B/D/D2/D3/D4 (safety timer only ends fast charge), B10B-4 actuator audit (VDD_MAX works, USB_SUSP does not),
  B10B-5 FAULT clamp regression, production run, warm reboot via PON reboot reason
- cache = B10B-5 c3732515 (HW EDL write, readback + full partition verify), class-A persistent validation
- test-only hooks/images are not part of the production kernel; images with the AP PSK are not published
2026-10-04 19:00:27 +03:00

60 lines
6.6 KiB
Bash

#!/bin/sh
# 480s side, B10B-3T (TEST image) boot K (RAM only). RESET-held power-on -> lk1st fastboot -> `fastboot boot` B10B-3 RAM image. Reads only over telnet.
# 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=ram; [ -n "$K" ] || { echo "usage: $0 K"; exit 2; }
cd ~/doc/modem/jz08-aurora; O=logs/b10/b10b3/t$K; mkdir -p $O; IMG=b10/b10b3/out-t/aurora-b10b3t.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/b10b3t-$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 "dfe2fae69f0c64be85bc972e2e8502e9bef262fa5dbb5e77b3c76ed183a89f1f $IMG" | sha256sum -c || exit 1
act "B10B3 $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 1800 ] && { act "ABORT: no fastboot"; exit 1; }; sleep 2; done
act "fastboot present"; { fastboot boot $IMG 2>&1; echo "rc=$?"; } | tee -a $A
else
act "B10B3 $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 ---iio; for d in /sys/bus/iio/devices/iio:device*; do echo "$d name=$(cat $d/name)"; ls $d | tr '\n' ' '; echo; done
for f in /sys/bus/iio/devices/iio:device*/in_*; do case $f in *_raw|*_input|*_scale|*_offset) echo "$f=$(cat $f 2>&1)";; esac; done
echo ---psy; ls -l /sys/class/power_supply/; for p in /sys/class/power_supply/*; do echo "-- $p"; cat $p/uevent; ls $p; done
echo ---dmesg-bms; dmesg | grep -iE "bms|battery|power_supply|lbc|charger|extcon|ci_hdrc|4000|1000"
echo ---lbc-state; grep -q " /sys/kernel/debug " /proc/mounts || mount -t debugfs debugfs /sys/kernel/debug; cat /sys/kernel/debug/pm8916_lbc/state; dmesg | grep -E "safety timer|supervisor|pm8916-lbc|lbc"
echo ---thermal; for t in /sys/class/thermal/thermal_zone*; do echo "$t $(cat $t/type) $(cat $t/temp)"; done
echo ---dmesg-adc; dmesg | grep -iE "vadc|iio|temp-alarm|qpnp|spmi-temp|pm8916-thermal|thermal"
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 "B10B3 $MODE$K END - operator visual check next"