Blog About Android Development

Android Development

Android Development

Mar31

{Flashing Firmware Images to the ADP1 Device}

This post serves to reduce the pain points of developers trying to Upgrade/Downgrade their G1 Firmware by following the HTC Android support site and various forums for bits and pieces of information and putting it together in one place. This post was modified on 30th April 09 to incorporate the 1.5 SDK.

I have added the solutions to the pain points after going through the upgrade process myself, from version 1.0 to 1.1 to 1.5 on an ADP1 device.

From the above HTC support link, download the actual Radio and System image binaries, as well as the fastboot executable, to help you flash the images to your device.

With the above files, you can:

  • Keep your Dev Phone up to date with the latest Android system images
  • Test your application on multiple Android platform versions, to ensure compatibility
  • Restore a corrupted device to a factory state

When flashing your device, make sure that you follow all of the instructions below, in the order that they are given.

Note that you can flash a system only to a supported device, as described in the following sections.

Overview

The sections below describe two alternative methods that you use to flash your device with a factory Android system image:

* Flashing the device using an updated recovery image (recovery-image method)

This approach involves using the adb tool, available in the Android SDK, to copy updated radio and recovery images to the device’s recovery partition on the SD card. It’s a straightforward operation that you can run in a Windows, OS X, or Linux environment. If you are an Android application developer, this method of flashing your device is recommended. Note that to use this method, the device must have the original factory bootloader that came with the device (hboot 0.95.3000).

* Flashing the device using fastboot commands (fastboot method)

This approach is slightly more complicated and involves using the adb tool to update the radio image and the fastboot tool to flash a system image to the device. Flashing your device in this way is useful if you need to install the radio and system images independently or you are already familiar with fastboot and are using it successfully in your environment. To use this method, your device must have a fastboot-compatible bootloader. Having the original factory bootloader included on ADP devices is not required.

Before you get started, decide which of these two methods is appropriate for you, then follow the instructions below, in the order given. The flashing process for both methods is similar ??the main difference is that the recovery-image method does not require the fastboot tool. Rather than using fastboot to flash a system image to the device, you use adb to copy an updated recovery image to the device. All other steps are the same.

Supported Devices

The system images provided on this page are designed only for installation on devices that meet the following requirements:

  • HTC Dream hardware platform only
  • Device must include a development bootloader that supports fastboot

You cannot flash these system images to other hardware platforms or to versions of HTC Dream hardware that don’t have a development bootloader that supports fastboot (fastboot is described in the next section). For example, the bootloader on T-Mobile G1 devices (and similar consumer devices) is not a development bootloader and does not support fastboot, so you cannot flash a new system image to those devices.

Get the Tools

To flash a system image to your device, you need a command-line tool called fastboot and the adb tool provided in the Android SDK.

The information of the executables that can be downloaded from the support site

On OS X and Linux, you can store the fastboot executable anywhere on your machine. On Windows, you must store the fastboot executable where it can find the AdbWinApi.dll file (included with the Android SDK), otherwise it will not work properly.

The recommended place to store the fastboot executable on Windows is with the other tools in the Android SDK, in the <sdk>/tools directory. On all platforms, you may want to add the location to your PATH, for convenience.

If your command line interface does not recognise fastboot,

On Windows, where <sdk>/tools has been added to path, Click START->Run. Type ‘cmd’ and click ENTER, In the console type ‘cmd’ and then type ‘fastboot’ and press ENTER

You cannot proceed with the upgrade of the System Image without fastboot, so the above steps are A MUST.

If you do not have the Android SDK installed on your local machine, download the latest version from this location and install it:

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

Once you install the SDK, the adb tool will be available to you.

If your development machine is running Windows, you should make sure to update your USB driver before continuing. For your convenience, the Android SDK (1.0 r2 or later) includes an updated USB driver that you can install. For more information, see Setting up a Device for Development on the Android Developers Site.

Download the Image Packages

To flash a new system image to your device, you need to download two image packages to your local machine.

  • If you are flashing your device using the recovery-image method, you need to download a recovery image package and a radio image package only.
  • If you are flashing your device using the fastboot method, you need to download a system image package and a radio image package only.

