[myTouch 3G, Magic General] stian230:
Hi I quote.

Install SDK utilities you need to connect your PC to your phone

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

http://developer.android.com/sdk/index.html

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\

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 - however you will need to CD to the ?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 refelect 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

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.

3. 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 http://xdaforums.com/showthread.php?t=530492 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 - 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!)

You do not need to be a rocket scientist to do this.

you can use the ADB to put in recovery again by fast boot

http://xdaforums.com/showthread.php?t=530492