Posts Tagged rom.zip
DISCLAIMER: I don’t invent anything new here, but just summarise things I’ve read across different forums and web sites. I did not write any software mentioned here, but only copy the files and made them available in one easy to access place. I use the procedure described here to create ROM images I flash to my HTC Desire phone, and so far it worked for me perfectly. However I do not guarantee it will work on your system with your files and your phone — use it at your own risk and assume all responsibility. REFLASHING YOUR PHONE MIGHT GET IT BRICKED AND MIGHT VOID YOUR WARRANTY.
To be able to follow this explanation you will need the basic understanding of the command line, be able to enter commands with the parameters, to walk from one folder to another, to compile programs and to run the resulting binaries. To run Java programs you’ll need Java SE runtime installed. To compress and uncompress files you’ll need “zip” program or something similar.
Your phone should be rooted beforehand or allow the installation of custom ROMs.
The process of creating your own ROM update file is not very complicated. Basically it consists of three steps:
- Download and unpack the image you like
- Make the necessary changes
- Pack and sign the .zip file
The update can contain as much as the full system + boot + radio + recovery + extras, which completely overwrites everything you have in your phone, or as little as single .apk file if you want to make just small changes.
Download and unpack
There are plenty of images available on the internet, it’s in your best interest to find the one as much similar to what you need to reduce the necessary changes and introduce as few problems as possible. There are three types of images you may use:
- RUU images (.exe)
- OTA images (.zip)
- 3rd party .zip images
RUU images contain full system, including radio, system, boot and the whole nine yards. However you’ll need to unpack .exe file into .zip file before doing anything useful. I have explanation how to extract the .zip file in Linux but if you use Windows or MacOS your procedure might be different.
OTA images usually contain only the difference between the previous software version and the current one. Therefore you’ll need the previous software as RUU/.zip file with the exact version, and be familiar with bspatch utilty to apply patches, which is quite tedious process. I don’t usually use OTA files if there are any other options available.
.zip images are the easiest to work with, just unpack with your zip archiver to the folder you like.
If you have started with RUU image, you’ll have system.img, boot.img and radio.img files. System image can be further unpacked with unyaffs (requires compilation) to another folder, usually “system/”. Boot image can be unpacked with the perl script (requires perl to be installed on your computer) also to another folder, usually “boot/”. Radio images cannot be unpacked and are better to be left alone.
Make the changes
Most of the changes are done to the system image, which contains all software and data files visible on the phone. Boot image should be changed only if you have deep linux knowledge to modify linux kernel and related matters.
If you have unpacked system image and made some changes, the system.img file is supposed to be moved somewhere else, so it’s not used anymore. Same with the boot.img file. All other files (hboot, recovery) are usually not used, because they might lead back to unrooting the phone and should be deleted or moved as well.
If you have based your work on RUU file, you’ll have to create META-INF folder with the correct information and update scripts inside. If you have unpacked someone’s .zip, the META-INF folder should be already present. Update script might mention some files in the update, so if you have removed (or added new) files, the update script should be amended to reflect those changes. Please, get a few images from different developers and try to understand the correct internal structure.
Pack and sign .zip file
Once you’ve made all the changes, you may change to the folder where you extracted all files, it might now contain .img files, like boot.img and radio.img as well as folders, like “system/”. Zip everything together with the command:
zip -r9 update.zip *
-r9 tells the program to collect files recursively and use the maximum compression. If you omit “r”, the subfolders will not be included (bad, bad idea!), if you omit “9″ nothing bad will happens, but resulting file might be about 1% larger.
To sign zipped file you should download SignApk.zip (requires Java), there are three files inside:
- SignApk.jar is a tool included with the Android platform source bundle.
- testkey.pk8 is the private key that is compatible with the rooted recovery image
- testkey.x509.pem is the corresponding certificate/public key
and the signing command looks like this:
java -jar signapk.jar testkey.x509.pem testkey.pk8 [update.zip] [update-signed.zip]
update-signed.zip can be copied to the phone and installed using the traditional recovery procedure. Personally I’d recommend “ClockworkMod Recovery” from Koush and Paul O’Brien, but I’m not sure if it is available for your phone.
While the actual creation of your own ROM update file is not very complicated, the devil is in the changes you make. Most ROM updates fail at first try, please, have a fresh nandroid backup ready at all times.
I’ve read about nice utility to extract rom.zip from RUU update and could not believe someone really have spent time to write a program, which might be easily obsoleted with new version of installshield.
Here’s a quick and dirty, but very reliable approach which does not care about installshield version and relies only on expected file name (rom.zip)
- install wine
- open terminal and change directory to .wine (cd ~/.wine)
- in the terminal type (but don’t press <enter> just yet) : cp `find -name rom.zip` ~/
- run RUU update file in another window and change back to the terminal
- as soon as the progress bar reaches about 70-80%, press <enter> in the terminal
- enjoy rom.zip in your home directory (but don’t forget to check zip integrity and checksums just in case)
Worked for me as a charm and did not require any 3rd-party software.