Page 1 of 3 123 LastLast
Results 1 to 15 of 32
  1. #1
    phoenixsong6's Avatar
    offline Moderator
    Join Date
    Dec 2010
    Location
    Seattle
    Posts
    731
    Thanks
    44
    Thanked 279 Times in 202 Posts
    Downloads
    17
    Uploads
    0

    [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:
    1. Item to be added (example, Calculator.apk)
    2. 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:
    Code:
    mkdir systemapp
    For Unix Command Line:
    Code:
    mkdir -p system/app
    3) Move the item into the correct location
    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")

    6) update-script:
    Code:
    show_progress 0.1 0
    copy_dir PACKAGE:system SYSTEM:
    show_progress 0.1 10
    Please add an empty line at the end!!

    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')
    MISC: ('/dev/block/mtdblock3')
    PACKAGE: update.zip
    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...
    Code:
    copy_dir PACKAGE:somefolder SDCARD:Music
    7) Zip up the folders you created (For me, I zipped up META-INF and system into Calculator.zip).

    8) Sign the update:
    Code:
    java -classpath <path to testsign.jar> testsign Calculator.zip Calculator-signed.zip
    The classpath is the path to the folder containing testsign.jar. If it is in the same folder, the classpath is just './testsign.jar'

    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 10:27 AM.

  2. 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)

  3. #2
    DJGHOSTS3V3N's Avatar
    offline The Helper
    Join Date
    Oct 2010
    Location
    In the Carribean
    Posts
    1,692
    Thanks
    111
    Thanked 369 Times in 222 Posts
    Downloads
    4
    Uploads
    0
    Awesome guide man. Once I get home ill thanks it.

    Sent from my Nexus S using Tapatalk

    "Remember that life loves you, but most of the time, you don't love life"


  4. #3
    Pzyduck's Avatar
    offline Super Moderator X
    Join Date
    Apr 2009
    Location
    La Rioja - Argentina
    Posts
    5,175
    Thanks
    1,885
    Thanked 4,285 Times in 1,850 Posts
    Blog Entries
    6
    Downloads
    183
    Uploads
    360
    Thanks you so much, beautifull guide

    Moved to correct area and sticky
    Last edited by Pzyduck; 03-17-2011 at 05:37 AM.

  5. The Following User Says Thank You to Pzyduck For This Useful Post:

    ZduneX25 (03-19-2011)

  6. #4
    DJGHOSTS3V3N's Avatar
    offline The Helper
    Join Date
    Oct 2010
    Location
    In the Carribean
    Posts
    1,692
    Thanks
    111
    Thanked 369 Times in 222 Posts
    Downloads
    4
    Uploads
    0
    Quote Originally Posted by phoenixsong6 View Post
    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:
    1. Item to be added (example, Calculator.apk)
    2. 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:
    Code:
    mkdir systemapp
    For Unix Command Line:
    Code:
    mkdir -p system/app
    3) Move the item into the correct location
    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")

    6) update-script:
    Code:
    show_progress 0.1 0
    copy_dir PACKAGE:system SYSTEM:
    show_progress 0.1 10
    Please add an empty line at the end!!

    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')
    MISC: ('/dev/block/mtdblock3')
    PACKAGE: update.zip
    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...
    Code:
    copy_dir PACKAGE:somefolder SDCARD:Music
    7) Zip up the folders you created (For me, I zipped up META-INF and system into Calculator.zip).

    8) Sign the update:
    Code:
    java -classpath <path to testsign> testsign.jar Calculator.zip Calculator-signed.zip
    The classpath is the path to the folder containing testsign.jar. If it is in the same folder, the classpath is just '.'

    You are all set!

    Note for Mac users:
    OSX creates hidden files in all directories called '.DS_Store'. Please remember to remove them!

    show_progress 0.1 0
    copy_dir PACKAGE:framework FRAMEWORK:
    show_progress 0.1 10

    With this UPDATE-SCRIPT will the update.zip modify the framework folder?

    "Remember that life loves you, but most of the time, you don't love life"


  7. The Following User Says Thank You to DJGHOSTS3V3N For This Useful Post:

    Semseddin (08-18-2011)

  8. #5
    phoenixsong6's Avatar
    offline Moderator
    Join Date
    Dec 2010
    Location
    Seattle
    Posts
    731
    Thanks
    44
    Thanked 279 Times in 202 Posts
    Downloads
    17
    Uploads
    0
    Quote Originally Posted by GHOSTS3V3N View Post
    show_progress 0.1 0
    copy_dir PACKAGE:framework FRAMEWORK:
    show_progress 0.1 10

    With this UPDATE-SCRIPT will the update.zip modify the framework folder?
    If framework is a directory in the root of your zip, it will work, but as I saw, it was in system/framework so your options are
    PACKAGE:system/framework SYSTEM:framework
    or the better method:
    PACKAGE:system SYSTEM:

  9. #6
    DJGHOSTS3V3N's Avatar
    offline The Helper
    Join Date
    Oct 2010
    Location
    In the Carribean
    Posts
    1,692
    Thanks
    111
    Thanked 369 Times in 222 Posts
    Downloads
    4
    Uploads
    0
    Ohh thanks man.

    Sent from my Nexus S using Tapatalk

    "Remember that life loves you, but most of the time, you don't love life"


  10. #7
    neo.ank's Avatar
    offline So I Hear You Can Mod
    Join Date
    Mar 2011
    Location
    India
    Posts
    249
    Thanks
    27
    Thanked 20 Times in 20 Posts
    Downloads
    15
    Uploads
    0
    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

  11. #8
    offline Of Mice and Modders
    Join Date
    Aug 2010
    Location
    Mexico
    Posts
    55
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Downloads
    14
    Uploads
    0
    Good guide. Just some questions:
    If i wanto to copy su comand to /system/sbin and give it 4500 attributes how should it be?

  12. #9
    Saurus's Avatar
    offline Super Moderator
    Join Date
    Sep 2010
    Location
    daLLas
    Posts
    1,725
    Thanks
    271
    Thanked 391 Times in 331 Posts
    Downloads
    78
    Uploads
    2
    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...

  13. #10
    phoenixsong6's Avatar
    offline Moderator
    Join Date
    Dec 2010
    Location
    Seattle
    Posts
    731
    Thanks
    44
    Thanked 279 Times in 202 Posts
    Downloads
    17
    Uploads
    0
    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.

  14. The Following User Says Thank You to phoenixsong6 For This Useful Post:

    Saurus (11-19-2011)

  15. #11
    offline Itty Bitty Modder
    Join Date
    Dec 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Downloads
    0
    Uploads
    0

    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.

    Regards.
    Edson

  16. #12
    phoenixsong6's Avatar
    offline Moderator
    Join Date
    Dec 2010
    Location
    Seattle
    Posts
    731
    Thanks
    44
    Thanked 279 Times in 202 Posts
    Downloads
    17
    Uploads
    0
    Did you remember to sign the update.zip? (Step 8)

  17. #13
    DJGHOSTS3V3N's Avatar
    offline The Helper
    Join Date
    Oct 2010
    Location
    In the Carribean
    Posts
    1,692
    Thanks
    111
    Thanked 369 Times in 222 Posts
    Downloads
    4
    Uploads
    0
    Oh shiet this is an old thread. :O.

    There are a lot of ways to sign a file out there, google it.

    Sent from my MB501 using Tapatalk

    "Remember that life loves you, but most of the time, you don't love life"


  18. #14
    offline Itty Bitty Modder
    Join Date
    Feb 2012
    Posts
    10
    Thanks
    0
    Thanked 1 Time in 1 Post
    Downloads
    0
    Uploads
    0

    the same wi

    Quote Originally Posted by edsonmj View Post
    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.

    Regards.
    Edson
    I did exactly the same with my XT532. Now I try to install again motoswitch via update.zip but I keep on getting the error:
    E:signature verification failed
    The update package may be not correct or corrupted!

    And yes, I signed the zip by executing step 8.

    any clues?

  19. #15
    phoenixsong6's Avatar
    offline Moderator
    Join Date
    Dec 2010
    Location
    Seattle
    Posts
    731
    Thanks
    44
    Thanked 279 Times in 202 Posts
    Downloads
    17
    Uploads
    0
    Are you using a custom recovery? If so, which one?

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •