mirror of
https://github.com/Klipper4FlashForge/firmware.git
synced 2026-10-23 13:52:16 -05:00
MOD_WEB, MOD_CAM, MOD_UI, MOD_SSH and MOD_WIFI all defaulted to on, and what
each one really offered was a half-installed printer: Mainsail with no
moonraker behind it, a camera that would not stream, a screen dark on purpose,
a root password deliberately not set on a machine whose entire recovery story
is "ssh in". Nobody wants those states. What someone who sets one actually
wants is a stock printer, and that is one FlashForge package away.
What they cost was a second answer to every question. Each init script carried
a gate, each `down` file argued its existence from a flag rather than from the
ordering that was the real reason, and anvil.conf had five lines that told a
user they had a choice.
MOD_SSH was the clearest case: it never turned ssh off. dropbear is the
rootfs's own and listens either way, so all the flag did was decline to set a
password.
Each gate is replaced by the fact it was standing in front of, not by a
constant:
S60nginx, S62moonraker nothing -- the web stack is what this mod is
S65camera there is no video device, which the script already
finds out and reports
S50wifi there is no $WIFI_CONF, likewise
S80ui HelixScreen is not installed, which was already the
other half of the condition
To leave a piece out, leave it out: BUILD_MAINSAIL, BUILD_MOONRAKER and
BUILD_HELIX decide what goes into a build, and `opkg remove` decides what stays
on a printer. What survives in anvil.conf is what has a range rather than a
state -- MOD_CAM_RES/FPS/PORT and the NICE_* priorities -- plus MOD_SPLASH,
MOD_STARTUP, MOD_IMPORT and MOD_S6, which are untouched here.
The `down` files stay. They were argued from MOD_WEB and MOD_CAM, but the
argument never depended on them: s6-svscan starts a service the instant the
directory appears, which is before any init script has checked a prerequisite.
Their text now says so.
Measured: `make build` produces a payload with no live read of any of the five,
and qa-static is 265 passed with shellcheck over the edited init scripts. The
test suite still exercises the removed flags and has not been updated.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gKRUCqj18TVF1Vz1oMpmC
125 lines
6.6 KiB
Bash
125 lines
6.6 KiB
Bash
# creator5-fw-builder — build configuration
|
|
# Edit paths to match your machine, then run `make build`.
|
|
|
|
# ---- identity of the package you are building -------------------------------
|
|
MOD_NAME=anvil # goes into the .tgz filename
|
|
MOD_VER="" # empty = today's UTC date, e.g. 20260823.
|
|
# Pin it to rebuild an old release, or for a
|
|
# second release on the same day (20260823b).
|
|
|
|
# Version stamped on the software component. Empty = keep the stock number
|
|
# (recommended). The installer wipes every other version dir before renaming
|
|
# its temp dir, so a collision is not a problem; a suffix like 1.9.7-mod is
|
|
# only useful if you want to see at a glance that a machine is modded.
|
|
SW_VER=""
|
|
|
|
# ---- which printer is this for? --------------------------------------------
|
|
# Creator5Pro / 0029 or Creator5 / 0028
|
|
# Find it on the printer: Settings -> About, or in
|
|
# /usr/data/firmwareRes/config/general.json ("machineName").
|
|
#
|
|
# This MUST match the model the stock package was built for. A package's
|
|
# runFirmwareExe.sh carries its own MACHINE=/PID= gate and refuses to install
|
|
# on the other model, so a Pro cannot be recovered or modded with a non-Pro
|
|
# package (and vice versa).
|
|
TARGET_MACHINE=Creator5Pro
|
|
|
|
# Override for one command: MODEL=Creator5 make build
|
|
# Build both at once: make release
|
|
|
|
# ---- inputs (sources you already have on this machine) ----------------------
|
|
# Everything below is relative to this. Point it wherever you keep the
|
|
# firmware and the source repos; nothing here is committed (config.env is
|
|
# gitignored, this file is the template).
|
|
DESKTOP="$HOME/Desktop"
|
|
|
|
# Stock OTA packages, ONE PER MODEL. They are not interchangeable: each
|
|
# carries a different firmwareExe and refuses to install on the other model.
|
|
# The one matching TARGET_MACHINE (or MODEL=) is selected automatically.
|
|
STOCK_TGZ_CREATOR5PRO="$DESKTOP/Creator5-1.9.7-1.2.9-20260810/Creator5Pro-1.9.7-1.2.9-20260810.tgz"
|
|
STOCK_TGZ_CREATOR5="$DESKTOP/Creator5-1.9.7-1.2.9-20260810/Creator5-1.9.7-1.2.9-20260810.tgz"
|
|
|
|
# Set this only to force one specific package regardless of model.
|
|
STOCK_TGZ=""
|
|
|
|
# KLIPPER_FORK USED TO BE HERE and pointed the build at a local checkout of
|
|
# the fork. It is gone: the Klipper build is pkg/klipper now, and a recipe
|
|
# names its source exactly once -- a checkout beside the pinned tarball is the
|
|
# second source that rule forbids, and the one that let a release ship a tree
|
|
# nobody had built. To build your own fork, put its tarball in vendor/ and
|
|
# re-pin KLIPPER_VERSION and KLIPPER_SHA256 in versions.env; the sha is then
|
|
# the same guarantee every other source in this repo carries.
|
|
|
|
# The toolchanger mod (klippy-extras + configs + helixscreen db entry) used to
|
|
# be a TOOLCHANGE= path to a creator5-toolchange checkout. It now lives in this
|
|
# repo under payload/klipper/, so there is nothing to set. BUILD_TOOLCHANGE=0
|
|
# here still turns it off.
|
|
|
|
# Mainsail, the HelixScreen build for the Creator 5 (MIPS static) and Moonraker
|
|
# are NOT set here. They are downloaded on demand into vendor/ by
|
|
# bin/fetch-assets.sh, pinned by version and sha256 in versions.env, so the
|
|
# repo carries no binaries. Set any of these ONLY to build against your own
|
|
# local copy.
|
|
# NOTE: the path is still checksummed against versions.env, and on a mismatch
|
|
# fetch-assets.sh OVERWRITES it with the pinned release -- SKIP does not save
|
|
# you, it re-downloads too. To build against your own file, also put ITS
|
|
# sha256 in versions.env; only an exact match is left alone ("cached"):
|
|
#HELIX_TGZ="$DESKTOP/helixscreen-creator5-v0.99.115.tar.gz"
|
|
#MAINSAIL_ZIP="$DESKTOP/mainsail.zip"
|
|
#MOONRAKER_TGZ="$DESKTOP/moonraker-v0.9.3.tar.gz"
|
|
|
|
# Optional extras -- leave empty to skip that feature
|
|
BUSYBOX_BIN="$DESKTOP/creator5/busybox" # optional richer busybox
|
|
|
|
# ---- what the installed image does at boot (baked into anvil.conf) ----------
|
|
# RUNTIME tunables: they are written into /usr/data/anvil/anvil.conf, which the
|
|
# printer re-reads at every boot, so they can be changed over ssh afterwards.
|
|
#
|
|
# THE ON/OFF SWITCHES ARE GONE. MOD_WEB, MOD_CAM, MOD_UI, MOD_SSH and MOD_WIFI
|
|
# were all here, all defaulted to 1, and all described a half-installed
|
|
# printer: Mainsail but no moonraker behind it, a screen that is dark on
|
|
# purpose, a root password deliberately not set on a machine whose recovery
|
|
# story is ssh. The web stack, the camera, the screen and wifi now start
|
|
# because they are installed. To leave a piece out, leave it out -- the BUILD_*
|
|
# flags below decide what goes INTO a package -- or `opkg remove` it on the
|
|
# printer.
|
|
#
|
|
# The BUILD_* flags that decide what goes INTO a package (BUILD_TOOLCHANGE,
|
|
# BUILD_MAINSAIL, BUILD_MOONRAKER, BUILD_HELIX) are not set
|
|
# here: bin/common.sh defaults them to the full firmware, and setting one in
|
|
# this file overrides that. Only touch them if you want a piece left out.
|
|
|
|
# Nice values for the services that share the SoC with klippy: they yield to
|
|
# it, so a busy host is less likely to miss Klipper's step deadlines (which
|
|
# surfaces as an MCU "Timer too close" shutdown, not as slowness). Baked into
|
|
# anvil.conf, and editable on the printer afterwards. 0 = normal priority.
|
|
# See the long note in payload/anvil.conf before changing these: klippy is
|
|
# already SCHED_FIFO plus a nice -20 reader thread, so these are insurance.
|
|
NICE_MOONRAKER=5 # the print path -- keep it modest
|
|
NICE_CAM=10 # pure background; software JPEG encode is heavy
|
|
|
|
# ---- root login shipped in the image ---------------------------------------
|
|
# This is the whole "enable ssh" feature. The stock rootfs already runs
|
|
# dropbear from /etc/init.d/S50dropbear, so port 22 is ALREADY open on a
|
|
# stock printer -- there is simply no published root password.
|
|
#
|
|
# Empty = the INSTALLER picks a random password on the printer -- on the
|
|
# FIRST install only, updates keep the one the machine already has -- and
|
|
# writes it to anvil-password.txt on the USB stick you flashed from. Every
|
|
# machine gets a different one, which a hash baked into a shared package
|
|
# never could.
|
|
# Set one here to choose your own: make passwd
|
|
# (it prompts, and runs inside the build image -- the same python everywhere,
|
|
# where a host openssl may lack `passwd -6` entirely)
|
|
ROOT_PW_HASH=""
|
|
|
|
# ---- crypto (from /usr/prog/bin/unTar on the printer) -----------------------
|
|
FF_KEY='FFP0331&*%root'
|
|
|
|
# ---- the printer replica -----------------------------------------------------
|
|
# Nothing here. The replica's settings -- the factory image, the partition
|
|
# sizes, a prebuilt printer image -- live in test.env, because they exist only
|
|
# for the tests and must never reach a printer:
|
|
#
|
|
# cp test.env.example test.env
|