Sanitized research log, build/reproducibility docs, DTS, kernel configs, patches, initramfs sources, bootchain migration plans and test logs. B5 direct boot PASS; B6 modem lifecycle in progress. No dumps, NV/EFS, vendor firmware or device identifiers included.
45 lines
4.4 KiB
Bash
Executable file
45 lines
4.4 KiB
Bash
Executable file
#!/bin/sh
|
|
# B4b2 via ModemManager: ONE simple-connect (apn=internet, ip-type=ipv4), manual IPv4 in routing table 100 only
|
|
# (main table / usb0 untouched), IP ping, DNS, clean disconnect. Long digit runs (IMEI/ICCID/IMSI) masked on-device.
|
|
O=/tmp/b4b2mm; mkdir -p $O; t() { cut -d' ' -f1 /proc/uptime; }
|
|
mask() { sed -E 's/([0-9]{6,})([0-9]{4})/******\2/g'; }
|
|
B=/sys/bus/platform/devices/4080000.remoteproc:bam-dmux
|
|
pm() { echo "### $(t) PM=$(cat $B/power/runtime_status) active_ms=$(cat $B/power/runtime_active_time) rproc=$(cat /sys/class/remoteproc/remoteproc0/state)"; }
|
|
cnt() { echo "### $(t) CNT $(for f in rx_packets rx_bytes tx_packets tx_bytes; do printf '%s=%s ' $f $(cat /sys/class/net/wwan0/statistics/$f); done)"; ip -s link show wwan0 2>&1; }
|
|
nv() { for want in modemst1 modemst2 fsg fsc persist; do for p in /sys/class/block/mmcblk0p*; do
|
|
[ "$(sed -n 's/^PARTNAME=//p' $p/uevent)" = "$want" ] && echo "$want $(sha256sum /dev/$(basename $p) | cut -d' ' -f1)"; done; done; }
|
|
nv > $O/nv-before.txt; cat /sys/block/mmcblk0/stat > $O/stat-before.txt; wc -l < /tmp/rmtfs.log > $O/rmtfs-offset.txt
|
|
{ mmcli -L; mmcli -m 0; mmcli -m 0 --signal-get 2>&1; pm; ip link show wwan0; ip route; ip rule; } 2>&1 | mask > $O/pre.txt
|
|
timeout 30 qmicli -p -d /dev/wwan0qmi0 --nas-get-serving-system > $O/pre-qmi.txt 2>&1 # GET only
|
|
grep -q "plugin: qcom-soc" $O/pre.txt && grep -q "primary port: wwan0qmi0" $O/pre.txt && grep -q "wwan0 (net)" $O/pre.txt \
|
|
&& grep -q "Registration state: 'registered'" $O/pre-qmi.txt && grep -q "PS: 'attached'" $O/pre-qmi.txt || { echo "PRECHECK FAILED"; echo B4B2MM-STOPPED; exit 1; }
|
|
# --- single connect
|
|
{ pm; echo "### $(t) mmcli -m 0 --simple-connect=apn=internet,ip-type=ipv4"; timeout 150 mmcli -m 0 --simple-connect="apn=internet,ip-type=ipv4" 2>&1; echo "### rc=$?"; pm; } > $O/connect.txt
|
|
BR=$(mmcli -m 0 | grep -oE "Bearer/[0-9]+" | tail -1 | cut -d/ -f2)
|
|
{ mmcli -m 0; [ -n "$BR" ] && mmcli -b $BR; } 2>&1 | mask > $O/after-connect.txt
|
|
grep -q "^### rc=0" $O/connect.txt && [ -n "$BR" ] && mmcli -b $BR | grep -q "connected: yes" || { echo "CONNECT FAILED (bearer '$BR')"; echo B4B2MM-STOPPED; exit 1; }
|
|
T=$(mmcli -b $BR); f() { echo "$T" | awk -F": " "/ $1:/{print \$2; exit}" | tr -d " "; }
|
|
IF=$(f interface); A=$(f address); PF=$(f prefix); GW=$(f gateway); DNS=$(f dns); MTU=$(f mtu); D1=${DNS%%,*}; D2=${DNS#*,}; [ "$D2" = "$DNS" ] && D2=
|
|
echo "BR=$BR IF=$IF A=$A PF=$PF GW=$GW DNS=$DNS MTU=$MTU" > $O/bearer-ip.txt
|
|
[ "$IF" = wwan0 ] && [ -n "$A" ] && [ -n "$PF" ] || { echo "BEARER HAS NO USABLE IPv4 on wwan0"; }
|
|
# --- manual IPv4 (table 100 + source rule; host routes only for DNS servers in main)
|
|
{ cnt; ip addr add $A/$PF dev wwan0; echo "addr rc=$?"; [ -n "$MTU" ] && ip link set wwan0 mtu $MTU; ip link set wwan0 up; echo "up rc=$?"; sleep 2; pm
|
|
ip route add default via $GW dev wwan0 table 100; echo "rt100 rc=$?"; ip rule add from $A lookup 100 priority 100; echo "rule rc=$?"
|
|
for d in $D1 $D2; do ip route add $d/32 dev wwan0 src $A; done
|
|
ip addr show wwan0; echo "--- main:"; ip route; echo "--- t100:"; ip route show table 100; ip rule; } > $O/cfg.txt 2>&1
|
|
# --- IP-only ping (source = LTE address -> table 100)
|
|
{ for h in 77.88.8.8 1.1.1.1 8.8.8.8; do echo "### $(t) ping -I $A $h"; ping -c 5 -W 3 -I $A $h 2>&1; pm; done; cnt; } > $O/ping.txt 2>&1
|
|
# --- DNS via operator DNS
|
|
{ for s in $D1 $D2; do echo "### $(t) nslookup ya.ru $s"; nslookup ya.ru $s 2>&1; done; pm; cnt; } > $O/dns.txt 2>&1
|
|
{ mmcli -b $BR; mmcli -m 0 --signal-get; } 2>&1 | mask > $O/during.txt
|
|
# --- clean disconnect
|
|
{ echo "### $(t) mmcli -m 0 --simple-disconnect"; timeout 60 mmcli -m 0 --simple-disconnect 2>&1; echo "### rc=$?"; mmcli -b $BR 2>&1 | grep -E "connected|interface|address"
|
|
ip rule del from $A lookup 100 priority 100; ip route flush table 100; for d in $D1 $D2; do ip route del $d/32 dev wwan0 2>/dev/null; done
|
|
ip addr flush dev wwan0; ip link set wwan0 down; echo "down rc=$?"; ip link show wwan0; ip route; ip rule; sleep 10; pm; } > $O/disconnect.txt 2>&1
|
|
{ mmcli -m 0; pm; } 2>&1 | mask > $O/post.txt
|
|
nv > $O/nv-after.txt; cat /sys/block/mmcblk0/stat > $O/stat-after.txt
|
|
tail -n +$(( $(cat $O/rmtfs-offset.txt) + 1 )) /tmp/rmtfs.log > $O/rmtfs-delta.log
|
|
dmesg | grep -iE "bam|dmux|wwan|resume|-110|-22|Resource temporarily|Oops|panic|fatal|q6v5|watchdog|ssr" > $O/dmesg.txt
|
|
mask < /tmp/mm.log > $O/mm.log
|
|
cmp -s $O/nv-before.txt $O/nv-after.txt && echo "NV BEFORE==AFTER" > $O/nv-result.txt || echo "NV DIFFERENT" > $O/nv-result.txt
|
|
tar -C /tmp -cf /tmp/b4b2mm.tar b4b2mm; echo B4B2MM-DONE
|