Custom Search

lundi 9 décembre 2013

How to: manually install an OTA update on your HTC device

Sometimes it turns out that your device for some reason can't find the most recent OTA (Over The Air) update. However, there is a solution to apply OTA update manually, without being forced to wait for the update being downloaded and installed by your device.

Facts you need to know before continuing:
  1. This method has nothing to do with the "adb sideload" feature available on Android devices since Jelly Bean. It should work on every Android HTC device.
  2. Read about different software versions for the HTC devices here. Keep in mind that the OTA update must match the software version on your device. Each original OTA update.zip package has 2 different software versions in its name - the version of the software that must be currently installed on your device and the version of the software that your device will run after the update. For example:
OTA_M7_UL_JB43_SENSE55_MR_HTC_Europe_3.62.401.1-2.24.401.8_release_338160gxmo5sd9337kadux.zip

As you can see, 2.24.401.8 is the software version you must currently have installed to be able to run the OTA and 3.62.401.1 is the version of the software expected after the update. You can't flash an OTA update on a different software version to that expected by the OTA update for two main reasons:
  1. Formal reason - the OTA update.zip package checks if your system is running the expected software version before it starts to install the update:
    assert(file_getprop("/system/build.prop", "ro.build.fingerprint") == "htc/htc_europe/m7:4.2.2/JDQ39/235216.8:user/release-keys");
    This must match the following build fingerprint from the build.prop. If the versions don't match, the installation of the OTA package will be cancelled.
    ro.build.fingerprint=htc/htc_europe/m7:4.2.2/JDQ39/235216.8:user/release-keys
  2. Technical reason - OTA update.zip packages usually contain patches for the target files. This way OTA update doesn't have to be 1GB size, even if it is supposed to update the whole OS to the newer version. Patch files have an *.apk.p extension (f.g. Camera.apk.p) and each patch file must match the target file (f.g. Camera.apk). To make it possible, OTA update.zip package checks the MD5 checksum of each file on the system partition on your device:
    assert(apply_patch_check("/system/app/Camera.apk",
    "b3b79e40bad0b1bec5fb949ac5f8662f91bee714",
    "5a5bf63e3d7c9de52a7d8d7a292e158263783844"));
    And finally, if the MD5 is correct it applies the patch. All these commands are stored in META-INF\com\google\android\updater-script of each OTA update.zip package. If the MD5 is incorrect, or at least one file is missing, the installation of the OTA package will be cancelled.
    assert(apply_patch("/system/app/Camera.apk", "-",
    b3b79e40bad0b1bec5fb949ac5f8662f91bee714, 4229394, 
    5a5bf63e3d7c9de52a7d8d7a292e158263783844,
    package_extract_file("patch/system/app/Camera.apk.p")));

Now you are ready to manually apply the OTA update on your device. The method you'll use is based on Android stock recovery.
  1. Make sure you have the stock (original) recovery flashed on your device
  2. Make sure you're running a completely unmodified operating system. Additional files like Superuser.apk or su binary are allowed, you just can't have any system files changed or removed (due to the MD5 check)
  3. Make sure you have a reasonable amount of battery charge remaining
  4. Make sure the OTA update you're about to install matches the software version on your device
  5. Copy the OTA update.zip package to your device (internal storage preferred)
  6. Turn OFF the device (make sure fastboot mode is disabled in settings)
  7. Hold your volume down and power keys until the bootloader starts up
  8. Using the volume keys, navigate down to RECOVERY and press power
  9. You are now in stock recovery mode. You should see nothing more than a (sometimes spinning) Android with the red exclamation mark above it (an empty black screen is also possible). Wait for a few seconds
  10. First hold volume up, then (with volume up held down) press power button to enter the main recovery menu. This keys combination may vary from device to device. Try different keys combination if the above one doesn't work (might be all three keys all together too)
  11. Navigate down to "apply from phone storage" text and press power to confirm
  12. Navigate to the location where you copied the OTA update.zip package and press power to confirm
  13. Wait (sometimes you might need to follow further instructions on the screen) until the update process is finished
  14. Once system is booted you should see a confirmation about the successfully flashed update.
Have any questions or comments? Feel free to share! Also, if you like this article, please use media sharing buttons (Twitter, G+, Facebook) below this post!

Aucun commentaire:

Enregistrer un commentaire