uzbek-plus/b7/b7a/b7a-measure.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

22 lines
1.3 KiB
Bash

#!/bin/sh
# B7A board-side MEASUREMENT ONLY (no clock set, no RTC, no eMMC). Raw output -> /tmp/b7/raw. Local timestamps: busybox adjtimex time.tv_sec/usec (CLOCK_REALTIME, µs).
trap '' HUP; B=/tmp/b7/busybox; R=/tmp/b7/raw; mkdir -p $R; Q="qmicli -p -d /dev/wwan0qmi0"; N=${1:-6}
ts() { $B adjtimex | awk '/time.tv_sec/{s=$2} /time.tv_usec/{u=$2} END{printf "%d.%06d", s, u}'; }
up() { cut -d' ' -f1 /proc/uptime; }
echo "BEGIN $(ts) up=$(up)" > $R/log
for r in $(seq 1 $N); do
for k in 1 2 3; do
a=$(ts); u=$(up); timeout 15 $Q --dms-get-time > $R/r$r-dms$k.txt 2>&1; b=$(ts)
echo "r$r DMS$k up=$u t0=$a t1=$b $(grep -o "System time: '[0-9]*" $R/r$r-dms$k.txt | grep -o '[0-9]*$')" >> $R/log
done
for k in 1 2; do
a=$(ts); u=$(up); timeout 15 $Q --nas-get-network-time > $R/r$r-nitz$k.txt 2>&1; b=$(ts)
echo "r$r NITZ$k up=$u t0=$a t1=$b $(sed -n "s/.*3GPP Date: *'\(.*\)'/\1/p" $R/r$r-nitz$k.txt) $(sed -n "s/.*3GPP Time: *'\(.*\)'/\1/p" $R/r$r-nitz$k.txt) tz=$(sed -n "s/.*3GPP Timezone Offset: *'\(.*\)'.*/\1/p" $R/r$r-nitz$k.txt)" >> $R/log
done
for n in 1 2 3; do ip=89.109.251.2$n
a=$(ts); u=$(up); timeout 9 $B ntpd -w -d -p $ip > $R/r$r-ntp$n.txt 2>&1; b=$(ts)
echo "r$r NTP$n up=$u t0=$a t1=$b $ip" >> $R/log
grep "reply from" $R/r$r-ntp$n.txt | sed "s/^/r$r NTP$n /" >> $R/log
done
done
echo "END $(ts) up=$(up)" >> $R/log