Please remember to add a category to the bottom of each page that you create.
See categories help for further details, but most will probably be [[Category:HTC ModelName]].

HTC Magic/Flashing Guide

From XDA-Developers
< HTC Magic(Redirected from HTC Sapphire Hacking)
Jump to: navigation, search

Ultimate Guide to Hacking your Sapphire Handset
Standard Disclaimer

So you want to hack your HTC Sapphire handset - perhaps install a new ROM, backup what you have or just get 'root'.
You've come to the right place!

Please keep in mind that this is a Wiki -- so if you see anything missing or confusing -- please help add it or correct it!
(Fine Print: While the utmost care has been taken in preparing this guide, we all make mistakes and you have to accept any risk when you follow any instructions listed below.)

Wiki Maintainer: Radix999

How to determine which Hardware revision and SPL you have

PVT32A or PVT32B?

First thing you need to do is determine what you have in your hands as there are several different variants of the HTC Sapphire and you can't use the ROMs/updates for one that you use for another.

Determining Hardware Revision/SPL

  1. First power off your phone (long press the Power Button/End Call button on your phone and select 'Power Off' on the menu.
  2. Now hold down the Back button and press the Power/End Call button to restart your phone.
  3. You should now see a screen with three little Androids on skateboards, a bunch of info at the top and a handful of options. e.g.:
SAPPHIRE PVT 32A SHIP S-ON H
HBOOT-1.33.0009 (SAPP10000)
CPLD-12
RADIO-3.22.20.17
May 8 2009,21:02:32

The key parts of this are:

PVT 32A                      (indicates the handset is a PVT32A type)
HBOOT-1.33.0009 (SAPP10000)  (indicates which SPL is have installed)

Useful info: There's obviously a lot more in the boot info, like SHIP means Shipping SPL, S-ON indicates Security On, H means it's a HTC Build... but for the purposes of flashing a ROM, the above two are all you need. In addition to Back+Power for fastboot mode, there are two other options when powering on that may be useful:

Home+Power boots to recovery mode, and
Volume Down+Power boots to HBOOT.

So what's the difference between PVT32A and PVT32B?

While the PVT32A and PVT32B handsets share the same looks and many common elements, there are a few key differences internally which is why they need different ROMs.

  • PVT32A handsets have 288MB total RAM (192MB usable by OS -- same as Hero handsets) and use the Qualcomm MSM7200A CPU.
  • PVT32B handsets have 192MB total RAM (96MB usable by OS) and use the Qualcomm MSM7201A CPU.

How do I tell them apart?

The best and safest way to tell is to bring up the fastboot screen above and use the information there. However, if you don't have physical access to the device, then you can use this information below as a general guide:

  • Google ION and MyTouch3G (original) (without 3.5mm headset jack) are all PVT32B
  • MyTouch3G Fender "Limited Edition" (LE), and MyTouch3G v1.2 WITH 3.5mm headset jack, are a hybrid PVT32A/B board and require specific ROMs for use with the stock kernel or CM based kernels to run PVT32B ROMs. [1]
  • Most Vodafone and 'Google branded' handsets are also PVT32B (Egypt and Hong Kong Vodafone handsets seem to be the exception here and are PVT32A)
  • Three(3) Australia, Austria and Denmark handsets are PVT32A
  • Taiwan ChungWha/Hami handsets are PVT32A
  • Japan NTTDoCoMo handsets are PVT32B
  • Singapore HTC handsets are PVT32A
  • Belgium Proximus handsets are PVT32A
  • India Airtel handsets are PVT32A
  • Canada Rogers handsets are PVT32A
  • Portuguese TMN are PVT32A and Vodafone handsets can be PVT32B or PVT32A
  • Israel Pelephone (imported by Newpan Telecom) handsets are PVT32A
  • Polish Orange handsets are PVT32A
  • Saudi Arabia STC handsets are PVT32A

Known Hackable SPL revisions

  • Amon_RA has a great collection of MAGIC SPL HBOOT's and this includes hacked SPL's you can use on your phone.
  • No known Sapphire handset needs an updated SPL yet unless you want to flash a new boot image, splash screen or recovery ROM to your handset - with the exception of the *"Perfect SPL" Revisions* listed below.
  • Updating your SPL can be risky, so this has been listed in the Advanced section below.
  • You do not need to update your SPL in order to install a complete ROM package.

"Perfect" SPL Revisions (which prevent us hacking)

  • Currently HBOOT-1.33.0006, HBOOT-1.33.0010, HBOOT-1.33.0013 and HBOOT-1.33.0014 are the known 'Perfect SPL' revisions on the Sapphire handsets that we know of.
  • It is not possible to fastboot a ROM if you have one of these SPLs; you need to wait until someone has hacked it.

Edit (12 Aug 2009) : Now you can! (if you don't have the 3.5mm / LE version). Refer to How-To - Fix that perfected SPL - Root the T-Mobile myTouch 3G

So what is an SPL anyway? What does it do?

The SPL, or Second Program Loader, is essentially the Android bootloader. It's job is more than just loading the Android OS - it also offers several other boot options, including Recovery mode, Fastboot, and HBOOT modes, and ultimately it's the SPL that allows manipulation of the flash nand on your device. Part of the SPL's job is to ensure that the data flashed to the device is correct. Most of the current shipping SPLs (apart from the "Perfect SPL's) let us flash a complete ROM image, but don't let us flash a recovery ROM or boot image as it checks the verification signature. Haykuro has modified the SPL's available to remove this check and this is what the Engineering SPL's available offer. As the SPL is so crucial to the handset though, you have to be very careful when flashing it as if it's updated incorrectly then you may be incapable of restoring it without specialised hardware and knowledge. You essentially have a very expensive brick ;)

