From 061def2343520033611ed27be75abb2424856ead Mon Sep 17 00:00:00 2001 From: ScottW514 Date: Mon, 3 Aug 2026 17:22:07 -0400 Subject: [PATCH] grblhal-glowforge: recipe with boot autostart gitsm-pinned build of the controller with a sysvinit script (defaults 92, after forgectrl), installed in both images. Reboot-verified on the bench: controller and forgectrl come up unattended and Grbl answers on TCP:23. --- docs/BRINGUP.md | 17 +++++---- kas/README.md | 4 +-- .../grblhal-glowforge/grblhal-glowforge.bb | 30 ++++++++++++++++ .../grblhal-glowforge/grblhal.init | 36 +++++++++++++++++++ .../images/forgefirm-image.bb | 3 +- 5 files changed, 81 insertions(+), 9 deletions(-) create mode 100644 meta-forgefirm/recipes-forgefirm/grblhal-glowforge/grblhal-glowforge.bb create mode 100644 meta-forgefirm/recipes-forgefirm/grblhal-glowforge/grblhal-glowforge/grblhal.init diff --git a/docs/BRINGUP.md b/docs/BRINGUP.md index 43fc50d..d5f0b96 100644 --- a/docs/BRINGUP.md +++ b/docs/BRINGUP.md @@ -102,7 +102,12 @@ grblHAL driver repo** (github.com/ScottW514/grblHAL-glowforge, branch `main`): core as a submodule at `src/grbl` (→ ScottW514/core fork, branch `forgefirm`, carrying the settings-write crash fix, PR'd upstream as grblHAL/core#999), `driver.c` implementing the HAL, machine constants in -`src/boards/glowforge.h`. Architecture: a wall-paced producer thread runs +`src/boards/glowforge.h`. **The controller autostarts at boot** since +2026-08-03: the `grblhal-glowforge` recipe (meta-forgefirm; gitsm pin + +sysvinit script `grblhal`, defaults 92) is installed in both images, and +the same init script is installed on the current bench rootfs +(reboot-verified: controller + forgectrl both up unattended, Grbl +answering on :23). The manual start below remains the bench/debug path. Architecture: a wall-paced producer thread runs the core stepper ISR against a virtual step clock (1000× machine tick) and maps step events to pulse bytes; a SCHED_FIFO shipper feeds `/dev/glowforge` with the bounded queue; a recursive core mutex stands in @@ -526,8 +531,8 @@ at live snapshots). 2026-08-02** — the controller is now the canonical driver repo `github.com/ScottW514/grblHAL-glowforge` (+ `ScottW514/core` fork; the settings-write crash fix is upstream PR grblHAL/core#999; repoint - the submodule to upstream when it merges). Remaining: a Yocto recipe - for grblHAL-glowforge in meta-forgefirm (pin SRCREV; fills the - `forgectrl` slot per kas/README.md), Phase 7 doc sweep (CLAUDE.md - charter refresh, README roadmap), kas flip + first GitHub release per - kas/README.md once ready to publish. + the submodule to upstream when it merges). ~~Yocto recipe for + grblHAL-glowforge~~ **DONE 2026-08-03** (`grblhal-glowforge` in + meta-forgefirm, boot autostart, reboot-verified). Remaining: Phase 7 + doc sweep (CLAUDE.md charter refresh, README roadmap), kas flip + + first GitHub release per kas/README.md once ready to publish. diff --git a/kas/README.md b/kas/README.md index e37ecb1..6944035 100644 --- a/kas/README.md +++ b/kas/README.md @@ -200,8 +200,8 @@ Scarthgap, but the legacy (Dunfell/Gatesgarth) layers won't build clean until: Glowforge's servers, the dependency ForgeFIRM exists to cut. Its slot is filled by `forgectrl` (github.com/ScottW514/forgectrl — the ForgeFIRM control daemon; camera MJPEG service today, hardware status/control and - GRBL-vs-cloud mode selection planned) plus the grblHAL controller - (recipe still pending, backlog item). + GRBL-vs-cloud mode selection planned) plus the `grblhal-glowforge` + motion controller (both in the images with boot autostart). --- diff --git a/meta-forgefirm/recipes-forgefirm/grblhal-glowforge/grblhal-glowforge.bb b/meta-forgefirm/recipes-forgefirm/grblhal-glowforge/grblhal-glowforge.bb new file mode 100644 index 0000000..f769efe --- /dev/null +++ b/meta-forgefirm/recipes-forgefirm/grblhal-glowforge/grblhal-glowforge.bb @@ -0,0 +1,30 @@ +DESCRIPTION = "grblHAL motion controller for the Glowforge factory board" +HOMEPAGE = "https://github.com/ScottW514/grblHAL-glowforge" + +LICENSE = "GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=3237e48bcef3455c7bea5c0ce16206f6" + +PV = "0.1.0" + +# gitsm: the grblHAL core rides as a submodule (ScottW514/core, branch +# forgefirm, carrying the settings-write crash fix PR'd upstream). +SRC_URI = "gitsm://github.com/ScottW514/grblHAL-glowforge.git;protocol=https;branch=main" +# Pinned; bump deliberately after pushing grblHAL-glowforge changes. +SRCREV = "c421f20281bb399bdbb65a45e355b3d4ca912d1d" + +SRC_URI += "file://grblhal.init" + +S = "${WORKDIR}/git" + +inherit cmake update-rc.d + +INITSCRIPT_NAME = "grblhal" +INITSCRIPT_PARAMS = "defaults 92" + +do_install:append() { + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/grblhal.init ${D}${sysconfdir}/init.d/grblhal +} + +# The controller streams into /dev/glowforge (glowforge.ko) at runtime. +RRECOMMENDS:${PN} = "kernel-module-glowforge" diff --git a/meta-forgefirm/recipes-forgefirm/grblhal-glowforge/grblhal-glowforge/grblhal.init b/meta-forgefirm/recipes-forgefirm/grblhal-glowforge/grblhal-glowforge/grblhal.init new file mode 100644 index 0000000..bdc7d3e --- /dev/null +++ b/meta-forgefirm/recipes-forgefirm/grblhal-glowforge/grblhal-glowforge/grblhal.init @@ -0,0 +1,36 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: grblhal +# Required-Start: $local_fs +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: grblHAL motion controller (Grbl over TCP:23) +### END INIT INFO + +DAEMON=/usr/bin/grblHAL_glowforge +PIDFILE=/var/run/grblhal.pid +LOG=/data/glowforge.log + +case "$1" in + start) + echo "Starting grblHAL" + start-stop-daemon -S -q -p $PIDFILE -m -b -x /bin/sh -- \ + -c "cd /data && GFSINK=/dev/glowforge exec $DAEMON -p 23 -e /data/EEPROM-glowforge.DAT >> $LOG 2>&1" + ;; + stop) + echo "Stopping grblHAL" + start-stop-daemon -K -q -p $PIDFILE + rm -f $PIDFILE + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac +exit 0 diff --git a/meta-forgefirm/recipes-forgefirm/images/forgefirm-image.bb b/meta-forgefirm/recipes-forgefirm/images/forgefirm-image.bb index 8f68a8b..b650dc9 100644 --- a/meta-forgefirm/recipes-forgefirm/images/forgefirm-image.bb +++ b/meta-forgefirm/recipes-forgefirm/images/forgefirm-image.bb @@ -10,7 +10,8 @@ DESCRIPTION = "OpenGlow/ForgeFIRM image for Glowforge" # backlog #5). IMAGE_INSTALL:remove = "gfui-client" +# grblhal-glowforge: the grblHAL motion controller (Grbl over TCP:23). # forgectrl: the ForgeFIRM control daemon (camera MJPEG service on :8080). # v4l-utils provides media-ctl / v4l2-ctl for the imx-media pipeline (also a # forgectrl runtime dependency, kept explicit here for bring-up use). -IMAGE_INSTALL:append = " forgectrl v4l-utils" +IMAGE_INSTALL:append = " grblhal-glowforge forgectrl v4l-utils"