Wednesday, February 29, 2012

Retrospect

Four years back on this day, I was preparing for my CA Final Exam. I was still an article assistant at M/s Vasu & Sivaram. My life was centered on the 8 papers I needed to clear for the completion of CA.

On 29-02-2008, my post in Ledger reads:
Today's fortune: Luck is coming your way. The way I see it, IDT is coming my way and no one in their right senses will call that 'Luck'. I have finally started with ASs and its progressing nicely. I intend to finish it by 15th so that I get enough time to revise MICS
So much has changed in the four years since I posted that: some good, some bad. It has been a terrific journey and today when I look back, I can gladly say that I am happy; I am happy for everything that happened in my life during these four years. Though I was not entirely lucky like the fortune teller said, I guess luck did come my way. I was lucky enough to clear CA in my first attempt, lucky to get a job right after my articleship, lucky to keep the friendships alive and lucky to escape from some life threatening accidents with nothing more than some minor bruises. So, in the end, the sorrows I had to suffer falls short of the happy moments by a long shot.

If the next four years are going to be even half as eventful as the previous Quartet, I will be a happy man. But that’s all in the future. Let’s see how it goes!

Annexure - Todays Fortune reads: "A pessimist sees the difficulty in every opportunity; an optimist sees the oportunity in every difficulty"

Sunday, February 19, 2012

A Novice's Guide to Rooting An Android Phone

Disclaimer: Following account traces the events unfolded during two days and contains technical information which may not be appropriate to some of the readers. Parental discretion adviced!

Chapter 1: The day the phone was bricked
Two days back (15th of February to be exact) my phone broke into a frenzy of weird music announcing the arrival of a brand new Firmware. The music pulled me back from the vortex some people call The Facebook. With trembling hands and a heart heavy with expectations I grabbed the phone and as expected I saw the notification announcing availability of firmware update. Ever since I found out from the manufacturers website that current firmware of my phone need to be updated to unlock the boot loader (program that loads the OS) of my phone, I have been anxiously and impatiently waiting for this moment. 'Finally.... 'I thought and pushed the update button without giving it a second thought. I was happy. The phone connected to my home WIFI and downloaded the update, rebooted itself and then installed the updated, again rebooted and slowly the welcome screen flashed. But something had gone wrong, really, really wrong...

As I unlocked the phone, I noticed little 'wobbliness' of the screen. It was a sign of things to come. As I explored I also learnt that WIFI was not working. The screen sometimes blinked making it very difficult to type. Then I knew: my phone had been 'bricked' (i.e. the phone was made unusable by a corrupted update of software) by the new update! I thought I could fix it by doing a factory rest. So I reset the phone once, then for a second time, a third and I stopped the 'reset' business with the fourth one. Clearly factory reset was utterly useless. So decided to go further. I rebooted the phone and from boot loader, tried the recovery option. I tried that couple of times and on both occasions, the screen froze with a red Exclamation mark. Now I was out of my wits. I had a broken down phone with no contacts (everything got deleted during the first factory reset). I took a backup of the SD card data and then restored an old backup of contacts stored in SD card so that I have something that resembled a useful phone. So ended the day in which my phone was bricked.

Chapter 2: The Decision
Next morning I called the HTC support hotline and they had bad news for me. They told that I have to contact their service centre at Ernakulam which is some 70KMs from my home and only then they can try to resolve the issue. Only problem was that with Information Systems Audit classes around the corner, I had no time to travel to Ernakulam. They told that I could also drop the phone in an outlet at my hometown. I didn’t want to do that either. So I decided to go to the service centre at Ernakulam. However, by the time I reached home, I had a new plan: instead of going to Ernakulam, I decided to try to root the phone and flash (install) a custom ROM (firmware). Thus started the mammoth rescue operation which lasted for 3.5 Hours.

Chapter 3: The Rescue of the phone that was bricked
I settled into the comfort of the armchair with a host of pen drives, USB cables, External HD etc. and began the rescue operation. Earlier in the day I had googled about the ways to root my phone and found a nice little tutorial in one of the forums. It wasn’t all that easy. It involved a complex process of unlocking my boot loader, flashing a custom CWM recovery, rooting the phone and flashing another ROM. But I decided to do go ahead and follow the steps given in the tutorial.

First I had to unlock the boot loader. My handset manufacturer provides a tool to generate an unlock binary file based on the unlock code of my handset. Unlocking the boot loader voids all or any of the warranty and if something went wrong after unlocking, i may not even get the benefit of the warranty. The notice didn't frighten me and i decided to go ahead. Unlocking the boot loader involved some command line theatrics, copying the unlock code and flashing (installing) a binary file emailed by the manufacturer. In the end phone is supposed to have an unlocked phone. And I did have an unlocked phone after completing these steps. Step One of the rescue was thus completed.

Step Two involved replacing the built-in recovery with a custom recovery called CWM (Clockwork Mod) Recovery. This step involved more terminal commands, flashing of an image file and rebooting. These steps were also completed successfully and I had managed to install the custom CWM Recovery.

By the end of this step, I was beginning to admire the beauty of Android and Linux. If it was a windows phone, I am sure that it would have been broken down completely by the end of 1st step. After the first two steps, I still had a phone with something of an OS and I was still able to boot it and make calls using the 'wobbly' UI.

Almost 1.5 hours into the rescue, I was able to successfully unlock the boot loader and install a custom recovery. Now I had to root my phone. Normally in all android phones, super user access (administrator access) is not given to the user as by default it is restricted. This is done to prevent any unauthorized modification to the system files. But some applications won’t work properly without superuser access. Rooting is the process by which superuser access can be gained. Third step involved placing a zip file in SD card and then installing it using CWM Recovery. It was a simple procedure and after installation of the file, I had superuser access to my phone.

Now to the penultimate and most important step: Increasing the Internal Memory. My phone had only about 50 MB of usable internal memory. Most of the apps can only be installed in internal memory. That meant I was not in a position to install most of the apps. Fourth Step was the solution for this memory problem. It involved wiping data and cache, installing Busybox (more command line showdown), partitioning my SD card using CWM Recovery and flashing (installing) a script placed in the SD card using recovery. This took a little longer to complete as I had some difficulties installing the Busybox. Eventually, I found the source of the problem and solution involved wiping the data again and starting from the beginning of Step 4. By the end of the third hour, I managed to successfully complete Step Four and my phone had 2GB of Internal memory.

Even after all these steps, the problem with my phone remained. The UI was still 'wobbly' and WIFI was still not working. The only solution was to install another ROM to replace the existing corrupted one. I searched for ROM in XDA Forums and found one. It took some to download the 153MB file. Installation of the ROM involved booting to recovery and entering more commands using the terminal. After that I had to again partition the SD card and run the zip file to increase the internal memory. This too was completed successfully. Finally, 3.5 hours into the rescue, I had successfully restored my phone. Only the painstaking exercise of restoring data backups and installing lost apps remained. It took another 2 hours to restore data backups and install apps over WIFI.

Chapter 4: And he used the phone happily ever after!
I have a phone with 2GB of Internal Memory and all the apps I couldn’t install before (including the angry bird game collection). The phone is working extremely well and some features are performing better