#!/bin/sh # B2: start rmtfs STRICTLY READ-ONLY; rmtfs (-s) then starts the MSS remoteproc (driver auto_boot=false). # -r: storage_read_only (rmtfs v1.3 storage.c: O_RDONLY into RAM shadow buffers, pwrite->RAM, sync no-op) # -P: raw partitions via /dev/disk/by-partlabel/{modemst1,modemst2,fsc,fsg}; -s: rproc sync; -v verbose for d in /dev/disk/by-partlabel/modemst1 /dev/disk/by-partlabel/modemst2 /dev/disk/by-partlabel/fsc /dev/disk/by-partlabel/fsg; do [ "$(blockdev --getro $(readlink $d))" = 1 ] || { echo "ABORT: $d not RO"; exit 1; } done grep -q " /firmware .* ro," /proc/mounts || { echo "ABORT: /firmware not mounted ro"; exit 1; } [ "$(cat /sys/module/firmware_class/parameters/path)" = /firmware/image ] || { echo "ABORT: firmware path"; exit 1; } echo "[modem-up] before:"; for r in /sys/class/remoteproc/remoteproc*; do echo "$r $(cat $r/name) $(cat $r/state) $(cat $r/firmware)"; done echo "[modem-up] starting: LD_PRELOAD=/usr/lib/linebuf.so rmtfs -r -P -s -v" LD_PRELOAD=/usr/lib/linebuf.so rmtfs -r -P -s -v > /tmp/rmtfs.log 2>&1 & # linebuf.so = stdbuf -oL equivalent (logging only) echo $! > /tmp/rmtfs.pid sleep 20 echo "[modem-up] after 20s:"; for r in /sys/class/remoteproc/remoteproc*; do echo "$r $(cat $r/name) $(cat $r/state)"; done