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
@@ -0,0 +1,43 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: forgefirm-logrotate
# Required-Start: $local_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: rotate the /data logs at boot and hourly
### END INIT INFO
# The image runs no cron daemon, so rotation is driven here: once at
# every boot (bounds carry-over bloat), then hourly from a small
# background loop (bounds growth across long uptimes - a full /data
# breaks settings, update staging, and the controllers' own writes).
LOGROTATE=/usr/sbin/logrotate
CONF=/etc/logrotate.conf
PIDFILE=/var/run/forgefirm-logrotate.pid
case "$1" in
start)
[ -x "$LOGROTATE" ] || exit 0
"$LOGROTATE" "$CONF" 2>/dev/null
( while :; do
sleep 3600
"$LOGROTATE" "$CONF" 2>/dev/null
done ) &
echo $! > "$PIDFILE"
;;
stop)
[ -r "$PIDFILE" ] && kill "$(cat "$PIDFILE")" 2>/dev/null
rm -f "$PIDFILE"
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit 0
@@ -0,0 +1,12 @@
# ForgeFIRM logs on the persistent /data partition. copytruncate: the
# daemon and both controllers keep their log fds open for their whole
# lifetime, so the file must be truncated in place, never moved out
# from under them.
/data/forgectrl.log /data/glowforge.log /data/gfcloud.log /data/gfhome.log {
size 1M
rotate 3
copytruncate
compress
missingok
notifempty
}
@@ -0,0 +1,26 @@
SUMMARY = "Log rotation for the ForgeFIRM logs on /data"
DESCRIPTION = "Size-capped rotation for the daemon and controller logs \
on the persistent /data partition: a full /data breaks settings, update \
staging, and the controllers' own writes. Rotation runs at every boot \
and hourly while the machine is up."
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = " \
file://forgefirm.logrotate \
file://forgefirm-logrotate.init \
"
S = "${WORKDIR}"
inherit update-rc.d
INITSCRIPT_NAME = "forgefirm-logrotate"
INITSCRIPT_PARAMS = "defaults 40"
RDEPENDS:${PN} = "logrotate"
do_install() {
install -Dm 0644 ${WORKDIR}/forgefirm.logrotate ${D}${sysconfdir}/logrotate.d/forgefirm
install -Dm 0755 ${WORKDIR}/forgefirm-logrotate.init ${D}${sysconfdir}/init.d/forgefirm-logrotate
}