[TUTORIAL] Unlocking, rooting, custom roms installing, going back to stock

Search This thread

dansou901

Inactive Recognized Contributor
Apr 10, 2012
3,121
1,209
33
Aachen
OnePlus 5
OnePlus Nord
Credits go to @nlooooo for starting this thread!

WARNING
I’m not responsible for bricked devices, all you do is on your own responsibility. Most of the processes I’ll mention will work with some vital parts of your phone, so if you don’t have enough courage or until you don’t understand all the things you should do I recommend not to get involved with this.


Ok, there's a tool for almost all of that. Tool is updated, but you need to be sure to click the button for the right recovery, explanation below.
1. UNLOCKING OF BOOTLOADER
Everything starts with this. Unlocking of bootloader will allow you to make changes to some critical partitions of your phone (boot, system and recovery) and will allow you to flash custom recovery that can be used for installing of custom roms, mods and all kind of flashable zips. However, it won't s-off your phone, and other critical partitions (bootloader, radio) remain inaccessible.

So, I won't explain how to do that. Why? Because if you successfully unlock bootloader on your phone it means that you received enough knowledge for the rest of the process and you're qualified to go further.

This process will factory reset your phone (erase data partition) so backup your stuff before you proceed.

Ok, now go to htcdev.com, register your account, go to unlock bootloader section, for the device choose 'All other supported models' and follow the instructions carefully everything is explained in details. Pay attention to 'Required resources' on the first page after confirmation - you need Android SDK platform tools Java Runtime Environment and HTC Sync installed and there are all needed links. Files mentioned in step 5 you will find in Android Bundle zip you downloaded in folder adt-bundle-windows-x86_64\sdk\platform tools.
Here are some useful links about Android SDK platform tools, you won’t be needing most of it but it won't be bad to read.

Remark: once unlocked bootloader can be relocked but can never be locked again. This can be done issuing command from fastboot:
fastboot oem lock​
This means that on the top of you bootloader screen you’ll have a sign RELOCKED instead of LOCKED, which is a notice to HTC that you unlocked it once. Plus they have data about all users that requested unlock_code so they can deny your warranty whenever they want.

If you’ve successfully unlocked your phone bootloader we can proceed to the next step.


2. CUSTOM RECOVERY INSTALLING

- Go to this address:
There you can find custom recoveries for DesX. Some of them have a few bugs but they are generally functional. Download one of your choice, rename it to recovery.img and put it on the root of c: drive on your PC. Before downloading, read the thread linked to carefully, as it is important to check your hboot before installing a custom recovery.

Remark: you can use recovery image provided in WindyCityRockr's tool.

- Go here:
download SuperSU, connect your phone to PC and put it somewhere on your phone sd card.

- Do not disconnect your phone from PC, reboot phone to fastboot on one of this ways :
1. choose restart from power menu and when the screen comes off wait for the buttons to turn off and immediately push volume down, the phone will boot to bootloader, then select fastboot from bootloader menu
2. issuing command
adb reboot-bootloader​
from command prompt that will take you directly to fastboot

- once you’re in fastboot mode open command prompt, lead it to folder where you installed adb and fastboot (remark: unlocking bootloader guide pointed you to make a folder c:\Android for this) and issue commands
fastboot flash recovery c:\recovery.img
fastboot reboot-bootloader
fastboot erase cache​

The second and third commands are not quite necessary but they don’t harm and leave your phone with no trails of previous recoveries. Now you can disconnect your phone from your PC.

3. BACKING UP STOCK ROM
Now it is really important to backup your stock ROM. Dependent on your CID and hboot version, you can't use RUU to get back to stock, especially if your phone is branded by your carrier. Also, RUUs are only available for ICS bootloader (hboot 1.24 and lower). For JB there are only nand backups for a few CIDs uploaded by some nice xda members. So if you definitely want to be able to get back to stock any time, you'll have to backup your current configuration first. That's done by:
Reboot your phone to recovery
Backup -> Select all partitions -> Swipe to Backup​
That will take some time. After that's finished, you should make a copy of that backup somewhere safe (it's located on the sdcard in folder TWRP, just copy the whole folder somewhere).

4. ROOTING YOUR PHONE

