uflash is a lightweight, high-performance Unisoc flashing tool and firmware dumper built against the local upac PAC parsing library. It is designed to reliably navigate the Unisoc BootROM/FDL handshakes and provide robust flashing for modern devices (like the Meig SLM500S module, Android 10).
- Protocol Support: Understands legacy
0x7Ehandshakes and modern0xAEHost Protocol connections. - Auto-Repartitioning: Automatically detects
0x96or0xFEmismatch errors fromExecNandInitand dynamically generates aBSL_CMD_REPARTITIONpayload to format the8GB+eMMC layouts correctly. - Fast Flashing (MTK Style): Utilizes the
BSL_CMD_DISABLE_TRANSCODE (0x21)command to bypass HDLC byte-stuffing, unlocking massive transfer speeds (25+ MiB/s) for large images likesuper.img. Includes a robust 60s cooldown tolerance for heavy TLC cache flushes. - Firmware Dumping: Can read directly from the eMMC via
BSL_CMD_READ_STARTto extract live partitions without needing a pre-existing scatter file. - Smart NV Backup: Safely backs up critical calibration NV partitions before repartitioning.
- Adaptive USB Chunking: Modulates USB
libusb_bulk_transfersizes to prevent eMMC controller exhaustion, automatically gracefully backing off when FDL2 signals timeouts.
uflash depends on:
- Valid
libusb-1.0headers - The local
upacPAC library
mkdir build && cd build
cmake ..
make -j8./uflash <firmware.pac> [OPTIONS]Standard Full Flash: (Will auto-repartition if needed)
./uflash firmware.pacForce Full Flash: (Explicitly triggers comprehensive flashing modes)
./uflash firmware.pac --full-flashPreserve Current Layout: (Skips sensitive bootloader data and avoids repartitioning)
./uflash firmware.pac --preserve-layoutFast Flashing Mode: (Bypasses byte-stuffing overhead for massive performance gains)
./uflash firmware.pac --disable-transcodeFlash a Single Partition:
./uflash firmware.pac --partition bootSkip Specific Partitions:
./uflash firmware.pac --skip userdata --skip systemSkip NV Calibration Backup: (Useful if the partitions are already severely corrupted)
./uflash firmware.pac --skip-nv-backupDump Firmware from Device: (Extracts the device's partitions matching the PAC XML into a local folder)
./uflash firmware.pac --dump-firmware ./device_dump/Restart Device in Normal Mode:
./uflash --reset-onlyPrint Embedded PAC XML:
./uflash firmware.pac --dump-xmlDebug FDL Timeline:
./uflash firmware.pac --fdl2-settle-ms 5000 # Introduce a delay before FDL2 initiates
./uflash firmware.pac --debug-fast-lane # Print detailed fast-lane pipeline heuristics
./uflash firmware.pac --debug-protocol # Hex-dump every USB packet transmitted- 0xFE Repartition Rejection: If
ExecNandInitreturns0xFE, it typically indicates thatszID1andszID2are unsynchronized in the partition schema, or theuserdatasize isn't set to auto-fill (0x00size) for modern FDL2s. - Named Downloads: File downloads directed at
0x00base addresses requireDownloadByID.uflashwill automatically pad out unaligned named-download trails (e.g.gnssmodem.bin) to prevent CRC timeouts. - The Fast Lane (
DA_INFO_T): Fordisable-transcodeto work, theuflashprotocol engine parses the hiddenDA_INFO_Tstruct returned by modern Unisoc BootROMs (even on failure packets) to toggle thebDisableTransCodeflag.