logo logo

How to Create Android Update Zip Package

Home » Information Technology » Programming » Android » How to Create Android Update Zip Package




There are several ways to install applications or  library files to an Android Phone. You can use Market application to find and install or adb command line tool to install or push the files to Android file system. These are all easy to implement for  single  file but if you have several applications or library files to install at once, it might be better to use update zip file. The update zip file is Android advanced system to install applications or lib files to Android file system using recovery tool. This method is commonly used by rom or theme developers to distribute their package.

Creating an update zip file is quite easy, all you have to do is put the files in corresponding directory in Android file system and an update-script file to copy the files. For example, to install Calculator.apk into system/app and copy libsec-ril.so file into system/lib :

  • Create an empty folder (eg. C:\myupdate)
  • Create C:\myupdate\system\app folder for Calculator.apk and  C:\myupdate\system\lib folder for libsec-ril.so
  • Create C:\myupdate\META-INF\com\google\android folder for update-script file.
  • Create the update-script file with the following syntax:
  • show_progress 0.1 0
    
    copy_dir PACKAGE:system SYSTEM:
    
    show_progress 0.1 10
    

    Line 1&5 : show progress bar
    Line 3: copy system folder from update package to Android’s /system

    Note: you should add one extra  line at the end of the file (Line 6)

  • Compress the entire contents of C:\myupdate folder to zip (not the myupdate folder itself)
  • Sign the myupdate.zip file
  • java -jar signapk.jar certificate.pem key.pk8 myupdate.zip update.zip

    Note: you can find tutorial on how to sign the update.zip file here

  • Copy the update.zip file to sdcard and apply it from recovery console

update-script syntax reference (definitions from recovery.c android source code):

  • 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.
    Ex: copy_dir PACKAGE:system SYSTEM:

  • format
  • Syntax: format <root>
    Format a partiti0n
    Ex: format SYSTEM:, will format entire /system . Note: formatting erases data irreversibly.

  • delete
  • Syntax: delete <file1> [... <fileN>]
    Delete  file.
    EX: delete SYSTEM:app/Calculator.apk, will delete Calculator.apk from system/app directory.

  • delete_recursive
  • Syntax: delete_recursive <file-or-dir1> [... <file-or-dirN>]
    Delete a file or directory with all of it’s contents recursively
    Ex: delete_recursive DATA:dalvik-cache, will delete /data/dalvik-cache directory with all of it’s contents

  • run_program
  • Syntax: run_program <program-file> [<args> ...]
    Run an external program included in the update package.
    Ex: run_program PACKAGE:install_busybox.sh, will run install_busybox.sh script (shell command) included in the update package.

  • set_perm
  • Syntax: set_perm <uid> <gid> <mode> <path> [... <pathN>]
    Set ownership and permission of single file or entire directory trees, like ‘chmod’, ‘chown’, and ‘chgrp’ all in one
    Ex: set_perm 0 2000 0550 SYSTEM:etc/init.goldfish.sh

  • set_perm_recursive
  • Syntax: set_perm_recursive <uid> <gid> <dir-mode> <file-moe> <path> [... <pathN>]
    Set ownership and permission of a directory with all of it’s contents recursively

    Ex: set_perm_recursive 0 0 0755 0644 SYSTEM:app

  • show_progress
  • Syntax: show_progress <fraction> <duration>
    Use of the on-screen progress meter for the next operation, automatically advancing the meter over <duration> seconds (or more rapidly if the actual rate of progress can be determined).
    Ex: show_progress 0.1 0

  • symlink
  • Syntax: symlink <link-target> <link-path>

    Create a symlink (like ‘ln-s’). The <link-path> is in root:path format, but <link-target> is
    for the target filesystem (and may be relative)

