Tuesday, November 26, 2013

Firmware upgrade for Xperia U in Linux (II)

[Long post]

Edited (08th-Jun-2014): Updated the firmware download site.

In my previous post I explained that one of the things that made the installing process more difficult was the lack of a general picture of the process. There are lots of pages explaining recipes to install, but I find it difficult to follow recipes if I don't manage to understand the underlying logic.

The following is my visualization of the whole process (this is less than a week of knowledge, so I cannot say I'm an expert: take it with a grain of salt). You can get a more accurate picture of the Android architecture in other pages. And you can get the process in detail from XDA.

First, components

As far as I understand there are three components in an Android system


  1. The bootloader. This is a piece of software that usually loads the system, enables Android recovery image and image upgrades. Sometimes it is called the kernel, so I understand it is the underlying component of the Android
  2. The second one is called the system. It would include shared libraries and components. When people says Android is Java, I understand that it is probably related to this set.
  3. And the third one is called Gapps. Gapps it is not a component in its own. It's a package with Google applications. For licence reasons, you cannot distribute them attached to other components, so you almost always will find a package with Gapps.


OK. Now to the process. Again. You'll probably void the warranty and you could brick your phone. If you're not comfortable installing your own operating system at your computer, DON'T EVEN BOTHER reading further. If you are reading this, you have Linux at home and that's means that you are more than average Joe, but do it at tour own risk.

Second, the modes. Fastboot and the like


"Fastboot??? What the h***ll is that. Gonzalo, you told me this was going to be easy".

I nearly bricked a BQ Maxwell tablet upgrading to the official firmware, so, please, don't think this is easy.

Fastboot is a mode in the phone that allows to unlock and flash the bootloader. In the Xperia U you get that mode turning the phone off, then pressing the Volume up button and while pressing, connecting the USB cable to the computer. But you should already know if you had read the Sony document as I told you. The light in the phone should be blue.

There is also another mode called Flash mode. "Fastboot mode and Flash mode are different? Is there no other F-word?". To enter Flash mode, shutdown the mobile, disconnect the cable from the computer, press the Volume down, connect to the computer and release the volume down. The light in the phone should be green.

 Recovery mode. It is a mode that allows to do some powerful things from the phone. To enter that mode, power off the phone, then power on and after you see the SONY logo, press repeatedly volume down button (-) until you see recovery. While in the previous two modes the screen is powered off, in this mode, you can navigate the menus. To navigate in the recovery mode, you use volume up and volume down, and select with the Power button.

You will sometimes read about Normal mode. Normal mode is the phone on as usual, sometimes with the the debug options activated.

Updating. One twist.

After reading about components and modes, the first thing to do it would seem to update the bootloader. But...

...you cannot update the kernel directly because to avoid people messing around, kernels tend to be locked down by the manufacturer. Besides, sometimes you buy phones locked by the telco company (so that you get it cheaper, but you cannot change the company).

So before you update the kernel, you need to unlock (or root, as it sometimes called) the bootloader.

Unlocking the bootloader

I must confess I'm pleasantly surprised with Sony about the unlocking process. It has a very informative page with a step-to-step guide. Unfortunately, it doesn't work with Linux, but you should read it in detail because it is almost there. You'll need to install Android SDK. You'll need to follow most of the steps.. Also, you will need a code, you're going to get by email from that page. So go read, click next and fill the details with your email and IMEI, because you do really need the code.

When going for Linux, you're going to follow the same steps. BUT. Instead of the steps related to the USB drivers (i.e step 9), you need UDEV rules. UDEV is the way Linux uses to recognize new components, in particular USB devices. You will need the USB ID for your phone version, both in usual mode, in Fastboot mode and in Flash mode.



Back to the UDEV rules, these are the ones I got for Xperia U ST25i.



But you should get yours using the tool lsusb.

After you have the correct rules (and you have restarted the UDEV with "sudo service udev restart") connected in fastboot mode, you will be able to follow steps in the Sony Page and unlock the bootloader. And then to the next step

Flashing the kernel

This part should be easy but it gets a bit tricky. You are going to use a tool called Flashtool. But the tricky part is that Flashtool needs libusb-dev. From what I've been able to understand, that library suffered some fork, so you'll end up asking how the h*ll should you install that library. And if you've got a 64 bits linux version, things are not going to be easier. You may end up screwing the whole system because ia32-libs (don't follow that route).

Good thing about the Internet is that you are not alone. So in this page, you'll get to ease the problematic steps. Basically, compile libusb-dev from source and modify Flashtool.

And then flahsing the kernel should be easy. Flashtool allows lots of things, but I only flashed the kernel  with the firmware Flashtool came with. Once connected, I think you can flash either in Fast boot and in flash mode.

Flashing the system and Gapps

The last part is very easy. First download the system and Gapps. If you're going to pick the latest versions, do it from Maclaw. The download is a bit unintuitive (click Sony Xperia U, click CianogenMod in the right, and then download both files). Edited: If you want Android 4.4.3, see this post. The better place is from XDA. Once downloaded, copy them to the phone in normal mode.

