Files
firmware/config.env.example
T
Oleksandr ShyshatskyiandClaude Opus 5 a5300bde12 Split the repo into ship / build / test lanes, and add the printer replica
Two strands, both landing here because they had grown into each other in the
working tree.

The printer replica: the printer's real rootfs.squashfs chrooted under
qemu-mipsel, with /usr/prog and /usr/data from the factory image, so a package
is installed by FlashForge's own updater running on the printer's own busybox,
tar, md5sum and unTar. There are no stubs -- if the real prog partition is
missing the harness refuses to run rather than test against mocks. A release
workflow is blocked on it.

The lanes: a file's directory now says whether it can ever reach a printer.

  payload/, assets/   ship
  bin/, profiles/     build the package
  test/, docs/        neither, ever

  * the replica's own infrastructure moved out of bin/ and docker/ and in
    beside the harness it belongs to (test/extract-rootfs.sh,
    test/build-printer-image.sh, test/printer/Dockerfile{,.full})
  * the Makefile has two runners: only RUNSIM gets the docker socket and the
    replica's variables, so a build cannot reach the docker daemon at all
  * replica settings moved to test.env, which nothing in a package reads
  * build-time flags renamed BUILD_* (APPLY, REPORT, KLIPPER, TOOLCHANGE,
    MAINSAIL, HELIX). MOD_* now means only the runtime switches written into
    anvil.conf and re-read by the printer at every boot
  * verify.sh fails if any file in a package is byte-identical to one in
    bin/, test/, docker/ or profiles/ -- by content, because a name blacklist
    would trip over whatever Mainsail happens to call common.sh

Fixed while mapping it:

  * BUILD_REPORT was read only inside the BUILD_APPLY=0 branch, so four
    profiles declared it and got nothing. It is honoured on both paths now,
    and off outside probe: report.sh copies /etc, passwd and shadow onto the
    USB stick, which is a diagnostic, not something to hand out.
  * three checks in the brick lint had been quietly dead. Two were guarded on
    a payload/boot.sh replaced by the firmwareExe wrapper long ago; the third
    was the file glob itself, which matched neither firmwareExe nor the
    init.d/S* scripts -- the UI wrapper and every service went unscanned. A
    missing file is now a failure rather than a silent pass.
  * run-tests.sh overwrote config.env and copied it back, leaving the config
    you edited one crashed run away from being a fixture. It uses CONFIG_ENV.
  * bin/make-uninstall.sh does not exist and never did; README, run-pre.sh and
    full.env all pointed at it. Recovery is the stock package, which is what
    test-recovery actually proves.

README is now for someone who wants to flash their printer: what it is, which
file, how to flash, what to do when it goes wrong. The rest moved to
docs/how-it-works.md, docs/building.md and docs/testing.md.

make test: 89 passed, 0 failed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-23 14:30:09 +03:00

91 lines
4.5 KiB
Bash

# creator5-fw-builder — build configuration
# Edit paths to match your machine, then run ./build.sh
# ---- 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 web
# Build both at once: make release PROFILE=web
# ---- 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"
# Set this only to force one specific package regardless of model.
STOCK_TGZ=""
# Extracted stock software component -- the BASE our overlay is applied onto.
STOCK_SOFTWARE="$DESKTOP/software-1.9.8.tar_2026-08-21_7045c47d__md5-8e12dbbd961f0821bd7895f902563238/software-1.9.8"
# Your Klipper fork (branch creator5) -- klippy tree + prebuilt MIPS c_helper.so
KLIPPER_FORK="$DESKTOP/klipper"
# Toolchanger mod repo (klippy-extras + configs + helixscreen db entry)
TOOLCHANGE="$DESKTOP/creator5-toolchange"
# HelixScreen release tarball for the Creator 5 (MIPS static)
HELIX_TGZ="$DESKTOP/helixscreen-creator5-v0.99.115.tar.gz"
# Optional extras -- leave empty to skip that feature
MAINSAIL_ZIP="$PWD/assets/mainsail.zip" # scripts/fetch-mainsail.sh writes vendor/mainsail.zip
BUSYBOX_BIN="$DESKTOP/creator5/busybox" # optional richer busybox
# ---- what the installed image does at boot (baked into anvil.conf) ----------
# RUNTIME switches: 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 BUILD_* flags that decide what goes INTO a package (BUILD_KLIPPER,
# BUILD_MAINSAIL, BUILD_HELIX, BUILD_TOOLCHANGE, BUILD_APPLY, BUILD_REPORT)
# are owned by profiles/*.env and are deliberately not set here: the profile is
# sourced after this file and would override anything you put in.
MOD_UI=stock # stock | helix -- which UI owns the screen
MOD_WEB=1 # 1 = start nginx (Mainsail) + moonraker
MOD_SSH=1 # 1 = start dropbear on port 22
# ---- 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 = keep FlashForge's stock hash (nobody can log in).
# Generate one with: openssl passwd -6 'yourpassword'
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