Skip to content

Instantly share code, notes, and snippets.

@nullrndtx
Last active October 17, 2024 21:09
Show Gist options
  • Save nullrndtx/a331cb7611dd4b022bc5aebddbca3428 to your computer and use it in GitHub Desktop.
Save nullrndtx/a331cb7611dd4b022bc5aebddbca3428 to your computer and use it in GitHub Desktop.
SP Flash Tool on Linux? Why not? 8-)
#!/bin/bash
# check root user
if [ "$(id -u)" != 0 ]; then
echo "ERROR! Run this script with root user!"
exit 1
fi
# tab width
tabs 4
clear
# update repo
#apt-get update
sleep 2
# install dep
apt-get install libusb-dev libmtp-common libmtp-runtime libmtp9 libmtp-dev
# download sp flash tools
echo "Downloading SP Flash Tools"
sleep 2
cd /opt
wget http://spflashtool.com/download/SP_Flash_Tool_exe_Linux_64Bit_v5.1520.00.100.zip
unzip SP_Flash_Tool_exe_Linux_64Bit_v5.1520.00.100.zip
mv SP_Flash_Tool_exe_Linux_v5.1520.00.100 SPflashtools
rm SP_Flash_Tool_exe_Linux_64Bit_v5.1520.00.100.zip
sleep 2
echo "Done!"
# fixing BROM ERROR
echo "Fixing BROM Error"
sleep 2
touch /etc/udev/rules.d/80-persistent-usb.rules
echo "SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="0e8d", ATTR{idProduct}=="*"" > /etc/udev/rules.d/80-persistent-usb.rules
sleep 2
echo "Please wait...."
touch /etc/udev/rules.d/20-mm-blacklist-mtk.rules
echo "ATTRS{idVendor}=="0e8d", ENV{ID_MM_DEVICE_IGNORE}="1"" > /etc/udev/rules.d/20-mm-blacklist-mtk.rules
echo "ATTRS{idVendor}=="6000", ENV{ID_MM_DEVICE_IGNORE}="1"" >> /etc/udev/rules.d/20-mm-blacklist-mtk.rules
sleep 2
echo "BROM Error patched!"
# restart udev
sleep 2
echo "Restarting udev"
service udev restart
sleep 2
echo "Udev successfully restarted"
# done
clear
echo "SP Flash Tools Successfully Installed on /opt/SPflashtools"
echo "Copyright (c) 2016 - Randall Tux"
echo "[email protected] // Twitter: @randalltux"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment