Showing posts with label hacking. Show all posts
Showing posts with label hacking. Show all posts

Sunday, November 29, 2009

A 'simple guide' to loading new ROMs on your HTC Magic / MyTouch3G Android phone

This is my attempt to distill into a short post all the best information and sources I've found while learning how to load different Android ROMs on my phone. I'm not re-writing the work of others, I'm pointing to it and adding some comments / info I learned along the way that is either not in the information pointed to or that I found relevant along the way.

You have an HTC Magic / MyTouch3G  Android phone. It came with the software loaded at the factory. If you don't have one of these phones, then these instructions will be mostly correct anyway as far as the infrastructure you need.

The exceptions will be related to the specific model of phone you have if it isn't an HTC Magic / MyToucg3G. For example, the version of "fastboot" will be tied to the phone's hardware, in my case HTC, and you'll need a version written for your phone and the PC's OS (Windows or Linux or Mac) to allow it to talk to your type of phone. Separately, what ROMs you'll be able to load also depends on the type of phone you have. You would not, for example, try to follow specific HTC Magic instructions to load new ROMs on a Motorola Droid or vice versa. But the setting up of Java, Eclipse and the Android SDK will be almost identical in all cases where Ubuntu Linux is used as the PC OS.  The exception will be the contents of the udev rules file reporting the vendor ID and device ID. Don't worry about this right now. Deal with it when you get to it.

Having said that, I'm assuming you want to try other versions of Android, but you want a return path to the way your phone was before you messed with it. I'm assuming you do NOT want to "brick" (render dark and useless) your phone.

No problem. Absolutely do-able, provided you can read and follow instructions and don't just skip bits you don't understand.

Here are some simple steps to make it happen. They are based on the assumption you will be using Ubuntu Linux. If you're a Windows person, then this may be doubly interesting for you. Don't stop reading here. Bear with me.

Here are some steps to work your way though. As is often the case, it's best to read it through and then, after, work it through.

1. Install Ubuntu Linux 9.10. It can be 32-bit or 64-bit depending on your PC. Doesn't matter.

2. You need to set up the Android SDK in order to access the phone the way you need to in order to load new ROMs. Follow these instructions, bearing in mind the following notes:


a) If your Ubuntu Linux is 64-bit, the one flaw in the instructions linked to above is it makes no mention of the need to install the ia32libs if they aren't already installed. These libraries let you run 32-bit apps on your 64-bit linux. Without it, you'll get strange crashes in some libs. To install the ia32libs, you open a terminal ('Applications -> Accessories -> Terminal' on Ubuntu) and enter this command (no quotes): "sudo apt-get install ia32-libs". For Windows users: "sudo" means the command is to be run as root (as administrator). You'll be asked for your password to authorise. That is YOUR password. the one you logged in with...not some other password you can't and won't know.

b) As for the rest of the instructions, you can ignore the bits about actually writing your own apps if you don't plan to. But you do need to install the Java SDK, Eclipse and the Android SDK and ADT 0.94 (or the current version). So follow these instructions and make sure you can run these programs successfully.

c) When you get to the point where you're setting up talking to your real phone with adb and ddms, the udev "51-android-rules" file in /etc/udev/rules.d/ is *critical* and the author of those instructions has it nailed for the HTC Magic / MyTouch3G and the HTC G1 / Dream. For any other phone you'll have to use "lsusb" (list usb) command in a terminal, with you phone connected and debug turned on on the phone (it's in the docs), to get the vendor ID and device ID required.

d) You may have to start the adb server task using sudo (eg: "sudo adb start-server" for the linux system to allow you to access the phone using adb commands.  

3. Install fastboot for linux. Get it here. Read the instructions. Get it installed in the right directory and practice booting your phone in fastboot mode: power off, then while  holding down the BACK key, press the POWER button.

4. Assuming you can successfully see your phone using adb and ddms and "fastboot devices" lists your phone's serial number, you now want to go to Cyanogen's instructions for loading the recovery image and any ROM you like.
Of course, you would ONLY load ROMs that explicitly say they support your model of phone (HTC Magic / MyTouch3G). A ROM for use on some other phone (like HTC G1) probably won't work on a Magic unless it explicitly says will also work on one. For example, Cyanogen and Dwang and ASOP ROMs all work on both the G1 and the Magic / MyTouch3G.

There are often dire warnings about what SPL (Second Program Loader) is required by the ROM. HTC Magic owners with the factory "Hboot 1.33.0004 (SAPP10000)" SPL can almost always ignore these. Our phones already have the capability that the "Danger SPL" provides.  The SPL issues are mainly related to   the HTC Dream / G1 phones as the default SPL on those phones doesn't allow a system to boot if it is over a certain size. HTC Magic and Hero phones do not have this restriction. In fact, the "Danger SPL" is actually a magic SPL modded to be used on an HTC G1. Bottom line - HTC Magic owners with UK, NZ, NL and (some) AU Magic phones don't need it. I don't mess with the SPL as getting that flash process wrong CAN "brick" your phone. The usual error seems to either fail to first flash the correct version of the radio image related to the SPL, or to flash an SPL that is completely inappropriate for your phone. Academic interest only....we (HTC Magic 32B owners sourcing phones from Vodafone NZ, UK, NL and AU) don't need to do any of it.

That's pretty much it. Be sure to use nandroid (it's in the docs) to back up any ROMs you installed that you want to keep. If you're going to put it back on your phone, it may as well be of an install you've already configured.

I strongly recommend you put these backups in a safe place, clearly labelled and well organised. I also recommend copying the entire /Nandroid/[device name]/[version number] backup set into some other directory with a meaningful name. One backup per path. That way you can easily and simply copy the version you want to restore back on to the phone for a quick restore. Your directory names at the top level should make it obvious which backup it is. Guessing is no fun.

A good site for getting news on the latest ROMs is www.AndroidSpin.com. Once you've loaded a new ROM on a couple of times, it becomes simple and easy. You may load a ROM on that won't boot. Ooops. Not to worry, just start over and put one on that does. If it wiped out the Cyanogen recovery image, DO NOT PANIC! Just follow the instructions to load CM's recovery back on. You haven't messed with your SPL just by loading a ROM and (maybe) a recovery image, so you are almost certainly OK.

Bottom line: Take it one step at a time. No need to hurry. Give your head a chance to get around each step.

Have fun.