Radio Image Download

Each Android platform version is designed to run on top of a specifc version of the radio firmware. Typically, each successive release of the Android platform relies on a newer version of the radio firmware, so whenever you are planning to flash a new system image to your device, whether upgrade or downgrade, you should also update the radio firmware to the version expected by the platform. If you do not update your radio image, the system may encounter problems.

Download the signed radio image packages that you need from support site. The platform version compatibility of each radio image package is indicated in its filename.

Once you’ve downloaded a radio image package, you do not need to extract it — you can reference the image package directly from adb commands, as described in the sections below. You can store the radio image package anywhere on your machine, but make sure to store to maintain its version-specific naming.

System Image Download

Download the signed system image packages that you need from support site. Multiple versions of the Android platform are available, so make sure that you understand what version(s) you need and what version(s) you are downloading.

For development, you should select the lowest possible Android platform version that meets the needs of your applications. For example, if you are working in the Android 1.1 SDK and your application is using APIs introduced in Android 1.1, then you should download the Android 1.1 system image. If you are using the Android 1.1 SDK but your application does not use Android 1.1 APIs, then using Android 1.0 image is sufficient.

For testing, consider downloading all platform versions with which your application is compatible, then running your applications on those platform versions to ensure that they work as designed.

Each system image package is a .zip archive that includes several images that you will flash to your device:

  • A boot image — contains the kernel and initrd.
  • A recovery image — contains files used for rebuilding/updating the system.
  • A system image — contains the Android platform/apps of the specified version.

Note that the images in each package are mutually dependent, so you must flash them all to your device together. For example, you should not flash a system image to the device without also flashing the boot and recovery images included in the same image package.

Once you’ve downloaded a system image package, you do not need to extract it — you can reference the image package directly from fastboot commands, as described in the sections below. You can store the system image package anywhere on your machine, but make sure to store to maintain its version-specific naming.

Recovery Image Download

If you are flashing your device using the recovery-image method, download the recovery image package(s) that you need from the list of links in the table above. Currently, a recovery image packages is available only for the Android 1.1 platform version.

Each recovery image package is a .zip archive containing the full contents of a recovery partition, including:

  • A boot image – contains the kernel and initrd.
  • A recovery image – contains files used for rebuilding/updating the system.
  • A system image – contains the Android platform/apps of the specified version.
  • A radio image – contains the compatible radio firmware.

Note that the images in each recovery package are mutually dependent, so you must copy them all to your device together. For example, you should not copy a system image to the device without also copying the boot and recovery images included in the same image package.

Once you’ve downloaded a recovery image package, you do not need to extract it – you can reference the image package directly from adb commands, as described in the sections below. You can store the recovery image package anywhere on your machine, but make sure to store to maintain its version-specific naming.

PAINPOINT: Cannot downgrade to Android 1.1 with recovery package 142608

If you are using the recovery-image method and had previously downloaded and the Android 1.1 recovery package signed-dream_devphone-ota-142608.zip, you should make sure to download the replacement recovery package signed-dream_devphone-ota-142608-b.zip (see the download link at the top of this page).

This is necessary because the recovery package signed-dream_devphone-ota-142608.zip prevents you from downgrading to it from a higher version of the recovery image. Therefore, if you upgrade to the Android 1.5 recovery image, you won’t be able to downgrade to Android 1.1 unless you use the replacement package signed-dream_devphone-ota-142608-b.zip.

Update the Device Radio Firmware

