wiki:Android/ExtractRomImageFromWindowsRuuExeOnLinux

Extract ROM Image from RUU Windows Exe On Linux

For the complete list of my articles on Android devices and software, including analysis of devices and system firmware, lists of external resources and tools, and How-To instructions, check the front page of this wiki under the Android heading.

Sometimes there is a need to examine the contents of an HTC Remote Update Utility (RUU) package that is shipped as a Windows executable file (.EXE) on a GNU/Linux system. Because the RUU executable is a self-extracting installer it is not easy to locate the actual Android update ZIP file that is transferred to the device.

This guide shows how to use WINE and some basic shell commands to obtain the ZIP file containing the device images.

Prerequisites

Install the WINE system on the PC. By default it will create a working environment in $HOME/.wine

Obtain an RUU executable

The updates are available from HTC directly in some cases, or via other online sites. For this guide the example is for an HTC Vision (a.k.a. T-Mobile G2 or HTC Desire Z).

Run the executable

Open a terminal shell and do:

wine RUU_Vision_HTC_WWE_1.22.405.1_Radio_12.26.60.1301_26.02.00.24_M2_release_151197_signed.exe

The GUI installer will run. Wait until it gets to the first prompt:

Screenshot from HTC Android Phone ROM Update Utility 1.0.2.10

At this point the self-extracting executable has created a lot of temporary files, one of which is a ZIP that would be transferred to the device's SD-card root directory (usually renamed to update.zip).

Open a second terminal shell, create a directory structure to contain the image, then locate the actual ROM and have it copied into the new directory structure:

export DESTINATION=$HOME/HTC/ROMs/Vision_HTC_WWE_1.22.405.1_Radio_12.26.60.1301_26.02.00.24_M2_release_151197_signed
mkdir -p $DESTINATION
find $HOME/.wine/drive_c/windows/profiles/$USER/Temp -name '*.zip' -execdir cp {} $DESTINATION \;
ls -l $DESTINATION/
-rw-r--r-- 1 tj tj 295324560 2010-10-16 18:47 rom.zip

If other ZIP files from the Temp folder have been copied across use your judgement to examine and discard those that aren't ROM updates.

The GUI is no longer needed so press the Cancel button.

Examine the ZIP Contents

You may just want to list the contents of the ZIP to ensure it is what you're expecting. Using the terminal where DESTINATION was exported:

unzip -l $DESTINATION/rom.zip 
Archive:  rom.zip
warning [rom.zip]:  256 extra bytes at beginning or within zipfile
  (attempting to process anyway)
  Length      Date    Time    Name
---------  ---------- -----   ----
      261  2010-09-26 10:40   android-info.txt
  1048576  2010-09-26 11:06   hboot_7230_0.85.0002_100917.nb0
 25427968  2010-09-26 09:25   radio.img
       72  2010-09-24 08:43   rcdata.img
  2994176  2010-09-26 10:51   boot.img
  4042752  2010-09-26 10:51   recovery.img
585101312  2010-09-26 11:05   system.img
1143992320  2010-09-26 10:47   userdata.img
   786432  2010-09-24 08:43   splash1.nb0
   768000  2010-09-02 19:58   splash2.nb0
   340464  2010-09-26 10:47   dzdata.img
---------                     -------
1764502333                     11 files

Extract the ZIP Contents

Using the terminal change into the directory where the ZIP file has been placed then use unzip to extract the contents:

cd $DESTINATION
unzip rom.zip
Archive:  rom.zip
warning [rom.zip]:  256 extra bytes at beginning or within zipfile
  (attempting to process anyway)
  inflating: android-info.txt        
  inflating: hboot_7230_0.85.0002_100917.nb0  
  inflating: radio.img               
  inflating: rcdata.img              
  inflating: boot.img                
  inflating: recovery.img            
  inflating: system.img              
  inflating: userdata.img            

ls -l
-rw-r--r-- 1 tj tj        261 2010-09-26 10:40 android-info.txt
-rw-r--r-- 1 tj tj    2994176 2010-09-26 10:51 boot.img
-rw-r--r-- 1 tj tj     340464 2010-09-26 10:47 dzdata.img
-rw-r--r-- 1 tj tj    1048576 2010-09-26 11:06 hboot_7230_0.85.0002_100917.nb0
-rw-r--r-- 1 tj tj   25427968 2010-09-26 09:25 radio.img
-rw-r--r-- 1 tj tj         72 2010-09-24 08:43 rcdata.img
-rw-r--r-- 1 tj tj    4042752 2010-09-26 10:51 recovery.img
-rw-r--r-- 1 tj tj  295324560 2010-10-16 18:47 rom.zip
-rw-r--r-- 1 tj tj     786432 2010-09-24 08:43 splash1.nb0
-rw-r--r-- 1 tj tj     768000 2010-09-02 19:58 splash2.nb0
-rw-r--r-- 1 tj tj  585101312 2010-09-26 11:05 system.img
-rw-r--r-- 1 tj tj 1143992320 2010-09-26 10:47 userdata.img

Conclusion

The rom.zip file could now be transferred to the device's SD-card root using the Android Debug Bridge (adb) tool:

adb push rom.zip /sdcard/update.zip

and then the device instructed to update using the fastboot method or by restarting the device with the HBOOT button-combination to initiate an update.

Alternatively, it may be you want to examine the contents of the update on the PC without deploying it to a device.

Attachments