- From fastboot menu choose bootloader and then recovery to reboot phone to recovery
- If you successfully boot to recovery choose options:
Install zip from sd card
Choose zip from sd card​
Navigate to UPDATE-SuperSU-vx.xx.zip you stored on sd card and choose it. Once the installation is finished reboot your phone. Now you should see SuperSU app in app drawer and your phone is rooted.



5. CUSTOM ROMS INSTALLING
There are already quite a few ROMs available for our device. But watch out... many of them are discontinued, mostly the CM ROMs as well as the ROMs based off CM. Go here for the index:
That’s the Index thread I created for all user to track development for our device. There you’ll find roms that can be installed.

I have to emphasize that every chef gives an instruction how to install his rom, so here I’ll just give you the basics for custom rom installing using custom recovery.

- Download the rom of your choice and put it on the sd card of your device
- Unpack boot.img from rom.zip and put it on the root of c: drive on your PC
- Reboot phone to recovery
- Choose option ‘wipe data/factory reset’
- Choose option ‘wipe cache partition’
- Choose option ‘advanced’ and in next menu choose ‘wipe dalvik cache’
- Go back to main menu and choose ‘install zip from sd card’ and then ‘choose zip from sd card’
- Navigate recovery to rom zip you put on sd card and choose it
- Wait until the installation is finished
- Reboot your phone to fastboot and connect it to your PC
- Open command prompt, lead it to folder where you installed adb and fastboot (remark: unlocking bootloader guide pointed you to make a folder c:\Android for this) and issue commands
fastboot flash boot c:\boot.img
fastboot reboot-bootloader
fastboot erase cache​
- Reboot your phone

The last few steps are needed since there is no way to s-off our device, so boot.img included in rom.zip has to be flashed separately via fastboot.


Remark:
don’t ever forget for the golden rule of flashing ‘Always make a nand backup before you flash something'.


6. S-OFF
As S-OFF makes your device vibrating 7 tmes on each boot, you should really think about if you need it. If you are not sure about it, then it's not for you. If you still want to do it, go here:
Use the first link to get to the files needed to do your S-OFF. In the second link you'll find the things you can do after the S-OFF procedure including downgrading the hboot in order to install RUUs etc.


Ok, I did what I had promised, all suggestions and corrections are more than welcome.

All this came as 2 years experience with HTC phones (had Desire and Incredible S before), unlocking, rooting and taking their guts out :D.

Sources and links posted:
- HTC Developers site
- WinDroid HTC Desire X Toolkit v2.1 made by WindyCityRockr
- Android Developers site
- Cyanogen Wiki site
- SuperSU made by Chainfire
- Thanks to ckpv5 for nand ICS backup thread
- Thanks to Izzy Stinson for pointing me to things not explained enough
- Sources for recoveries can be found in my recovery thread
- Thanks to GtrCraft for the idea to include the backup of stockrom
- Thanks to nightwalkerkg and the rumrunners team for getting us the S-OFF
- Again thanks to ckpv5 for the S-OFF tutorial
 
Last edited:

dansou901

Inactive Recognized Contributor
Apr 10, 2012
3,121
1,209
33
Aachen
OnePlus 5
OnePlus Nord
Going back to stock for official update

Now to say more about a reverse part. The point of this is to make your phone available for official updates, and make it possible to do. Thanks to Ranalakshay36 and Bedroom we have information that you can apply OTA without need to relock bootloader on the phone. However, relocking is still mandatory if you want to install a fresh new rom using RUU.

The first important thing for this is: PEOPLE, MAKE A NAND BACKUP OF STOCK ROM BEFORE REMOVING OF ANY APP FROM SYSTEM OR INSTALLING A CUSTOM ROM!!! This will make this process much easier to do.

RECEIVING AND OFFICIAL UPDATES INSTALLING

Part one:

Ok, you just unlocked bootloader and rooted your phone (no custom rom installed), but you received a notification that you have an official update available and you want to install it. No problem at all if you didn't touch the apps on system partition (some of them are necessary for official support), and all you have to do are these 2 things:

1. Reinstall stock recovery - I attached it. Remember the part about custom recovery? The process for this is the same:
- download recovery I attached, rename it to recovery.img and put it on the root of c: drive on your PC
- reboot phone to fastboot
- connect it to a PC
- open command prompt and guide it to the folder where you have adb platform tools installed
- issue commands
fastboot flash recovery c:\recovery.img
fastboot reboot-bootloader
fastboot erase cache​

Now your phone should be ready to apply official update.

Part two:
1. You installed a custom rom, however you made a nand backup of your intact stock rooted, so all you need is to restore your nand backup and go to "Part one", that will do a thing.

2. You installed a custom rom, however you didn't make a nand backup of your intact stock rooted, or you deleted some important files from system partiton. So, you're almost scre**d. I said almost because you can ask some of your geeky friends to borrow you his nand backup that you can use for restore.

The best option is to revert back to stock using RUU, but that's currently limited only for devices with Europe based firmware. Here is the thread I made where you can find info about 1.18.401.1 RUU and CID compatibility and a way to check CID of your phone to make sure you can use it:


To run RUU you need to relock your bootloader. This is how you can do it:
- reboot phone to fastboot
- connect it to a PC
- open command prompt and guide it to the folder where you have adb platform tools installed
- issue command
fastboot oem lock​
- the phone should restart automatically and you'll have a sign RELOCKED on the top of bootloader screen.

After you successfully relock bootloader you can run RUU directly from fastboot. With earlier HTC models there was I a way to bypass CID checking and use any RUU to revert back to stock using a GoldCard, but someone told me that it's not possible with Desire X.

Remark: once you relock bootloader it can be unlocked again in the same way you did it for the first time, and, of course, it will factory reset you phone. Also, going in this order is mandatory, cause if you relock bootloader before you flash stock recovery, you won't be able to do that with relocked bootloader

If you can't run a RUU because of incompatible CID, you have to have a nand backup ready for restoring or else to find one in the forums. Here is a thread with different nand backups incompatible from the RUUs:

Follow the instructions in the above thread to restore your backup.


Credits:
- Cobje - stock recovery img from latest update (1.18.xx)
http://xdaforums.com/showpost.php?p=35031493&postcount=25
- Ranalakshay36 and Bedroom for the intel.
 

Attachments

  • stock_recovery.img
    4.2 MB · Views: 2,805
Last edited:

nightcrow

Senior Member
Feb 16, 2008
290
121
Good job writing this tutorial!

One small remark: unlocking bootloader via htcdev will hard-reset the device so all data on the phone will be lost. Might be useful to mention this so users can back-up as much as possible on an un-rooted device.
 

nlooooo

Senior Member
Oct 29, 2011
2,432
817
Nis
Good job writing this tutorial!

One small remark: unlocking bootloader via htcdev will hard-reset the device so all data on the phone will be lost. Might be useful to mention this so users can back-up as much as possible on an un-rooted device.

Thanks, forgot about that while I was writing all this stuff.
 

nightcrow

Senior Member
Feb 16, 2008
290
121
I can imagine it's quite a story ;)

Anyway well done and it will definitely be useful to the ones that are about to dive into the rabbit-hole.
 

ayyu3m

Senior Member
Oct 19, 2007
1,765
276
System Error
a very well written master piece tutorial. absolutely easy use of english as well without most technical jargon. keep up the good work.

here after m gonna redirect such noob questions to this page.
 
  • Like
Reactions: nlooooo

nlooooo

Senior Member
Oct 29, 2011
2,432
817
Nis
a very well written master piece tutorial. absolutely easy use of english as well without most technical jargon. keep up the good work.

here after m gonna redirect such noob questions to this page.

When an English gentleman says that's an easy use of English I somehow get delighted...
 

AxR979

Member
Apr 17, 2009
40
2
thx man, its very helpful for noobs like me who cant follow every thread :D

there is one more thing i need you help to do it .. how to install busybox ?

I tried all the market apps but i keep getting they same problem "failed to install, try other version or different location"
 

Izzy Stinson

Senior Member
Aug 12, 2011
702
73
I have one question, after I done process 1 and 2, can I factory reset again from the settings without losing root and still keep bootloader unlocked?

Sent from my HTC Desire X using xda app-developers app
 

nlooooo

Senior Member
Oct 29, 2011
2,432
817
Nis
I have one question, after I done process 1 and 2, can I factory reset again from the settings without losing root and still keep bootloader unlocked?

Sent from my HTC Desire X using xda app-developers app

Of course you can, factory reset deletes only data partition while all others stay intact, and Superuser app is located on system partition, while bootloader can't be accessed from there, only from fastboot.
 
  • Like
Reactions: Izzy Stinson

Izzy Stinson

Senior Member
Aug 12, 2011
702
73
Of course you can, factory reset deletes only data partition while all others stay intact, and Superuser app is located on system partition, while bootloader can't be accessed from there, only from fastboot.

thanks. :D and one last question. you gave 3 links to download for cwm recovery. which of those three are the best cwm for you?
 

nlooooo

Senior Member
Oct 29, 2011
2,432
817
Nis
For me the best is 4ext, but it's not released yet for our device. :D

I would go with Claudyy's version.since it doesn't have a screen shift bug.
 
  • Like
Reactions: Izzy Stinson

Izzy Stinson

Senior Member
Aug 12, 2011
702
73
For me the best is 4ext, but it's not released yet for our device. :D

I would go with Claudyy's version.since it doesn't have a screen shift bug.

so i guess im gonna download clauddy cwm then.

so it is CWM-protou.img, i should rename it to recovery.img right?

sorry for asking so many questions, i dont like to make mistakes when doing this kind of things.. :silly:
 

Top Liked Posts

  • There are no posts matching your filters.
  • 56
    Credits go to @nlooooo for starting this thread!

    WARNING
    I’m not responsible for bricked devices, all you do is on your own responsibility. Most of the processes I’ll mention will work with some vital parts of your phone, so if you don’t have enough courage or until you don’t understand all the things you should do I recommend not to get involved with this.


    Ok, there's a tool for almost all of that. Tool is updated, but you need to be sure to click the button for the right recovery, explanation below.
    1. UNLOCKING OF BOOTLOADER
    Everything starts with this. Unlocking of bootloader will allow you to make changes to some critical partitions of your phone (boot, system and recovery) and will allow you to flash custom recovery that can be used for installing of custom roms, mods and all kind of flashable zips. However, it won't s-off your phone, and other critical partitions (bootloader, radio) remain inaccessible.

    So, I won't explain how to do that. Why? Because if you successfully unlock bootloader on your phone it means that you received enough knowledge for the rest of the process and you're qualified to go further.

    This process will factory reset your phone (erase data partition) so backup your stuff before you proceed.

    Ok, now go to htcdev.com, register your account, go to unlock bootloader section, for the device choose 'All other supported models' and follow the instructions carefully everything is explained in details. Pay attention to 'Required resources' on the first page after confirmation - you need Android SDK platform tools Java Runtime Environment and HTC Sync installed and there are all needed links. Files mentioned in step 5 you will find in Android Bundle zip you downloaded in folder adt-bundle-windows-x86_64\sdk\platform tools.
    Here are some useful links about Android SDK platform tools, you won’t be needing most of it but it won't be bad to read.

    Remark: once unlocked bootloader can be relocked but can never be locked again. This can be done issuing command from fastboot:
    fastboot oem lock​
    This means that on the top of you bootloader screen you’ll have a sign RELOCKED instead of LOCKED, which is a notice to HTC that you unlocked it once. Plus they have data about all users that requested unlock_code so they can deny your warranty whenever they want.

    If you’ve successfully unlocked your phone bootloader we can proceed to the next step.


    2. CUSTOM RECOVERY INSTALLING

    - Go to this address:
    There you can find custom recoveries for DesX. Some of them have a few bugs but they are generally functional. Download one of your choice, rename it to recovery.img and put it on the root of c: drive on your PC. Before downloading, read the thread linked to carefully, as it is important to check your hboot before installing a custom recovery.

    Remark: you can use recovery image provided in WindyCityRockr's tool.

    - Go here:
    download SuperSU, connect your phone to PC and put it somewhere on your phone sd card.

    - Do not disconnect your phone from PC, reboot phone to fastboot on one of this ways :
    1. choose restart from power menu and when the screen comes off wait for the buttons to turn off and immediately push volume down, the phone will boot to bootloader, then select fastboot from bootloader menu
    2. issuing command
    adb reboot-bootloader​
    from command prompt that will take you directly to fastboot

    - once you’re in fastboot mode open command prompt, lead it to folder where you installed adb and fastboot (remark: unlocking bootloader guide pointed you to make a folder c:\Android for this) and issue commands
    fastboot flash recovery c:\recovery.img
    fastboot reboot-bootloader
    fastboot erase cache​

    The second and third commands are not quite necessary but they don’t harm and leave your phone with no trails of previous recoveries. Now you can disconnect your phone from your PC.

    3. BACKING UP STOCK ROM
    Now it is really important to backup your stock ROM. Dependent on your CID and hboot version, you can't use RUU to get back to stock, especially if your phone is branded by your carrier. Also, RUUs are only available for ICS bootloader (hboot 1.24 and lower). For JB there are only nand backups for a few CIDs uploaded by some nice xda members. So if you definitely want to be able to get back to stock any time, you'll have to backup your current configuration first. That's done by:
    Reboot your phone to recovery
    Backup -> Select all partitions -> Swipe to Backup​
    That will take some time. After that's finished, you should make a copy of that backup somewhere safe (it's located on the sdcard in folder TWRP, just copy the whole folder somewhere).

    4. ROOTING YOUR PHONE

    - From fastboot menu choose bootloader and then recovery to reboot phone to recovery
    - If you successfully boot to recovery choose options:
    Install zip from sd card
    Choose zip from sd card​
    Navigate to UPDATE-SuperSU-vx.xx.zip you stored on sd card and choose it. Once the installation is finished reboot your phone. Now you should see SuperSU app in app drawer and your phone is rooted.



    5. CUSTOM ROMS INSTALLING
    There are already quite a few ROMs available for our device. But watch out... many of them are discontinued, mostly the CM ROMs as well as the ROMs based off CM. Go here for the index:
    That’s the Index thread I created for all user to track development for our device. There you’ll find roms that can be installed.

    I have to emphasize that every chef gives an instruction how to install his rom, so here I’ll just give you the basics for custom rom installing using custom recovery.

    - Download the rom of your choice and put it on the sd card of your device
    - Unpack boot.img from rom.zip and put it on the root of c: drive on your PC
    - Reboot phone to recovery
    - Choose option ‘wipe data/factory reset’
    - Choose option ‘wipe cache partition’
    - Choose option ‘advanced’ and in next menu choose ‘wipe dalvik cache’
    - Go back to main menu and choose ‘install zip from sd card’ and then ‘choose zip from sd card’
    - Navigate recovery to rom zip you put on sd card and choose it
    - Wait until the installation is finished
    - Reboot your phone to fastboot and connect it to your PC
    - Open command prompt, lead it to folder where you installed adb and fastboot (remark: unlocking bootloader guide pointed you to make a folder c:\Android for this) and issue commands
    fastboot flash boot c:\boot.img
    fastboot reboot-bootloader
    fastboot erase cache​
    - Reboot your phone

    The last few steps are needed since there is no way to s-off our device, so boot.img included in rom.zip has to be flashed separately via fastboot.


    Remark:
    don’t ever forget for the golden rule of flashing ‘Always make a nand backup before you flash something'.


    6. S-OFF
    As S-OFF makes your device vibrating 7 tmes on each boot, you should really think about if you need it. If you are not sure about it, then it's not for you. If you still want to do it, go here:
    Use the first link to get to the files needed to do your S-OFF. In the second link you'll find the things you can do after the S-OFF procedure including downgrading the hboot in order to install RUUs etc.


    Ok, I did what I had promised, all suggestions and corrections are more than welcome.

    All this came as 2 years experience with HTC phones (had Desire and Incredible S before), unlocking, rooting and taking their guts out :D.

    Sources and links posted:
    - HTC Developers site
    - WinDroid HTC Desire X Toolkit v2.1 made by WindyCityRockr
    - Android Developers site
    - Cyanogen Wiki site
    - SuperSU made by Chainfire
    - Thanks to ckpv5 for nand ICS backup thread
    - Thanks to Izzy Stinson for pointing me to things not explained enough
    - Sources for recoveries can be found in my recovery thread
    - Thanks to GtrCraft for the idea to include the backup of stockrom
    - Thanks to nightwalkerkg and the rumrunners team for getting us the S-OFF
    - Again thanks to ckpv5 for the S-OFF tutorial
    23
    Going back to stock for official update

    Now to say more about a reverse part. The point of this is to make your phone available for official updates, and make it possible to do. Thanks to Ranalakshay36 and Bedroom we have information that you can apply OTA without need to relock bootloader on the phone. However, relocking is still mandatory if you want to install a fresh new rom using RUU.

    The first important thing for this is: PEOPLE, MAKE A NAND BACKUP OF STOCK ROM BEFORE REMOVING OF ANY APP FROM SYSTEM OR INSTALLING A CUSTOM ROM!!! This will make this process much easier to do.

    RECEIVING AND OFFICIAL UPDATES INSTALLING

    Part one:

    Ok, you just unlocked bootloader and rooted your phone (no custom rom installed), but you received a notification that you have an official update available and you want to install it. No problem at all if you didn't touch the apps on system partition (some of them are necessary for official support), and all you have to do are these 2 things:

    1. Reinstall stock recovery - I attached it. Remember the part about custom recovery? The process for this is the same:
    - download recovery I attached, rename it to recovery.img and put it on the root of c: drive on your PC
    - reboot phone to fastboot
    - connect it to a PC
    - open command prompt and guide it to the folder where you have adb platform tools installed
    - issue commands
    fastboot flash recovery c:\recovery.img
    fastboot reboot-bootloader
    fastboot erase cache​

    Now your phone should be ready to apply official update.

    Part two:
    1. You installed a custom rom, however you made a nand backup of your intact stock rooted, so all you need is to restore your nand backup and go to "Part one", that will do a thing.

    2. You installed a custom rom, however you didn't make a nand backup of your intact stock rooted, or you deleted some important files from system partiton. So, you're almost scre**d. I said almost because you can ask some of your geeky friends to borrow you his nand backup that you can use for restore.

    The best option is to revert back to stock using RUU, but that's currently limited only for devices with Europe based firmware. Here is the thread I made where you can find info about 1.18.401.1 RUU and CID compatibility and a way to check CID of your phone to make sure you can use it:


    To run RUU you need to relock your bootloader. This is how you can do it:
    - reboot phone to fastboot
    - connect it to a PC
    - open command prompt and guide it to the folder where you have adb platform tools installed
    - issue command
    fastboot oem lock​
    - the phone should restart automatically and you'll have a sign RELOCKED on the top of bootloader screen.

    After you successfully relock bootloader you can run RUU directly from fastboot. With earlier HTC models there was I a way to bypass CID checking and use any RUU to revert back to stock using a GoldCard, but someone told me that it's not possible with Desire X.

    Remark: once you relock bootloader it can be unlocked again in the same way you did it for the first time, and, of course, it will factory reset you phone. Also, going in this order is mandatory, cause if you relock bootloader before you flash stock recovery, you won't be able to do that with relocked bootloader

    If you can't run a RUU because of incompatible CID, you have to have a nand backup ready for restoring or else to find one in the forums. Here is a thread with different nand backups incompatible from the RUUs:

    Follow the instructions in the above thread to restore your backup.


    Credits:
    - Cobje - stock recovery img from latest update (1.18.xx)
    http://xdaforums.com/showpost.php?p=35031493&postcount=25
    - Ranalakshay36 and Bedroom for the intel.
    6
    Reserved once more...
    2
    Good job writing this tutorial!

    One small remark: unlocking bootloader via htcdev will hard-reset the device so all data on the phone will be lost. Might be useful to mention this so users can back-up as much as possible on an un-rooted device.
    2
    i finally unlocked my bootloader and rooted my phone with this method :good:

    i think you should update the command in this "- once you’re in fastboot mode open command prompt, lead it to folder where you installed adb and fastboot (remark: unlocking bootloader guide pointed you to make a folder "c:\Android)" TO "cd c:\Android"

    and also you should also mention that everytime if wish to enter fastboot, you need to remove and reinsert battery. if you go fastboot reboot, then go to fastboot again with voldown + power keys it will not work. you need to remove and reinsert battery then retry then it will work. at least thats what happened to me.

    and also i want you to update this "- Do not disconnect your phone from PC, reboot phone to fastboot on one of this ways :
    1. power it on holding power+vol down then select fastboot from bootloader menu
    2. issuing command" TO "disconnect phone from pc, turn off phone, then remove and reinsert battery then enter fastboot, then connect phone to pc again".

    other than it works smooth and my phone now rooted.