Much kudos must go to Paul over at MoDaCo for becoming the first person to give us root for the Desire.  It’s still early days in terms of ROM development but at least now it gives us the opportunity to start truly customising our devices without the bounds imposed by HTC.  I remember with great fondness the fun I had flashing custom ROMs on my G1 and HD2 (although of course for WM devices it was a different process altogether), at times I would flash everyday just to say I had the latest and greatest; but of course you will soon find the best ROM that suits your particular needs and stick with it.  I wonder how long it will be before we get a proper Cyanogen release for the Desire.  Now there’s something to look forward to.

Before I start with the rooting process itself, there are a few things you should know.

Compatibility

By following the instructions below you will be able to root your HTC Desire, but important, this only applies if you have a bootloader version of 0.75 or below and a ROM version of 1.15.xxx.x or below,  to check this, turn off your Desire and then turn it back on with the back key held.   You need to look at the second line which should be in green text; you’ll see HBOOT followed by a number.  Provided this is 0.75 or below these instructions should work for you.

Root Protection

Previous to the latest incarnations of Android, rooting was easy.  There were several options you could take and many ways of getting the low level access to your device that you wanted.  As with a lot of things though, the manufacturers have become wise to this and engineered ways of making this harder and harder to achieve.  The Desire certainly is not a straightforward phone to root for a number of reasons including:

  • A ‘perfected bootloader’ that doesn’t allow flashing or booting of any images (not even the signed HTC ones)
  • An RUU flash process that does not allow downgrading of the bootloader to earlier versions
  • A kernel that as yet does not have any publically known exploits, made worse by HTC not releasing publically the source code, yet
  • A new protection method previously seen on the HTC Taboo that protects key partitions from having write access.  Even with SU access, it is not possible to write to the boot, recovery or system partitions

The reality is that the options currently available for rooting the Desire are very limited.  Assuming that a kernel exploit had been found, it would still leave the key partitions unwritable, essentially rendering the SU access useless.  And so, the root process became a process of methodically probing every possible point of exposure, looking for a way in.  This has now been found; the downside being that it is not as simple as rooting a device that is actually designed to be accessible at the lowest level such as the Nexus One (even though the hardware is very similar)

The Root:  What is will and won’t do

The root process currently will:

  • Flash your Desire with a new, generic 1.15.405.4 based ROM that has SU access

The root process will not:

  • Enable you to flash your Desire with a custom image that can be launched by just holding down the volume down key when powering on as in other Android devices
  • Enable you to have write access to the /system partition in normal use

It goes without saying that both of these limitations are being worked on and no doubt will be overcome in due course.  I’ll publish an update once this has happened or you can follow the thread directly over at MoDaCo or XDA.

Prerequisites

To be able to follow these instructions you will need or have access to the following:

  • Your Desire, obviously
  • A computer running Windows, OSX or Linux
  • A microUSB cable
  • A microUSB card (to be made into a gold card which is necessary if your Desire is an operator supplied device such as Orange or T-Mobile; you’ll also need ADB (part of the tools folder of the SDK, available here) and HxD Hex Editor which is available here)
  • The downloads listed below

Downloads

Before making a start on the rooting process, download the following file to your machine.

Caveat:  Rooting your desire could void your warranty, please be aware of this before going any further.  Also, read through all of the steps before you start to ensure that you fully understand what you need to do.  If unsure, stop.  I take no responsibility for any bricked devices as a result of following this guide.  Important also to note that the root process will wipe your device there is currently no option to backup your device ROM before you start; rooting the Desire is still in its early days and is not as simple or comprehensive as say rooting a G1; yet.

So, now that you are ready here are the steps needed to perform root on the desire:

Step 1 – creating a Gold Card (Only need if your Desire is operator supplied)

  • Format the microSD card to FAT32 format
  • Put the microSD card into your Desire and boot
  • Ensure that you have unzipped the SDK, and then open a command prompt to in the location that you extracted it.  Change to the /tools directory
  • Enter the following, then press Enter:
    adb shell cat /sys/class/mmc_host/mmc1/mmc1:*/cid
    You should get a very long number which looks something like 00544d5107943247037c7d22bd003453
  • Visit this page and enter the number then visit this page and enter your reversed number and create your gold card image, which will be emailed to you
  • Open the HxD hex editor (Important to note that if you are using Windows Vista or Windows 7 then you must right click and run as administrator)
  • Go to the Extra menu and select Open Disk.  Under physical disk, select Removable Disk (your microSD card), uncheck Open as Readonly and click OK.  Note you should select the physical disck and not the logical disk, this is important!
  • Go to the Extra menu again and select Open Disk Image, open the gold card image that you should have now received by email
  • Now you will have 2 tabs, one for your removable disk and the other for the gold card image.  Press OK when prompted for Sector Size (selecting 512(Hard disks/Floppy disks)) and click OK
  • Click on the gold card image tab.  Go to the Edit menu and choose Select All, followed by the Edit menu again and then Copy
  • Click on the Removable Disk tab.  Highlight offset (line) 00000000 to offset (line) 00000170, then click the Edit menu again and select Paste Write
  • Click on the File menu and select Save accepting the warning that follows.
  • You now have a gold card!

Step 2 – Rooting

  • Unzip the file that you have downloaded above into directory, then open a command prompt/terminal window at that directory
  • Turn off your Desire, and then turn it back on with the back button held down.  You’ll see FASTBOOT written on the screen in a red box.  Connect the Desire to your computer
  • In the terminal window, enter the following (as appropriate to the computer you are using!) followed by Enter:
    step1-windows.bat
    ./step1-mac.sh
    ./step1-linux.sh
  • When this step has completed, using the optical trackball, navigate to BOOTLOADER and then RECOVERY in the menu, using the volume buttons to move and the power button to select
  • In the terminal window, enter the following (again, appropriate to the computer you are using) followed by Enter:
    step2-windows.bat
    ./step2-mac.sh
    ./step2-linux.sh
  • Once this has completed, your Desire should be at the recovery screen.  Next select the Wipe option, then select the option to apply an update zip from sdcard.  Select rootedupdate.zip
  • This will now root your Desire but will take a little while so an ideal time to make a cup of tea!
  • When the flash has finished, reboot your Desire and you’ll have root

Enjoy!

Thanks to Paul for finding root, nilezon for his patched windows ADB binary, ChainsDD for his SU permissions update and Amon_RA for the recovery image which has been used in this guide.