Follow the steps below to update the radio image on the device.

  1. Ensure that a SD card is inserted in the device
  2. Boot the device normally
  3. Connect the device to your development machine over USB.
  4. At a command line, ensure that adb recognizes your device by issuing this command:
  5. $ adb devices
    You should see your device in the console output generated by the command
  6. Use the adb push command to copy the contents of the radio image package to the update.zip archive on the device’s SD card:
  7. $ adb push <radio-image-package>.zip /sdcard/update.zipThe command prints the number of bytes copied and the elapsed time, then completes. However, note that the files are still being copied in the background, so wait a minute or two before continuing. If you continue too soon and terminate the operation before it is complete, you will get a “bad update.zip” error later, when you try to install the update. To ensure that the entire radio image package is copied before you continue, use this command:

    $ adb shell sync

    When sync returns, all of the data has been copied to the device.
    PAIN POINT: I never got a ! icon following step 8 from the Support site. And without completing the steps below, the installation is NOT complete. Turn off your Phone:Press ‘Menu’ to go to Main Screen with Wallpaper.Keep the ‘Call end’ button pressed till you get the Phone options, and select Power Off option. Select OK to shut down.

  8. Hold the home key and power key to boot and enter the recovery mode. When the device enters recovery mode, it displays a “!” icon.
  9. With the recovery console displayed, open the sliding keyboard and hold down the ALT+l key combination to enable log output in the recovery console and continue.
  10. Next, hold down the ALT+s key combination to install the update. An “installing update” icon and progress bar are displayed (keep holding the ALT+s combination) — when the progress bar completes, the installation is finished.
  11. Press the HOME-BACK key combination to write the radio image, update the firmware, and automatically reboot. Note that if you do not use HOME-BACK at this point, the device will not load the updated radio image. After writing the radio image, the device shows a “updating firmware” icon for a few seconds and then automatically reboots in normal mode.

After the device reboots normally, you can update the system image, as described in the next section.

To check the radio image version, you can start the device in fastboot mode (see below). If you still find the old image version, your update was not complete.

Copy the Recovery Image Package to the Device
For the recovery-image method only, after you’ve successfully updated the radio firmware, the next (and final) step is using the adb tool to copy the recovery image package to the device SD card. (If you are using the fastboot method, you do not need to copy a recovery image to the device – see Flash the System Image Package to the Device instead.)

follow the steps below to update the recovery image on the device.

  1. Ensure that a SD card is inserted in the device
  2. Boot the device normally
  3. Connect the device to your development machine over USB.
  4. At a command line, ensure that adb recognizes your device by issuing this command:
  5. $ adb devices
    You should see your device in the console output generated by the command
  6. Use the adb push command to copy the contents of the recovery image package to the update.zip archive on the device’s SD card:
  7. $ adb push <recovery-image-package>.zip /sdcard/update.zipThe command prints the number of bytes copied and the elapsed time, then completes. However, note that the files are still being copied in the background, so wait a minute or two before continuing. If you continue too soon and terminate the operation before it is complete, you will get a “bad update.zip” error later, when you try to install the update. To ensure that the entire recovery image package is copied before you continue, use this command:

    $ adb shell sync

    When sync returns, all of the data has been copied to the device.

    PAIN POINT: I never got a ! icon following step 8 from the Support site. And without completing the steps below, the installation is NOT complete. Turn off your Phone:Press ‘Menu’ to go to Main Screen with Wallpaper.Keep the ‘Call end’ button pressed till you get the Phone options, and select Power Off option. Select OK to shut down.

  8. Hold the home key and power key to boot and enter the recovery mode. When the device enters recovery mode, it displays a “!” icon.
  9. With the recovery console displayed, open the sliding keyboard and hold down the ALT+l key combination to enable log output in the recovery console and continue.
  10. Next, hold down the ALT+s key combination to install the update. An “installing update” icon and progress bar are displayed (keep holding the ALT+s combination) — when the progress bar completes, the installation is finished.
  11. Press the HOME-BACK key combination to write the recovery image, update the firmware, and automatically reboot. Note that if you do not use HOME-BACK at this point, the device will not load the updated recovery image. After writing the recovery image, the device shows a “updating firmware” icon for a few seconds and then automatically reboots in normal mode.

After the device reboots normally, the operation is complete.

Flash the System Image to the Device
For the fastboot method only, after you’ve successfully updated the radio firmware, the next (and final) step is using the fastboot tool to flash the system image package to the device. Note that you should always update the radio image whenever you update the Android system image on your device. (If you are using the recovery-image method, you do not need to flash the system image package to the device – see Copy the Recovery Image Package to the Device instead.)

