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).
73 lines
4.5 KiB
Bash
73 lines
4.5 KiB
Bash
#!/bin/bash
|
|
# R2/T2 watcher (480s; board side read-only). Usage: t2-watch.sh <UARTLOG> <ATTEMPT-TAG>
|
|
# For each SBL1 start: class A/B/C from pm_device_init, furthest stage, PASS/FAIL; Linux -> PON dump over UART (md5-checked);
|
|
# hang -> wait for auto-reset (max 120 s from start), next start is recorded as a follow-up of the same attempt.
|
|
L=$1; TAG=$2; TTY=/dev/ttyUSB0
|
|
OUT=~/doc/modem/jz08-aurora/logs/r2/t2; mkdir -p $OUT; RES=$OUT/results.tsv
|
|
[ -f $RES ] || printf 'attempt\tstart\tclass\tsblS\tpm_device\tcdt\tpm_driver\tsbl_delta\tbatt\tstage\tresult\tnote\n' > $RES
|
|
lg() { tr -d '\000' < $L; }
|
|
dumpcmd() {
|
|
printf '%s\r' "grep -q ' /sys/kernel/debug ' /proc/mounts || mount -t debugfs debugfs /sys/kernel/debug; R=/sys/kernel/debug/regmap/0-00/registers; { dd if=\$R bs=9 skip=2048 count=256 2>/dev/null; dd if=\$R bs=9 skip=2304 count=256 2>/dev/null | grep -v ': 00\$'; } > /tmp/t2.txt; echo T2-BEGIN-$1; sed 's/^/T2R /' /tmp/t2.txt; echo T2-SUM-$1 \$(md5sum < /tmp/t2.txt) up=\$(cut -d' ' -f1 /proc/uptime); echo T2-END-$1" > $TTY
|
|
}
|
|
capture() { # id startline
|
|
for try in 1 2 3; do
|
|
dumpcmd $1-$try
|
|
for i in $(seq 1 25); do sleep 1; lg | tail -n +$2 | grep -a -q "T2-END-$1-$try" && break; done
|
|
seg=$(lg | tail -n +$2 | sed -n "/T2-BEGIN-$1-$try/,/T2-END-$1-$try/p")
|
|
body=$(echo "$seg" | grep -a -o "T2R [0-9a-f]\{4\}: [0-9a-f]\{2\}" | cut -c5-)
|
|
want=$(echo "$seg" | grep -a -o "T2-SUM-$1-$try [0-9a-f]\{32\}" | awk '{print $2}' | tail -1)
|
|
got=$(printf '%s\n' "$body" | md5sum | awk '{print $1}')
|
|
[ -n "$want" ] && [ "$want" = "$got" ] && { printf '%s\n' "$body" > $OUT/$1-regs.txt; return 0; }
|
|
echo "try $try md5 mismatch want=$want got=$got" >> $OUT/$1-meta.txt
|
|
done; return 1
|
|
}
|
|
stage_of() { # text on stdin
|
|
local t; t=$(cat); local s=sbl_start
|
|
echo "$t" | grep -a -q "Pre_DDR_clock_init, Start" && s=ddr_init
|
|
echo "$t" | grep -a -q "pm_driver_init" && s=pm_driver
|
|
echo "$t" | grep -a -q "SBL1, End" && s=sbl1_end
|
|
echo "$t" | grep -a -q "welcome to lk" && s=lk
|
|
echo "$t" | grep -a -q "target_init()" && s=lk_target_init
|
|
echo "$t" | grep -a -q "MMC card:" && s=lk_mmc
|
|
echo "$t" | grep -a -q -E "Jumping to kernel|booting linux @" && s=lk_jump
|
|
echo "$t" | grep -a -q "Booting Linux on physical" && s=linux
|
|
echo "$t" | grep -a -q "EMMC-RO-SUMMARY" && s=linux_init
|
|
echo $s
|
|
}
|
|
pos=$(lg | wc -l); pos=$((pos+1)); k=0
|
|
echo "$(date +%T) $TAG: watching $L from line $pos"
|
|
while true; do
|
|
n=$(lg | tail -n +$pos | grep -a -n "SBL1, Start" | head -1 | cut -d: -f1)
|
|
[ -z "$n" ] && { sleep 1; continue; }
|
|
s=$((pos+n-1)); k=$((k+1)); ts=$(lg | sed -n "${s}p" | cut -c1-8 | tr -d :)
|
|
sleep 3
|
|
sbl=$(lg | sed -n "${s},$((s+40))p")
|
|
v() { echo "$sbl" | grep -a -o "$1 - *[0-9]* - $2" | awk '{print $3}' | head -1; }
|
|
sblS=$(v B "SBL1, Start"); pmd=$(v D pm_device_init); cdt=$(v D boot_config_data_table_init); pmdrv=$(v D pm_driver_init)
|
|
sbld=$(v D "SBL1, Delta"); batt=$(echo "$sbl" | grep -a -o "batt_voltage=[0-9]*" | cut -d= -f2 | head -1)
|
|
cls=U; [ -n "$pmd" ] && { if [ "$pmd" -lt 11500 ]; then cls=A; elif [ "$pmd" -gt 15000 ]; then cls=C; else cls=B; fi; }
|
|
id=$TAG-$k-$ts-$cls
|
|
echo "start line $s time $ts sblS=$sblS pm_device_init=$pmd cdt=$cdt pm_driver=$pmdrv sbl_delta=$sbld batt=$batt class=$cls" > $OUT/$id-meta.txt
|
|
echo "$(date +%T) start #$k $id"
|
|
ok=0; restarted=0
|
|
for i in $(seq 1 120); do
|
|
sleep 1
|
|
seg=$(lg | tail -n +$((s+1)))
|
|
echo "$seg" | grep -a -q "SBL1, Start" && { restarted=1; break; }
|
|
echo "$seg" | grep -a -q "EMMC-RO-SUMMARY" && { ok=1; break; }
|
|
done
|
|
segend=$(lg | tail -n +$s | awk 'NR>1 && /SBL1, Start/{exit} {print}')
|
|
stage=$(echo "$segend" | stage_of); last=$(echo "$segend" | grep -a -v "^.\{13\} *$" | tail -1 | cut -c1-12)
|
|
pos=$((s+1))
|
|
if [ $ok = 1 ]; then
|
|
sleep 8
|
|
if lg | tail -n +$((s+1)) | grep -a -q "SBL1, Start"; then res=FAIL; note="restart after Linux init"
|
|
elif capture $id $((s+1)); then res=PASS; note="PON captured"
|
|
else res=PASS; note="PON capture failed"; fi
|
|
elif [ $restarted = 1 ]; then res=FAIL; note="hang at $stage, auto-reset (last output $last)"
|
|
else res=FAIL; note="hang at $stage, no reset within 120 s (last output $last)"; fi
|
|
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' $TAG $ts $cls "$sblS" "$pmd" "$cdt" "$pmdrv" "$sbld" "$batt" $stage $res "$note" >> $RES
|
|
echo "$(date +%T) #$k $id -> $stage $res ($note)"
|
|
[ $res = PASS ] && { echo "$(date +%T) $TAG DONE"; exit 0; }
|
|
[ $restarted = 0 ] && { echo "$(date +%T) $TAG STUCK (needs power cycle)"; exit 0; }
|
|
done
|