uzbek-plus/r3/r3b/r3b-board-obs.sh
q 8d7721c775 B7: add network time bootstrap and persistent B7C cache
B7A: QMI DMS time vs VNIIFTRI NTP (DMS = UTC - 0.28 s, sigma 1 ms; NITZ = DMS
truncated to 1 s). B7B: a 1970 -> 2026 date -s step is harmless for the modem
stack. B7C: aurora-modem probes DMS/NITZ along the start flow and steps
CLOCK_REALTIME once at the first valid sample (REG registered/attached), never
RTC; background SNTP check (query only) after START OK. 3/3 class-A cold boots
PASS (residual +0.04/+0.36/+0.84 s), cache 14fe453a written (B7C_WRITE_VERIFIED)
and verified by a normal power-on (V1, +0.26 s).

Also publishes the prerequisite R2 (boot-hang / lk eMMC investigation, T4
telnet baseline that B7C builds on) and R3 (autonomous cold boot, NCM loss)
material, and extends tools/publish-sanitize.py to r2/, r3/, b7/.
Binary images, initramfs, busybox and raw logs stay out (see b7/*/SHA256SUMS).
2026-10-02 20:18:25 +03:00

20 lines
1.6 KiB
Bash

#!/bin/sh
# R3B board-side READ-ONLY observer. Writes only /run/r3b (tmpfs). Every 2 s: host/LTE reachability + controller/MM/rmtfs/wwan0 state.
# Every 5th sample adds mmcli state. Any change of the key fields -> one line to /dev/kmsg (visible on passive UART).
trap '' HUP; O=/run/r3b; mkdir -p $O; L=$O/obs.log; last=; n=0
while :; do n=$((n+1))
u=$(cut -d' ' -f1 /proc/uptime)
h=$(ping -c1 -W1 172.16.42.2 >/dev/null 2>&1 && echo up || echo DOWN)
l=$(ping -c1 -W1 -I wwan0 77.88.8.8 >/dev/null 2>&1 && echo ok || echo FAIL)
s=$(cat /run/aurora-modem/state 2>/dev/null)
w=$(cat /sys/class/net/wwan0/operstate 2>/dev/null); a=$(ip -4 -o addr show wwan0 2>/dev/null | awk '{print $4}')
ua=$(ip -4 -o addr show usb0 2>/dev/null | awk '{print $4}'); uc=$(cat /sys/class/net/usb0/carrier 2>/dev/null)
mm=$(pidof ModemManager); rf=$(pidof rmtfs); am=$(ps | grep -c '[/]usr/sbin/aurora-modem'); lc=$(wc -l < /run/aurora-modem/lifecycle.log)
ms=
if [ $((n % 5)) = 1 ]; then ms=$(timeout 8 mmcli -m any 2>/dev/null | tr -d '\033' | sed 's/\[[0-9;]*m//g' | grep -E '\| +(state|registration|access tech): ' | awk -F': ' '{print $2}' | tr -d ' ' | tr '\n' '/')
b=$(timeout 8 mmcli -b 1 2>/dev/null | tr -d '\033' | sed 's/\[[0-9;]*m//g' | grep -m1 'connected:' | awk -F': ' '{print $2}'); ms="mm=$ms bearer1=$b"; fi
echo "$u host=$h lte=$l state=$s wwan0=$w,$a usb0=$ua,c$uc mm_pid=$mm rmtfs_pid=$rf am_procs=$am lc_lines=$lc $ms" >> $L
k="host=$h lte=$l state=$s wwan0=$w,$a usb0=$ua,c$uc mm=$mm rmtfs=$rf am=$am lc=$lc"
[ "$k" != "$last" ] && echo "<5>[r3b-obs] $u $k" > /dev/kmsg; last=$k
sleep 2
done