Skip to content

Latest commit

 

History

History
64 lines (44 loc) · 1.35 KB

File metadata and controls

64 lines (44 loc) · 1.35 KB

Snapmaker U1 Firmware Repacker

Tool for unpacking and repacking Snapmaker U1 firmware files

What it does

Snapmaker U1 firmware uses a custom format with XOR-obfuscated headers and checksums. This tool handles the decryption, extraction, and repacking of firmware images.

Building

cargo build --release

Binary will be at target/release/snapmaker_firmware_repacker

Usage

Unpack firmware

./snapmaker_firmware_repacker unpack -i firmware.bin -o output_dir

Extracts:

  • update.img
  • at32f403a.bin
  • at32f415.bin
  • MCU_DESC

Pack firmware

./snapmaker_firmware_repacker pack \
  -i input_dir \
  -o new_firmware.bin \
  -v "0.9.0.121" \
  -b "20251106132913"

Version and build time strings must match the format Snapmaker U1 expects.

Firmware format

  • 64-byte main header (XOR encrypted)

    • Magic: SNMK (0x4B4D4E53)
    • Version string at offset 8
    • Build time at offset 32
    • File count at offset 47 (single byte)
    • Checksum at offset 6-7
  • 32-byte sub-file headers (XOR encrypted)

    • File type, offset, size, MD5 hash
    • Own checksum field
  • File data (not encrypted)

XOR table is 256 bytes, used as a simple substitution cipher on headers.

Notes

  • MD5 hashes are verified on unpack
  • Checksums are validated for both main and sub-file headers
  • Repacked firmware matches 1 to 1 to original firmware