Running the “MediaTek SP Flash Tool” on Arch Linux2019-02-23
I’ve taken my Gemini PDA from the shelf lately, since I got updates on the keyboard that I deemed to terrible to use. The keyboard update will get a separate post once it’s finished.
I would like to use the Gemini as kind of a “mobile terminal” running Linux without a graphical interface. That’s a thing I would have to build on my own though, so I’m trying to get all the required parts figured out and running.
One part of that is running the “Flash Tool” provided by Planet Computers in order to get OS images onto the device. This Tool seems to be provided by MediaTek, which is the producer of the SoC for that device. Back when I still had a Windows PC in my household, I used it to create a backup of my
NVRAM partition which contains critical information, i.e. the IMEI of the device and so on. Fortunately, Planet Computers now also provides a Flash Tool for Linux.
~/c/g/FlashToolLinux $ sudo ./flash_tool.sh /home/mgr/code/gemini/FlashToolLinux/./flash_tool: error while loading shared libraries: libaudio.so.2: cannot open shared object file: No such file or directory
Whoever put together this “Linux version” of that tool just threw in a bunch of prebuilt libraries into the binary’s folder and put a
LD_LIBRARIES_PATH into the shell script. A
libaudio.so.2 however was not included and also wasn’t available on my system.
This was not too much of a problem, once I found out what package I was missing for it to work.
~/c/g/FlashToolLinux $ yay -Ss libaudio aur/nas 1.9.4-4 (+69 0.76%) Network Audio System is a network transparent, client/server audio transport system. Provides libaudio2.so.
Update 2019-03-27: As of today, I also needed to install
libjpeg6-turbo for the tool to start.
~/c/g/FlashToolLinux $ yay -S community/libjpeg6-turbo
So after installing these packages from the AUR, I naturally ended up with the next error message.
~/c/g/FlashToolLinux $ sudo ./flash_tool.sh No protocol specified flash_tool: cannot connect to X server :0
I wasn’t sure if this was due to the lack of running X servers, but I found a common workaround which seemed to work for other people on related problems as well.
~/c/g/FlashToolLinux $ xhost local:root non-network local connections being added to access control list
After running the above command, the Flash Tool started alright. So I just put the xhost command into the shell script.
With these preparation steps, I was able to read back the NVRAM partition from by Gemini, and successfully flash the stock Android again, as described in the support wiki.
By the way, the tool also starts without running the shell script with sudo. I guess it requires permissions to do stuff on the USB ports or so? You might be able to get away with configuring permissions for the user to run this tool with instead of giving it root permissions when running.