When you get your HTC One M9 handset out of the box you always have it’s stock version or Android (with bloatware included) over the top. From there, many people choose to gain root access which lets them installing custom recoveries, custom ROMS and root-only apps from Google Play. If you want to take your device away from root access and restore it back to stock Android you can do that easily by following the guide below.
FILES YOU NEED
- Download the Fastboot zip  file to the desktop of the computer.
- Setup the ADB Drivers  for Windows on the computer. Likewise, follow the same link through to our other page and install the HTC USB Drivers on the computer. Reboot that computer after it’s done. Bookmark this page before you reboot so you can easily come back to the page and continue the guide.
- There’s no point following this guide unless you root HTC One M9  first.
- Download the Hex editor .
HOW TO RESTORE HTC ONE M9 TO STOCK ANDROID SOFTWARE
- Open the folder where you have the ADB and Fastboot on the computer.
- Right-click and hold the Shift key at the same time to find a new menu pop-up on the screen.
- Choose to open the command window here from the menu.
- Connect the HTC One M9 handset to the computer via USB.
- Type the first command: adb shell
- You might need to grant the SuperSU request. Enter this command: dd if=/dev/block/mmcblk0p8 of=/sdcard/mmcblk0p8
- Type the final command: exit
- Now you have the P8 file on the smartphone from the computer by using the command prompt. Execute that file now by typing this: adb pull /sdcard/mmcblk0p8
- Open the file with the Hex editor and search from the 00408400 code.
- You will see constant numbers 68 25 32 C6. Do not alter those in any way. The fifth digit with code 00408404 is the tampered flag.
- Over-right the existing value with 00. To be clear, you can see a lot of 0’s but the fifth column down shows 68 25 32 C6 10 in the picture above. You need to change the last column from 10 to 00. Understand that yours might not say 10. Typically the HTC One M9 has 10 inserted here but yours might say 09. Whatever the value from that final number you need to change it to 00.
Now that you have changed the value, you need to push that change back to the device. Here’s how:
- Type this command from the command line: adb reboot bootloader
- Now the next: fastboot flash pg2fs mmcblk0p8mod.img
- Now the last command: fastboot reboot-bootloader
- Once done, you will see the *** Software status: Official *** from the bootloader screen.