March 5, 2013

I DesireS Jellybean

I have always been afraid of tampering with my HTC Desire S. Not in the fear of voiding warranty, rather following the logic of "Why fix something when it's not broken". It's nearly two years old now and I have been in the mood of getting a new phone since MWC'13. With Samsung Galaxy S4 and HTC ONE looming around the corner, causing the prices of galaxy S3 and oneX to plummet,  now was the perfect time to truly enjoy android. I must warn you though... trying to "have fun" with an HTC phone is one pain in the circuit. Obviously, I am not commanding you to do anything... it is you, who must decide to pursue this lolgag or not and risk bricking your device.

JB-4.2.2 on Desire S. Woohoo!




Objective

Install Android JellyBean 4.2.2 on a stock HTC Desire S with HTC Gingerbread 2.3.5

How-To

Well... the general OEM android phone would have it's bootloader locked, ie: No root access for you. Need to get rid of that first, and voila we are done. NOT! Desire S being an HTC phone, you'd also have to deal with the S-OFF/ON situation. HTC phones are default S-ON, blocking access to NAND. That makes this game a whole lot messy/fun.

Rooting is truly simple. But getting going S-ON to S-OFF is not. For S-OFF you'd need to replace your bootloader with ENG HBOOT (from Revolutionary), and that only works when your stock hboot is 0.98.x., which is not the case in most Desire S with GB-2.3.5. So, logically, you'd have to downgrade your hboot from whatever version you have (I had v2.x.x) to v0.98.x and then S-OFF. To downgrade your device, you'd need to install an older RUU (ROM Update Utility - Stock android from OEM) from HTC which would be region specific. What if you don't find an older RUU for your region (like in my case)!? You'd need a GoldCard which allows you to install any RUU regardless of region checks.  So, now you install an older RUU to get an older hboot - v0.98.x. Revolutionary's S-OFF tool can now work with this. With this, you now have an S-OFF'd device. Flash a recovery again. Root your phone via recovery. And we are done. You can now flash any rom you want via the recovery you installed. I warned ya that it was going to be a pain.
  1. Unlock device via HTCDev.
  2. Make a GoldCard.
  3. Flash a recovery #1.
  4. Flash Root #1.
  5. Change device version to an older one than the old RUU that you are going to install to downgrade your hboot to 0.98.x. Via misc_version.
  6. Lock device via fastboot.
  7. Install RUU
  8. Run Revolurionary's S-OFF tool.
  9. Flash a recovery #2.
  10. Done.
  11. Install Custom Rom for lulz.

0. Prerequisites

You'll need  a few things in the right place.

DesireS/Android drivers

Download HTC Sync, install it. Plug in device and let it install the drivers. Now, uninstll HTC Sync - we only needed that trash of an application for it's bundeled drivers.

DesireS All-in-One Toolkit v2.0

