Posted 7/Oct 2013 at 14:23
by in Science & Tech / read by 693 people

From CyanogenMod and back again on Xperia Z

The day after I bought my Xperia Z, I used Sony's official bootloader unlock instructions to unlock the bootloader and flash the latest CyanogenMod stable release (10.1.3). Now about a week later, I'm back to stock Xperia software. Here is the full story about the why and the such and so. (instructions at the bottom)

Just about seven months ago I replaced my X10 Mini Pro with an Xperia Go. The overall experience was nice, though the performance wasn't as good as I had hoped for. Even so, not being one who changes phones that frequently, I had expected to keep it for at leat half a year, if not a full year more. Until my phone came in close contact with the floor of the Copenhagen metro. Before it had met the ground in a park, the street, the bathroom, the livingroom without much more than a scratch on the plastic. This time, the screen got shattered. It still worked though.

So, on the way home from Copenhagen I did some research into what to do. A repair would cost me about 60% of the purchas price of the phone and was quickly discarded as an option. I would buy a new phone. As an active Ingress player, waterproof is a must have for me. I've been quite satisfied with every Sony (or Sony Ericsson) phone I've had (about five now) and for some reason can't stad Samsung - probably because of their complete disregard for usability. Prices I could find on the internet for the Z were a bit over budget though, the Z Ultra is simply too large, the Z1 wasn't on the market yet so choice stood between the ZR and the V. 

Apart from that I couldn't find a retailer selling the V. And the ZR was sold out. They had just cut a signifcant part off the pricetag on the Z though at the store, so that's the phone I left the store with. And returned to the store with, within an hour. Not that there was anything wrong with the phone, it was just that I didn't have a micro SIM. They were happy to cut my regular size SIM card for me, charging 75 kr for it (just about 14 USD)!

I got home again, continued setup - and I won't bore you with the well known yada yada of running Android.

Almost immediately after I took the phone for a spin on playing Ingress, Niantec's location based game. It was dark, and the portals we were targetting were in a park. So I browsed through my brand new phone looking for simple Flashlight or Torch. I had it on my Xperia Go, but it was completely missing on the Z. Ain't that weird. I tried out a few apps from the Play store, but most of those turned off immediately after switching to another app. In the end I found one, but it didn't quite work the way I would want it.

In the meantime, a software update had been found and downloaded - so while in that park, having the phone connected to a Anker E3 external battery pack, I updated Android. Somehow hoping Sony would have added the simple yet effective Torch app there. Well, they didn't.

If it was this experience, or the fact that I was already considerig trying out CyanogenMod I can't tell for sure, but the next day I was ready to flash Android Jelly Bean 4.2.2 onty my device. And I loved every bit of it. The simple flashlight, to turn on from the notification bar. The custom number of apps on my homescreen. Basically, I could customize everything. And yet, I found myself looking for two things. 1) Xperia's tiny apps, to overlay any other app. 2) The Photoshpere camera feature. And perhaps in general the whole Xperia look and feel, which I kinda like actually. One element that certainly contributed to me getting back to stock Xperia was the fact that the PC Companian software told me, while I was preparing to install CyanogenMod, that it had yet another Android update for me. This time to 4.2.2 - which was the same version CM could offer me.

Anyway, I kept on using CM for about a week and kept on loving it. And kept on missing the aforementioned things. In the end, I decided, if I can't have photosphere, it's not worth it for me to run a custom ROM. I wanted back. And I went back. And it was surprisingly easy!

Here are the steps, there and back again:

Note: You will losse ALL data on your device upon unlocking the bootloader, flashing CyonagenMod and when flashing the Xperia software again. Consider yourself warned!

1) On your phone, download the Android ROM here: get.cm - save it to your MicroSD card. Download the same file onto your computer.

2) Still on your phone, download the Google Apps package from here: wiki.cyanogenmod.org/w/Gapps - also save that on your MicroSD card.

3) Download and install the Android Development Kit for your system, I used linux: developer.android.com/(..)/sdk/index.html. This will give you the fastboot command which you'll need later.

4) Open your dialer, and type *#06# - this will tell you the IMEI number of your phone. Keep it open.

5) Visit unlockbootloader.sonymobile.com/(..)/instructions read all instructions there carefully (or pretend that you did, and click continue, next and yes as fast as you can. I never followed steps 10 through 14 as listed on Sony's instructions, but it might be that you have to.

6) When you come to that little three field form, enter your name, the first 14 characters of your phone's IMEI number and your email address. This email address needs to be valid, as it's there you'll receive the unlock code.

7) Turn your phone off, while you continue with the next steps

8) Open the folder where you installed the 'fastboot' tool from the Android Development Kit, and open the Android ROM zipfile. Extract 'boot.img' from that zipfile onto the same folder.

9) Now open a command window, for example through start -> run -> cmd.exe <enter>, in the same folder as where you have the fastboot.exe and boot.img files (go there with the 'cd' command).

10) Connect a Micro USB cable to your computer, press and hold the volume UP button on your phone and only then connect that cable to your phone (while keeping the volume button pressed). The LED turns blue.

11) Type, in the commandline, fastboot.exe -i 0x0fce oem unlock 0xTHEKEY where you replace THEKEY with the code you received from Sony in response to your request from step 6.

12) Then flash CM's bootloader with the command: fastboot -i 0xfce flash boot boot.img

13) Reboot your phone using: fastboot -i 0xfce reboot - immediately after, start pressing volume up and down sequentually a few times, until a very nerdy looking menu appears.

14) Use the volume up and down keys to go up and down in the menu, and the power button to confirm. Look for wipe data/factory reset and do that. 

15) Stay in the menu, and choose "Install zip from SD card" and then "Choose zip from SD card", then select the CyanogenMod file you downloaded and conform that you want to install that. Repeat this step for the Google Apps zip file. If you cannot find the zip file, look for an option to choose from an External SD card.

16) And that's about it - when done, just restart your phone. Have some patience, first time boot always takes some time.

17) Anjoy full root and customization options.

Back to stock Xperia

Now let's say you want to go back to running Xperia software. Easy! All you'll need is your phone, an internet connection and a Windows computer. Linux won't do here.

1) Download Sony's Flash tool ("Emma") from: developer.sonymobile.com/(..)/xperia-devices/

2) Turn off your phone while you continue with the next steps

3) Unpack all files from the zip file

4) Run the installer .exe, and remember where you installed it 

5) If you would now run Emma, it would ask you to login or create an account. I tried that, but still haven't received my account approval yet. But here's the thing, you don't have to login. Just copy the file called 'customization.ini' onto the location where you installed the the Flash tool (probably: "C:\Program Files\Sony Mobile\Emma\").

6) Now make sure you don't have the PC Companian software running, and open up Emma.

7) Hold down the volume DOWN button on your phone, while you connect the USB cable. Emma will recognize your device, when it does you can release the volume down button.

8) I had only one software version to choose from, so I chose that and confirmed my selection. You might have more options to choose from, generally you would want to select the latest version and/or the version that matches your country/area/operator.

9) Once you have selected and confirmed the software version it will start downloading and installing. During which you can easily get yourself some coffee, get some work done, update your blog, or whatever - it's going to take a while. 

10) When the wait is over, disconnect your USB cable and turn on your phone. After a slow first boot you're back and ready to enjoy Android without root, less customization options but the full Xperia experience.

I also tried just responding to PC Companians message about me being able to use that tool to update my phone, but after the download and checking phases that just told me it wouldn't do it since I was running customized software.

That's about all. If you have some advice a good Torch app I should try let me know - I'm still looking ;).

You might also want to explore these likealots