[HTC One S] khan.orak:
Lately, many people, including myself, have been at a disadvantage of not having an official RUU for JellyBean so that stock environment can be achieved. Although sometimes, OTA's are available which can do the job. Hence this Tutorial. Also this saves the effort to do S-OFF/SuperCID which often brings along more problems.

This Tutorial, in principle, can be applied to both S4 and S3 variants.

All thanks to [MENTION=4454577]xander1993[/MENTION] at the VilleC2 Development Section who created the original thread Here. Though somewhat unclear and related to VilleC2, I thought of making a thorough guide for Ville with some minor changes.

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

For T-MOBILE UK Users:

(UK people with other operators e.g Three, Vodafone etc can also try the Jellybean Nandroid backup

IF

their firmware is upgraded to that of Jellybean)

ICS Users: Those stuck on ICS custom ROMs and can't get stock, Use This RUU to get to stock ICS and then update to Jellybean via System Updates Check. Thanks to [MENTION=4758499]ppm48[/MENTION]

Jellybean Users:Those stuck on Jellybean custom ROMs wanting to get stock, I have a Stock Jellybean 4.1.1 Nandroid backup for you guys Here Since there isn't any OTA.zip for T-Mobile UK for Jellybean. You can just flash this Nandroid right away without using this tutorial. Again, Thanks to [MENTION=4758499]ppm48[/MENTION] for this. Also, if you have bootloops after restoring this backup, flash a Jellybean Sense boot.img.

Additionally refer to this post by [MENTION=4885902]mkoev[/MENTION] , should prove a lot helpful. Then you can follow the tutorial.

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

For OPTUS Users with CID OPTUS001:

(All thanks to [MENTION=1103905]salac[/MENTION])

Get the modified OTA.zip Here. by [MENTION=1103905]salac[/MENTION]

Optus users please follow [MENTION=1103905]salac[/MENTION] 's post above to flash the OTA.zip

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Pre-requisites:

1. Notepad++

2. 7-Zip (Recommended)

3. ADB+Fastboot (Get it Here)

4. HTC drivers (Standalone OR HTC Sync Manager Drivers)

5. Unlock_code.bin from HTCDev to unlock bootloader.

6. Any OS (Custom/Stock) present on the phone. (I have not tested it for phones without any OS, you may try it at your own risk and post results here)

Not Needed anymore.

Common Steps:

In this guide, I will ask you to go to fastboot/adb so you should know how you would do that. (All fastboot/adb commands are to be given via Command Prompt from PC)

To execute

Fastboot

Commands:

- Go to fastboot folder on your PC

- Go to fastboot via bootloader on your phone

- Connect the Phone to PC and on the Phone it should say

Fastboot - USB Mode

- Now in the fastboot folder on your PC, Hold Shift + Right-Click and click Open Command Window Here

- Now you can enter commands given in the guide for fastboot.

To execute

ADB

Commands:

- Same procedure except that you don't need to go to fasboot on your phone. You can execute adb commands while in Android OS/desktop.

To boot into

Bootloader

:

- While the phone is turned off, Press Volume Down + Power Button simultaneously.

OR

- If you are in Android OS, use the following adb command to boot into bootloader:

adb reboot bootloader

OR

- If you want to reboot into bootloader from fastboot:

fastboot reboot-bootloader

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Caution for SuperCID users:

Please click the CROSS button on your Browser Tab, as flashing this is not intended for you. Either don't flash the OTA.zip, which will brick your phone if you do, OR change your CID to original one. e.g. H3G__001, BM___001, ORANG001

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Procedure:

- ** - ** - ** - Make Nandroid Backups before you do anything, remember you are doing this at your own risk - ** - ** - ** -

1. Download a OTA.zip – Most likely from Here. (You can rename the OTA file which usually has a long name to simply OTA.zip for ease)

2. Extract firmware.zip from OTA.zip. Then extract boot.img from firmware.zip. For now, copy Boot.img to ADB+Fastboot Folder..

3. Now to match the CID of your phone. You can get the CID of your phone via CID Getter from Play Store. Once opened, at the top will be your CID in Red color.

Alternatively, You can also get CID of your phone via Fastboot. Command for that is:

fastboot getvar cid

and it should display your CID.

4. Inside firmware.zip, look for android-info.txt. Supported CIDs should be mentioned inside this file. If it matches with that of your phone, Proceed otherwise