Install the drivers and SDK utilities you need to connect your PC to your phone.

Download the Android SDK

You can download the full SDK from the Android Developer website for your platform:

You'll need to download the SDK appropriate for your platform and extract it into a directory somewhere. I'm going to assume you're using Windows here and suggest you extract it into a folder called

C:\AndroidSDK\

on your hard disk. You can put it anywhere you like really, but if you do you'll need to substitute it for the folder above.

Add the tools directory to your system path for easy access

In Windows it's easy to add the *Android SDK Tools* directory to your system path. Doing this lets you use the Android SDK tools anywhere and makes it easier for you. On Windows XP: Go to Control Panel->System, Choose the 'Advanced' tab and then click 'Environment Variables' To do this on Vista/Windows7: Simply go to Control Panel->System and choose 'Advanced System Settings' and then 'Environment Variables'

Now that you've got here locate *Path* under System Variables and click Edit, then add the following to the end of the string displayed:

;C:\AndroidSDK\tools\

(Newer versions of the android has the adb tool located here "C:\AndroidSDK\platform-tools")Then click OK until you get out of the menus.

Now that you've done this you should be able to bring up a command shell and type 'adb' and it should run straight away without needing to change path.

Please note that you can skip this step completely if you find it too complicated. But you will need to "cd" (change directory) to AndroidSDK\tools every time you open up a command prompt, so it's worthwhile doing. I'm going to assume you have made the change above in all further examples as it gets too complicated really. If you're not confident in a DOS shell, I'd suggest you do a little bit of reading up on basic navigation in DOS first.

Enable Debugging mode on the phone before connecting to PC and installing the ADB driver

Menu > Settings > Applications > Developement > USB Debugging

Install the USB drivers correctly - check using "adb devices"

If you have already connected your phone to your computer before then the USB drivers are probably already loaded. If you're lucky then typing 'adb devices' in a command prompt will produce something like:

C:\AndroidSDK>adb devices
List of devices attached
XXXXXXXXXXXX    device

Where XXXXXXXXXXXX is the serial number of your phone. If it doesn't produce that line, then you need to check Device Manager and ensure the device drivers for your phone were installed correctly.

If you are having issues installing the ADB driver, you need to connect your phone then go into Device Manager and check the ADB device properties. Check the following property and it'll look something like:

Device Instance Id: USB\VID_0BB4&PID_0C02&MI_01\7&293A7D0D&0&0001

To fix the driver installation problem, you need to edit the driver's .ini file and change all the references of 0C03 to 0C02, or 0C02 to 0C03 if your device property states your Device Id is 0C03.

Note: After flashing a new ROM, your Device ID may change again to either 0C03 or remain as 0C02. So you need to update the .ini file again as above to reflect the change and re-install the driver.

Another known way to fix the above issue is to download and install HTC Sync. This seems to install the correct drivers.

How to use ADB

ADB stands for Android Debugging Bridge - it's a useful way of talking to your handset while it's running. ADB provides commands for copying files to and from your phone, installing packages and debugging your Android applications.

Useful commands include:

  • adb devices - lists which devices are currently attached to your computer
  • adb install <packagename.apk> - lets you install an Android application on your phone
  • adb remount - Remounts your system in write mode - this lets you alter system files on your phone using ADB
  • adb push <localfile> <location on your phone> - lets you upload files to your phones filesystem
  • adb pull <location on your phone> <localfile> - lets you download files off your phones filesystem
  • adb logcat - starts dumping debugging information from your handset to the console - useful for debugging your apps
  • adb shell <command> - drops you into a basic linux command shell on your phone with no parameters or lets you run commands directly

