flash: restore to stock from genuine Bitmain firmware files
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
This commit is contained in:
@@ -21,6 +21,7 @@ pub const CV1835_P1_SIZE: u64 = 16 * 1024 * 1024;
|
||||
pub const AM335X_HOLE_OFFSET: u64 = 0x780000;
|
||||
pub const AM335X_HOLE_SIZE: u64 = 0x80000;
|
||||
pub const AM335X_CHIP_SIZE: u64 = 0x8000000;
|
||||
#[allow(clippy::type_complexity)]
|
||||
const AM335X_MAP: &[(&str, u64, u64, bool, bool, i64, Option<&str>)] = &[
|
||||
("mtd0", 0x0000000, 0x20000, true, true, 0, None),
|
||||
("mtd1", 0x0020000, 0x20000, true, true, 0, None),
|
||||
|
||||
Reference in New Issue
Block a user