Thread: [HOW-TO] Create an update.zip
- 03-17-2011, 02:16 AM #1
[HOW-TO] Create an update.zip
So, if you want to create a .zip with something to add to your phone, there are a few tools to automate their creation, but restricted to Windows. Here I will explain the mechanics of their creation (applicable in all OSs).
Things you need:
- Item to be added (example, Calculator.apk)
- Testsign.jar: Get it here
1) Decide where the item to be added goes (/system/app)
2) Create the folders appropriate to the location from step 1
For me, this would mean I create a folder, 'app', inside a folder 'system'
For Windows Command Line:
mkdir -p system/app
For me, Calculator.apk is located at system/app/Calculator.apk
4) Create the following file tree: META-INF/com/google/android
Use the appropriate code from above.
5) create a file called update-script in META-INF/com/google/android
Note the lack of an extension, to achieve this effect, Windows users should include quotation marks around the name in the Save As dialog box.( Save As: "update-script")
show_progress 0.1 0 copy_dir PACKAGE:system SYSTEM: show_progress 0.1 10
The code above is pretty easy to understand The thing to note is the line with copy_dir:
Syntax: copy_dir <src-dir> <dst-dir> [<timestamp>]
Copy the contents of <src-dir> to <dst-dir>. The original contents of <dst-dir> are preserved unless something in <src-dir> overwrote them.
<src-dir> and <dst-dir> options:
ROOT: Root FileSystem ('/')
BOOT: Boot ('/dev/block/mtdblock0')
DATA: Data ('/data' or '/dev/block/mtdblock2')
CACHE: Cache ('/cache' or '/dev/block/mtdblock5')
RECOVERY: Recovery ('/dev/block/mtdblock4')
SDCARD: SDCard ('/sdcard')
SYSTEM: System ('/system' or '/dev/block/mtdblock1')
TMP: (RAM, cleared on reboot)
Example: If you wanted to copy 'somefolder' from your update.zip to your SDCard's 'Music' folder...
copy_dir PACKAGE:somefolder SDCARD:Music
8) Sign the update:
java -classpath <path to testsign.jar> testsign Calculator.zip Calculator-signed.zip
You are all set!
Note for Mac users:
OSX creates hidden files in all directories called '.DS_Store'. Please remember to remove them!
Note for Windows users:
I tend to use the Unix file separator ('/'), so please remember to switch it to '\' when using commands on your computer. On the other hand, Android is a Unix system, so android commands use '/'
Last edited by phoenixsong6; 03-18-2011 at 11:27 AM.
16 Users Say Thank You to phoenixsong6 For This Useful Post
3rdstring (03-31-2011), blackwing182 (12-28-2011), CarL!ToX™ (03-17-2011), dholla1 (03-26-2012), DJGHOSTS3V3N (03-17-2011), dlamber7 (08-04-2011), epinter (03-17-2011), firesnatch (03-17-2011), jaims009 (10-11-2011), jethro650 (10-17-2011), Naser_Maldini (04-25-2011), neo.ank (08-21-2011), Pzyduck (03-17-2011), Saurus (09-17-2011), scouter389 (03-20-2011), ZduneX25 (03-19-2011)
- 03-17-2011, 05:27 AM #2
- 03-17-2011, 06:32 AM #3
- Join Date
- Apr 2009
- La Rioja - Argentina
- Thanked 4,281 Times in 1,850 Posts
- Blog Entries
Thanks you so much, beautifull guide
Moved to correct area and sticky
Last edited by Pzyduck; 03-17-2011 at 06:37 AM.
The Following User Says Thank You to Pzyduck For This Useful Post:
- 03-17-2011, 08:14 PM #4
The Following User Says Thank You to DJGHOSTS3V3N For This Useful Post:
- 03-18-2011, 08:38 AM #5
- 03-18-2011, 04:51 PM #6
- 08-21-2011, 06:58 PM #7
Thanks a lot man... Really a useful Guide.."If x+y+z= Success, then
x= Hard Work,
y= Play, and
z= Keep Your Mouth Shut." - Einstein
- 08-23-2011, 01:49 PM #8Of Mice and Modders
- Join Date
- Aug 2010
- Thanked 4 Times in 4 Posts
Good guide. Just some questions:
If i wanto to copy su comand to /system/sbin and give it 4500 attributes how should it be?
- 11-17-2011, 05:51 PM #9
Complete and concise guide by @phoenixsong6 (as usual). One suggestion; if using a mtdblock as <dst_dir> do a 'mount' command to verify the assignment of the partition to /dev/block/mtdblockn before the copy_dir, since n can differ between various devices.Hic sunt dracones...
- 11-17-2011, 08:44 PM #10
This is for the older recoveries and uses amend script. Most recoveries don't even support it anymore. I'm going to make a new guide in a few days for the newer edify scripting.
As for your note about mounting the blocks, for amend scripting, it is not necessary since the recovery automatically mounts the blocks and maps them with the appropriate name. For the newer edify script, though, yes, you need to remember to mount them before any manipulation.
The Following User Says Thank You to phoenixsong6 For This Useful Post:
- 12-28-2011, 06:36 AM #11Itty Bitty Modder
- Join Date
- Dec 2011
- Thanked 0 Times in 0 Posts
Signature failed when try to use with Motorola XT531, help
I got your procedure as a final chance to my case.
Let me explain:
I root my XT531 and start to move some files from /system/app to have more space on the internal memory.
So, I had succes using the follow, I move the file.apk to my sdcard and replace a link to it in the original place.
So far I was feeling good and had 55 MB free.
But, my proud was broken when a I move a file named motoswitch.apk from /system/app to sdcard and forgotten to create a respective link to it on the original place. After reboot I got a blank Screen.
So, to make worst, I had enter in recovery mode and used "wipe data user" this was big mistake, because I lost the profile that could be used for example to receive an email and paste the file again.
So, as I explain, my final change is create a update.zip to restore the file to the correct folder.
When I tried your tip I got the message "E:Signature verification failed" ou "Invalid" I guess.
PS: the USB Debug option is not checked.
Please help me.
- 12-28-2011, 11:12 AM #12
Did you remember to sign the update.zip? (Step 8)
- 12-28-2011, 12:46 PM #13
- 02-07-2012, 01:31 PM #14Itty Bitty Modder
- Join Date
- Feb 2012
- Thanked 1 Time in 1 Post
the same wi
- 02-07-2012, 01:46 PM #15
Are you using a custom recovery? If so, which one?