There are currently several ways to install software or library files on your Android phone. You can use the market program to find and install software, or you can use the adb command line tool to install or send files to your Android file system. These methods are very convenient for operating a single file, but if you need to install multiple software or library files at one time, then the most convenient method is probably to use the update.zip (also known as the flash package) file. The Android system uses a recovery tool (recovery) to install the software or library files in this update.zip file into the Android file system. A ROM or theme developer usually uses this method to release their works (brush packages).
Creating an update.zip file is very simple. All you need to do is place the files in the corresponding folders in the Android file system, and then write a function that copies these files to The update-script file corresponding to the mobile phone location. As an example, this article will install Calculator.apk to the system/app folder, and copy the libsec-ril.so file to the system/lib folder:
Create a new empty folder (for this article: C:\mumayi )
Create a new folder C:\mumayi\system\app to place Calculator.apk and a folder C:\mumayi\system\lib to place libsec-ril.so.
Create the folder C:\mumayi\META-INF\com\google\android to place the update-script file.
Create a file named update-script with the following content (highlighted part):
Line 1 and 5: Display progress bar
Line 3: Copy the system folder in the flash package to Android's /system
Note: You should add an extra blank line at the end of the file (that is, line 6)
All contents in C:\mumayi compression are compressed into a zip package (be sure to remember: it is compressing the contents of the mumayi folder, not the mumayi folder itself)
Sign mumayi.zip
Signature command: java -jar signapk.jar certificate.pem key.pk8 mumayi.zip update.zip
Copy the update.zip file to the SD card, and then enter the recovery interface on your phone to flash Enter this flashing package
Advanced learning: (The following is for reference only. Due to different actual situations, there may be certain discrepancies. However, it is highly recommended to study this part)
update-script Syntax reference (defined in the recovery.c file of the Android source code):
copy_dir
Syntax: copy_dir
Description: Copy the contents of
Example: copy_dir PACKAGE:system SYSTEM:, this command will copy the system folder in the flash package to the /system folder of the phone
format
Syntax: format
Description: Format a partition.
Example: format SYSTEM:, this command will format the entire /system. Note: The data deletion operation performed during formatting is irreversible.
delete
Syntax: delete
Description: Delete the file.
Example: delete SYSTEM:app/Calculator.apk, this command will delete the Calculator.apk file in the system/app folder of the mobile phone.
delete_recursive
Syntax: delete_recursive
Description: Delete a file or delete recursively A folder (that is, including all the contents in the folder)
Example: delete_recursive DATA:dalvik-cache, this command will delete the /data/dalvik-cache folder and the files in the folder All content.
run_program
Syntax: run_program
Description: Run an external program in the flash package.
Example: run_program PACKAGE:install_busybox.sh, this command will execute the install_busybox.sh script (command line) in the flash package.
set_perm (if you have any doubts about the values ??involved in this command, please Google. uid=user id, gid=group id)
Syntax: set_perm
Description: Set the owner and permissions of a certain file or the entire specified directory tree, like a 'chmod', ' A collection of chown', and 'chgrp' commands.
Example: set_perm 0 2000 0550 SYSTEM:etc/init.goldfish.sh. This command will set the user group of the etc/init.goldfish.sh file in the system partition on the phone to: shell; the user is: root; permissions are: the owner and members of the user group to which they belong can read and execute operations, and other users have no operation permissions.
set_perm_recursive (if you have any questions about the values ??involved in this command, please Google. uid=user id, gid=group id)
Syntax: set_perm_recursive
Description: Recursively set the owner and permissions of all contents in a folder
Example: set_perm_recursive 0 0 0755 0644 SYSTEM:app, this command will recursively set the user group of the system/app folder and all its contents on the phone to: root; the user is: root; the permissions of the app folder are: owner can Perform read, write, and execute operations, and other users can read and execute operations; the permissions of all files under the app folder are: the owner can perform read and write operations, and other users can perform read operations.
show_progress
Syntax: show_progress
Description: Display a progress bar on the screen for the next operation, automatically based on < Duration > the specified number of seconds to increment the progress bar state (more quickly if the advancement of the progress bar is actually deterministic).
Example: show_progress 0.1 0, this command means that after the operation is completed, the progress bar advances 0.1 (10%)
symlink
Syntax: symlink
Description: Create a matching link (like 'ln-s').
The format of
Example: symlink /system /bin/su SYSTEM:xbin/su, this command will create a symbolic link for /system/bin/su under the xbin folder in the system partition of the phone, named su