SP FLASH TOOL - LINUX UBUNTU (chapter 2)

cleopatra81

Active Member
Mar 13, 2016
126
165
43
Milan
#1
SP FLASH TOOL - LINUX UBUNTU - Chapter 2°

Successfully tested on Ubuntu 14.04 LTS

Before proceeding, please follow very carefully all the steps at Chapter 1°

STEPS :

Step 5 - Installing SP Flash Tool

Download "SP_Flash_Tool_exe Linux_64Bit_v5.1604.00.100.zip" at the next link :

http://www.mediafire.com/file/4p3roo9fipikai8/SP_Flash_Tool_exe_Linux_64Bit_v5.1604.00.100.zip

Open the terminal and type the following commands :

sudo apt-get install libusb-dev

cd Downloads

unzip SP_Flash_Tool_exe_Linux_64Bit_v5.1604.00.100.zip /home/cleopatra81/Downloads/SP_Flash_Tool_exe_Linux_64Bit_v5.1604.00.100 mv /home/cleopatra81/Desktop

Do not forget to change cleopatra81 with your name !

Now type the following commands :

cd Desktop

cd SP_Flash_Tool_exe_Linux_v5.1604.00.100

chmod + x flash_tool

chmod + x flash_tool.sh

sudo adduser cleopatra81 dialout (change cleopatra81 with your name)

newgrp - dialout

sudo -i

sudo nano /etc/udev/rules.d/80-persistent-usb.rules

Copy the following string in the text document that will appear, then save and close:

SUBSYSTEM == "usb", ACTION == "add", idVendor ATTR {} == "0E8D" idProduct ATTR {} == "*"

PAY NO ATTENTION TO THE ERROR "Gtk-WARNING **: Calling Inhibit failed: GDBus.Error" !

Now, type the following command :

sudo gedit /etc/udev/rules.d/20-mm-blacklist-mtk.rules

Copy the following two strings in the text document that will appear, then save and close :

ATTRS{idVendor}=="0e8d", ENV{ID_MM_DEVICE_IGNORE}="1"

ATTRS{idVendor}=="6000", ENV{ID_MM_DEVICE_IGNORE}="1"

PAY NO ATTENTION TO THE ERROR "Gtk-WARNING **: Calling Inhibit failed: GDBus.Error" !

Then, restarting udev by typing the following command :

sudo service udev restart


Step 6 - How to flash a ROM

Turn off your phone and type the following commands :

cd Desktop

cd SP_Flash_Tool_exe_Linux_v5.1604.00.100

sudo ./flash_tool

From this point forward, the method is the same like on Windows OS :emoji_sunglasses:

 
Likes: mrsim

mrsim

KingOfNoobs
Staff member
Mar 1, 2014
16,207
2,366
113
47
London UK
#2
WOW...are any drivers needed in order to flash a rom or will linux/ubuntu just flash without the drivers installed...!!!

and why the thread in 2 parts...?
 

cleopatra81

Active Member
Mar 13, 2016
126
165
43
Milan
#3
The thread is in 2 parts because there is a limit (amount of words).
Linux OS are very different from Windows OS.
Linux OS interact with Android better than Windows OS.
It is because Android OS is fundamentally based on Linux OS.
For sure, Linux OS are more complicated than Windows OS.
But to intervention deeply on Android OS, the best choice are Linux OS :emoji_slight_smile:
 
Likes: mrsim

cleopatra81

Active Member
Mar 13, 2016
126
165
43
Milan
#5
No need any VCOM driver or other kind of drivers .
Thanks to this thread, anyone will be able to install Ubuntu to interact with Androis OS based smartphones.

:emoji_slight_smile:
 
Likes: mrsim

dada216

New Member
Mar 22, 2017
3
2
3
33
#6
and drivers,(usb/vcom)...are they needed in order to use ubunto on linux...do they have to be installed...?
The usb drivers shipped within current kernel release support mediatek devices natively. only developers libraries need to be installed to access all the functions these drivers provide.
 
Likes: mrsim

dada216

New Member
Mar 22, 2017
3
2
3
33
#7
I was observing the behaviour of the kernel shipped drivers with my mediatek device (it's a doogee x5 max pro, MT673M) while trying to understand when and how to plug in the battery in order flash it correctly. I think I got it.
I assume we need the preloader available to the kernel in order to flash the phone.
these are my dmesg output in these three different battery/phone on or off cases

1) Phone turned off, battery NOT plugged in. As soon as I attach the usb cable this is my dmesg output

Code:
[44697.439851] usb 3-1: new high-speed USB device number 126 using xhci_hcd
[44697.568463] usb 3-1: New USB device found, idVendor=0e8d, idProduct=2000
[44697.568466] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[44697.568468] usb 3-1: Product: MT65xx Preloader
[44697.568469] usb 3-1: Manufacturer: MediaTek
[44700.217931] usb 3-1: USB disconnect, device number 126
please note after a little while the USB disconnect message appeared even if the phone was still attached.

2) Phone turned off, battery IS plugged in. A couple of seconds after I attach the usb cable the phone battery start to charge, the animation appears on the phone screen, ubuntu (16.04 LTS) shows an error window saying "Unable to mount MT65xx Android Phone" and this is my dmesg output

Code:
[44706.840018] usb 3-1: new high-speed USB device number 127 using xhci_hcd
[44706.969037] usb 3-1: New USB device found, idVendor=0e8d, idProduct=2008
[44706.969056] usb 3-1: New USB device strings: Mfr=2, Product=3, SerialNumber=4
[44706.969058] usb 3-1: Product: MT65xx Android Phone
[44706.969059] usb 3-1: Manufacturer: MediaTek
[44706.969060] usb 3-1: SerialNumber: 0123456789ABCDEF <- This is the actual printout of the command.
[44738.593260] usb 3-1: USB disconnect, device number 127
please note in this case the USB disconnect message appeared only when I detached the usb cable.

3) Phone turned on (USB debug on, phone option for "Use USB for" is set to "File Transfer"). Battery IS plugged in (obviously), as soon as I attach the usb cable Ubuntu mounts the internal SD cards correctly and this is my dmesg output

Code:
[44796.334285] usb 3-1: new high-speed USB device number 2 using xhci_hcd
[44796.463559] usb 3-1: New USB device found, idVendor=0e8d, idProduct=201d
[44796.463569] usb 3-1: New USB device strings: Mfr=2, Product=3, SerialNumber=4
[44796.463575] usb 3-1: Product: X5max_PRO
[44796.463580] usb 3-1: Manufacturer: MediaTek
[44796.463584] usb 3-1: SerialNumber: *************** <- I'm obscuring my phone serial number for privacy reason but it got printed out correctly, not bogus values like in the previous case.
in this case no usb disconnect message appeared untile I physically detached the phone, not even when I unmounted the phone from Nautilus, it only appeared when I physically detached the phone.

so from this behavior I think I'm positive that at least with my current combination of mediatek device and usb drivers shipped with the ubuntu linux kernel ( 4.4.0-66-generic x86_64 GNU/Linux)
the phone need to be attached to the computer with its battery NOT plugged in, moreover there appears to be a pretty fast timeout before the usb devices detaches itself from the host pc.

whats relevant to the SP flash tool sticky thread is that reading dmesg output this way could help understand how other mediatek devices operate in regards to preloader driver being available to the system when they're plugged in. shorter instructions could be written.
I thought I share this since I spent half a day trying to figure out if this was the problem I was having.
 
Likes: mrsim
Jan 31, 2017
1
1
1
56
#9
I have had serious problems with Download and especially with Format in ./flash_tool on my Debian Testing machine.
I received many errors and googling them leads to no results or to the misleading results.
The solution was:
- use Java 8 instead of the newer one (download/extract from Oracle, export PATH=...../java8/bin:$PATH, check the version: java -version)
If errors will not disapear with J8, then try older kernel.
My problems were on current 4.17 version, so do something like:
apt install linux-image-4.9.0-7-amd64 linux-headers-4.9.0-7-amd64 ; update-grub
and maybe boot with Shift. I don't know exactly, I have used the 2-nd machine with 4.9.0-5.
 
Likes: mrsim