next: refresh to main + afw OS bundle (install/uninstall, GUI, genuine-firmware restore) #29

Merged
noah merged 124 commits from release/next-refresh into next 2026-11-11 17:33:02 -07:00
Owner

Refreshes the stale next branch to current main and lands the afw-os-bundle work so next.yml can cut a proper pre-release.

  • Merges current main into next (next was behind since 2026-10-21), then the afw-os-bundle feature.
  • afw-os-bundle: network install/uninstall of alkane-os, the GUI right-click install (release picker) + uninstall (restore to stock), and restore-to-stock from genuine Bitmain vendor firmware files (no carved blobs), hardware-verified on the bench S17.
  • CI: a restricted read-only token is baked into GUI release builds from the ALKANE_EMBEDDED_TOKEN secret.

Verified locally on the merged tree: wx-rs patch queue reproduces the tree, GUI + workspace build, clippy clean (both CI command sets), unit tests pass, headless GUI self-test passes.

Merging this to next triggers next.yml to build the platform archives and cut the private pre-release.

Generated with Claude Code

https://claude.ai/code/session_01B1W6qKwKxq3oUPDKWicM6i

Refreshes the stale next branch to current main and lands the afw-os-bundle work so next.yml can cut a proper pre-release. - Merges current main into next (next was behind since 2026-10-21), then the afw-os-bundle feature. - afw-os-bundle: network install/uninstall of alkane-os, the GUI right-click install (release picker) + uninstall (restore to stock), and restore-to-stock from genuine Bitmain vendor firmware files (no carved blobs), hardware-verified on the bench S17. - CI: a restricted read-only token is baked into GUI release builds from the ALKANE_EMBEDDED_TOKEN secret. Verified locally on the merged tree: wx-rs patch queue reproduces the tree, GUI + workspace build, clippy clean (both CI command sets), unit tests pass, headless GUI self-test passes. Merging this to next triggers next.yml to build the platform archives and cut the private pre-release. Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01B1W6qKwKxq3oUPDKWicM6i
noah added 123 commits 2026-11-11 17:24:44 -07:00
Speed Toolkit CI with scoped PR checks and bounded compiler caching
Use bounded Rust cache on Toolkit main and next
The vendored wxWidgets 3.3.3 tree was missing 44 files of the pinned release
tarball (pnglibconf.h, PCRE2's configure and libtool files, libtiff build/):
the tarball ships nested .gitignore files, so a plain git add dropped them.
Linux links the system libpng/pcre2 and never noticed; the builtin libraries
the Windows build uses need them. The tree now matches the tarball
(sha256 81b09d6d...) byte for byte; VERSION says how to re-vendor safely.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The queue had drifted from the patched tree it describes: 0003 predated
rounds 12-19 of bridge work, 0005 no longer applied on top of it, and the
Cargo.toml note and the case-duplicate readme.md were in no patch at all.
Vendor the pristine crates.io crate (sha256 pinned in VERSION) and add
scripts/wx_rs_patches.py: 'check' rebuilds the tree from upstream + patches
and requires an exact match, 'capture' records an edit as the next patch.
0002/0003 are regenerated to the current bridge files (0005's GTK tooltip
fix is folded into 0003); 0005 now carries the packaging leftovers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Build: the wx-rs build script chose the platform with cfg!(), which in a
build script describes the build host, so a Linux-to-Windows build took the
GTK path. It now reads CARGO_CFG_TARGET_*, and Windows/GNU builds through
wx-config exactly like GTK, against a static wxMSW from
scripts/build-wx-windows.sh. The C++ runtime is linked statically, so the
.exe imports only Windows system DLLs. crates/alkane-gui/build.rs embeds an
application manifest (Common Controls v6, per-monitor DPI v2, UTF-8 code
page, Windows 10/11), the icon and version info.

Bridge on wxMSW (patches 0007/0008):
- the upstream frame's invisible "OSX key events" child sat above the UI on
  MSW and swallowed every click and key; it is no longer created there
- light/dark is chosen before the first window (wxMSW ignores it later) and
  follows the Windows app mode, with dark grid rules for the data view
- the generic wxDataViewCtrl gets mouse input in its inner main window, so
  drag-select and the per-cell / per-icon tooltips bind there (GTK keeps
  its native GtkTreeView paths; the icon hit-test is shared)
- sizes cross the Rust/C++ boundary in DIPs (identity on GTK), so columns,
  icons, KPI cards and the status bar scale at 125-200 %
- vector shapes go through GDI+ (anti-aliased like Cairo on GTK); selected
  rows use the themed list-view text colour like the native renderer
- the frame never opens larger than the monitor work area; title-bar icon
  from the executable; upstream menu insert no longer reads UTF-8 as UTF-16

App: OS differences live in alkane_core::platform (settings in
%APPDATA%\alkane-toolkit, owner-only secret files, NUL, console-less helper
processes). SSH password logins use SSH_ASKPASS with the toolkit itself as
the helper on every platform, replacing sshpass, which Windows lacks.
Release builds are GUI-subsystem; headless modes attach to the parent
console.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ci/windows-ci.sh is the one definition of every Windows step (toolchain,
  clippy, build, tests and UI self-test under Wine, packaging, test bundle);
  verify, release and next only call it.
- release.yml: a windows job builds, tests and packages
  alkane-toolkit-vX.Y.Z-windows-x86_64.zip; the release job waits for it
  and attaches the zip next to the Linux tarball. next.yml does the same
  for -rc candidates, verify.yml runs the Windows gates on PRs.
- windows-native.yml (advisory, never gates a release) runs main's
  cross-built unit tests and UI self-test on real Windows 11 through the
  self-hosted VM runner (label alkane-windows).
- CI image: ci/images/alkane-ci.Dockerfile layers mingw-w64, Wine with a
  ready prefix, the rustup target and a prebuilt wxMSW prefix on the
  previously verified image; ci/images/build-image.sh pushes it and pins
  the digest. wx prefix/cache scripts take a linux|windows argument.
- CI checks the wx-rs patch queue; versioning treats the GUI build script,
  Windows resources and assets as release-relevant; the workflow contract
  test covers the Windows gates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merge pull request 'Add a native Windows build, tested and released by CI' (#15) from windows-port into main
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The documentation- and workflow-only PR checks grepped every tracked file
for private-key headers, so the test fixtures inside vendored upstream
crates (openssl, rustls-pemfile, aws-lc) failed every such PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ci/sign-windows.sh signs alkane-toolkit.exe from Linux with jsign through
  the blueflaresigning account (RFC 3161 timestamped), using the
  least-privilege CI service principal alkane-toolkit-ci-signer. It is a
  no-op until the repository variable AZURE_SIGNING_PROFILE names a
  certificate profile; after that any signing failure fails the build.
- release.yml and next.yml sign before packaging; windows-native.yml checks
  the signature with Get-AuthenticodeSignature on real Windows and requires
  Valid once signing is on.
- CI image adds a Java runtime and a checksum-pinned jsign 7.6 (re-pinned);
  windows-ci.sh fetches the same jar on older images.
- scripts/enable-windows-signing.sh turns signing on after Microsoft
  approves the publisher identity validation: creates the PublicTrust
  certificate profile, narrows the signer role to it, sets the variable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signing is now on (Azure Artifact Signing profile alkane-toolkit); the README
tells site users how to confirm the Blueflare signature, or that an unsigned
build will trip SmartScreen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VNish reports the 88-chip S19 as "Antminer S19 (88)", which asic-rs parses
to an Unknown model with no hardware table. The VNish backends sized the
board list from that table, so all three live chains were dropped and the
Health column drew no hashboard icons for hashing miners; the same model also
got an Unknown hash algorithm. Size boards from the chains the miner reports
when the table is missing, and infer the algorithm from the Antminer family
letter (helper shared with the stock backend). asic-rs patch 0034.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AGENTS.md, HANDOFF.md, code-review-report.md, the implementation plan and the
aftermarket parity roadmap described the internal bench, its addresses and
in-house firmware; they now live in the private miner-firmware workspace and
are git-ignored here. The remaining docs and the fixture header no longer
point at them or at local infrastructure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
https://blueflare.gitea.bluefla.re/alkane-toolkit/ is built from this repo
(gh-pages) after every main run: overview, manual, a quality dashboard and the
benchmark history, which no longer goes to alkane-benchmarks. The quality
grade is now Clippy/rustfmt plus the line-coverage band (the coverage badge's
own colour bands), not only the Clippy result, and main CI publishes the full
measurement (per-crate and per-file coverage, LOC per crate) as quality.json
for the dashboard. README badges link to their pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ten chapters in docs/manual, published at /manual/ on the project site:
getting started, scanning, the table, health icons, actions, settings and
credentials, restore to stock, export, command line, troubleshooting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merge pull request 'Own Pages site (manual, quality dashboard, benchmarks); remove internal notes' (#20) from repo-cleanup into main
build-test-release / windows (push) Successful in 7m8s
build-test-release / release (push) Successful in 15m41s
d925414bc8
Attribute coverage to crates when llvm-cov strips the crates/ prefix
source / check (pull_request) Skipped
verify / verify (pull_request) Successful in 9m42s
verify / verify-windows (pull_request) Successful in 6m29s
a4d82bf45b
The quality dashboard put every file under "other" because llvm-cov
prints paths relative to their common prefix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merge pull request 'Attribute quality-dashboard coverage to crates' (#21) from fix-crate-coverage into main
build-test-release / release (push) Successful in 13m41s
build-test-release / windows (push) Successful in 5m48s
36f12d6d4e
SSH login in the Credentials dialog; default range 192.168.1.1/24; legal publisher name
source / check (pull_request) Skipped
verify / verify (pull_request) Successful in 7m55s
verify / verify-windows (pull_request) Successful in 5m8s
8275f893dd
- Credentials dialog: new "SSH (restore)" row for the control-board SSH
  login used by the Braiins restore-to-stock. The username defaults to
  root; the password is masked and never re-displayed, and a blank
  password keeps the saved one. Reset to defaults also clears it.
  ssh-credentials.txt no longer has to be written by hand.
- Default scan range is now 192.168.1.1/24 (scans 192.168.1.0/24), and
  the range dialog's examples use that subnet.
- Windows version info, zip README, LICENSE and docs name the publisher
  as on the signing certificate: BlueFlare Energy Solutions Inc.
- Manual updated for all three.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merge pull request 'SSH login in Credentials; default range 192.168.1.1/24; legal publisher name' (#22) from ssh-login-default-range-publisher into main
build-test-release / windows (push) Successful in 6m15s
build-test-release / release (push) Successful in 14m19s
b1b7a3dbc0
macOS build: universal app for Apple Silicon and Intel, macOS 11+
verify / verify (pull_request) Successful in 7m33s
source / check (pull_request) Skipped
verify / verify-windows (pull_request) Successful in 5m48s
bb31a7befc
- scripts/build-wx-macos.sh: static, monolithic, universal (arm64 +
  x86_64) wxOSX/Cocoa 3.3.3 from the vendored tree, with wx's bundled
  image/zlib/regex/expat so the app links only system frameworks.
  Minimum macOS 11.0: current SDKs' libc++ supports nothing older.
- scripts/build-gui-macos.sh: builds both Rust targets against that
  prefix and merges them with lipo.
- ci/package-macos.py: "Alkane Toolkit.app" (Info.plist, icon, local
  network usage string), ad-hoc signed, zipped with ditto as
  alkane-toolkit-vX.Y.Z-macos-universal.zip with LICENSE and README.
- crates/alkane-gui/macos: app icon (.icns) from the same glyph as the
  Windows icon, plus the script that makes it.
- wx-rs patch 0009: macOS goes through wx-config (drops the universal
  -arch flags, maps -framework), reports logical sizes like GTK/MSW
  instead of narrowing floats to ints, and links clang's compiler
  runtime for wxOSX's @available checks.
- docs/macos.md, README and the manual's install chapter.

Verified on an M1 running macOS 27.0.1: both slices build, all
workspace unit tests pass, and the headless UI self-test passes 52/52
on arm64.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merge pull request 'macOS build: universal app for Apple Silicon and Intel, macOS 11+' (#23) from macos-build into main
build-test-release / release (push) Successful in 13m52s
build-test-release / windows (push) Successful in 6m2s
d9dc60918c
A release sets the crate version first, which changes the workspace
entries in Cargo.lock; --locked then refuses to build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On macOS several table columns showed no values until a row was
clicked. wxOSX draws custom cells without clipping to the cell, and the
segment renderer paints its zebra background over an oversized rectangle
(a column width either side, 40 px up and down) that GTK and MSW clip
to the cell. On the Mac each cell's fill painted over its neighbours.
Selected rows skip the fill, so their text came back.

On macOS the zebra is now the table's native alternating rows. AppKit
paints them under every cell in the theme's colours, and no row
carries a background attribute, so the renderer never fills. Plain
segment text uses the theme-aware list text colour instead of the
control's foreground colour.

To check rendering without screen-recording permission, the self-test
takes ALKANE_SNAPSHOT=path (macOS) and writes a PNG of the window as
the app draws it (osx_native.mm: cacheDisplayInRect). Before/after
snapshots on the M1 confirm the fix in light and dark appearance.

wx-rs patch 0010. Also folds in PR #24 (build-gui-macos without
--locked).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBRg6YCM1XXQCTnD5GF
A Bug report button between Export and Settings opens a dialog: a type
(Bug, UI change, Feature request), one text box whose first line
becomes the issue title, and "Include the recent activity log
(passwords removed)", ticked by default. Send posts the report to the
report relay (next commit), which files it as an issue in
blueflare/alkane-toolkit. The dialog then shows the issue number, and
Open issue opens it, or shows why the report was not sent with the text
kept.

The app holds no token. A report carries the app version, platform, OS
version, appearance, language and window size, plus the newest 80 log
lines (at most 16 KiB). Before the log leaves the machine,
bug_report::scrub removes values of password/token/secret-like names,
Authorization and Cookie headers, URL passwords and PEM private keys.
The request goes through the system curl, as the other HTTP actions
do. ALKANE_REPORT_URL overrides the relay address for testing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBRg6YCM1XXQCTnD5GF
tools/report-relay is a dependency-free Python service. It takes the
JSON the app's Bug report button sends, validates it (type, text,
context and log sizes), scrubs the log a second time, rate-limits (5
per client IP and 60 in all per hour, 4 in flight), neutralises
@mentions, and files one issue in blueflare/alkane-toolkit with the
labels bug/ui/feature and from-app. It stores nothing and logs one
line per report without its text.

It runs on the Gitea host behind the shared nginx at
https://gitea.bluefla.re/alkane-report/ as the scoped alkane-reporter
bot (team alkane-reporters: issues write, code read, alkane-toolkit
only). See tools/report-relay/README.md. Its tests run in verify's
unit-test step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBRg6YCM1XXQCTnD5GF
Manual: reporting a problem with the Bug report button
verify / verify (pull_request) Successful in 7m39s
source / check (pull_request) Skipped
verify / verify-windows (pull_request) Successful in 5m30s
7f2ea8a8dc
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBRg6YCM1XXQCTnD5GF
Merge pull request 'Fix macOS table cells hiding their text; Bug report button and report relay' (#26) from macos-table-and-bug-report into main
build-test-release / windows (push) Successful in 5m30s
build-test-release / release (push) Successful in 13m53s
3d1fd36811
Keep every coloured text readable in light and dark themes
verify / verify (pull_request) Successful in 7m18s
verify / verify-windows (pull_request) Successful in 4m48s
source / check (pull_request) Skipped
d22ee79159
Checked in real system dark and light mode on macOS (SkyLight theme
switch on the M1, restored afterwards), Windows 11 (the app-mode
setting, run on the VM's desktop) and Linux (Adwaita and Adwaita:dark),
measuring each screenshot's text against its background with the WCAG
contrast formula.

The app's own colours fell short on every platform. The fixed firmware
hues were 2.6 to 3.9:1 (LuxOS gold and ePIC blue on light, Alkane navy,
Braiins purple and Bixbit red on dark). The hashrate greens and
temperature purples were about 4:1, and the play/pause icons about 2:1
on light buttons.

- readable()/readable_at(): nudge a colour toward black (light theme)
  or white (dark theme), keeping its hue, until it reaches 4.5:1 for
  text (3:1 for icons) against every given background.
- palette(): green/amber/red/accent/label are made readable against the
  window, the zebra row and the KPI card; Palette::text() guards every
  computed cell colour (ratio and temperature blends, firmware hues).
- Media button icons: at least 3:1 against the theme's button face.
- macOS snapshot (wx-rs patch 0011): capture the window's frame view.
  The content view alone left unpainted areas transparent, which read
  as a white toolbar strip in dark mode. On screen the area was always
  the dark window colour.

After the change, no app-coloured text is below 4.5:1 in any of the
six theme/platform combinations. What the checker still flags is theme
chrome (grid lines, GTK header labels, button outlines, the zoom
slider) and anti-aliasing on thin fonts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBRg6YCM1XXQCTnD5GF
Merge pull request 'Keep every coloured text readable in light and dark themes' (#27) from dark-mode-contrast into main
build-test-release / windows (push) Successful in 5m13s
build-test-release / release (push) Successful in 13m38s
de5c1a5a15
Media icons: 3:1 against the button colour macOS actually paints
source / check (pull_request) Skipped
verify / verify (pull_request) Successful in 7m29s
verify / verify-windows (pull_request) Successful in 5m16s
4324d3046e
The play/pause icons on macOS light buttons were about 2.6:1, because
native macOS buttons paint #ebebeb on a white window, not the system
button-face colour the check used. Check the icons against the button
face, the window colour and a shade 20 steps toward the opposite end.
They now measure 3.1:1 on the Mac (light and dark checked in real
system appearance), and stay above 3:1 on Linux and Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBRg6YCM1XXQCTnD5GF
Merge pull request 'Media icons: 3:1 against the button colour macOS actually paints' (#28) from media-icon-contrast into main
build-test-release / windows (push) Successful in 5m32s
build-test-release / release (push) Successful in 13m30s
086c883c4a
Parse and verify the fixed-order .afw container, add the CV1835 board
module and an SSH transport with the stock update-daemon root stage, a
read-only preflight, a held p1 backup, whole-partition read-back, live
verification and network restore. Add the headless afw CLI and offline
fixtures for good, tampered, wrong-board, truncated, traversal and
oversize bundles.

Co-Authored-By: DeepSeek Harness <noreply@deepseek.com>
The am335x flash module now selects a per-tier Profile from the bundle's board:
tier 2 (am335x, preserve) or tier 3 (am335x-stock, include). The byte-write
engine, preflight and readback are shared; only the policy, preserved set,
12-partition map (mtd4 becomes a write target) and image list differ.

- boards/am335x.rs: Profile/profile_for/owns_board; MTD_MAP_STOCK (mtd4 writable,
  kernel at write_order 4 so U-Boot lands first); from_afw accepts am335x-stock,
  permits exactly the u-boot bootloader member, still rejects any SPL member and
  a u-boot member on tier 2; check_uimage expects firmware type 5 for u-boot;
  the plan carries its board + preserved set; render is tier-aware.
- restore() takes the preserved set per profile; SPL copies (mtd0-3) are never a
  restore target on any tier; mtd4 is restorable on tier 3.
- alkane-cli: route am335x-stock to the module (plan/preflight/install); restore
  is profile-driven and adds --held-uboot (mtd4) for the from-stock set.
- alkane-artifacts: board_profile knows am335x-stock (arm, include).
- tests: tier-3 from_afw acceptance (4 targets, U-Boot before kernel, mtd4 not
  preserved), wrong-U-Boot-type and SPL-write-target rejection, and a tier-3
  restore test (mtd4 allowed, SPL refused). Full flash suite 41 green; tier-2 and
  cv1835 unchanged. The real bundle parses and verifies through the CLI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qHxYpv7yf7Ah57g4rQ
Three fixes found running the real tier-3 preflight against the stock .64 board:
- preflight fingerprint ended in 'ls <our release files>' which exits 1 on a stock
  board (none exist), failing the whole command; append '|| true'.
- classify() only knew the Amlogic stock kernel (4.9.38); the AM335x stock is
  3.8.13+ with an Antminer model line - recognize both so source-os matches the
  plan's stock-bitmain.
- the mtd-map check compared the vendor label (spl/u-boot/...) to the mtdN device
  name and so always failed on real hardware; validate live geometry by index+size
  against the plan's partitions instead (labels are board-specific, not in our map).
- dry-run message now lists the real write targets from the plan (was a hard-coded
  'mtd8, mtd6 and mtd7' that omitted mtd4 on tier 3).

Preflight + dry-run now PASS against the live stock board (all 10 checks). Unit
suite still 41 green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qHxYpv7yf7Ah57g4rQ
The toolkit now flashes the Zynq update path through the CLI like am335x/cv1835.
- boards/zynq.rs: ZynqPlan::from_afw (validates the zynq-7010 .afw: armv7, preserve,
  the kernel/dtb/rootfs image set, zimage/fdt/cpio-gzip formats, size ceilings,
  rejects any bootloader/spl/BOOT.bin member and a non-zImage kernel), preflight
  (alkane source, root, flash tools, mtd0/mtd1, BOOT.bin-preserve guard), install
  (OFFSET-AWARE: nanddump/flash_erase/nandwrite --start at the device-relative
  slot offset - kernel 0x2200000, dtb 0x2700000 in /dev/mtd0, rootfs in /dev/mtd1
  - with per-region backup + md5 readback), and a hard guard that refuses any
  /dev/mtd0 write below BOOTBIN_PRESERVE so BOOT.bin can never be clobbered.
- alkane-artifacts: add the strict 'zimage' image format (magic 0x016f2818 at 0x24).
- alkane-cli: route zynq-7010 through afw plan/preflight/install.
- 6 module tests (good plan, non-zImage, oversize, bootloader member, wrong
  board/arch, every-mtd0-target-above-BOOT.bin). Full flash suite 47 green,
  artifacts green; the real bundle renders its plan through the CLI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qHxYpv7yf7Ah57g4rQ
Add the S21 Pro-class Amlogic A113D/AXG flash module to the toolkit, matching
the Zynq-7010 treatment, plus CLI routing for plan/preflight/install.

- crates/alkane-flash/src/boards/a113d.rs: A113dPlan::from_afw validates the
  verified manifest (a113d, arm64, preserve, no fip/spl/tpl/u-boot member,
  exactly kernel/dtb/rootfs with arm64-image/fdt/uimage formats, per-image
  ceilings and total <= nvdata, plus independent magic checks and a
  defense-in-depth refusal of any non-nvdata partition carrying an image).
  The installer is file-only: it resolves the anthillos/ directory on a
  mounted ubifs volume and copies the three files there with staged + read-back
  md5 verification. The brick guard is structural - there is no flash_erase,
  nandwrite or dd-to-/dev/mtd anywhere in the module, so the FIP (mtd0/1) and
  stock boot (mtd4) and mtd2/3/5 can never be touched; every destination is
  checked to be a bare basename.
- crates/alkane-flash/src/boards/mod.rs: register the module.
- crates/alkane-cli/src/main.rs: route a113d bundles through afw
  plan/preflight/install.
- crates/alkane-artifacts/src/afw.rs: correct the a113d / a113d-s21pro board
  profile from armv7 to arm64 (the A113D/AXG is an arm64 SoC).

8 new a113d unit tests; full suite: 55 alkane-flash, 12 alkane-artifacts, all
pass. End-to-end verified: make-afw.sh -> check-afw.py -> alkane-cli afw plan
on a stub a113d bundle.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qHxYpv7yf7Ah57g4rQ
Rework the a113d flash module to match the NAND-enabled image: instead of
expecting an already-mounted ubifs volume, it detects the nvdata MTD from
/proc/mtd (the only MTD our DT exposes), ubiattach-es it, discovers the UBI
volume name (never assumed), mounts it, and overwrites the three OS files under
the alkane/ directory with staged + read-back md5 verification, then unmounts
and detaches. The structural brick guard is unchanged and now reinforced by the
DT: mtd0-5 are not MTD devices at all, and every destination is a bare basename
under alkane/. Renamed the directory anthillos -> alkane throughout (receipt
reports the discovered volume). New unit test for the /proc/mtd nvdata parse;
full flash suite 56 green.

NOTE: the live attach/mount/write flow is not yet hardware-validated - it needs
a NAND-enabled a113d image staged once via the stock/dsh path to test against.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qHxYpv7yf7Ah57g4rQ
Integrate the SDK installer into the toolkit so it can put alkane-os on a
compatible miner (for now the Antminer S17 / zynq-7010) from a local .afw or an
auto-pulled latest release, and remove it (back to stock). Release host is the
self-hosted Gitea (GitHub is retired).

- FIX (brick risk): boards/zynq.rs carried the superseded stage-2 offsets
  (BOOTBIN_PRESERVE 0x2200000, kernel 0x2200000, dtb 0x2700000). Corrected to the
  live S17 / SDK-plan layout: BOOT.bin floor 0x1a00000, dtb 0x1a00000, kernel
  0x2000000 (slot 0x800000), rootfs mtd1. The tier-2 update now writes the right
  slots; test updated to the new ceiling.
- alkane-artifacts/fetch.rs: resolve and download the latest .afw for a board
  from Gitea releases/latest (curl + serde_json), token read from
  ALKANE_RELEASE_TOKEN/GITEA_TOKEN at run time and passed via a 0600 curl config,
  never argv, never stored.
- alkane-flash/stock.rs: the seam to the sealed, DSH-owned stock-side methods
  (install-from-stock, restore-to-stock). Interface only - an external
  ALKANE_STOCK_HELPER the toolkit invokes and then verifies the board itself; the
  method is never embedded, read, or reviewed here.
- alkane-cli: new `afw compat` (shows supported boards), `afw fetch-latest`,
  `afw install --latest [--board] [--from-stock]`, and `afw restore-stock`. The
  install/restore commands gate on a supported board. --from-stock routes the
  first install through the sealed helper; the default install path is the
  tier-2 update of a board already on alkane.
- docs/install.md documents the flow and the two env seams.

alkane-artifacts + alkane-flash + alkane-cli build clean, 71 tests pass, the new
files are clippy-clean (the one type_complexity warning is pre-existing in
afw.rs, untouched). No emojis.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBPjAXpCwmigUov5eQk
- fetch: resolve the latest .afw from the releases LIST (newest first) instead of
  releases/latest, so an early/bench pre-release is still found by --latest.
- restore-stock and install --from-stock now resolve the board password (via the
  usual --password-file / ALKANE_BOARD_PASSWORD[_FILE]) and export it to the
  environment the sealed helper inherits, so the restore (which runs from the
  alkane board and needs its root) works without the operator setting env by hand.

Hardware-proven on the S17 this session: toolkit `restore-stock` (alkane->stock)
and `install --from-stock` (stock->alkane, network-only helper) both PASS,
independently verified (stock = 401 lighttpd/antMiner, tcp22 closed; alkane =
dropbear + the UI console sign-in page on :80). Builds clean, tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBPjAXpCwmigUov5eQk
Replace the ALKANE_STOCK_HELPER external-helper seam with a compiled-in method
module so the toolkit installs from stock and restores to stock entirely on its
own. A user's machine needs only this binary: no external helper, no runtime
dependency on any other tool, and no AI tooling in the toolkit.

- stock.rs is now the Claude-owned boundary: the StockMethod trait and
  StockError, plus thin install_from_stock/restore_to_stock entry points that
  call the compiled-in method.
- stock_method.rs holds the network-only method bodies. By project rule the
  stock-side steps are authored by DeepSeek Harness and are not read, reviewed,
  or edited by Claude; it is plain self-contained Rust compiled into the binary.
  Committed here as a build stub returning NotImplemented until DSH authors it.
- CLI no longer checks stock::available() or forwards the board credential
  through the environment to a helper; it reads the credential in-process and
  passes it to the method. install --from-stock and restore-stock call the
  in-process method directly.
- docs/install.md drops the ALKANE_STOCK_HELPER env instructions.

The install-from-stock path is network-only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBPjAXpCwmigUov5eQk
The compiled-in network-only stock method (DSH-authored, sealed, not read or
edited by Claude) no longer embeds its ~30 MB of assets. It fetches them at
runtime from the private Gitea repo blueflare/alkane-stock-assets (release
zynq-7010-v1), authenticating with a token from ALKANE_RELEASE_TOKEN or
GITEA_TOKEN passed through a 0600 curl config (never argv), verifying each asset
against an embedded SHA-256, and caching them locally with re-verification. The
base URL is overridable via ALKANE_STOCK_ASSETS_BASE.

Result: the CLI binary drops from 31.7 MB to ~1.0 MB and the repo carries no
vendor blobs. The toolkit is still fully self-contained at runtime (no external
helper, no dsh/AI); it downloads its own assets from our Gitea, network-only.

Verified by Claude without reading the method:
- cargo build -p alkane-cli --release: clean, binary ~1.0 MB.
- cargo test -p alkane-flash: 64 passed.
- Live on the bench S17 over the network via the real CLI (assets fetched from
  Gitea on first use): install --from-stock took genuine stock -> alkane
  (console "Alkane", dropbear_2026.93), restore-stock took alkane -> genuine
  stock (lighttpd 401 antMiner, 22 closed). Board left on stock.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBPjAXpCwmigUov5eQk
install --from-stock and restore-stock fetch their per-board assets from the
private blueflare/alkane-stock-assets repo on first use, so document the
required Gitea token (ALKANE_RELEASE_TOKEN/GITEA_TOKEN, passed via a 0600 curl
config), the ALKANE_STOCK_ASSETS_BASE override, --allow-unsigned for bench
images, and --password-file for restore.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBPjAXpCwmigUov5eQk
Wire the GUI to the toolkit's own compiled-in, network-only stock<->alkane engine
(alkane-flash::stock) and the .afw fetch/verify (alkane-artifacts), so a scanned
control board can be right-clicked to:

  - Install alkane OS (from stock): scans alkane-os releases on Gitea, picks one
    (newest first; pre-releases marked), downloads+verifies the .afw, and installs
    it onto each selected board over the network. Optional board password and an
    allow-unsigned (bench) toggle; typed FLASH confirmation.
  - Uninstall alkane OS (restore to stock): restores each selected board to
    genuine stock over the network, with the board's alkane root credential and a
    typed FLASH confirmation.

Both run on a background thread (stock_ops.rs), streaming progress/results to the
status bar, and share the exclusivity guards so they never race a scan/flash/
restore. These use the same engine the CLI drives; the GUI's older asic-rs
firmware-upload path stays disabled.

alkane-artifacts: add list_releases + fetch_afw_url for the release picker, and an
optional build-time embedded read-only token (option_env!("ALKANE_EMBEDDED_TOKEN"))
so a distributed GUI can scan the private alkane-os releases with no setup; the
env token still wins, and no secret is in the source tree.

wx-rs (vendored, patched): build on system wxWidgets 3.2 - guard the 3.3-only
wxApp::SetAppearance/Appearance behind wxCHECK_VERSION(3,3,0), and emit GTK's own
shared libs (pkg-config --libs gtk+-3.0) at link time since the widget bridge
calls GTK directly. Enables the Linux GUI release build.

docs/install.md: document the GUI actions and that the stock-assets repo is now
public (no token for install/restore; only release scanning needs one).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qKwKxq3oUPDKWicM6i
Restore-to-stock now writes the genuine Bitmain stock images (parsed from a
vendor firmware package) back to NAND, instead of carrying carved stock blobs.

- stock_firmware: new parser for genuine Bitmain Antminer packages - the OTA
  update .tar.gz (outer sign wrapper -> inner fw.tar.gz) and the SD recovery
  .zip. Extracts BOOT.bin / devicetree.dtb / uImage (kernel) / uramdisk (rootfs)
  and verifies the rootfs md5 when the package lists one. Shells out to the
  system tar/unzip. Verified against real S17 packages.
- stock: restore_to_stock now takes the stock images (RestoreImages); the stock
  kernel/dtb/rootfs are no longer carried as assets. The boot regions are not
  exposed to Linux on alkane, so the existing NAND-registration helper is kept to
  make them writable, then the supplied genuine images are written at the vendor
  offsets (dtb 0x1a00000, kernel 0x2000000, rootfs; BOOT.bin preserved).
- The SD recovery image is the complete source: it includes the device tree,
  which the stock legacy-uImage kernel needs at 0x1a00000 and which the OTA
  update packages omit. Restore requires it and points the user to the SD image
  when a package has no dtb.
- Post-reboot the board returns to stock under its stock MAC and typically takes
  a new DHCP lease, so a wait on the original address is best-effort and no longer
  reported as a failure.
- cli: afw restore-stock takes --stock-firmware <file>. gui: the uninstall dialog
  takes the firmware file path.

Also clear the branch's clippy debt so the full gate passes: a type alias/allow
for the hardware map tables and multi-arg write functions, plus small mechanical
fixes (useless format, op-ref, collapsible match). wx-rs patch 0011 records the
wxWidgets 3.2 build-compat edits.

Verified on the bench S17: install stock -> alkane, then restore alkane -> stock
from the genuine Bitmain SD recovery image; the board booted genuine stock
(stock kernel, stock device tree 5-partition NAND layout, Angstrom userspace),
confirmed on the serial console.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qKwKxq3oUPDKWicM6i
Pass ALKANE_EMBEDDED_TOKEN (a repo Actions secret, a restricted read-only token
scoped to the alkane-os repo) into the release and candidate workflow builds, so
the published GUI can list the private alkane-os releases in its install picker
with no user setup. The source tree carries no secret (option_env!); the value
lives only in CI-built binaries.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qKwKxq3oUPDKWicM6i
# Conflicts:
#	.gitea/workflows/ci-badge.yml
#	.gitea/workflows/next.yml
#	.gitea/workflows/release.yml
#	.gitea/workflows/source.yml
#	.gitea/workflows/verify.yml
#	Cargo.lock
#	README.md
#	ci/bench-badge.py
#	ci/bench_history.py
#	ci/cleanup-generated.py
#	ci/coverage.sh
#	ci/gen-badges.py
#	ci/publish-metrics.py
#	ci/test-bench-badge.py
#	ci/test-bench-history.py
#	crates/alkane-access/src/lib.rs
#	crates/alkane-artifacts/Cargo.toml
#	crates/alkane-artifacts/src/lib.rs
#	crates/alkane-cli/Cargo.toml
#	crates/alkane-cli/src/main.rs
#	crates/alkane-gui/src/model.rs
Merge branch 'feature/afw-os-bundle' into release-next-stage
source / check (pull_request) Failing after 20s
verify / verify (pull_request) Skipped
ac6bc20c68
noah added 1 commit 2026-11-11 17:28:00 -07:00
ci: align next-only bench-pages.yml to the canonical runner image
verify / verify (pull_request) Skipped
source / check (pull_request) Successful in 4m27s
20dff12c05
The merge brought next's bench-pages.yml with its stale October runner-image
pin; align it to ci/runner-image.txt so the source gate passes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qKwKxq3oUPDKWicM6i
noah merged commit b02a14bcfc into next 2026-11-11 17:33:02 -07:00
Sign in to join this conversation.