Files
firmware/config.env.example
T
Oleksandr ShyshatskyiandClaude Opus 5 607e6595fb Start the camera ourselves: mjpg-streamer was on the disk all along
Correcting the previous commit, which said the :8080 stream could not be
restored without cross-compiling a streamer. Both halves are actually true:

  * firmwareExe really did serve the stream itself -- its own accept loop,
    `GET /?action=stream`, boundarydonotcross, even announcing
    `Server: MJPG-Streamer/0.2` -- so killing it does take the camera down.
  * ...but /usr/prog/mjpg-streamer/ ships the genuine article: mjpg_streamer,
    input_uvc.so, output_http.so, its own libjpeg.so.9 and www/.
    app_startup.sh:159 exports LD_LIBRARY_PATH for it and then never launches
    it. Nothing needs building; the binary just needs starting.

S65camera does that, on the S50wifi pattern -- the wait for /dev/video0 and the
respawn loop run in a background subshell, so a printer with no camera plugged
in never holds up Klipper or the UI. stop() kills the supervisor before the
streamer, or it would come back three seconds later.

Two details are load-bearing and easy to lose: libjpeg.so.9 lives in the
mjpg-streamer directory, so without LD_LIBRARY_PATH the binary dies on a
missing shared object (the same trap moonrakerDaemon has in S60web); and the
plugin .so names resolve against the working directory, hence the cd.

nginx proxies it at /webcam/ with buffering off and no read timeout, since
MJPEG is one endless response, and moonraker.conf's [webcam] entry uses
relative URLs through that proxy -- so one forwarded port carries the stream,
tunnels included. MOD_CAM=0 turns it off; MOD_CAM_RES/FPS/PORT tune it.

The earlier claim is corrected in docs/notes/25 and in the README, which no
longer lists the camera as something you give up.

Verified: parses under the printer's own busybox ash, lint-danger clean. The
full suite was not re-run to completion -- the working tree is being edited
concurrently and a build lane raced it (tar: file changed as we read it).
bin/patch.sh's MOD_CAM line is deliberately left out of this commit for the
same reason.

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

100 lines
5.1 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 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"
# 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"
# 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 and the HelixScreen build for the Creator 5 (MIPS static) 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 either of these ONLY to build against your own local copy --
# an explicit path is used as-is and is never downloaded or checksummed:
#HELIX_TGZ="$DESKTOP/helixscreen-creator5-v0.99.115.tar.gz"
#MAINSAIL_ZIP="$DESKTOP/mainsail.zip"
# 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 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) 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 package with a piece left out.
MOD_WEB=1 # 1 = start nginx (Mainsail) + moonraker
MOD_CAM=1 # 1 = start mjpg-streamer on :8080 (firmwareExe used to)
MOD_SSH=1 # 1 = start dropbear on port 22
MOD_WIFI=1 # 1 = bring up wlan0 (firmwareExe used to do this)
# ---- 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 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: 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