15 lines
1.4 KiB
Bash
15 lines
1.4 KiB
Bash
#!/bin/sh
|
|
# 480s: B18 RAM test. Waits for lk1st fastboot (RESET held at power-on, USB to 480s), `fastboot boot` the b18 image, waits for NCM,
|
|
# then reports kernel, USB role switch and gadget state. Nothing flashed. Role stays "device" until switched by hand:
|
|
# echo host > /sys/class/usb_role/*/role (NCM drops; use ssh root@192.168.77.1 over Wi-Fi) | echo device > ... to return.
|
|
cd ~/doc/modem/jz08-aurora; O=logs/b18/ram${1:-1}; mkdir -p $O; IMG=b18/out/aurora-b18.img
|
|
A=$O/host-actions.txt; act() { echo "$(date -u +%H:%M:%S) $*" | tee -a $A; }
|
|
tn() { { sleep 1; sed "s/\$/\r/" "$1"; sleep $2; } | ncat 172.16.42.1 23 | tr -d "\000\r"; }
|
|
grep " aurora-b18.img\$" b18/out/SHA256SUMS | sed "s| | b18/out/|" | sha256sum -c || exit 1
|
|
act "B18 ram: waiting for fastboot <EMMC_SERIAL> (RESET held at power-on)"
|
|
i=0; until fastboot devices 2>/dev/null | grep -q <EMMC_SERIAL>; do i=$((i+1)); [ $i -ge 900 ] && { act ABORT; 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 240 ] && { act "ABORT NCM (role came up as host? check over Wi-Fi)"; exit 1; }; sleep 1; done; act "NCM up"
|
|
printf 'uname -r; for r in /sys/class/usb_role/*; do echo "$r role=$(cat $r/role)"; done; dmesg | grep -iE "ci_hdrc|ehci|usbcore|role" | tail -8\n' > $O/.w
|
|
sleep 5; tn $O/.w 4 | grep -avE "^/ #" | tee -a $A
|
|
act "READY"
|