mirror of
https://github.com/Klipper4FlashForge/firmware.git
synced 2026-10-22 05:12:16 -05:00
The software component existed to give the mod one exec hook. It is not needed for that any more, so a release now carries our installer and our payload and nothing else: 26MB smaller, 21MB of which was FlashForge's own firmwareExe travelling back to the partition it was already on, along with their klippy tree, their wifi module and their configs. WHAT IT GIVES BACK. /usr/prog/PROGRAM/software is no longer rewritten, so the version directory there stays FlashForge's with their genuine firmwareExe inside it -- and app_startup.sh's five-second watchdog, which copies one out of that directory when nothing by that name is running, has something to copy again. A printer whose payload fails to install now comes up on the stock UI instead of a blank screen. That recovery has been broken since we started deleting their binary out of a component we shipped; docs/how-it-works.md claimed it worked throughout. THE ROOT PASSWORD moves with it, because it used to ride in the component's shadow file. bin/pack.sh bakes ROOT_PW_HASH into the installer, single-quoted -- an unquoted $6$... would have the printer's shell expand $6 as a positional parameter and ship a truncated hash -- and the installer writes it to /usr/prog/etc/shadow. The random-password path asks one question instead of four: FlashForge ship the same root hash on every machine, so a live shadow still carrying it means nobody has set a password and it is ours to set. The .prev-root-hash recording, the shipped-vs-live comparison and the restore-it- afterwards step were all machinery for surviving a file that nothing overwrites any more, and are gone. pack.sh checks the hardcoded constant against the stock package it built from, because getting it wrong is silent and total: every printer would read as "already set" and none would ever get a password. bin/patch.sh is bin/payload.sh. It patched nothing any more -- no splice, no shadow edit, no firmwareExe deletion -- and what is left is the payload: the feed installed by the printer's own opkg, the seeded config, the manifest. Its sections are renumbered 1-5 with no gaps, and the five tombstone comments marking where removed sections used to be are gone with them. test_recipe_layout.py loses six of its nine tests. Each compared the tree against a description of the tree -- no fourth directory kind, each kind still used, 3rdparty carries no files of ours, installer/ holds exactly two named files -- and none could go red for a reason a printer would notice, while all six went red the moment the layout legitimately changed. The two that bite are kept: a payload/ path escaping $MODDIR, and a recipe name at both levels, which makes pkg_dir silently build the wrong package. SW_VER is deleted from config.env.example and both workflows: it stamped a component that is not built. Gates: 112 static tests pass. The generated installer is verified after substitution -- all four lines present, and `sh -n` over the result, because a hash with a stray character in it would otherwise reach a printer as a syntax error whose only symptom is a package that installs nothing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CH7Yb4wuPhnppHAB25UX7e
61 lines
3.6 KiB
Plaintext
61 lines
3.6 KiB
Plaintext
# anvil-python -- CPython, cross-compiled for the printer.
|
|
#
|
|
# WHY THERE IS A SECOND PYTHON ON THIS MACHINE AT ALL. FlashForge built its
|
|
# 3.8.2 without _sqlite3, and that single omission is what pins
|
|
# MOONRAKER_VERSION to a 2023 commit: every Moonraker from v0.9.0 on keeps its
|
|
# database in sqlite. This interpreter has a working sqlite3, which is what
|
|
# eventually unpins it.
|
|
#
|
|
# THE PREFIX IS COMPILED IN, exactly as it is for s6. sys.prefix and the stdlib
|
|
# search that follows from it are baked in at configure time, so moving the
|
|
# directory on the printer breaks the interpreter -- it has to be rebuilt, not
|
|
# renamed. That is also the argument for putting it in $MODDIR with everything
|
|
# else rather than somewhere private: there is one prefix to keep stable, not
|
|
# two.
|
|
#
|
|
# ONLY bin/python3.13 SHIPS, and the name matters. payload/anvil-env.sh
|
|
# PREPENDS $MODDIR/bin to PATH (s6-svscan execs s6-supervise by name off PATH,
|
|
# so it has to), so a bin/python3 of ours would sit AHEAD of FlashForge's for
|
|
# every process that sources it, and anything saying `python3` rather than
|
|
# "$FF_PYTHON" would silently change interpreter. `make install` creates that
|
|
# symlink, plus idle3, pydoc3 and the *-config scripts; build.sh names the one
|
|
# binary it ships and the rest are simply never copied out of the staging tree.
|
|
PKG_NAME=anvil-python
|
|
PKG_VERSION="$PY_VERSION"
|
|
PKG_RELEASE=1
|
|
PKG_SECTION=lang
|
|
|
|
PKG_EXCLUDE=".version"
|
|
|
|
# NO Depends, AND THAT IS A MEASURED CLAIM RATHER THAN AN OVERSIGHT. Every C
|
|
# library this interpreter uses is linked in STATICALLY -- see build.sh -- so
|
|
# the only shared objects it needs are the printer's own libc, libm, libdl,
|
|
# libpthread and libatomic.so.1, all of which are on the stock rootfs. Nothing
|
|
# in this feed has to be installed first.
|
|
PKG_DEPENDS=""
|
|
|
|
# SEVEN LIBRARIES, AND EACH ONE IS EXACTLY ONE stdlib MODULE. openssl is _ssl
|
|
# and _hashlib, sqlite is _sqlite3, zlib is zlib, libffi is _ctypes, xz is
|
|
# _lzma, bzip2 is _bz2, expat is pyexpat. build.sh gates all seven by name
|
|
# after the build, because CPython's answer to a library it cannot link is to
|
|
# record the module as absent and CARRY ON -- a silent success that produces an
|
|
# interpreter missing the one module this package exists for.
|
|
PKG_BUILD_DEPENDS="openssl sqlite zlib libffi xz bzip2 expat"
|
|
|
|
# THE HEADERS ARE THE POINT OF THE DEV SPLIT HERE, more than anywhere else in
|
|
# this feed. The eighteen pkgs/3rdparty/python-* recipes cross-compile C extensions
|
|
# against them, and before this package existed they reached them by building
|
|
# inside bin/payload.sh at the one moment an untrimmed staging tree happened to
|
|
# be on disk. A -dev package is that moment made durable: the headers are in
|
|
# the feed, a wheel recipe names `python` as a build dependency and gets them,
|
|
# and a printer -- which builds no extension modules -- installs none of it.
|
|
#
|
|
# config-3.13-* comes along because sysconfig's LIBPL points into it, and a
|
|
# sysconfig answering with a directory that does not exist is the kind of thing
|
|
# a future setuptools notices. libpython3.13.a is deleted in build.sh rather
|
|
# than shipped inside it: 35MB of static archive that nothing links.
|
|
PKG_DEV_FILES="include lib/pkgconfig lib/python$PY_MM/config-$PY_MM-*"
|
|
PKG_DEV_DESCRIPTION="CPython headers and build configuration for mipsel. This is what the pkgs/3rdparty/python-* recipes compile their C extensions against; nothing installs it on a printer."
|
|
|
|
PKG_DESCRIPTION="CPython $PY_VERSION for the printer, with sqlite3, ssl, lzma, bz2, ctypes and expat linked in statically. Installs as bin/python3.13 -- never as python3, which would shadow the stock interpreter on PATH."
|