Definition of roots and partitions (from root.c android source code)

 ROOT:     (Linux block device) /mountpoint/ fs, size
    Description.

  BOOT:     (/dev/mtdblock[?]) / (RAM)  Raw
    Kernel, ramdisk and  boot config.
  DATA:     (/dev/mtdblock5)   /data/   yaffs2, 91904kb
    User, system config,  app config, and apps (without  a2sd)
  CACHE:    (/dev/mtdblock4)   /cache/  yaffs2, 30720kb
    OTA cache,  Recovery/update config and temp
  MISC:     (/dev/mtdblock[?]) N/A     Raw
    [TODO: Get info on MISC:]
  PACKAGE:  (Relative to package file) N/A
    Pseudo-filesystem for update  package.
  RECOVERY: (/dev/mtdblock[?]) / (RAM) Raw,     [?]kb
    The recovery  and update environment's kernel and ramdisk.
    Similar to BOOT:.
  SDCARD:   (/dev/mmcblk0(p1)) /sdcard/ fat32,  32MB-32GB
    The microSD card. Update zip is usually here.
  SYSTEM:   (/dev/mtdblock3)   /system/ yaffs2, 92160kb
    The OS partition,    static and read-only.
  TMP:                         /tmp/    in RAM
    Standard Linux temporary directory.
    Cleared on poweroff/reboot.
Share
Related post:
bottom

27 Responses to “How to Create Android Update Zip Package”

  1. [...] This post was mentioned on Twitter by Top How To, Lorensius W. L. T. Lorensius W. L. T said: How to Create Android Update Zip Package http://goo.gl/fb/lk4vs [...]

  2. Mutia says:

    hi, its work.. But why i cant do the show_progress? It take very long long time..

  3. [...] Originally Posted by OMJ Based on the state you have things in now I think that it would be easier to make an update.zip than use metamorph. Basically you need to pull all the files that you changed and package them in a zip. If you dont have any experience with the update.zip format then I would suggest looking at ones done by other themers because files must be nested correctly. If you get stuck shoot me a pm and I will help you out when I can Found this tut on making an update.zip. It seems pretty easy and straightforward: How to Create Android Update Zip Package | All About Web & Mobile Application Development [...]

  4. yahso says:

    not worked
    i have this error

    error in update scripte

  5. Ken Kinder says:

    Hey man, thanks for the instructions. For what it’s worth, this worked perfectly for me in modifying an official update from Google; the only catch was, I deleted Google’s certificates in the zip file before trying to sign my own.

  6. Latest HotFile – SharingMatrix Downloads…

    Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more information? It is extremely helpful for me….

  7. Purchase mp3 music online…

    This important is 1 of the finest piece of writing that My spouse and i have read through till date on this specific subject matter. Extremely descriptive nevertheless to the point with out just about any filler….

  8. nokia n98 says:

    Great Photography Tutorials…

    Appreciation pro the suggestions and references information’s….

  9. clean line says:

    Buy Soft Toys & Childrens Toy online now!…

    Hello blogger, good morning. Wonderful post. You have gained a new reader. Pleasee continue this awesome work and I look forward to more of your superb articles….

  10. Good check list, I am running through it with my sites now .

  11. Best Life Insurance Quotes, Rates & Policy…

    When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get three emails with the same comment. Is there any way you can remove me from that service? Thanks!Thanks…

  12. ghd website says:

    Great article. I have to use more of these ideas. Thanks.

  13. Thank for your post, i really love it. I will come again.

  14. [...] How to Create Android Update Zip Package (17) [...]

  15. [...] schau mal hier: How to Create Android Update Zip Package | All About Web & Mobile Application Development How to Sign Android APK or Zip Files | All About Web & Mobile Application Development [...]

  16. n Development How to Sign Android APK or Zip Files | All About Web & Mobile Application Development [...]

  17. pedrinho says:

    first of all – thanks for the post – is great

    my problem, with recovery 3e it does not accept these signed update.zip the only message is “installation aborted”.
    seems to open and read the update.zip if i enter “show_progress 0.1 50000″ it tooks more time to display the message.

    any hints ? thankyou, greez from BR

    hw: hero h6 china phone

  18. Adi Martha says:

    sama…disini juga kena Instalation Aborted setelah nambah key. kenapa ya?
    apa karena ga cocok sama versi ClockWorkMod nya? :)

  19. leon says:

    不全啊 大哥

  20. [...] the system/framework folder from the uot theme download and make it in to your update.zip format following this guide. Using ultrajack to apply these updates means you can skip the signing part of the guide. Fourth: [...]

  21. [...] [/TR] اینجا هم یه چیزایی نوشته کسی میتونه کمکم بکنه؟ http://www.londatiga.net/it/how-to-c…e-zip-package/ پاسخ با نقل [...]

Leave a Reply

 
bottom