[One (M8) General] EddyOS:
*** I HAVE SOLD MY M8 BUT I WILL TRY AND KEEP THIS UP-TO-DATE WHEN NEW RUUs COME OUT ***

*** NEW GUIDE AS WE NOW HAVE AN RUU!!! ***

This guide is for Windows-only. The reason for this is because the htc_fastboot file used is a Windows binary and there doesn't appear to be a version for Mac/Linux

This guide will allow you to return your EU, unbranded M8_UL device to 100% stock (inc. locking the bootloader and removing the tampered flag) for resale purposes or to return to HTC. It does not cover carrier-branded handsets and does require you to be S-OFF but Step 3 can be done on an S-ON EU M8 so long as your bootloader is relocked and you match one of the CIDs listed below. A lot of this can be used to restore a US carrier M8 as the RUUs are available, though, but you'd have to get the relevant RUU.zip from the EXE (which is very easy)

This process applies to the following CIDs:

HTC__001

HTC__102

HTC__203

HTC__E11

HTC__405

HTC__Y13

HTC__304

HTC__A07

HTC__032

HTC__J15

HTC__016

HTC__M27

HTC__K18

HTC__A48

HTC__002

You need the following files stored in your fastboot folder:

4.16.401.10 RUU ZIP - https://drive.google.com/file/d/0B17smFr95pleU2NqcVB3NWxoNnM/view (renamed to ruu.zip - not ruu.zip.zip!)

md5:4e03845aeab375746b4553e610047680

htc_fastboot.exe - *** REMOVED DUE TO HUGE AMMOUNTS OF SPAM REQUESTS ***

md5: 7343C5BCEC64373F83D69BD074954759

TWRP - http://techerrata.com/file/twrp2/m8/openrecovery-twrp-2.8.4.0-m8.img (renamed to recovery.img) md5:

e51c6ce8db0b7318ef31e1e7bd03c96e

And you'll also need HTC Sync Manager - http://www.htc.com/uk/support/software/htc-sync-manager.aspx (install it for the drivers and then uninstall it but leave the drivers on your PC)

All commands in bold are to be done in a command prompt window in your fastboot folder

1. 'Lock' the bootloader and reset the tamper flag

We know we can relock the bootloader by using the command 'fastboot oem lock', but it will show 'RELOCKED' on the bootloader and still show the phone has been unlocked in the past. With S-OFF we can set it back to 'LOCKED' ;). To do this, we need to use TWRP and adb shell

Flash TWRP in the usual manner by connecting the phone to the PC whilst in the bootloader and flash by using the command fastboot flash recovery recovery.img. Once flashed, boot the phone into TWRP and connect to your PC and make sure the drivers are successfully installed. To confirm it's working type adb devices and it should be listed with your devices serial number. Assuming you can see the device, we can now use adb shell to change the flag from 'UNLOCKED' to 'LOCKED' by using the following commands:

adb shell

echo -ne '\x00\x00\x00\x00' | dd of=/dev/block/mmcblk0p2 bs=1 seek=33796

Once the command has finished, we can continue using adb shell to reset the tamper flag by using the following command:

echo -ne '\x00' | dd of=/dev/block/mmcblk0p6 bs=1 seek=5314564

Once this has finished, we can exit out of adb shell by simply typing exit. Then reboot the phone into the bootloader through the menu in TWRP so we can confirm the flags are set back to stock.

2. Change the CID (if required)

Now we're in the bootloader and are 'LOCKED' and not listed as modified (but still S-OFF) it's best we reset the CID so moving forward things are easy. To do this, you just need to use fastboot oem writecid HTC__001, or whichever CID your device originally came with from the list at the beginning of this guide. Once you've reset the CID, reboot the bootloader to confirm the changes using fastboot reboot-bootloader

3. Flash the RUU

We are now at the point where we can flash the RUU and restore the phone to 100% stock. To do this, we first need to boot the phone into RUU mode using the command fastboot oem rebootRUU. Once in RUU mode, you'll see a silver HTC logo on the phone and that's it. At this point, we now use the HTC fastboot package to flash their RUU.zip file using the command htc_fastboot flash zip ruu.zip. This process will take a few minutes, and the phone will reboot a few times but once done it'll say complete. At this point, reboot the phone back to the bootloader using fastboot reboot-bootloader

4. Factory reset the device *** OPTIONAL ***

Having flashed the RUU, I always prefer to do a factory reset to make sure everything is in order. To do this, boot into the stock recovery and once at the black screen hold volume up and press power to get into the menu and then select 'wipe data/factory reset' using the volume buttons and use power to select the option.

5. Reboot the phone

Pretty obvious this - just select 'reboot system now' and you should be good to go!