The biggest and baddest gun in the arsenal. Has a lot of utils and comes with adb and fastboot (which you'll use quite often). This is what you'll use to root it the first time (Unlock via HTCDev). Also you'll use it quite often to boot into bootloader/recovery, in case you are too lazy to type out shell commands. Instead of having to download the whole SDK or android utils, just get this and familiarize yourself with the interface (kinda way too simple really).

GoldCard Utils

You'll need a spare microSD (small one is fine, I used a 1GB) to act as your GoldCard for your device. A GoldCard is basically a little code in the code section of your microSD header. Helps bypass RUU region checks. Also in case you brick your phone, you can use this to install a fresh RUU.
Dowload GoldCard Tool.

Root App - su

Inorder to gain root, you'll need to flash a root app through recovery.
Dowload and keep SuperSU.

Recovery

Every rooted android phone has a recovery flashed on it. This is what you'll use to install roms, install zips, clear cache/data, even backup. Very important and very useful. I picked 4ext (xda-forum)for this. You may also pick amongst CWM and TWRP. Get the recovery.img and keep it somewhere for any of them. You'll use fastboot to flash the recovery image.

misc_version

This helps mask the device version to a very old one, so that you may install the old RUU on it. 

The RUU

Any old HTC Desire S RUU will do as we have a GoldCard. I picked - RUU_Saga_HTC_Europe_1.28.401.1
My DesireS has a region code of HTC__J15, which is the GCC region. I couldn't find any old RUU for my region.


Try to keep all of the above in the same place. I kept all the software/img/zip/ruu in the DesireS All-in-One's resource directory - where adb and fastboot reside.

Ensure that USB Debugging is enabled and that the phone is indeed connected to the PC. Quite often that's the solution to many problems you might face.

Check with adb shell (comes with the All-in-One Tkit) command:

> adb devices

1. Unlock Device via HTCDev

Use the DesireS All-in-One toolkit and get this done. Make sure USB debugging is enabled on the device. It's the steps in the top-left pane, titled, "To Root the Phone, Follow in Order". Once all the five steps are done. Boot in bootlader and verify - *UNLOCKED* 

2. Make a GoldCard

  1. Take your microSD and format in the phone.
  2. Connect to PC as disk Drive.
  3. Place the SuperUser app zip in it (Will be used later).
  4. Follow Instructions.
Now that you have a GoldCard, you are almost ready for an RUU installation.

3. Flash a Recovery #1

Use All-in-One Tkit to boot into bootloader. Then use fastboot via cmd prompt. The below commands consider that you have recovery.img and fastboot in the same directory.

fastboot flash recovery recovery.img
fastboot reboot-bootloader

4. Flash Root #1

Now that you have installed a recovery and are in the bootloader. Get into the recovery. 



Install the SuperUser zip. There should be an option somewhere in your recovery tool to install from zip (in 4ext, this is inside "install from SDCard" menu).
After installation, reboot the phone normally in the recovery itself ("reboot now").

Go to the SuperSU app, and set the "user permissions/handling of new requests" from prompt to grant. This is very important for the next step.

5. misc_version

Ensure USB debugging is on while the phone is connect as "Charge Only". In the command prompt shell, 

> adb push misc_version /data/local/tmp
> adb shell chmod 777 /data/local/tmp/misc_version
> adb shell
$ su
# cd /data/local/tmp
# ./misc_version -s 1.27.405.6
# exit
> adb reboot-bootloader

Note that, ">" is cmdPrompt, '$' is adbShell and '#' is su granted adb shell. It has to be a '#' else you have not been given root access permission and you must redo the previous step (Step 4).

The misc_version argument (1.27.405.6) has to be very accurate, else the next step won't work.

6. Relock Device

fastboot oem lock

You'll see an error in the cmdPrompt. Ignore it.
The device should restart itself. If not already at bootloader, restart into bootloader. You'll see a *RE-LOCKED*
So far so good. Reboot the phone normally.

7. Install RUU

Ensure USB Debugging. Run the RUU.exe
Sit back and relax. If you have done everything to the word so far, then you shouldn't be seeing any problem. The RUU will detect your phone's version as 1.27.405.6 and "upgarde" accordingly.

When done. Restart into bootloader and observer the hboot version. Should be some 0.98.x.x.

8. Revolutionary's S-OFF

  1. Get the zip - revolutionary-version.zip
  2. Run revolutionary.exe, get beta key.
  3. Fill in your info in the form on the site and get the serial key.
  4. Enter the serial key in to the tool.
  5. Time for another coffee...
This will temproot your phone via zergRush and S-OFF it. You'll see some message about life and lemons. That's when you it's going smooth.

9. Flash a Recovery #2 - Same as Step 3

10. Done

You have now successfully rooted your HTC Desire S. Woohoo!

11. Installing JB

I picked Flinny Andromadus CM_10.1 build 16 for this. It comes with Jellybean 4.2.2. Get the rom zip and the google apps (gapps zip). Place the same in the root of your SDCard.

Boot into recovery (You should know how to do this by now)

Check md5 and then install the rom followed by the apps. If you have some backup.zip (from nandroid or Titanium backup), now is a good time to install that too.