stop

and don't put yourself into more problems. (CID Match Exception: This 4th step may not be applicable to you if & only if you are to skip steps 11 to 16, if this is the case, you may flash OTA.zip skipping steps 11 to 16; Read step 10 for more info and then come back here)

5. We need to remove some code lines from inside the OTA.zip. For this, Open the OTA.zip with 7-zip (Right-click ---> 7-zip ---> Open Archive).

6. Head over to META-INF\com\google\android and find a file named updater-script. Drag it out of the archive to the folder/desktop where you can edit it. You should make an extra copy of this file.

7. Once you drag it out, delete the original updater-script inside the archive. It will recompress OTA.zip.

8. Edit with Notepad++ the extracted updater-script file. Find these lines (in the beginning of the file) and delete them altogether:

[COLOR="Purple"]assert(check_cid(getprop("ro.cid"), "00000000" , "11111111" ,
"22222222" , "33333333" , "44444444" , "55555555" , "66666666" ,
"77777777" , "88888888" , "99999999" ,
"BM___001") == "t");[/COLOR]
ifelse( is_ship_bootloader(getprop("ro.bootloader")) == "t" ,
assert(check_mid("full", "PJ4011000") == "t");,
assert(check_mid("simple", "PJ4011000") == "t");
);

You should delete these lines up to exact semi-colon ; at the end. (the purple lines with different CIDs can be different from those mentioned here, so no need to panic, just delete them)

9. Once edited, Copy this edited updater-script into the OTA.zip archive at the same location from which it was removed. It will recompress OTA.zip. You may now transfer OTA.zip to your SD-Card on your phone.

10. If you previously updated to JellyBean via OTA (Or if you have the exact or newer firmware on your phone than that present inside OTA.zip), skip steps

11 to 16

. For example, if you have HBOOT Version 2.15.0000/2.13.0000 or above, it means you have already upgraded to Jellybean firmware so

no need

for Steps 11 to 16.

In case, if you are to proceed to step 11, that is if you are to flash firmware.zip, make sure to match CID as mentioned in step 4 to avoid any bricks. This is especially useful for those who have ICS and want to get stock JB or those on JB but want complete stock HBOOT, recovery etc.

11. Place firmware.zip extracted from OTA.zip inside ADB + Fastboot Folder.

12. Lock the bootloader, if unlocked. For this, go to fastboot on your phone and give the command:

fastboot oem lock

The phone reboots after this.

13. While in Android OS/Desktop, fire up Command window on PC to give the following ADB command to boot into OEM Update Mode.

adb reboot oem-78

OR (if you can't access OS to execute adb)

From Fastboot:

fastboot oem rebootRUU

You should be seeing HTC logo.

14. While in OEM Update Mode, give the following fastboot command to flash firmware:

fastboot flash zip firmware.zip

If it fails with error and doesn't show any Green Progressbar, keep trying the above command. Usually works after a few tries.

********** DO NOT REBOOT MANUALLY UNTIL IT FINISHES FLASHING FIRMWARE OR YOU'LL BRICK YOUR PHONE *************

15. Once firmware is updated, reboot into bootloader. Go into fastboot.

16. Place Unlock_code.bin inside ADB + Fastboot Folder. Use the following fastboot command to unlock your bootloader again. (This will wipe your phone except for SD, so you must make a backup before doing this)

[COLOR="Blue"]fastboot flash unlocktoken Unlock_code.bin[/COLOR]

17. Download a recovery. Preferred Recovery is TWRP 2.3.3.0 and I have not tested this guide with any other version. Put the recovery in the ADB + Fastboot folder.

18. Now go into bootloader again. This time to flash the recovery anew.

fastboot flash recovery recovery.img

19. Now go to the recovery via bootloader. Wipe data/factory reset, cache, dalvik.

20. Restore the Nandroid backup you had made earlier.

21. Now Flash the OTA.zip which is on your SD-Card. It should flash fine.

22. Go to fastboot via bootloader. We are now going to flash kernel with the following command, boot.img you had earlier copied to ADB+Fastboot folder.

fastboot flash boot boot.img

23. Reboot to the OS and you should see complete stock JB OS.

--------------------------------------------------------------------------------------------------------------------------------------------------------

Please Rate the thread and Hit the Thanks button if this tutorial helped you!