#!/bin/sh # 480s side, B9B RAM boot K: RESET-held power-on -> lk1st fastboot -> `fastboot boot` B9B RAM image. Nothing is flashed; # eMMC cache stays B8F. Then waits for LTE START OK + Wi-Fi AP ENABLED and saves the display state (b9b-test.sh state). # Visual checks (show/bl) are run separately with b9b-cmd.sh while the operator looks at the screen. K=$1; [ -n "$K" ] || { echo "usage: $0 K"; exit 2; } cd ~/doc/modem/jz08-aurora; O=logs/b9/b9b/ram$K; mkdir -p $O; IMG=b9/b9b/out/aurora-b9b.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"; } echo "46e7a6822cf5dd13e50feccb7d205f9fddb155c19ba6eaab8d42d5f9fa8ecf4e $IMG" | sha256sum -c || exit 1 OLD=$(ps -eo pid,cmd | grep "[u]artlog.py /dev/ttyUSB0" | awk '{print $1}'); [ -n "$OLD" ] && kill $OLD; sleep 1 U=logs/uart/b9b-ram$K-$(date +%Y%m%d-%H%M%S); setsid nohup python3 tools/uartlog.py /dev/ttyUSB0 $U > $U.stderr 2>&1 < /dev/null & echo $U > $O/uartlog-path act "B9B ram$K: waiting for fastboot (power off >= 90 s, then RESET held + battery -> USB)" if fastboot devices 2>/dev/null | grep -q ; then act "already in fastboot - wait for power-off"; until ! fastboot devices 2>/dev/null | grep -q ; do sleep 1; done; fi i=0; until fastboot devices 2>/dev/null | grep -q ; 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 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" 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-b9|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 '/usr/libexec/aurora/b9b/b9b-test.sh state\n' > $O/.s tn $O/.s 12 | sed -n '/^B9B-STATE-BEGIN/,/^B9B-STATE-END/p' > $O/state-boot.txt; act "state saved ($(wc -l < $O/state-boot.txt) lines)" cp $U.log $O/uart.log