Build and release engineering: teardown order, slot safety, release gates

- Controllers stop at K80, before forgectrl at K90: runlevel 0/6 no
  longer tears down the cooling engine, fire gates, and broker while a
  controller may still be executing a job.
- The grblhal/gfcloud init scripts are real emergency levers: stop
  routes through the supervisor (POST /controller/stop - a bare pkill
  was safed and respawned seconds later), start resumes supervision,
  status exists, and the pkill fallback matches full executable paths
  instead of truncated names or bare substrings.
- slotmigrate: the partition grow gets the same 2048-sector tolerance
  as the filesystem branch (an exact compare rewrote the MBR at S02 on
  every boot on disks where the grow cannot land on the last sector),
  verifies it made progress, and the resize2fs retry is bounded at
  three attempts with the counter kept on p3 itself.
- Installer: archive product/platform are verified after the signature,
  and a validly signed OLDER release now requires an explicit yes
  instead of installing as a silent downgrade. All predictable /tmp
  paths in the installer and ffboot are mktemp now.
- release.sh rejects multiple positional versions (the last one used to
  win silently) and a release without factory-era verification dies
  unless explicitly bypassed; mkfw.sh refuses to pack when the public
  key for the post-sign self-check is missing.
- forgefirm-logrotate: size-capped rotation (boot + hourly) for the
  /data logs - a full /data breaks settings, update staging, and the
  controllers own writes.
- Bench build scripts derive every path from their own location or
  FF_SRC_TOP/FF_BUILD_TOP and log to mktemp files.
This commit is contained in:
ScottW514
2026-08-14 18:23:13 -04:00
parent cbabf7d111
commit 58d4d91948
15 changed files with 301 additions and 45 deletions
@@ -20,7 +20,10 @@ S = "${WORKDIR}/git"
inherit cmake update-rc.d
INITSCRIPT_NAME = "grblhal"
INITSCRIPT_PARAMS = "defaults 92"
# stop 80 < forgectrl's 90: at runlevel 0/6 the controller goes down
# BEFORE the daemon that carries the cooling engine, fire gates, and
# broker - never the other way around.
INITSCRIPT_PARAMS = "start 92 2 3 4 5 . stop 80 0 1 6 ."
do_install:append() {
install -d ${D}${sysconfdir}/init.d
@@ -11,21 +11,54 @@
# The controller lifecycle belongs to the forgectrl supervisor: it
# spawns the controller selected by controller_mode as a direct child
# (that relationship carries the pulse-device fd and death detection).
# This script remains only as a manual emergency stop.
# This script is the manual emergency lever, routed THROUGH the
# supervisor: stop asks it to stop the child and hold it down (a bare
# pkill would be safed and respawned seconds later); start resumes
# supervision.
DAEMON_BIN=/usr/bin/grblHAL_glowforge
TOKEN_FILE=/data/forgefirm/panel.token
CTRL_URL="http://127.0.0.1:${FORGECTRL_PORT:-8080}"
super_post() {
[ -r "$TOKEN_FILE" ] || return 1
curl -sf -m 20 -X POST \
-H "X-ForgeFIRM-Token: $(cat "$TOKEN_FILE")" \
"$CTRL_URL/controller/$1" >/dev/null 2>&1
}
case "$1" in
start)
echo "grblHAL is managed by forgectrl (POST /mode to switch controllers)"
if super_post start; then
echo "grblHAL supervision resumed (forgectrl spawns the selected controller)"
else
echo "grblHAL is managed by forgectrl (POST /mode to switch controllers)"
fi
;;
stop)
echo "Stopping grblHAL"
pkill -x grblHAL_glowfor 2>/dev/null
if ! super_post stop; then
# Supervisor unreachable: kill the controller directly. If a
# supervisor is alive after all, the child's exit still lands on
# its safing path. Match the full executable path, not the
# 15-char comm truncation.
pkill -f "^$DAEMON_BIN" 2>/dev/null
fi
;;
status)
if pgrep -f "^$DAEMON_BIN" >/dev/null 2>&1; then
echo "grblHAL is running"
exit 0
else
echo "grblHAL is not running"
exit 3
fi
;;
restart)
$0 stop
;;
*)
echo "Usage: $0 {start|stop|restart}"
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac