[TUTORIAL]How to setup SP_Flash_Tool_Linux (MTK/MediaTek Soc)

Search This thread

kanedagr

Senior Member
Feb 22, 2011
143
13
Galatsi
The solution was to let the battery drain. Then started sp flash tools loaded the scatter file for the phone, pressed start and plugged the phone. One second it took. Everything fine and frp removed. I did with Manjaro Linux.
 

dragon788

Member
Apr 30, 2013
26
4
Sorry for your trouble...
First: which version of SP flash tool do you use?
For SP Flash tool error 4001 I find several approaches on the web.
Most of them advice to reconnect the battery once the red progress bar has reached 100 percent. It might do to hold the volume + or - button at that moment.
For a
You shouldn't really be installing a package from an old repo on your system.

The script contains this:
Code:
LD_LIBRARY_PATH=$dirname:$dirname/lib
export LD_LIBRARY_PATH

This means that it looks in the lib dir for any extra dependencies.
Therefore, you should be able to extract the libpng12.so.0.54.0 out of the deb and copy it to the lib dir without affecting the rest of the system.

Code:
dpkg -x libpng12-0_1.2.54-1ubuntu1.1_amd64.deb /tmp/libpng2
cp /tmp/libpng2/lib/x86_64-linux-gnu/libpng12.so.0.54.0 lib
cd lib
ln -s libpng12.so.0.54.0 libpng12.so.0
Miss Montage this is pretty late to the game, but the newest versions of the SP Flash Tool for Linux have fixed the QT4-libpng12 dependency issues. I'd suggest iinking their download pages and recommending higher than v5.2020, I"m not sure where exactly it got fixed but the latest versions (v5 and v6) both work without error in a Debian Buster environment (and probably on Ubuntu 20.x) where libpng12 is LONG gone.

 
  • Like
Reactions: locness3

vonpupp

Member
Sep 4, 2018
7
1
Hello everybody.

I followed up the instructions:
- I added my user to the uucp group (I am using Arch Linux)
- I added the device to the udev rules
- I blacklisted the device from modemmanager

Yet SPFT doesn't work for me, neither on linux nor on virtualbox. I don't have a physical machine with windows. I just use linux.

The software sits there waiting for the device, herewith the screenshot:

If I type mmcli -L no modems are found which leads me to believe that the blacklisting of the device from mm has been successful. I don't know how to proceed. I am using SP_Flash_Tool_v5.2136_Linux.zip with the MT6771_Android_scatter.txt file from the stock rom (Ulefone Armor 8 Pro). I also tried it as root, with the same results.

What I would like to achieve is to perform a dump of the preloader and then a backup of the phone to later test a port of TWRP in colaboration with @lopestom for this phone model. I am friendly with the terminal, isn't there any way to perform this directly on the command line via dd or similar now that I can read the scatter file and have access to the memory mappings? I don't know how to proceed, any help is welcome.

Thank you very much.
 

Attachments

  • MT6771_Android_scatter.txt
    49.5 KB · Views: 58

qwertyuiop1289

Senior Member
Dec 10, 2021
144
35
Huawei P20 Lite
Nokia X5 (5.1 Plus)
SP Flash Tool does not work with KDE neon. It does work with Elementary OS. Both are Ubuntu 16.04 based.

Code:
$ ./flash_tool
QMetaObject::connectSlotsByName: No matching signal for on_pushButton_browser_clicked()
QObject::moveToThread: Cannot move objects with a parent
comboTimeout index(3) saved.
Application asked to unregister timer 0x2600000b which is not registered in this thread. Fix application.
Application asked to unregister timer 0x70000009 which is not registered in this thread. Fix application.
Application asked to unregister timer 0x7b00000a which is not registered in this thread. Fix application.
Uncaught std::exception in main(): locale::facet::_S_create_c_locale name not valid

Tried it with SP_Flash_Tool_v5.1752_Linux.
I have the same problem on Arch Linux - SP_Flash_Tool-5.1916_Linux.
 

Abdallah00

New member
Nov 21, 2020
1
0
I am testing some error when I run the flash tool can you help me I don't mind donating tour chancel for the help thank you
 

kngharv

Senior Member
Ok, I had a such trouble getting SP Flash Tool to detect my phone.

In case people don't know, you need to put your phone to fastboot mode for SP Flash Tool to flash the ROM.

I wish people tell me that in a more straight forward way (instead of instructing people to push volume up / volume down / volume up&down etc).

What I did was simply using command line

adb reboot fastboot

and the SP Flash Tool start to download almost immediately.

One advantage of using adb / fastboot command line is that it is a good indicator rather your driver worked or not.

if adb devices and fastboot devices
don't list your connected device, then, you know you either have a device driver issue or you've purchased a usb cable too cheap to flash ROM.
 
Last edited:
  • Like
Reactions: tendouser

drvnprgrmr

New member
Nov 5, 2022
3
0
Hi peeps! I hard bricked my infinix x551 and am trying to unbrick it.
Can someone please guide me?
I believe it was bricked by spflash tool because the issue started after I tried to use the tool to flash the stock rom
but I think I did it wrongly and now my phone is bricked.

SOMEONE HELP!!! :cry:
😭😭😭
 

drvnprgrmr

New member
Nov 5, 2022
3
0
Hi peeps! I hard bricked my infinix x551 and am trying to unbrick it.
Can someone please guide me?
I believe it was bricked by spflash tool because the issue started after I tried to use the tool to flash the stock rom
but I think I did it wrongly and now my phone is bricked.

SOMEONE HELP!!! :cry:
😭😭😭
Btw I'm a newbie in android modding so please take it easy. 😅
 

Top Liked Posts

  • There are no posts matching your filters.
  • 62
    This works only on Linux 64-bit
    DISCLAIMER: It is always risky to flash your mobile device. I do not and will not take any responsibility for bootloops and bricks.
    Please check carefully that the ROM or recovery.img you want to flash is suitable for your specific device and for the sp_flash_tool. The firmware directory should neither contain meta-inf nor system folder, but something_with_a_scatter.txt and a system.img
    Backup your phone before flashing!
    Your phone's battery should be at least half charged (50 percent) before you start this.

    I successfully ran these steps on my UMI Hammer with Linux Ubuntu 14.04 and 16.04. I do not have other devices or Linux derivates and do not plan to buy/install any.

    CREDITS and a zillion thanks to Sergio Rivero for his excellent tutorial on mibqyyo.com!!!!
    Also many thanks to N2K1 for giving me some more background information!

    So here we go:

    Step 1:
    If you haven't done so before, install the Linux generic usb-drivers package:
    Code:
    sudo apt-get update
    sudo apt install libusb-dev
    Download SP Flash Tool Linux (latest version): http://mtk2000.ucoz.ru/load/soft/soft_mtk/sp_flash_tool/5-1-0-14 (Password to extract currently is mtk2000v3)
    or here https://androidmtk.com/smart-phone-flash-tool
    In case you haven't done before, install unrar:
    Code:
    sudo apt install unrar
    Extract the downloaded file -> graphic file manager (e.g. Nautilus): double-click and extract. Terminal:
    Code:
    unrar x path_to_file
    (from now on: please adapt paths to your own settings)
    Move the new folder „sp_flash_tool“ to a directory of your choice.
    Code:
    mv /home/username/Downloads/sp_flash_tool /home/username/...
    You might also need to install libqtwebkit4 (it just happened to me on Linux Ubuntu 16.04):
    Code:
    sudo apt install libqtwebkit4

    [Only For Ubuntu 16.10 and newer]
    Run
    Code:
    dpkg -x libpng12-0_1.2.54-1ubuntu1.1_amd64.deb /tmp/libpng2
    cp /tmp/libpng2/lib/x86_64-linux-gnu/libpng12.so.0.54.0 lib
    cd lib
    ln -s libpng12.so.0.54.0 libpng12.so.0
    These libraries are still required for the flash tool but have been removed from new Ubuntu versions.
    Thanks @hanalinqu, @z3r0c00l_2k https://xdaforums.com/showpost.php?p=73484473&postcount=216 and @opticyclic https://xdaforums.com/showpost.php?p=81543495&postcount=285 for this information!

    Step 2:

    Change into the newly created directory:
    Code:
    cd /sp_flash_tool
    We make one file executable by typing:
    Code:
    chmod +x flash_tool

    In order to avoid running the flash_tool as root user, you need to add a standard user to the usergroup "dialout" (thanks to @egalus for this bit!)
    Code:
    sudo adduser username dialout
    For Arch Linux:
    Code:
    gpasswd -a username uucp

    and activate the membership immediately
    Code:
    newgrp - dialout
    (Arch Linux):
    Code:
    newgrp - uucp

    Step 3:

    Now you can open the tool:

    Code:
    ./flash_tool
    or double-click on the flash_tool icon.
    You can try at this stage if the flash tool connects to your phone:
    In the user interface, choose tab „Download“. Hit "scatter-loading", navigate to a directory with a valid firmware for your device and choose the scatter-file.
    For testing purposes uncheck "name" and check one of the smaller files in the list below (for example "logo")
    Switch off your device. Hit the "Download" button in SP_Flash_Tool and connect your phone to the computer. Some devices require you to take off the battery for about 10 seconds, with others you need to press Vol+ or Vol- while plugging the cable into the phone. Please look up device-specific threads and try out different options.

    If nothing happens at all, open a second terminal, run
    Code:
    dmesg | grep usb
    and look out for a MediaTek entry. If there is none → did you install libusb-dev (Step 1?)
    If the answer is yes, you might need to create a persistent udev rule for the MTK Preloader:
    Code:
    sudo gedit /etc/udev/rules.d/80-persistent-usb.rules
    Add the following line to the file:
    Code:
    SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="0e8d", ATTR{idProduct}=="*"
    Save the file and exit.
    Reload the usb-rules:
    Code:
    sudo service udev restart
    Disconnect the usb data cable from the computer and the smartphone. Close the flash tool. Switch on your phone (fastboot mode will do). Repeat the first paragraph of Step 3.

    If the tool connects, within a few seconds a red progress bar will appear. Unfortunately, in my case an error message came along with it:
    S_BROM_CMD_JUMP_DA_FAIL (2035)
    There is a connection, but also one more obstacle to overcome...

    Step 4:
    Now we come to the interesting part, which cost me 2 weeks of (futile) research and frustration. Finally I found Sergio Riveros tutorial on mibqyyo. Thanks to him again and again and again for this priceless piece of information :)
    The “modemmanager” package integrated by default within Linux Ubuntu 14.04 and later is not compatible with the MTK Flash Tool for Linux
    To put it in different words: The modem manager controls port /dev/ttyACM0 and disables the Flash Tool. So we blacklist it for the two MTK vendor IDs the flash tool uses:
    Code:
    sudo gedit /etc/udev/rules.d/20-mm-blacklist-mtk.rules
    You insert these two lines:
    Code:
    ATTRS{idVendor}=="0e8d", ENV{ID_MM_DEVICE_IGNORE}="1"
    ATTRS{idVendor}=="6000", ENV{ID_MM_DEVICE_IGNORE}="1"
    Save the file, exit and restart udev:
    Code:
    sudo service udev restart

    Switch your phone on (fastboot mode will suffice) and off again.

    Step 5:
    Code:
    ./flash_tool
    or double-click on the flash_tool icon.
    Now everything should run smoothly. In case you encounter
    Code:
    BROM ERROR : S_SECURITY_SF_CODE_FORMAT_FORBIDDEN (6012) , MSP ERROE CODE : 0x00
    change the download agent to MTK_AllInOne_DA.bin (screenshot #4)
    There are plenty of tutorials on the web for the further steps.
    Happy flashing! When a green circle with a white checkmark appears, you are done. You can close the flash tool and disconnect your phone. For a clean start with a new ROM boot into recovery and wipe data/factory reset.
    5
    edent; BROM Exception! ( BROM ERROR : S_COM_PORT_OPEN_FAIL (1013) [COM said:
    Failed to open COM port.[/CODE]

    dear edent,

    I had the same as you (error1013)

    I just started flash_tool in root mode (sudo ./flash_tool.sh)
    and it worked...

    arnold
    3
    Please change your tutorial and remove the security risk of executing flash_tool as root.
    As far as I understand the flashing procedure it is just using a serial connection to upload the rom to the mobile device thus it only needs one special right not every user might have:
    The user needs write permission to the MTK usb-device.
    At least for ubuntu it suffices to add the user to the dialout group as groupmembers get access to every modem.
    Maybe logging out and back in again after adding the user to the group is needed.

    I tested this by flashing my Jiayu S3 (which used /dev/ttyACM0) using ubuntu 15.04 and a user who is a member of the dialout group - no problem at all, thus no need for root except for adding the user to the group dialout.

    Never execute anything you download from places like needrom as root user - at least not on a system you need or have data on that you need!
    2
    Well, that's what life's supposed to be - give and take :) You are especially welcome!
    2
    Great post!

    Just wanted to say you saved me HOURS OR DAYS OR WEEKS of time on the modemmanager thing. I have Arch Linux, successfully ported over this tutorial, but I had no idea the modemmanager package was causing the issue. SP Flash Tool was the last frontier for using my Android devices on Linux. Thanks so much!