[Desire Android Development] Matco:
Hi there,

I just came up to Android with an Orange branded HTC Desire. Until now, I was using a HTC Diamond 2 with WM and tried some cooked ROM. But it was really easy with WM. Now, I need to understand more or less how my Android phone works to be able to play with it the same way I played with my Diamond 2.

As I'm a bit lost with some Android terms and concepts and I would like to purpose a kind of glossary for newbies like me. The goal is to explain common concepts with a functional and a technical point of view. I try to give example based on Nexus One and Desire based on personal experiments.

I'll start with what I've understood last few days and believe to be right. I'll ask you to correct my mistakes and to complete this FAQ. I'll keep this post updated.

For the moment following lines may contain big mistakes. I will try to flag validated information.

ROM

A ROM contains the OS on your phone. It can be installed like Windows or Linux on your desktop PC. A ROM contains the kernel and a pack of applications already installed for you. You can find a lot of cooked ROM (ROMs made by great people who would like to share with you optimizations they've done on their phone) on Internet. Normally, Android phones only accept ROM which are signed by the reseller. So you can only put Orange ROM on Orange branded phone.

Moreover, installing a new ROM is a way to update your phone. However, Android phone include an internal updating system (it's just a program like Windows update) so you can receive updates without installing a new ROM. It's called OTA (On The Air) update. OTA update is the way for basic customers to receive update for their phone.

Functionally :

Install a ROM is as easy as execute an exe on you Windows PC. It very easy and fast. You can also install a ROM by using the Recovery Menu.

GoldCard

A GoldCard is a modified SDCard which allows you to put the original unbranded ROM on a career branded phone (installing the original HTC Desire ROM on an Orange HTC Desire). Normally, if you try to execute a HTC ROM updater with a Orange phone, you'll be stuck after 4 or 5 clicks on next. With a Goldcard in your phone, you can archive the process.

You can't install a ROM built for an other device just using a GoldCard (installing a Nexus One ROM on a Desire is not possible).

GoldCard is only needed if you have a carrier-branded Desire, even for rooting process. Unbranded phones never need it.

Be sure to keep your GoldCard because it will be needed for each ROM modifications. You can use a GoldCard as a normal SDCard without problem. However, if you create new partitions for app2sd, your GoldCard will ruined.

Functionally :

Create a GoldCard is easy. It will take you 30 minutes. Not all SDCards work to create a GoldCard. Mine (SanDisk 4Go) included in my Orange package worked perfectly.

Instructions can be found here or here.

Technically :

If I'm right, while you are installing a ROM from the executable on your desktop PC, the phone checks if the ROM you're trying to install match a hard coded key on the phone. With a GoldCard, you make the phone believe signature is good.

CID

The serial number of your SDCard. You'll need to retrieve it with ADB Shell to create your GoldCard.

Functionally :

In ADB Shell (see ADB section), following command line give you your CID :

cat /sys/class/mmc_host/mmc1/mmc1:*/cid

Fastboot

It's like the BIOS on your desktop PC. You can access the fastboot with a keyboard combo while starting your phone. It give you access to some function like Recovery Mode or SIM Unlock. With fastboot, you can also install a new ROM using a zip placed on your SDCard.

Use can easily unlock Fastboot on the Nexus One using a ADB shell command.

Fastboot give you access to the recovery mode. In this mode, you can gain write permission in the /system partition which is not possible in Disk Drive mode, event with USB Debugging enabled. With this access, you can easily remove applications which are included in the ROM (like FriendStream in HTC ROMs).

Functionally :

To reach Fastboot on Desire : Hold down back button while pressing power.

Technically :

When you connect the phone to your PC in Fastboot, you will establish a special connection with the device. It uses "Android Bootloaded Interface" driver.

Fastboot unlock

An operation to unlock Fastboot. It's the first step to root your phone. It's easily done for the Nexus One via ADB (see here). It much more difficult with the Desire (possible thanks to Paul).

HBoot

An other boot menu.

Functionally :

To reach HBoot on Desire : Hold down volume down button while pressing power.

ADB

ADB means Android Debug Bridge. You can read this. When you connect your phone to your PC, you can choose different modes :

Charge only : No interaction with your PC

Internet tethering (only if you have a HTC standard ROM, Orange & Co disable this option) : Your PC will see your phone like a modem.

HTC Sync (if you have a HTC standard ROM) : Use to synchronize you data with HTC Sync software

Disk drive : Your PC will see your phone as a USB key allowing you to access to your SDCard

If you're in Disk Drive mode (or even if you're in Charge only mode), you can activate USB debugging (setting > applications > development on your phone). In this mode, your PC will use a ADB driver to establish a special connection. With ADB drivers, you have access to ADB Shell.

With ADB Shell, you can list every file on device and deploy your own application.

Functionally :

Activate USB debugging on your phone to play with ADB Shell.

ADB Shell is accessible from Windows or Linux.

For people who don't use to play with command line, on windows, you must either open a cmd.exe and move in the "tools" folder (with cd command) of your unzipped ADB package or add this repository to your path (instructions here[URL].

Then you can check that everything is alright with following command :

adb devices

You should see :

List of devices attached
HTxxxxxxxx device

Then you can type "adb shell" to enter the shell. All Unix basics commands are available and you can do whatever your want... almost nothing since you're not root.

Rooting

Rooting a device is a process to become root on its OS. It allows you to install very nice apps like app2sd (to install application on SDCard), SetCPU app (to overclock or downclock your device) or OpenVPN. This kind of apps can not run if your device is not rooted.

With a rooted device, you can install apps which are not yet validated for your phone on the market by modifying the ID of your device (like the user-agent of your browser). It's easier than downloading the apk file from somebody who extracted the application on a device accepted by the market for this application.

Finally, with a rooted device, you can install ROM from an other device (installing a Nexus One ROM on a Desire).

Functionally :

On Desire, become root is now possible thanks to Paul from Modaco. On Nexus One, it much more easy.

Process is easy if you follow guides step by step. Warning, it will remove all data and configuration on your phone. However, your SD card won't be modified.

If you follow the guide to root the Desire, one of the first steps is to put a big zip file on your SDCard (often rootedupdate.zip). In fact, this zip file contains the ROM you'll have on your phone at the end of the process. Guides generally provide an almost generic ROM. The only modification made to this ROM is the addition of the Superuser Permissions app (the Ninja icon) which will help you to grant root access to applications asking for permission. Installing this ROM is the easier solution. However, you can use every ROM you want (you will find some very interesting ROM on this forum). Just put the file on your SDCard at the beginning of the process and point to the good zip file in the last step. Warning, if you want to install a ROM with app2sd in it, you must know that this application requires a special partition on your SDCard, so you must format your SDCard before the first boot of your new ROM. To do this, just after installing the ROM zip file (the last step of the rooting process), you have to stay in the Recovery Menu and use the good option to create partitions on your SDCard. Of course, your SDCard will be formated.

Technically :

I have no idea what are tricks to become root. You have to find a hole in the phone software. It's not easy.

The process itself requires several steps :

The first step is to unlock the bootloader. This step is easy on Nexus One. On Desire, this step is archived by installing a kind of ROM from Fastboot on your phone.

Unlocking bootloader will give you access to the Recovery Menu and will make your phone accept non-HTC-signed updates (for Desire).

Then, you have to connect your device in HBoot mode to your PC in order to write some files on the phone. These files are used to launch the Recovery Menu. From this menu, you can wipe all data and some caches (I don't know differences between all caches)

Finally you can install a new ROM on your device using a zip file on your SDCard.

Recovery Mode

The Recovery Mode is a special mode accessible from HBoot. You'll need to access this mode to push files needed for the Recovery Menu. It's an important step in the rooting process.

Functionally :

When your phone is in Recovery Mode, you'll see a little red triangle on your screen.

Technically :

Recovery Mode is a special provided by Android to do special operations. In fact, I don't know what's the real usage of this mode.

Recovery Menu

The Recovery Menu is a small tool accessible from Recovery Mode. It purposes some options such as wipe your data, format your SDCard and the most important option : deploy ROM or files from a zip file previously dropped at the root of your SDCard.

Functionally :

The Recovery Menu is a green menu you have to use in the root process.

Technically :

On the Desire, Recovery Menu is the only way to write files on /system. Put a zip file on the root of your SDCard and the Recovery Menu will unzip the package and deploy files on your phone for you. You will have to use this menu to install OpenVPN because this application requires to put some file in /system partition. In the last step of the rooting process, Recovery Menu will deploy your ROM (which is nothing more than just a bunch of files) on your phone.

SIM Unlock

SIM Unlock in a process different from all others. If I'm right, you'll have to use Fastboot, put some files on your SDCard and press SIMUnlock. Required files can be provided by your operator. This process works with all ROMs and don't required a root access.

Nandroid Backup

The Nandroid backup process creates binary images (.img) of the boot, data and system partitions (and ext also, if you choose nand+ext). Needless to say you need root in order to be able to perform this kind of backup.

Later, you can use those image files to restore those partitions, in a very similar way you restore a hard-disk partition from a ghost created image. Practically the restore process erases all their content and replaces it with the data saved in the img files, thus reverting the phone's software to the state it was when you performed backup.

Nandroid backup doesn't include the radio image; you can only change (or revert) the radio by flashing it again.

If you want to go back to stock software, you need to use a RUU, which overwrites all the modifications you made into the phone's software (and of course removes the root access as well).

APK

This is the file format for applications. Each application is packaged in an APK file. When you install an application from the market, you're just downlading an APK file which is then automatically installed on your phone.

You can also find APK files on Internet, put them on your SDCard (or directly download them from your phone) and install them.

Deodexed

Technically :

By default, applications are odexed. This allows Android to preload some parts of an application to optimize its launch time. Unfortunately it makes application resources be dispatched outside the APK. Deodexing is a process of gathering all resources inside the application.

Functionally :

Some applications apply a theme on other applications. You need a deodexed version of the targeted application to use this. However, deodexing applications is not a process you should take care of. You'll find some custom ROMs in which all applications have been deodexed for you.

That's all for now. I really want to complete technical information on above lines. It will be great if somebody could explain why you can not install a Nexus One ROM on a HTC Desire using only a GoldCard. Moreover I would like to know how works Fastboot with SDCard. It seems that SDCard plays a really important role (used to update ROM, SIM unlock and GoldCard).

PS : English is not my native language, please be indulgent.

Many thanks to The Professor and silvake for some precisions.

Matco.