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:myupdatesystemapp folder for Calculator.apk and C:myupdatesystemlib folder for libsec-ril.so
- Create C:myupdateMETA-INFcomgoogleandroid folder for update-script file.
- Create the update-script file with the following syntax: show_progress 0.1 0
- Compress the entire contents of C:myupdate folder to zip (not the myupdate folder itself)
- Sign the myupdate.zip file
- Copy the update.zip file to sdcard and apply it from recovery console
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)
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
update-script syntax reference (definitions from recovery.c android source code):
- copy_dir
- format
- delete
- delete_recursive
- run_program
- set_perm
- set_perm_recursive
- show_progress
- symlink
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:
Syntax: format <root>
Format a partiti0n
Ex: format SYSTEM:, will format entire /system . Note: formatting erases data irreversibly.
Syntax: delete <file1> [… <fileN>]
Delete file.
EX: delete SYSTEM:app/Calculator.apk, will delete Calculator.apk from system/app directory.
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
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.
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
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
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
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)
花了一天时间弄这东西,终于在天黑之前搞定了xt800的root,让时间回味这一刻 ,让岁月铭记这一回o(╯□╰)o。
- 下载update.zip,放到储存卡的根目录上
- 关机
- 按住搜索键 + 拍照键 + 电源开关键, 开机
- 出现感叹号警告图标后,按音量键向上+拍照键,进入recovery模式
- 音量键上下调整高亮条,选择apply sdcard:update.zip 来安装update.zip
- 待完成后,重启,即有root权限
以下不是必须,只是使在adb shell下也能获得root权限
- 下载http://www.magicandroidapps.com/su.zip,解压缩,放到SDK的tools文件夹下
- 输入如下命令 C:Android>adb push su /data/local
- 利用Root Explorer或其他方式mount整个系统,使其处在可读写状态
- 输入以下命令 $ su
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock6 /system
# cd /system/bin
# mv su osu
# cat /data/local/su > su
# chmod 6755 su
# ls -l *su如果最后显示如下,表示成功了
-rwsr-sr-x root root 76200 2008-08-01 05:00 osu
-rwsr-sr-x root root 76200 2009-05-30 11:28 su - 最后输入以下命令,机器会重启,重启后即可 # sync
# reboot
下载:Android_xt800_root_1 (2010-01-22, 3.11 MB)