FORUMS
Remove All Ads from XDA

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

198 posts
Thanks Meter: 152
 
By Miss Montage, Senior Member on 19th July 2015, 04:17 PM
Post Reply Email Thread
27th July 2016, 10:25 AM |#151  
Member
Thanks Meter: 9
 
More
Hmm... If I start flash_tools then plug in the tablet while it is switched off, I get COM_PORT_OPEN_FAIL. So, getting closer!

Code:
vid is 0e8d

device vid = 0e8d

pid is 2000

device pid = 2000

com portName is: /dev/ttyACM0

Total wait time = -1469611351.000000
USB port is obtained. path name(/dev/ttyACM0), port name(/dev/ttyACM0)
USB port detected: /dev/ttyACM0
Connect BROM failed: S_COM_PORT_OPEN_FAIL
Disconnect!
BROM Exception! ( BROM ERROR : S_COM_PORT_OPEN_FAIL (1013)

[COM] Failed to open COM port.
 
 
2nd August 2016, 10:19 PM |#152  
Junior Member
Thanks Meter: 3
 
More
Quote:
Originally Posted by edent;
BROM Exception! ( BROM ERROR : S_COM_PORT_OPEN_FAIL (1013)

[COM

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
The Following 3 Users Say Thank You to arnold444 For This Useful Post: [ View ] Gift arnold444 Ad-Free
17th August 2016, 08:17 PM |#153  
Junior Member
Thanks Meter: 2
 
More
Quote:
Originally Posted by Miss Montage

Unfortunately this seems to work 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. 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 install libusb-dev
Download sp_flash_tool_linux. For 64bit-systems I recommend version 5.1516.00.100 or later, for 32-bit systems I haven't found any version. If in doubt try
Code:
file flash_tool
Step 2:
Extract the downloaded file -> graphic file manager (e.g. Nautilus): double-click and extract. Terminal:
Code:
unzip 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/...
Step 3:

Change into the newly created directory:
Code:
cd /sp_flash_tool
We make two files executable by typing:
Code:
chmod +x flash_tool
and
Code:
chmod +x flash_tool.sh
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 4:

Now you can open the tool:

Code:
./flash_tool.sh
edit for SP_Flash_Tool_Linux_v > 15.32.00.100
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 4.

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 5:
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
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 6:
Type
Code:
./flash_tool.sh
or for SP_Flash_Tool_Linux_v > 5.15.32.00.100
Code:
./flash_tool
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. Remove the battery for about 10 seconds and reinsert it. For a clean start with a new ROM boot into recovery and wipe data/factory reset.

Hi, i modied rules of udev, but if i see a lsusb i see mt65preload only for few seconds, if i see a varlogmessages i see that the mt65preload disconnect immediatly. If i lunch flashtool and try to download logo i received a 1013 error.someone can help me.
17th August 2016, 08:36 PM |#154  
OP Senior Member
Thanks Meter: 152
 
More
Which SP Flash Tool Version do you use? Which phone do you want to flash?
Have you tried a different USB Data Cable and/or a different port? Have you tried to hold vol- or vol+ while connecting the phone? (If possible) Have you tried to remove the battery before connecting the phone?
Also, could you be so kind to remove the full quote of my original post? It clutters the thread
The Following User Says Thank You to Miss Montage For This Useful Post: [ View ] Gift Miss Montage Ad-Free
20th August 2016, 04:22 PM |#155  
theincognito's Avatar
Senior Member
Thanks Meter: 380
 
More
Hi. First of all,thank you for the guide. I am using Kali Linux Rolling (64 bit).. My phone is Lenovo K5 Note(A7020a48).. I tried to port TWRP and flashed it.. Obviously,my recovery was corrupted.. I couldn't boot the phone anymore,so I downloaded my firmware zip and tried to flash it..
Code:
Stage: checksum processing:100% percent, checksum:0x910e
Connecting to BROM...
Scanning USB port...
Search usb, timeout set as 3600000 ms
add@/devices/pci0000:00/0000:00:14.0/usb1/1-1

add@/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0

add@/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.1

add@/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.1/tty/ttyACM0

vid is 0e8d

device vid = 0e8d

pid is 2000

device pid = 2000

com portName is: /dev/ttyACM0

Total wait time = -1471706263.000000
USB port is obtained. path name(/dev/ttyACM0), port name(/dev/ttyACM0)
USB port detected: /dev/ttyACM0
BROM connected
Downloading & Connecting to DA...
connect DA end stage: 2, enable DRAM in 1st DA: 0
DA Connected
executing DADownloadAll...
Stage: 
[0] WRITING TO PARTITION [ preloader ]

Stage: 
[2] WRITING TO PARTITION [ recovery ]

Stage: 
[15] WRITING TO PARTITION [ efuse ]

Stage: 
[16] WRITING TO PARTITION [ md1img ]

Download failed.
Disconnect!
BROM Exception! ( ERROR : STATUS_SEC_IMGHDR_TYPE_MISMATCH (-1073610711) , MSP ERROE CODE : 0x00.
What do i do? My phone is bricked and can't use it? :'(

SP_Flash_Tool_exe_Linux_v5.1632.00.100

EDIT: Used the same firmware zip and flashed via SP Flash Tool in Windows.. It worked!! I mean,I am happy that my phone is up and running,but why it didn't work on Linux?
The Following User Says Thank You to theincognito For This Useful Post: [ View ] Gift theincognito Ad-Free
20th August 2016, 08:11 PM |#156  
OP Senior Member
Thanks Meter: 152
 
More
I don't know why it failed at a later stage in Linux. Did you use DA-Agent MTK_Allinone_DA.bin?
26th August 2016, 12:42 PM |#157  
Lovas's Avatar
Junior Member
Thanks Meter: 6
 
More
Useful guide
Hello there,

for me was very useful THIS ONE GUIDE

Step by step. It is easy, and working in my case
26th August 2016, 07:39 PM |#158  
OP Senior Member
Thanks Meter: 152
 
More
But that guide is for Sony Flash Tool
27th August 2016, 01:06 AM |#159  
Lovas's Avatar
Junior Member
Thanks Meter: 6
 
More
Quote:
Originally Posted by Miss Montage

But that guide is for Sony Flash Tool

Nope, it is not just for Sony. It is for SP flash tool. It is universal tool for flashing a lot of phones, roms...
27th August 2016, 01:18 PM |#160  
OP Senior Member
Thanks Meter: 152
 
More
There is no "universal" flash tool available for both Sony and MediaTek Phones, the video you linked clearly refers to this website: http://www.flashtool.net/downloads.php
and a Sony device:
Attached Thumbnails
Click image for larger version

Name:	Bildschirmfoto_2016-08-27_14-13-34.png
Views:	148
Size:	103.8 KB
ID:	3856248  
27th August 2016, 08:01 PM |#161  
Lovas's Avatar
Junior Member
Thanks Meter: 6
 
More
Quote:
Originally Posted by Miss Montage

There is no "universal" flash tool available for both Sony and MediaTek Phones, the video you linked clearly refers to this website: http://www.flashtool.net/downloads.php
and a Sony device:

OK, now i see there is some difference. I am apology.
BUT, i use this guide to overcome errors in SP flash tools. Especially that screenshot you posted show me how to make /etc/udev/rules.d/51-flashtool.rules files.

So, i did:
1. Download SP flash tool from official site
2. Unzip file
3. In SP_flash_tool foltder i opened terminal and type 1. chmod +x flash_tool 2. chmod +x flash_tool.sh
4. Connect cell phone to pc and in terminal type lsusb. As in video shown i copied marked part of my device information (just 4 signs)
5. sudo gedit /etc/udev/rules.d/51-flashtool.rules i copied this line into - SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="0fce", ATTRS{idProduct}=="*", MODE="0777" Bolded star i changed with that 4 signs (device information), save and close file
6. After that i opened terminal in SP flash tool folder and type Sudo -s
7. And finally double click on flash_tool or in terminal ./flash_tool to start

And i succeeded to flash TWRP and rom to UMI ROME cell phone without errors
Post Reply Subscribe to Thread

Tags
2035, flash tool linux, linux, mtk, sp_flash_tool

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes