[One (M7) General] electronical:
If you regularly install/test custom firmwares, ROMs and mods on your HTC One, it can be quite annoying and time-consuming if you want to go back to the latest stock software with official manufacturer OTA support (for example, to check if the latest official OTA update has been released for your region). Flashing the RUU is arguably the easiest and fastest way, but many of us have only older RUU's available which means having to download some quite big OTA updates every time. To avoid this inconvenience, i've done some research about the various methods to return to the latest stock version as hassle-free and as quickly as possible and i've come up with the following solution. This idea is not ground-breaking and might not be new to some (or most) of you, but i believe this guide should be useful for "noobs" or those who never thought of or didn't know how to handle OTAs and also to find the easiest and fastest way to swap any custom software (ROM/firmware) on your HTC One with the last 100% stock installation right before you flashed a custom recovery.

The procedure described below tries to eliminate the need to look for and flash stock firmware and stock ROMs uploaded by others, which may not necessarily exactly match with the original stock software of your phone especially since there exists dozens of HTC One variants. Using downloaded stock firmware/ROM from others might cause incompatibilities, degradation in performance, lost of signal, poor reception, etc. Ideally, you want to be able to flash whatever ROM/firmware and at any time, if you wish, you should be able to switch back to your

own

stock ROM and firmware. This is usually done by flashing your RUU (Rom Update Utility) according to your phone's MID and CID. However, most of you would need to go through an annoying and time-consuming update process to download several OTAs before finally reaching the current latest stock version. But here's a solution!

Minimum requirements:

1. Your HTC One's bootloader must be unlocked.

If your device is already S-OFF and if you relocked/locked your bootloader, then you can unlock the bootloader without having to use the official htcdev website. Just follow this guide to set the Bootloader as UNLOCKED: http://xdaforums.com/showthread.php?t=2497712

2. You need to find your device's RUU (decrypted is even better as it allows going through the process faster)

or

your 100% stock software backup (firmware and ROM). If you made a nandroid backup after unlocking the Bootloader, it won't work since some data was wiped from your phone's memory during the unlocking process from the official htcdev website.

It's advised to use the RUU to restore which is specifically designed for a set of devices according to their MID and CID, rather than trying your luck at finding a compatible stock firmware and ROM for your HTC One variant. Here's a thread with a collection of RUUs and stock firmware/ROMs: http://xdaforums.com/showthread.php?t=2428276

3. Your device should be S-OFF.

This is not an absolute requirement but S-OFF makes the whole procedure much easier. For the purpose of this guide, it will be assumed that your device is S-OFF.

Advantages of this method:

1. You will save time by being able to restore back to the latest 100% stock version very quickly (some OTA updates are around 400 MB which can take some time to download). You will only have to download the OTA's one time and then back up these OTA's to use later for updating/restoring your stock software.

2. You won't need an internet connection to update to your last stock version backup. The update process to previously downloaded (and backed up) OTA's will not require an internet connection. However, you will have to download any newer OTA's if available.

3. You will not have to rely on other sources to find your latest stock firmware and stock ROM. Therefore, you can be certain that you're getting a perfectly matching firmware and ROM for your specific HTC One model (the restored firmware and ROM will be exactly as if you never tampered with your device, with official manufacturer OTA support).

4. You will not have to downgrade if using an older RUU or older stock firmware/ROM, and then have to update it again via OTA. Your HTC One will be restored to 100% stock with the same software version just before you flashed a custom firmware/ROM.

5. If you absolutely need to run the RUU to go back to 100% stock, then you will not have to run the RUU process more than once (which will wipe all your nandroid backups as well as all your data, assuming you have a decrypted RUU, otherwise you will have to run the RUU twice only).

Procedure:

To summarize, if you want to go back to 100% stock using the method in this guide, all you will have to do is restore your nandroid backup and flash the firmware from the latest OTA. You will then get stock software with full OTA support within a few minutes from a custom installation. The method itself consists of handling official OTAs and extracting the most recent firmware in order to restore. But you will need a starting point where your device is 100% stock and able to receive and install official OTAs from the manufacturer. Let's assume that your HTC One is 100% stock. Whatever means you used to reach 100% stock, you will need it again. So, keep that RUU (preferably try to find your decrypted RUU zip) or stock files handy.

Check if you have any OTA update available:

No update available

If no OTA updates are available for your device, you can flash your custom recovery and then do a nandroid backup (very important). Then, you can root, flash a custom ROM and if you're S-OFF, you can even flash custom firmware.

Going back to stock: if you want to check for OTA availability at any time or you just want to go back to 100% stock, the easiest and safest way is to run your RUU. But if you found your decrypted RUU zip, you can go back to stock even faster; first restore your nandroid backup and then extract firmware.zip from the decrypted RUU zip and flash it. That's it. You're now back to 100% stock. You can check if there are any available OTAs and then go back to using custom ROMs again if you like.

