How To: Flash firmware package on the HTC device


Flashing so called "firmware" is as popular these days as flashing "custom ROM". For HTC old-boys it's nothing complicated, but some fresh Android users might find it difficult to understand the differences between "firmware" and a "custom ROM". As a result they might be afraid to upgrade OS on their device or even accidentally hard/soft brick it. Before continuing please read this article: How To: Find the proper firmware variant on the HTC device.


First of all let’s make some definitions clear. Both "Firmware" and "ROM" has their own dictionary definitions, but in this guide we need to use the same context of these words as you can find on popular articles and forums.

Your device is equipped with eMMC memory (embedded MultiMediaCard) - a place where every kind of data is stored. This eMMC memory in Android OS is called mmcblk0. But for a various reasons this memory space has to be divided into several smaller parts (f.g. not every kind of data can be stored on the same type of a filesystem). As a result, the eMMC memory is separated into different partitions (RAW, EXT3, EXT4) - smaller or bigger. To indicate the correct partition, each of them has it's own number - p1, p2, p3, p(...) etc. The whole partition name indicates also the eMMC number it's located in - mmcblk0p1, mmcblk0p2, mmcblk0p3, mmcblk0p(...) etc.

To see a lit of all the partitions on your device just type cat /proc/emmc in the adb.exe command shell.

Doing that you can also see the original name of each partition. The list you can see above is what we call "firmware", and what "custom ROM" is made of is usually just "boot" and "system" partitions. In other words - custom ROM represents "system", "boot" (sometimes "userdata" too) and everything else you can see on the list is a "firmware".


Important: Every signed and official firmware.zip can be flashed on a particular device only. Information about the device and its variant can be found inside android-info.txt in the firmware.zip package.

Question: Where firmware comes from? There are 2 ways: official and non-official. Usually firmware package comes together with the OTA (.zip) update. Inside the OTA package you can find firmware.zip archive (always signed). The non-official way is based on decrypting and extracting content of the RUU (.exe)

Question: Is everything from the list above always included in the official firmware.zip? No. HTC updates only these components (partitions) where there were changes in the code, usually related to the Android OS update or security changes in the bootloader (hboot). That means firmware.zip might have "adsp", "boot", "radio" inside and weigh 10 MB or it might contain a lot more and weight even 50 MB.


Signed (official) firmware packages can be flashed on both S-ON and S-OFF device. Once modified (unsigned) firmware.zip can't be flashed on the S-ON device. If your device is S-ON then you have to re-lock the bootloader. As long as your device is S-ON you also can't downgrade the firmware version.


Important: Make sure you have a correct MID (Model ID) and CID (Carrier ID). To check that use fastboot getvar all command. Everything you do, including following this guide, you do at your own risk!



Flashing Process
  1. Download this mini-sdk package and extract it to c:\mini-sdk
  2. Copy firmware (.zip) package to c:\mini-sdk and rename it to "firmware.zip"
  3. Connect your device to the PC
  4. Boot your device in fastboot mode (vol down + power ===> fastboot)
  5. Open a command prompt on the PC (cmd.exe), type and confirm each command with ENTER:
  6. cd /d c:\mini-sdk
  7. fastboot getvar all (open android-info.txt inside firmware.zip and check if MID and CID matches)
  8. <optionally> fastboot oem lock (if your device is not yet re-locked)
  9. fastboot oem rebootRUU
  10. fastboot flash zip firmware.zip and wait for the process to be completed. Sometimes flashing firmware once doesn't work, so flash firmware.zip again using the same command.
  11. fastboot reboot

In case of further questions I prepared a little Q&A part:
  • What is firmware.zip?
Firmware.zip is a part of Over The Air (OTA) update from the HTC. It contains important parts of the firmware like radio, bootloader, recovery, kernel etc.
  • Why it's important to flash firmware.zip and when should I flash it?
It is recommended to have the latest firmware on your device for the best modem performance and overall system stability. Sometimes it's necessary to have the latest bootloader too, because otherwise your device might not work well with the new system update.
  • Why it's important to flash it before flashing custom ROM?
Because firmware.zip contains boot.img (ramdisk and kernel) that will replace custom boot.img from any custom ROM you already have. That's why you have to flash firmware.zip first, because otherwise boot.img will be overwritten with the stock one. If you already flashed firmware.zip after flashing custom ROM, just flash this particular custom ROM again.
  • Does firmware.zip contain recovery?
Yes, it does contain recovery image, that's why after flashing firmware.zip you will have to flash custom recovery again to be able to flash custom ROM afterwards.
  • Can I flash any firmware.zip on my device?
Not if your device is S-ON. To be able to flash firmware.zip on the S-ON device, your MID number (example: PN0710000) and CID number (example: HTC__001) must match the firmware.zip version you are about to flash.
  • If my MID or CID doesn't match, can I brick my device if I try to flash firmware.zip anyway?
As long as your device is S-ON flashing firmware.zip with non matching MID or CID will result in error and nothing will be flashed, so there is no risk of brick.
  • Do I need to have locked, unlocked or relocked bootloader to be able to flash firmware.zip?
Your bootloader needs to be relocked.
  • If I can't flash newest firmware.zip because of wrong modeid (MID) or cidnum (CID) does it mean I can't use custom ROM based on the latest HTC update?
In most cases you should be able to use any custom ROM as long as hboot update is not mandatory.
  • What if there is no firmware.zip for my MID/CID?
Try to find latest OTA update for your original stock ROM and extract it. Firmware.zip should be inside.

Do you 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!


For latest news follow Android Revolution HD on popular social platforms:

Next
Previous