Sunday, December 13, 2015

The Ubuntu Users Guide To Updating Your Xperia Device

I have an Xperia Z tablet. I've had it for three years now, and I'm as happy with it now as I were when I first wrote about it. Speedy, tough and extremely light.

Except for one thing. For whatever reason, this particular model (SGP312), with this  particular Japanese version of Android, haven't had an update in two years. This is especially surprising as  Sony Mobile is pretty good at keeping older hardware updated, and as other country versions of this tablet still get regular updates.

The last year has seen several serious security issues with Android, and many older devices got updated to Android 5.1.1. this autumn. I'd very much like it on my tablet as well, for peace of mind if nothing else.

Fortunately, Sony Mobile is pretty enlightened when it comes to giving you access to your own hardware. Many manufacturers will go to great lengths to stop you from unlocking or changing their products in any way. But Sony will help you unlock your phone, and even provides information to custom system makers to help them do a better job.

So, while I ideally would have gotten updated automatically, with a Sony tablet I can at least do it myself without jumping through too many hoops.


If you look up how to update manually on the net, chances are you'll encounter a nightmare of complicated, conflicting information. Long, convoluted instructions that have you manually unlock and root your tablet, install recovery software, download custom system images from sketchy Russian file servers and so on.

But all this is completely unnecessary. We have some simple, reliable tools around today that will easily let you download and install official system images, even if they haven't been released in your part of the world yet. They'll even root your device for you if you want.


So here is my quick guide to updating your Xperia device, using Ubuntu 15.10. If you're a Linux user, like me, you will find the process a bit unsettling. Instead of just installing the software with the software updater, you need to visit different web sites and download packages from file sharing sites, blindly trusting you're not downloading something bad. Apparently Windows users do this all the time.

You need two applications, both of which are cross platform and work on Windows, Linux and OSX:

The first application is XperiFirm. It's a download tool for the official Sony system versions for all Xperia devices. It's like the official "PC Companion" application, except that it lets you download any official system version no matter what device you have.

Follow the explanations on that page — download the file, install mono and the ssl certificates, and run the tool. Select your device type and device, and choose the specific system variant you want. If you select one of the available variants, you'll see the latest release version available.



The variants mostly differ by region in the world, but sometimes there's also carrier-specific versions here. In the screenshot above, I've selected "SGP312 Wi-Fi" on the left, and I've looked at the "EU4" and the "Japan" variant. As you can see, the latest Japan release ("10.3.1 ...") is a lot older than the EU4 ("10.7.A ...") one — that's exactly my problem.

Which variant to pick? For phones it can matter, since different variants set up the mobile phone hardware for different regions. A variant for Europe may have trouble getting a good connection in Japan. For tablets it's not really important. The difference is mostly things like the default language, installed extra apps and things like that. You can really pick any one you like. I picked EU4 for no particular reason. Click the version number up in the right corner and it will download the firmware.


Once done, we need to package the firmware and install on the tablet. For that we need a second application, called Flashtool. It's just a little cumbersome to install, but follow the instructions and we're good to go.

First, make sure Linux will recognize your Sony as a valid USB device (Windows and Mac users need to install a driver that basically does the same thing):

$ cd /etc/udev/rules.d
$ sudo gedit 51-sony.rules

In the file, add the line:

SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="0fce", ATTRS{idProduct}=="*", MODE="0777"

Save and exit. Restart the USB device manager:

$ sudo service udev restart


Download Flashtool. Follow the "Linux" link for the latest release. At the time of writing, you first download 0.9.19.8 — just click on the Torrent link and when Ubuntu asks, select the default "Transmission" as the app to use. The download will start after a while. Unpack the file:

$ 7z e flashtool-0.9.19.8-linux.tar.7z

(If you don't have "7z", install it with 'sudo apt-get install p7zip').

Now, dowload the 0.9.19.10 'patch' from the page above (this might not be available, and not necessary by the time you read this). It's a file called 'x10flasher.jar'. Just move it into the Flashtool directory where it replaces the existing version:

$ mv x10flasher.jar Flashtool/

On your tablet, go to "developer options" at the bottom (tab "build number" in "about tablet" repeatedly if you don't have that) and activate USB debugging. Go to "Security" and activate "Allow unknown sources". Connect the tablet to your computer with an USB cable. Start Flashtool:

$ cd Flashtool
$ ./Flashtool

Select Tools-> Bundles-> Create. In "Select source folder", select the directory full of files you downloaded earlier. It's named something like "SGP312_VMo EU1_1273-3865_10.7.A.0.222_R4E". For device, branding and version you can probably put anything you want, but it's a good idea to enter the right values — "SGP312", "EU1", and "10.7.A.0.222" for instance — so you know what version it is. Select all in the folder list and press the right-arrow button to say that everything in the bundle will be installed.

Click the lightning bolt (flash device), and select "flashmode" in the popup. You get a window looking much like this:



Pick the directory where you downloaded the firmware earlier. Pick it in the list (here I have two different ones). I left all other options at their defaults. Press "Flash" and follow the on-screen instructions. Basically you need to put your tablet or phone in flash mode, and how to do that differs a bit.

After a long while, the process will finish. Reboot and enjoy your new version!

Flashtool can do a lot of other useful things. It can unlock your device, it can root it, and you can remove things you don't want from the system image. I haven't tried any of these functions, and don't know how well they work. I would recommend not doing any of these things unless you actually need to. Some Sony software (like the camera, for some models) don't work properly with a rooted device, for instance. And if you remove something important from the firmware by mistake your tablet will fail to boot.


How is the update itself? I updated from 4.2.2 to 5.1.1. There's some visual tweaks and changes, and the operating system itself has no doubt seen a lot of internal improvements and bug fixes. My main reason for updating is the security fixes.

But the most significant change I experience is the keyboard. The Sony International Keyboard is great; it lets you use more than one language (such as Swedish and English) at the same time and gives you typing suggestions for both. In version 5 the keyboard is much better, with faster, more accurate suggestions.

The Japanese keyboard has also improved a lot, and now lets you input text by drawing kanji and kana by hand if you want to. It no longer defaults to romaji every time you select it, but remembers the state you used last. Switching between keyboards also feels faster and smoother than before.

The on-screen keyboard is the primary way to input text, and improvements here have a big impact. I'm happy I could update for this reason alone. Well worth spending my day off on this.

No comments: