Skip to content

feat: add firmware upgrade for antminer stock#182

Merged
b-rowan merged 15 commits into256foundation:masterfrom
glitchpixelz:feat-upgrade-firmware-antminer-stock
Mar 18, 2026
Merged

feat: add firmware upgrade for antminer stock#182
b-rowan merged 15 commits into256foundation:masterfrom
glitchpixelz:feat-upgrade-firmware-antminer-stock

Conversation

@glitchpixelz
Copy link
Contributor

Antminer stock firmware upgrades now support both merged BMU bundles and raw single-image .bmu files. For merged bundles, the backend reads miner_type.cgi, matches the correct internal image to the miner’s model/control-board subtype, and uploads only that selected payload. For raw images, it skips filename heuristics and uploads directly, relying on upgrade.cgi to accept or reject the firmware.

The upload path now also validates the Antminer response more strictly: success requires both HTTP success and the expected JSON payload (code = U000, stats = success), while malformed or rejected responses return explicit errors.

@b-rowan
Copy link
Member

b-rowan commented Mar 17, 2026

Concept ACK, but I think it might make sense to change the implementation a bit to make FirmwareImage generic with Ext traits. Helps break things apart a bit, since the mod.rs files are starting to get pretty big.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a cross-backend firmware-upgrade capability to the miner trait surface and wires it through the Python bindings, with a concrete Antminer V2020 implementation that can extract the correct image from merged BMU bundles and validates upgrade responses more strictly.

Changes:

  • Introduce UpgradeFirmware trait and make it part of the core Miner trait; add “not supported” impls for non-Antminer backends.
  • Implement Antminer V2020 firmware upload via upgrade.cgi, including merged-BMU parsing/selection using miner_type.cgi.
  • Expose supports_upgrade_firmware and upgrade_firmware() in the Python wrapper.

Reviewed changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/python/miner.rs Exposes firmware-upgrade capability in the Python API.
asic-rs-core/src/traits/miner.rs Adds UpgradeFirmware trait and includes it in Miner.
asic-rs-firmwares/antminer/src/backends/v2020/mod.rs Implements Antminer firmware upgrade, including BMU bundle parsing and image selection.
asic-rs-firmwares/antminer/src/backends/v2020/web.rs Implements firmware upload HTTP request and response validation; adds miner_type endpoint call.
asic-rs-firmwares/antminer/Cargo.toml Adds crc32fast dependency for BMU CRC validation.
asic-rs-firmwares/whatsminer/src/backends/v1/mod.rs Adds UpgradeFirmware impl (unsupported).
asic-rs-firmwares/whatsminer/src/backends/v2/mod.rs Adds UpgradeFirmware impl (unsupported).
asic-rs-firmwares/whatsminer/src/backends/v3/mod.rs Adds UpgradeFirmware impl (unsupported).
asic-rs-firmwares/vnish/src/backends/v1_2_0/mod.rs Adds UpgradeFirmware impl (unsupported).
asic-rs-firmwares/nerdaxe/src/backends/v1/mod.rs Adds UpgradeFirmware impl (unsupported).
asic-rs-firmwares/marathon/src/backends/v1/mod.rs Adds UpgradeFirmware impl (unsupported).
asic-rs-firmwares/luxminer/src/backends/v1/mod.rs Adds UpgradeFirmware impl (unsupported).
asic-rs-firmwares/epic/src/backends/v1/mod.rs Adds UpgradeFirmware impl (unsupported).
asic-rs-firmwares/braiins/src/backends/v21_09/mod.rs Adds UpgradeFirmware impl (unsupported).
asic-rs-firmwares/braiins/src/backends/v25_07/mod.rs Adds UpgradeFirmware impl (unsupported).
asic-rs-firmwares/bitaxe/src/backends/v2_0_0/mod.rs Adds UpgradeFirmware impl (unsupported).
asic-rs-firmwares/bitaxe/src/backends/v2_9_0/mod.rs Adds UpgradeFirmware impl (unsupported).
asic-rs-firmwares/avalonminer/src/backends/avalon_a/mod.rs Adds UpgradeFirmware impl (unsupported).
asic-rs-firmwares/avalonminer/src/backends/avalon_q/mod.rs Adds UpgradeFirmware impl (unsupported).
Cargo.toml Adds workspace dependency version for crc32fast.
Cargo.lock Locks crc32fast into dependency graph.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@glitchpixelz
Copy link
Contributor Author

Antminer T21 Firmware Testing Results.md
5:30PM 3/17/2026

@glitchpixelz glitchpixelz requested a review from b-rowan March 18, 2026 12:30
@b-rowan
Copy link
Member

b-rowan commented Mar 18, 2026

Starting to get very close now, just a couple smaller style/nit things.

@glitchpixelz glitchpixelz marked this pull request as draft March 18, 2026 20:06
@glitchpixelz glitchpixelz marked this pull request as ready for review March 18, 2026 21:45
@glitchpixelz
Copy link
Contributor Author

Antminer_Firmware_Upgrade_Tests_2026-03-18.md
4:55PM 3/18/2026

@glitchpixelz glitchpixelz requested a review from b-rowan March 18, 2026 21:57
Copy link
Member

@b-rowan b-rowan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@b-rowan b-rowan changed the title Feat upgrade firmware antminer stock feat: add firmware upgrade for antminer stock Mar 18, 2026
@b-rowan b-rowan merged commit 07d23f2 into 256foundation:master Mar 18, 2026
2 checks passed
@glitchpixelz glitchpixelz deleted the feat-upgrade-firmware-antminer-stock branch March 19, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants