Skip to content
shivrajtodePublic

About

SP Flash Tool (MediaTek) on a rooted Android phone or tablet: Termux + Debian chroot + box64 + Termux:X11

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

spft: SP Flash Tool on an Android phone

root required Android 8 and newer 64-bit kernel flashes MediaTek devices MIT license

Flash or unbrick a MediaTek phone or tablet
with just another rooted Android phone. No PC.

Start  ·  Check your phone  ·  Guide  ·  Fix a problem  ·  How it works

Made by Shivraj  ·  Telegram @Shivraj_editx  ·  GitHub



Phone only
Your rooted phone is the computer. No PC, no Windows.

Smooth screen
The real SP Flash Tool on Termux:X11, not on a slow VNC. Its window fits your screen by itself.

Safe to try
spft check tests your phone first. spft stop stops everything and cleans up.

What you need

The phone that runs spft (the host) The device you want to fix (the target)
Rooted (Magisk, KernelSU, APatch) A MediaTek (MTK) chip. Not Qualcomm, Exynos or Unisoc.
Android 8 or newer, with a 64-bit kernel The exact firmware for your model, unzipped, with a ..._scatter.txt file
An OTG adapter and a data USB cable Switched off when you connect it
About 3 GB free space, and internet for the install A battery as full as you can get it

Not sure about your phone? Check it first. It installs nothing. All the details are in the Guide.

Start in 3 steps

Three steps: 1. get the apps (Termux and Termux:X11, not from Google Play). 2. Install spft with one line, once, in about 15 to 30 minutes. 3. Start it by typing spft.

Step 1. Get the apps

Download them from these links, not from Google Play. Open each app once after you install it.

App What it is for Get it
Termux The terminal where you type spft F-Droid or GitHub
Termux:X11 The screen the tool is shown on GitHub nightly: the file termux-x11-universal-debug.apk
Termux:API (optional) Only for other Termux tools. spft works without it. F-Droid or GitHub

Important

Termux and Termux:API must come from the same place (both F-Droid, or both GitHub). They are signed with different keys. More rules: Guide, section 2.

Step 2. Install spft (one time)

Open Termux, paste this one line and press Enter:

pkg update -y && pkg install -y git && git clone https://github.com/shivrajtode/spft ~/spft && bash ~/spft/install.sh
  • At the very start your root app asks: press Allow for Termux, quickly. (KernelSU and APatch may show no window: switch Termux on in their Superuser list before you start.)
  • The first time it takes 15 to 30 minutes and downloads a few hundred MB. Keep Termux open and the phone charging. A quiet screen is not a hang: what you will see.
  • Stopped half way? Run bash ~/spft/install.sh again. It only does what is still missing.
Why two commands, and not only git clone?

git clone only copies files. Git never runs a program from a repository (that would be unsafe), so the install is one more command, install.sh. The line above does both for you.

Step 3. Start it

When you see done. Start SP Flash Tool with: spft, type:

spft

SP Flash Tool opens on the Termux:X11 screen, fitted to your display. Next: flash your device without errors.

Check a phone first (no install)

Can this phone be the host? Find out without installing anything. In Termux paste:

bash <(curl -fsSL https://raw.githubusercontent.com/shivrajtode/spft/main/check.sh)

It downloads a few small files into a temporary folder, tests the phone, and deletes them again. Your root app may ask: press Allow for Termux. (If it says curl: command not found, run pkg install curl first.)

The output of spft check on a good host: root works, the Termux:X11 app is installed, the kernel is 64-bit, the cdc_acm driver is present, and the result says that spft can be installed and started on this device.

The check ends with a Result: whether spft can run on this device, and what to keep in mind. More about the check, with the output of a tablet that cannot flash.

How it works

Your rooted phone runs Termux, Debian, box64 and SP Flash Tool. An OTG adapter and a data cable connect it to the MediaTek device you want to fix.

spft sets up all of this for you. Termux is where you type, Debian is a small Linux system inside your phone, box64 lets it run SP Flash Tool (made for x86_64 PCs), and Termux:X11 shows the tool's window. The details (folders, settings, tests) are in How it works.

Everyday commands

Command What it does
spft Start SP Flash Tool
spft stop Force-stop everything of spft and clear the caches. Never while it flashes.
spft check Test the phone and the setup, with a hint for every problem
spft update Get the newest spft and apply it
spft tool Install or change SP Flash Tool, for example when its download fails
spft uninstall Delete the Debian system and the downloads. Asks first.
spft help Show all commands

All commands and screen options: Guide.

Need help?


Guide
Every step in order: your files, flashing without errors, Android 12 and newer.

Fix a problem
Error codes (1013, 2005, 5054, ...), a black screen, a device that is not found.

How it works
Folders, settings and tests, for the curious.

Still stuck? Open an issue at https://github.com/shivrajtode/spft/issues and paste the output of spft check.

Good to know

Warning

Flashing the wrong firmware, or interrupting a flash, can permanently damage a device. You use this at your own risk.

  • Tested on a Samsung Galaxy J7 Max (Android 8, 32-bit Android on a 64-bit kernel) with SP Flash Tool v5.2228. The install, the commands and the download logic are also covered by automatic tests that use stand-in programs (bash tests/run_all.sh). Other devices should work if they meet the requirements. Please report what you find.
  • Devices with secure boot (they ask for an Auth file, or report errors like S_AUTH or STATUS_BROM_CMD_SEND_DA_FAIL) usually cannot be flashed with SP Flash Tool alone. mtkclient can work around this on many of them.
  • SP Flash Tool belongs to MediaTek. It is not part of this repository and is downloaded when you install.

Made by Shivraj: Telegram @Shivraj_editx, GitHub shivrajtode.

And Special thanx💖 to my friend Kaif Telegram @mkr_infinity for recommending spflashtool linux version and giving some guide about it.

Thanks to Termux, Termux:X11, box64, Debian, mtkclient, and the Hovatek forum for its SP Flash Tool guide and error code list.

License: MIT (this repository only, not SP Flash Tool).

About

SP Flash Tool (MediaTek) on a rooted Android phone or tablet: Termux + Debian chroot + box64 + Termux:X11

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages