How to setup SP_Flash_Tool_Linux (MTK/MediaTek Soc)

Started By: wangxiaoli Started On: 2017-9-27 20:48:15
2231 2
Step 1:
If you haven't done so before, install the Linux generic usb-drivers package:        Code:
                sudo apt-get updatesudo apt install libusb-dev
Download SP Flash Tool Linux (latest version): http://mtk2000.ucoz.ru/load/soft/sof..._tool/5-1-0-14 (Password to extract currently is mtk2000v1)
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/...
Only for Ubuntu 16.10 and newer:
Run         Code:
                wget -q -O /tmp/libpng12.deb http://mirrors.kernel.org/ubuntu ... -1ubuntu1_amd64.deb \  && dpkg -i /tmp/libpng12.deb \  && rm /tmp/libpng12.deb
These libraries are still required for the flash tool but have been removed from new Ubuntu versions.  
Thanks @hanalinqu and @z3r0c00l_2k 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
                        Quote:
                                 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
FROM XDA.



2# 2018-10-15 09:39:02
That UDEV rule makes no sense. It does not set anything. It just matches some properties. A udev rule is supposed to execute an action if it matches certain rules. Otherwise it is pointless, as it does nothing.
Reply


3# 2018-10-15 09:39:41
Guest 89.1.146.x replied at 2018-10-15 09:39
That UDEV rule makes no sense. It does not set anything. It just matches some properties. A udev rul ...

I mean the persistent usb one.
Reply
You have to log in before you can reply Login | Register now Sign in with facebook Sign in with google

Points Rules

International