# sfd_tool **Repository Path**: qlljcf666/sfd_tool ## Basic Information - **Project Name**: sfd_tool - **Description**: No description available - **Primary Language**: Unknown - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-11-21 - **Last Updated**: 2026-11-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SFD Tool SFD Tool is a cross‑platform GUI and CLI tool for working with Spreadtrum/UNISOC devices. It focuses on **safe partition backup/restore, PAC flashing, and advanced maintenance operations**, with first‑class support for modern 64‑bit platforms. ![Logo](icon.png) ![License](https://img.shields.io/github/license/C-Hidery/sfd_tool) **GPL-3.0-or-later** [中文文档](README_ZH.md) ## Introduction This is the modified version of tool 'spreadtrum_flash' sfd_tool is an enhanced release for spreadtrum_flash **(This version adds GTK4 graphical interface)** [spreadtrum_flash](https://github.com/TomKing062/spreadtrum_flash) **Notice: The support for Windows 7 is deprecated, because GTK Development Team stopped the maintenance for MinGW64 on 2026 Oct.17.** --- Run this before making: ``` bash # Ubuntu/Debian sudo apt install libusb-1.0-0-dev gcc g++ libgtk-4-dev libzip-dev pkg-config make cmake gettext nlohmann-json3-dev libxml2-dev # Fedora/RHEL sudo dnf install gcc-c++ gtk4-devel libusb1-devel libusb1 libzip-devel pkgconf-pkg-config make cmake gettext json-devel libxml2-devel # macOS brew install libusb gtk4 libzip pkg-config make cmake gettext nlohmann-json libxml2 # Android(Termux) pkg install x11-repo pkg install termux-api libusb clang git pkg-config gtk4 glib pango libcairo gdk-pixbuf at-spi2-core xorgproto xorg-util-macros make cmake attr gettext nlohmann-json libxml2 libzip ``` Then make: ``` bash make # Termux make termux # Locales i18n make locales ``` Use on Termux(No GUI): ``` bash # Search OTG device termux-usb -l # example #[ # "/dev/bus/usb/xxx/xxx" #] # Authorize OTG device termux-usb -r /dev/bus/usb/xxx/xxx # Run(example) termux-usb -e './sfd_tool --no-gui --usb-fd' /dev/bus/usb/xxx/xxx ``` **WARN : You may must run tool as root to connect to device correctly!** --- ***Modified CLI commands:*** part_table [FILE PATH] **This command is equivalent to the `partition_list` command.** exec_addr [BINARY FILE] [ADDR] **Modified, you need to provide file path and address** exec **Modified, you need to provide FDL1 address when you execute FDL1** read_spec [PART NAME] [OFFSET] [SIZE] [FILE] **Modified, equivalent to the `read_part` command, then `read_part` is equivalent to the `r`** --no-fdl **New option, execute it if you want to connect to device without FDL1/2(Only Sprd4 Mode).** cptable **New command, use it to get partition table through compatibility method(FDL2 only)** --no-gui **New parameter, open sfd_tool without GUI** dis_avb_tos **New Command, use with caution.** --tool-mode **New parameter, you can use some commands that DO NOT need device connection, use `exit` to exit tool** ## Reconnecting mode in GUI mode You can run `sfd_tool` with this parameter: --reconnect This option will let tool try to reconnect to device, equivalent to `-r` in CLI. ## PAC Flashing Notes **Device can be in any stage when you decide to flash a PAC firmware.** **SFD Tool will automatically execute FDL in PAC firmware if device is not in FDL2.** Of course, you can execute your own FDL file before flashing PAC. Notice: - region/OCDT selection (e.g. OPPO/Realme PAC) not supported ## WARNING - DISABLE VERITY & AVB **Command:** `dis_avb_tos [BACKUP FILE]` / `verity 0` / `bl 0` / `e_bl [BACKUP MISCDATA PATH]` This command will **DISABLE** Android's DM-verity and AVB security verification mechanisms on your device. ## CONSEQUENCES - Your device will have **NO system integrity protection** - The following apps will **STOP WORKING**: - Banking apps and Google Pay - Apps using fingerprint/password for payments (WeChat Pay, Alipay, etc.) - Netflix HD streaming and some DRM-protected content - Games with anti-cheat protection (PUBG, Genshin Impact, etc.) - Malware can easily modify your system without any warning - Your device becomes significantly more vulnerable to data theft ## BEFORE CONTINUING **FULL Backup is very important before these operations!** - For `dis_avb_tos` , SFD Tool will automatically backup your `trustos` partition - For `e_bl`, SFD Tool will automatically backup your `miscdata` partition - **Keep this backup safe** - you will need it for recovery ## TO RESTORE For `verity 0`, Use command: `verity 1` For `dis_avb_tos`, flash backup image. For `bl 0`, Use command: `bl 1` For `e_bl`, flash backup image and execute a factory reset. **If these don't work for your device, please flash back all partition backups!** [Useful link for more details](https://github.com/TomKing062/unisoc_chipram_signcheck_exploit/) ## Features - **Cross‑platform GUI** (GTK4) - Tabs for Connect, Partition Operation, PAC Flash, Automated Task, Manual Operation, Advanced Operation, Advanced Settings, Debug Options, Log, and About. - **Partition backup and restore** - Read/write individual partitions. - Block‑size‑aware backup/restore pipeline to avoid alignment issues. - **Restore from folder**: batch restore multiple partitions from a folder of images (see user guide for details). - **PAC firmware flashing** - Inspect PAC contents and flash selected partitions. - **Automated task packages** - Load ZIP packages containing `package.json` and optional `images/`; - Validate partition names/sizes against the connected device; - Execute ordered `actions` such as `write_part`, `repartition`, and `reset`; - Dedicated log pane at the bottom of the page. - See [Automated Task Packages](docs/AUTOMATED_TASK_EN.md) for the package format and command reference. - **Manual low‑level operations** - Read/write by address, execute code at arbitrary addresses, etc. - **Advanced maintenance tools** - Other expert‑only functions for debugging and recovery. - **CLI mode** - Run without GUI using `--no-gui`. - Rich command set for scripting and headless environments. - **Internationalisation (i18n)** - Translated UI (e.g. `zh_CN`, `en_US`), using gettext `.po`/`.mo` files. ## Supported platforms & binaries SFD Tool is primarily tested and released for: - **Windows 10/11 x64** - **Linux x86_64** (e.g. Debian/Ubuntu, RPM‑based distros) - **macOS** (recent versions) - **Termux / Android** (CLI only, via `--no-gui`) Prebuilt binaries and packages are provided on GitHub Releases, typically including: - Windows x64 executables (LibUSB and/or SPRD driver builds). - `.deb` packages for popular Debian/Ubuntu versions. - `.rpm` packages for RPM‑based distributions. - macOS `.dmg` application bundles. And Arch Linux users can use this pre-built package in aur: [sfd_tool_arch_aur_package](https://aur.archlinux.org/packages/sfd-tool) For exact platforms and artifact names, refer to the latest release page and [.github/workflows/build.yml](.github/workflows/build.yml). ## Building from source (CMake) SFD Tool uses **CMake** as the primary build system. The legacy Makefile is kept only for reference. Basic out‑of‑source build (example): ```bash cmake -S . -B build -DCMAKE_BUILD_TYPE=Release cmake --build build -j ``` On Windows you can use a Visual Studio generator, on macOS and Linux Ninja or Makefiles. See: - [docs/AUTOMATED_TASK_EN.md](docs/AUTOMATED_TASK_EN.md) – Automated task package format and command reference. - [docs/cmake_EN.md](docs/cmake_EN.md) – English CMake/build guide. - [docs/cmake.md](docs/cmake.md) – Chinese CMake/build guide with more details, including per‑user config and `ui_language`. ## Running ### GUI After building, run the GUI executable from your build directory, e.g.: ```bash ./build/sfd_tool ``` On installed systems you can start SFD Tool from your desktop environment (menu entry created by the package) or by running `sfd_tool` from a terminal. ### CLI mode For headless and scripted environments you can run SFD Tool in CLI mode: ```bash sfd_tool --no-gui --help ``` This prints the full list of commands and options. Some examples: - List partition table. - Read a specific region to a file. - Execute code at a given address. - Use `--no-fdl` or similar flags for special boot modes. For the authoritative CLI reference, see: - Inline help: `sfd_tool --help` - Manpage (on Linux): `man sfd-tool` ## Configuration & language SFD Tool stores per‑user configuration (UI language, recent paths, etc.) in a JSON config file in the user’s home directory (location varies by platform). Key points: - `ui_language` can be set to `auto`, `zh_CN`, `en_US`, etc. - On first run the tool may migrate legacy config files from the project root into the per‑user location. See [docs/cmake.md](docs/cmake.md) for details. ## Documentation map - **Chinese user guide (canonical for end users)** - [docs/USER_GUIDE_ZH.md](docs/USER_GUIDE_ZH.md) - **Project overview (English)** - This README - [README_ZH.md](README_ZH.md) – Chinese overview - **Architecture & development** - [ARCHITECTURE.md](ARCHITECTURE.md) - **Build & configuration** - [docs/cmake_EN.md](docs/cmake_EN.md) - [docs/cmake.md](docs/cmake.md) - **Release & CI (maintainers)** - [docs/RELEASE_GUIDE_ZH.md](docs/RELEASE_GUIDE_ZH.md) - CI workflow: [.github/workflows/build.yml](.github/workflows/build.yml) - **Changelog** - [docs/VERSION_LOG.md](docs/VERSION_LOG.md) – shown in the About tab. ## Safety and disclaimer Working with device partitions and bootloaders is inherently risky. Incorrect operations can brick a device and may lead to data loss. - Always back up critical partitions before flashing or using advanced tools. - Do not use functions you do not fully understand. - Read the warnings in the user guide and on the Advanced Operation tab. SFD Tool is distributed under the terms of the GPL. See the repository for license details. ## Want to Run SFD Tool without root privileges? Actually, SFD Tool can be run without root privileges, but you have to create a `udev` rule. Create `/etc/udev/rules.d/80-spd.rules` with this line: ```text SUBSYSTEMS=="usb", ATTRS{idVendor}=="1782", ATTRS{idProduct}=="4d00", MODE="0666", TAG+="uaccess" ``` By the way, `80-spd.rules` is also in repo.