How to use Fastboot

Fastboot is another boot method and is used to drop the phone into a safe mode to load/flash alternate ROMs. You need USB debugging turned on before you can use Fastboot mode - so I'd recommend you do this first (under Settings->Applications->Development->USB Debugging). You will also need to power off your phone first (hold down Power and select Power Off) and then hold down the *Back+Power* Buttons to start the phone in Fastboot mode. You will need your USB cable connected to be able to issue any commands and assuming your drivers are correct you should be able to issue:

C:\AndroidSDK>fastboot devices
List of devices attached
XXXXXXXXXXXX    fastboot

Other commands in this mode include - we'll cover these below in subsequent sections.

  • fastboot boot <filename> - boots a ROM stored on your pc specified by the filename </code>
  • fastboot flash <partition> <filename> - flashes a ROM stored on your pc, partition can be one of {boot, recovery, system, userdata}

fastboot binaries for mac and linux can be found here

Learn how to use fastboot and boot a recovery ROM

Download a recovery ROM for your device

There are several different recovery ROMs available for the HTC Magic devices.

  • Amon_RA has created several nice recovery ROMs available from Amon RA recovery and get the Recovery ROM appropriate for your device - these recovery ROMs have Nandroid Backup and Nandroid Restore and are perfect for the average user.
  • You can also use Cyanogen's 1.3.1 Recovery ROM available for: PVT32A devices and PVT32B devices. This ROM has some additional options for partitioning your SD card for Apps2SD/Swapper/etc.

Fastboot the recovery ROM

Fastbooting a ROM doesn't write anything to your device -- it just loads it directly from your PC and temporarily runs it on the phone -- so it's a completely safe way of fixing/recovering/backing up your existing ROM. To fastboot a ROM you need to first drop your phone into fastboot mode and check that it's working.

Now, drop into a command shell and make sure the recovery image you're wanting to load is in the same directory that you're running this in. If it's called something other than recovery-rom.img then substitute that instead.

C:\AndroidSDK> fastboot boot recovery-rom.img

If you are having problems changing the directory in the command prompt, just make a copy of the command prompt .exe itself, and place it in the folder that contains the recovery ROM, then run the above command.

And once again, if you have a perfected SPL which does not allow remote fastboot, you will have to fix it first.

Use the Recovery ROM to Backup your current ROM with Nandroid

Once you've booted to a recovery ROM - you can use the Nandroid Backup option. If you get a 'cannot mount /dev/mkblkxxx error' when you do this then check your microSD card is inserted correctly and if so, wait a few seconds for it to register to the recovery ROM correctly. If at first you don't succeed, try, try again (sdcard can take a few seconds to mount!)

How to pick which ROM is right for your hardware and you

Language

Make sure you pick a ROM that supports your native language - though it might also be possible to replace the default IME with one more suited to your language. (someone want to fill in here on how to install different languages?)

Stability vs Bleeding edge

  • ION based ROMs are based on a Google shipping ROM and are designed for speed, but often don't have HTC's additions.

They are best if you want a light and fast ROM and make a great base.

  • HTC based ROMs are based on HTC's shipping ROM and as such have a few of HTC's additions - QuickOffice, Exchange support, PDF Support, Smart Dialer and other HTC additions.
  • Hero is are ripped from shipping Hero ROMs - they're bleeding edge and not designed for your phone - you will have some issues because of this - but offers lots of UI and app improvements over cupcake builds.

Current issues with ROMs and workarounds

  • Hero ROMs currently have the following issues
  • Bluetooth headset/mic support is broken, though Bluetooth headset playback works fine - no known solution.
  • TouchFLO sluggishness - don't use it or minimise widget use - especially clocks.
  • LEDs mapped incorrectly - no known solution. (Fixed for 32A)
  • Trackball notification blink/alert disabled or erratic - no known solution.
  • Camera flipped/oriented wrong - need to reinstall old Camera package to fix. (Fixed in new ROMs such as MyHero 1.1.2)

List of currently available ROMs - ROM Cookers add your creations here!

PVT32A ROMs

PVT32B ROMs

Clear ROMs
ROMs with Rosie AKA Hero Based ROMs

Most (not all!) HTC Dream ROMs are compatible with PVT32B Magics!

HTC_Sapphire_Hacking_2 Continue to HTC Sapphire Hacking - Part 2