[HTC Desire 510] jdmedeiros:
I decided to place the instructions here in the open so that others can review them and eventually find some mistakes. karmasblade you owe me absolutely nothing and if you decide this is too much of a pain I completely understand.

karmasblade, BEFORE YOU DO THIS I WOULD LIKE 2 OR 3 SENIOR MEMBERS TO VALIDADE THESE INSTRUCTIONS; THAT'S WHY THEY ARE HERE INSTEAD OF ME JUST PM YOU

If you decide to do it, make sure you copy paste the commands whenever possible. The following steps are needed to make sure you do not share any personal information. If your phone did not have any personal information you would just have to do steps 16 through 19 and then upload the folder.

1.	You will need your Unlock_code.bin from HTCDEV; if you still have it great (it may still be in your email) otherwise you need to go through the bootloader unlock procedure up to the step where you get an email from HTC with the file Unlock_code.bin which you should place in the folder where you have fastboot.exe

2.	You will need openrecovery-twrp-2.8.5.0-a11.img which you can get here http://techerrata.com/file/twrp2/a11/openrecovery-twrp-2.8.5.0-a11.img and save it in the same folder where you have fastboot.exe

3.	Download this RUU https://mega.co.nz/#!6Z4SQDTA!3W89qbflxnQhE8fr_QnJMBFAO3aCHKcdkegFtxQ6tuY rename it to 0PCVIMGXXX and place it in the root of the sdcard

4.	Connect the phone to the PC and run “abd shell”, “su” and then “cat /proc/emmc” From this list you need to find out the highest numbered block. In my case it’s mmcblk0p44 and therefore the number is 44.

5.	Connect the phone to the PC and run "adb reboot recovery" When the recovery menu comes up on the phone press "Backup" On the top of the screen, press "Backup Name", add a few characters to the name so you know it's this backup and hit the return key

6.	After the backup is complete, from the main menu, press "Wipe", then "Advanced Wipe" and select the first 4 options: Dalvik, System, Cache, Data; Slide to Wipe

7.	From the PC run "adb shell" and then execute "mv /external_sd/0PCVIMGXXX /external_sd/0PCVIMG.zip"

8.	From the main menu Press "Reboot" and then "Bootloader". It will say "No OS Installed! Are you sure you wish to reboot?" Press "Swipe to Reboot". It will then say "Install SuperSU?" and you should press "Do Not Install". After a few seconds (about 8) it will reboot. It will say "FASTBOOT USB" in red and "HBOOT" in the blue bar.

9. From the PC run "fastboot oem lock". The phone will reboot and come back to the same screen.

10. Press the Power button once; when you do this it will search your sdcard looking for the 0PCVIMG.zip and it will install it. Eventually it will say "Update Complete..." press <POWER> to reboot. Hit the "Power" button to reboot.

11. Once the phone boots, got to settings and turn on developer options and usb debuging. On the phone run the File Manager application, open the sdcard and rename 0PCVIMG.zip to 0PCVIMGXXX.

12. From the PC run "adb reboot bootloader"

13. Unlock the bootloader... from the PC run "fastboot flash unlocktoken Unlock_code.bin" and the phone will reboot.

14. From the PC run "adb reboot bootloader"

15. From the PC install recovery “fastboot flash recovery openrecovery-twrp-2.8.5.0-a11.img”

16. Reboot to Recovery by pressing the Power button and then VOL down to select RECOVERY followed by the Power button again, It will go to the Recovery menu.

17. Form the PC run “adb shell”

18. Inside the shell run “mkdir /external_sd/mmcblks”

19. For this step you will need the number from Step 4. If it’s not 44 then change the 44 in the following command. Inside the shell run

for i in `seq 1 44`; do dd if=/dev/block/mmcblk0p$i of=/external_sd/mmcblks/mmcblk0p$i.bin; done

This will take a while as it copies the memory blocks to the folder mmcblks in the sdcard.

20. From the Recovery menu, select Restore, select the backup you did on Step 5 and restore your phone. Reboot system and you should have your original phone back.

21. If you had a kernel other than the stock kernel installed you will have to install it again. To do that you would reboot to fastboot running “adb reboot bootloader” and then “fastboot flash boot xxxxxxxxxxx.img”.

22. That’s it; you would then have to upload the folder mmcblks to a place like Mega.