Update available

Here is the more interesting part of this guide:

1. You will need the original firmware.zip file for your current stock software version. If you ran the RUU to go back to stock, extract rom.zip (follow this guide: http://xdaforums.com/showthread.php?t=2497614) and then extract firmware.zip from the decrypted RUU rom.zip file. If the RUU rom.zip is not decrypted, it will give you an extraction error about all the files contained within being corrupt. In that case, you should try to find a decrypted version of the same RUU or decrypt it yourself (requires Linux, as decrypting an RUU is currently not possible on other OS). Use Winrar/Winzip to open the firmware.zip and extract recovery.img and place it in your adb folder.

2. Check for software update in the Settings menu. If you get OTA update notification, accept it. Note the file size of the OTA download, as it'll be useful to easily identify it later when searching in your device's internal memory. Let it download but do not install it. Select the option "Install Later" when prompted.

3. In the Settings menu, disable fastboot and enable USB Debugging.

4. Flash custom recovery. Root your device. Boot up to Android.

5. Install ES File Explorer from the Play Store (it's free) and give it root permission from its settings. Use ES File Explorer to search for the OTA on your phone. I found Root Explorer to be much faster at searching files although it's a paid app. You will usually find the downloaded OTA in your /sdcard/Download/ folder or /data/data/com.android.providers.downloads/cache/ folder. The OTA will have the keyword "OTA" in its filename and it will be a single zip file. You can also confirm that it's the OTA file by its file size from the earlier OTA pop-up notification. If you still can't find your OTA zip, you can search for "OTA" or "zip" through ES File Explorer or Root Explorer (much faster). Then go through the search results. Here's the original filename of one of my OTA's: OTA_M7_U_JB_50_S_HTC_Europe_2.24.401.2-1.29.401.2_R_P_release_325145_signedn3pctn48i51c9iue.zip. When you've found the OTA, copy it using ES File Explorer to the /sdcard/ location on your phone. Then plug in a USB cable to your HTC One and copy the OTA to a safe place on your PC hard drive.

6. Now, connect your phone via USB, reboot and go to your bootloader. We'll be flashing recovery.img from step 1. Use command "fastboot erase cache" then "fastboot flash recovery recovery.img" and finally "fastboot reboot". Now, you have 100% stock again with OTA support. The SuperUser/SuperSU app will still be visible on your phone but it won't work since the su binary will have been wiped during the stock recovery restore process.

7. Check for OTA software update again from the Settings menu. Install the downloaded file through the update notification menu. But if the update re-downloads, cancel it. Instead, you can manually flash it by copying the OTA zip to the phone's internal memory (don't have to rename the OTA zip but for simplicity, rename it to update.zip) and go to your Bootloader. Select Recovery using the Power button and then press the Power and Volume Up buttons to load the stock recovery menu. Then, select 'apply from phone storage' and navigate the menu as you would in a custom recovery to find update.zip and select it to install. It will follow the official update procedures and will reboot a few times before going back to your homescreen. Check attachments below for the stock recovery menu and options.

8. When your phone reboots, check for OTA again. If update is found, download it but choose "Install Later".

9. Then, just follow the same steps above; 4 through 8. Redo the same steps to copy the OTA to your PC and extract firmware.zip. The principle is that you should backup all the successive OTAs until there are no more updates available. The very last OTA's firmware.zip is the most important file. Keep it separately from the other firmwares. You should also save the previous complete OTA zips to be able to update quickly if you ever need to run RUU again.

10. After you've made a backup for the last OTA zip file, check for software update and install the already download OTA zip through the normal update notification menu. If the OTA update re-downloads, cancel it and do a manual flash for the OTA update that you saved previously, as explained in step 7. Note that an official OTA will update both the firmware and ROM.

11. Then, flash a custom recovery and make a complete nandroid backup to secure your last updated stock ROM. Copy the nandroid backup to your PC. Keep the nandroid backup and the last firmware.zip file (extracted from the last downloaded OTA zip file) safely as these two files are the only ones you will need to restore quickly back to 100% stock with OTA support, unless you were to run the RUU, in which case, you'll have to install all the OTA zip files successively.

12. Now, you can flash whatever you like on your HTC One. If you're S-OFF, you can flash custom firmware as well.

Going back to stock: if you want to check quickly if any OTA's are available or just want to easily go back to 100% stock software, all you have to do is first, restore the last nandroid backup of the stock ROM and then flash the firmware.zip from the last OTA update that you downloaded. That's it. Now, you can check and update easily to any new OTA that might have been released while your device was on custom ROM/firmware. Obviously, you can also backup any available OTA's, by following the same steps above.

I will probably expand this guide further if there is any interest in it.

If this guide was helpful to you, just press the "THANKS" button! :cool: