How to Install SP Flash Tool on Ubuntu for MediaTek Android Flashing

Many of Appual’s guides for rooting and flashing Mediatek-based Android devices rely on a tool called SP Flash Tool. For users of Windows PCs, this is usually no problem at all, as the SP Flash Tool runs flawlessly after installing all the proper Mediatek VCOM drivers.

However, the latest versions of Ubuntu (16.04 – 17.10) have made changes to certain dependencies, and getting SP Flash Tool to communicate with your Mediatek-based Android device can be somewhat of a headache if you’re running one of the latest Ubuntu versions.

This guide will show you how to properly set up the dependencies required for SP Flash Tool on Linux.

Requirements:

  1. libpng12-0_1.2.54-1ubuntu1
  2. Latest SP Flash Tool for Linux

First you need to download and install the libpng12-0 package – SP Flash Tool is dependant on this package, but it was not included in the latest Ubuntu releases. So you will need to download and install it manually. Just right click on the .deb file and choose “Open with Software Install”.

You also need to install install libusb-dev package, so run:

sudo apt-get update
sudo apt install libusb-dev

Now download the latest SP Flash Tool for Linux, and extract it anywhere on your computer. I just left it inside the Downloads folder, it works fine.

Now right click on the newly extracted SP Flash Tool folder and choose “Open in Terminal”.

In the terminal type the following commands:

chmod +x flash_tool
sudo adduser username dialout
newgrp – dialout

And now you can run SP Flash Tool by typing in the terminal:

./flash_tool.sh

Troubleshooting

Phone will not connect / USB port not found:

Open a terminal and run:

dmesg | grep usb

Now look for your MediaTek device entry, and copy the idProduct string. Now in the terminal, type:

And then add the following line (replacing the idProduct with yours) to the file, and save.

SUBSYSTEM==”usb”, ACTION==”add”, ATTR{idVendor}==”0e8d”, ATTR{idProduct}==”*

If the terminal displays dialogue about timing out while trying to find the USB port, it may help to keep disconnecting your phone and trying different USB ports.

If you receive the error “S_BROM_CMD_JUMP_DA_FAIL (2035)”

Make sure you installed libusb-dev as instructed earlier in this guide. If so, we will need to blacklist Ubuntu’s modem manager (because it controls port /dev/ttyACM0, which is disabling SP Flash Tool from running properly).

Type in the terminal:

 

 

Then insert these two lines into the text file:

ATTRS{idVendor}==”0e8d”, ENV{ID_MM_DEVICE_IGNORE}=”1″
ATTRS{idVendor}==”6000″, ENV{ID_MM_DEVICE_IGNORE}=”1″

Then in the terminal: sudo service udev restart

ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.

Comments

30
    MK
    mas kopi Sep 13, 2018

    [ 8182.401798] usb 1-2: new high-speed USB device number 120 using xhci_hcd
    [ 8182.550853] usb 1-2: New USB device found, idVendor=22d9, idProduct=0006
    [ 8182.550856] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    [ 8182.550859] usb 1-2: Product: OPPO Preloader
    [ 8182.550861] usb 1-2: Manufacturer: OPPO
    [ 8184.211202] usb 1-2: USB disconnect, device number 120
    [ 8208.222391] usb 1-2: new high-speed USB device number 121 using xhci_hcd
    [ 8208.371347] usb 1-2: New USB device found, idVendor=22d9, idProduct=0006
    [ 8208.371360] usb 1-2: New USB device strings: Mfr=2, Product=3, SerialNumber=0
    [ 8208.371369] usb 1-2: Product: R831 Android Phone
    [ 8208.371377] usb 1-2: Manufacturer: OPPO
    mskopi@mskopi-Aspire-E5-475G:~$
    mskopi@mskopi-Aspire-E5-475G:~$
    mskopi@mskopi-Aspire-E5-475G:~$ sudo gedit /etc/udev/rules.d/80-persistent-usb.rules
    [sudo] password for mskopi:

    ** (gedit:10040): WARNING **: 11:31:49.350: Set document metadata failed: Setting attribute metadata::gedit-spell-language not supported

    BP
    bhanu pratap Dec 16, 2018

    getting the error of cant connect to x server while giving the command to open flashtool in terminal

    NJ
    Nasir Javed Dec 16, 2018

    how to run sp tool on raspberry pi 3 ?

    WD
    William Duque Feb 5, 2019

    I remember that with ubuntu 12. I was just running the spflash application, but with the last ones to do all this

    KS
    Karol Sandurski Mar 20, 2019

    Hi
    My Oukittel k6000 not connect, I don’t know why

      SW
      Shane Warren Author Sep 15, 2019

      The problem is with the device drivers for Outkittel K6000, you need to install the appropriate drivers for the device.

    X3
    xth 3k5 Jun 16, 2019

    ** (gedit:7414): WARNING **: 16:05:03.499: Set document metadata failed: Setting attribute metadata::gedit-spell-language not supportedThis string on the top appears after sudo gedit /etc/udev/rules.d/80-persistent-usbWhat I have to do?

    IP
    Ian Paulo Jul 6, 2019

    the same way as here i guess, it is linux too. You just need an ARMHF image of SP tool

      HA
      Hausemaster Jul 23, 2020

      WAAH! I need sp flash tools for the raspberry Pi, please anyone try compiling the flash tools to run on armhf systems, if the raspberry Pi gets flashing software support from all OEMs we are gonna live like a tinkerer…… ([Oops! I accidentally deleted the important folder, but idc cuz my Pi can fix it LOL] this will be possible if OEMs give official support)

    GS
    Gilson Oliveira da Silva Jul 24, 2019

    Era exatamente isso que eu estava procurando.
    Deu tudo certo aqui!
    Muito obrigado pela ajuda!

    EM
    Esabwa Makotsi Aug 16, 2019

    Is there any way to get libpng12-0_1.2.54-1ubuntu1 without running the commands in the terminal. I am using a proxy network so I cannot run the commands in my terminal. Like a zip file or something of the sort.

      SW
      Shane Warren Author Aug 17, 2019

      It needs to be installed using the terminal

        EM
        Esabwa Makotsi Aug 17, 2019

        Unlucky for me I suppose. I have to do away with my proxy so I can run these commands. Thanks Warren

        SA
        sandiko Jun 29, 2020

        https://packages.debian.org
        by the way, you use debian family distribution, so just download those deb files
        you can continue by installing it normally with $ dpkg -i libpng_name.deb
        or just extract that .deb files and extract them , keep extract that data.tar.xz too,and you will have any kind of libpng12.so.0 files inside data/lib/x86_64-linux-gnu/*
        copy those files and give them to spflash/lib folders.it’s very basic knowledge of linux users by the way

        Reply
    SW
    Shane Warren Author Sep 10, 2019

    You can try the following command to avoid these warnings :
    sudo -H gedit /some/where/file.txt &>/dev/null

    Reply
    SW
    Shane Warren Author Sep 21, 2019

    Login in as the root user using the following command:
    xhost local:root
    Point it to the correct display using the following command:
    sudo DISPLAY=$DISPLAY gedit /etc/profile

    Reply
    SW
    Shane Warren Author Sep 23, 2019

    Enter the following code in the terminal:
    “sudo gedit /usr/share/applications/eclipse-luna.desktop”

    LE
    leo Oct 9, 2019

    leo@leo-NUC7CJYH:~/Downloads/SP_Flash_Tool-5.1916_Linux$ newgrp – dialout
    newgrp: group ‘–’ does not exist
    ?

    SW
    Shane Warren Author Oct 10, 2019

    Have you installed “libpng12-0 package” and “libusb-dev package”?

      SE
      Senzanima Oct 26, 2019

      It works with Ubuntu 19.10 Desktop?

        SW
        Shane Warren Author Oct 29, 2019

        Should Work

          SE
          Senzanima Oct 29, 2019

          Hi, maybe you can help me. I get an error (permission denied) after typing ./flash_tool.sh. What should I do? Thanks in advance.

          SW
          Shane Warren Author Oct 31, 2019

          Are you signed in as the root user? verify that you are signed in as root by typing “sudo -i” and then the password.

          RO
          Robotdacucina Oct 30, 2019

          If I try this way it gives me this error: “permission denied” (Permesso negato).https://uploads.disquscdn.c…Can you help me? Thanks in advance.

          SW
          Shane Warren Author Oct 31, 2019

          Root permissions might not have been granted due to which the error is being triggered. Open the terminal and execute “sudo -i” and enter your password to sign in as root in the terminal, then execute the rest of the commands.

          SA
          sandiko Jun 29, 2020

          give execute permission to flashtool.sh file by

          chmod +x flashtool.sh

    RJ
    Rodgers Jashon Feb 5, 2020

    libpng12-0 is missing in ubuntu 19.10

    ON
    oneironaut Sep 3, 2021

    when type ./flash_tool.sh i am getting this error:./flash_tool: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
    ?

      MZ
      Muhammad Zubyan Author Sep 6, 2021

      Which version of Ubuntu you are using?