Follow the steps below to flash a system image package to your device:

  1. Boot the device in fastboot mode.PAIN POINT: Hold the Camera button and the power button at the same time when powering on, the phone will boot into Boot Loader Mode.Make sure the display on the phone changes from “Serial0″ to “FASTBOOT”. If it doesn’t, try pressing the back button.The device is now in fastboot mode and is ready to receive fastboot commands. (I have had success doing this with usb plugged in the whole time, but others haven’t. If you have trouble, try it w/ usb unplugged until you see the skateboards screen.).If you want to exit fastboot mode at this point, you can hold down the keys MENU+Call Start + Call End together.
    Note that the bootloader screen may vary across devices.
    For Android Dev Phone devices, the bootloader screen shows an image of skateboarding robots. Other devices may show a different image or color pattern. In all cases, the bootloader screen shows the text “FASTBOOT” when in fastboot mode. The bootloader also shows the radio version.
  2. Connect the device to your development machine over USB, if it isn’t currently connected.
    • USBClass_ff&SubClass_42&Prot_03
    • USBClass_ff&SubClass_42
    • USBClass_ff
  3. From your computer command line type > fastboot devices.(Keep the emulator off, and the device should be indicated:
    List of devices attached
    HTXXXXXXXXXX device

    PAIN POINT: Device is not seen in fastboot mode.

    (NOTE: Check the USB device in Computer Manager when the phone IS IN fastboot mode. The computer sees the phone in fastboot mode as a different device than the phone in normal mode)

    When the Device is in fastboot mode:

    If it asks you to install drivers, then go ahead and use the same usb drivers that you used to get adb working. You can skip the rest of the instructions. Fastboot should be working for you now.
    If it doesn’t ask you to install a driver, you need to figure out if the correct driver is loaded already.
    Right click on My Computer, and click Manage, then go to the device manager

    If you see an “ADB Interface” category at/near the top, with “HTC Dream” under it, then you’re good to go. Fastboot should be working for you.

    In the device manager, go down to “Universal Serial Bus Controllers”, and see if you have at least one “USB Mass Storage device”. If you have multiple ones, you’ll need to go through each to find the correct one.

    To find the correct one, right click on the USB Mass Storage device and click Properties. Go to the Details tab. In the combo box at the top that says “Device Instance Id”, bring up the pull down and choose “Compatible Ids”. If that is the correct device, then you will see 3 entries:

    Once you find the correct device, go to the driver tab, and click “Update Driver”. Choose “No, not this time”, then “Install from a list or specific location”, then “Don’t search, I will choose the driver to install”, and then choose the same usb driver that you used to get adb to work (most probably located in the <sdk>/usb_drivers or its sub-folder)

    PAIN POINT: If you don’t see an “ADB Interface” category, then it’s likely that windows loaded the USB Mass Storage driver for it automatically OR If the ADB Interfaces category is seen, but ADB devices/fastboot devices command is not able to list the device.

    Unplug all your USB devices, and plug only the G1 device,

    Then Uninstall the

    ADB Interface->HTC Dream Composite ADB Interface (if present).

    USB Serial Bus Controllers->USB Composite Device

    USB Serial Bus Controllers ->USB Mass Storage Device

    Now Use the USB cord to plug in the G1 Device to your computer, You will be prompted for drivers. Choose to “Install from a list or specific location”, then “Don’t search, I will choose the driver to install”, and then choose the same usb driver that you used to get adb to work (most probably located in the <sdk>/usb_drivers or its sub-folder).

    After that’s done, you should be good to go. Open a command prompt and type fastboot devices and it should list the phone.

    Note that, rather than using separate fastboot commands to erase the userdata and cache partitions, as described in the previous steps, you can simply supply the -w option when flashing the system image, which has the same result.

  4. Next, use this fastboot command to flash the contents of the image package to the device:
  5. $ fastboot update <imagepackage>.zip [-w] With this command, fastboot copies all of the images in <system-image-package>.zip to the appropriate partitions on the device. During the process, it prints status messages to the command shell. Depending on your bootloader version, fastboot may also print status messages to the bootloader screen.When all image are copied to the device successfully, fastboot displays a success message.PAIN POINT: Even though I had completed a successful radio image update, and had the proper bootloader version 0.95.3000, I was not able to successfully update the System Image.Unzip the System image and extract these files to your <sdk>/tools and flash the boot.img, recovery.img and system.img individually:
    $fastboot flash boot boot.img
    $fastboot flash recovery recovery.img
    $fastboot flash system system.img

    You may want erase the contents of the userdata partition, by using this fastboot command:

    $ fastboot erase userdata

    This will remove all of the installed applications and their data, but it is a useful step when debugging because it ensures a clean execution environment for the application. Erasing the user data may also be necessary when you are flashing a lower (downgrade) platform version to your device. However, it is not strictly necessary to erase the userdata partition when upgrading to a higher (upgrade) platform version, which is the typical use-case in consumer devices.

    You may also want to erase the cache partition, using this fastboot command:

    $ fastboot erase cache

  6. Reboot the device. In most cases, fastboot should reboot the device automatically after copying the image files.
    If necessary, you can reboot the device manually using these fastboot commands:
    $ fastboot reboot or $ fastboot reboot-bootloaderYou can also reboot from the device from the fastboot mode, by holding down the key combination MENU+Call Start + Call End.For information about other fastboot commands, use$ fastboot

Posted by Shesh in Installation Comments: 9 Add comment

Comments

  1. vel wrote on April 17, 2009:

    i am not able to download following file ota-radio-1_22_14_11.zip
    Its redirecting me to some HTC site but its not downloading the file

  2. Shesh wrote on April 17, 2009:

    Vel, The support site changes those links internally, so I have changed the document to refer you to the support site link that
    has the download information.

  3. Malik Al-Shayeb wrote on April 26, 2009:

    Hi
    I have a G1 Dev and i have installed some Rom that supported the multi touch “just wanted to try it ” anyway this rom got a lot of prolems and im trying to go back to my originla 1.0 and i think that i have losst the devlopment bootloader do u have any idea how can i downgrade to the original 1.0 or 1.1 Dev

    Note this is the machine info now
    Model number
    T-Mobile G1
    Frimware version
    1.1
    Baseband version
    62.33.20.08H_1.22.14.11
    Kernel
    2.6.25-01843-gfea26b0
    jeasusfreke@androidDev #1
    Build Number
    Kila-user 1.1 PLAT-RC33 126986
    OTA-rel-keys,release-keys

  4. Shesh wrote on April 28, 2009:

    Malik, You can reflash the images that you want to install on your device, as long as you install the same version of the radio and system images.

    Since your firmware version on your device is 1.1 I would suggest you to do the following:

    1. Download signed-dream_devphone-ota-142608-b.zip from the HTC support site.
    2. Copy the signed-dream_devphone-ota-142608-b.zip to your /tools directory.
    3. Ensure ADP device is connected through USB to your computer.
    4. cd to
    /tools and run: adb push signed-dream_devphone-ota-142608-b.zip /sdcard/update.zip
    Follow the remaining steps from Copy the Recovery Image Package to the Device – to ensure that the update is complete.

    You can then decide to upgrade further to 1.5 radio and recovery image packages – by following the guidelines in the article.

    If recovery-package copy does not work, only then do you need to flash the system image. The steps for doing so are also detailed in the article.

  5. Phil wrote on June 11, 2009:

    Thank God for the in depth how to, im still new to this whole thing well it looks like im good to go, thanks alot

  6. Pradeep wrote on July 9, 2009:

    Thanks,

    Very well written…

  7. MAX wrote on August 5, 2009:

    i am not able to download following file ota-radio-1_22_14_11.zip

    Its redirecting me to HTC support site, but NOT downloading the file (same problem as Val above). the link i nthe page “support site” sends me to the same problem page. Please advise.

  8. Shesh wrote on August 6, 2009:

    Kindly contact HTC support site for any broken links on their pages.

  9. JaimeF wrote on February 23, 2010:

    I am attempting to flash my phone and I am at the step where I input the code $ adb push .zip /sdcard/update.zip but I keep getting an error stating permission is denied.

    What am I doing wrong?

Add Comment

You must be logged in to post a comment.