And reboot in Recovery mode. In Recovery mode you should do a backup. Just in case.

Then follow the process "Install zip->Choose zip from /storage/sdcard0 and select the folder where you copied the file" to load first the system file. And then do the same process with the Gapps file.

And then wipe data/factory reset, followed by wipe cache partition and followed by "advanced->Wipe dalvik cache"

And then "reboot system now"

One last note


One of the things I struggled with was reading about a sdcard "Where is the SDCARD in an Xperia U?".

I understand it is a sort of internal storage. Anyway, there is no socket to put a SDCARD inside, so forget about it.




Sunday, November 24, 2013

Firmware upgrade for Xperia U in Linux (I)

About a year ago I received some wonderful presents from a group of friends :D. One of them was an Xperia U.

Sony Xperia U (ST25i) has a stock Android 2.3, which a year ago was already a bit old. Fortunately, Sony had already published Android 4.04 for the Xperia U, and the same day I received, I installed ICS (Android is famous for putting sweet names to its versions).

The phone worked quite well. But new Android versions came, and it was obvious Xperia U wouldn't get an updated.

So I decided to explore the Android unofficial update scene. And I ended up installing a custom firmware. And I don't regret it.

I have the new shiny Android KitKat 4.4. The phone works really great. Fluid. Visually more pleasant. No crapware (why do they force to install apps nobody uses?).

It still has some issues pending (at this moment, Bluetooth does not work yet), but for me it is no longer a matter of testing a Custom Firmware. It is much much better than the official Sony 4.0.4 version. Besides, the scene for the Xperia is very active and vital (yesterday I installed a 22nd November version that didn't have wifi working, and this morning I installed another version where wifi works)

The real process is very easy, but I had some issues getting to there. Because of two things:


  1. I didn't even know the most basic terminology about the process (not that I am an expert know, you know) and I couldn't manage to get a mental picture of it.
  2. Most of the pages are Microsoft Windows based. I have Linux at home. Linux Mint 64bits, to get things more complicated (as we'll see). 


So in my next post I'll try to explain the process in a sort of newbie post. HOWEVER. Word of caution. You'll probably void the warranty and you could brick your phone. So this is not something for the faint of heart.

UPDATED: Link to the detailed post.

Friday, November 8, 2013

Companies, developers and recruitment

A few months ago I reported my business unit was offered for sale. Not much to report about it (I know very little and I can write even less)

Obviously, most of us in the business unit, decided to brush up our Linkedin pages and get into the job market, just in case.

I remember in particular one interview. It didn't start well when I replied "Sí, I mean, yes" after listening my name with a perfect Spanish z sound (as it turned out, one of the interviewers was Spanish too). It didn't continue well due to my inability to reply to the typical Java interview questions (such as Big-Oh notation complexity for a java hashlist look up or differences between Spring container and JEE container). I didn't pass the test.

But for me as an experience, the interview finished wonderfully when the Spanish guy asked "What are you looking for? What's your ideal job?"

I think it is very difficult to match companies and people.

Companies would really like people that could commit to the project and I certainly prefer a company where I feel my work makes a difference. However, companies tend to look for people that can hit the ground running at the lower cost. And developers tend to look for companies with better conditions and more buzzwords.

One could think that model is flawed. But the fact is that the alternative is not always better. In a past life I had to do some recruitment. And the worst selection was a guy I thought he was going to fit perfectly in the culture. And as an interviewee I've never asked if I would be able to fully manage my own machine or if I would personally know the people managing the servers.

So back again to the interview "What are you looking for? What's your ideal job?". Putting in words, I want a place challenging, where I can learn new things and do different tasks day in day out. I want a place where I can commit and where my job makes a difference. I won't talk about my current job except to say people are wonderful. I don't know about the future in my current job. And I'm really proud that people still remember me from my previous job. I do remember them too. So people are very important too.

But, the fact is that suddenly, I realized how difficult matching companies with people is. Because I certainly could have answered all those questions, and that wouldn't have made me more suitable for the job (in fact I aced the concurrency ones which I have a more solid knowledge background but less experience). I remember selecting people we used to ask for digital signature experience and hitting the ground running didn't have anything to do with that.

But even if I were an incredibly valued employee, I wouldn't have a clue if the job I was being offered is the one was looking for or if that's my ideal job.

Friday, November 1, 2013

One year

A year ago I was in a plane flying into London. I was in whirl, nearly panicking. My life about to change.

I'm somebody who loves being in his comfort zone. And then leaving your wife and daughters for 6 months. Leaving your country for who knows how much time.

It has been hard. There have been difficult times. In lots of different levels. Renting in London (well worth a million pages book). Eating in London (a shorter book :D). Weekend trips back to Spain waking up at 4am on a Saturday and back to London at 3pm on a gloomy Sunday. Talking to your family via Skype. Missing lots of things. Closing down the family home in Madrid and moving to London. Missing the light.

But I don't regret it at all. It is being a wonderful experience. My daughters are happy. My wife is happy. There are lots of great people all around.

And so far, it is working well. There's a new comfort zone around (sort of).

I don't know about the future.

But so far, so good.