1. mount
Syntax:
Mount (type, location, mount_point );
Note:
Type = "MTD" location = "<partition>" mount the yaffs2 file system partition;
Type = "vfat" location = "/dev/block/<whatever>" mount the device.
For example:
mount("MTD", "system", "/system");
Mount the system partition and set the return Pointer "/system"
mount("vfat", "/dev/block/mmcblk1p2", "/system");
Mount/dev/block/mmcblk1p2 and return the pointer "/system"
2. Unmount
Syntax:
Unmount (mount_point );
Note:
Mount_point is the pointer generated by the mount settings. This function is opposite to mounting. it detaches a partition or device. This function is used together with mount.
For example:
unmount("/system");
Unmount/system partition
3. Format
Syntax:
Format (type, location );
Note:
Type = "MTD" location = partition (partition), format the partition represented by the location parameter.
For example:
format("MTD", "system");
Format system partitions
4. Delete
Syntax:
Delete (<path> );
Note:
Delete a file <path>
For example:
delete("/data/zipalign.log");
Delete file/data/zipalign. log
5. delete_recursive
Syntax:
Delete_recursive (<path> );
Note:
Delete a folder <path>
For example:
delete_recursive("/data/dalvik-cache");
Delete folders/data/dalvik-cache
6. show_progress
Syntax:
Show_progress (<fraction>, <duration> );
Note:
The progress bar is displayed for the following program operations. The progress bar moves forward according to <duration> <fraction>
For example:
show_progress(0.1, 10);
The operations under show_progress may be performed for 10 s. After completion, the progress bar advances to 0.1 (that is, 10%)
7. package_extract_dir
Syntax:
Package_extract_dir (package_path, destination_path );
Note:
Release package_path to destination_path
For example:
package_extract_dir("system", "/system");
Release all files and subfolders in the system folder in the ROM package to/system
8. package_extract_file
Syntax:
Package_extract_file (package_path, destination_path );
Note:
Decompress the package_path file to destination_path.
For example:
package_extract_dir("my.zip", "/system");
Decompress the my.zip file in the rompackage to/system
9. Symlink
Syntax:
Symlink (<target>, <src1>, <src2> ,...);
Note:
Create a link to the target symbol src1, src2 ,......
For example:
symlink("toolbox", "/system/bin/ps");
Create a symbolic link to toolbox/system/bin/ps
10. set_perm
Syntax:
Set_perm (<uid>, <gid>, <mode>, <path> );
Note:
Set the user of the <path> file to uid, user group to gid, and permission to mode.
For example:
set_perm(1002, 1002, 0440, "/system/etc/dbus.conf");
Set the owner of the file/system/etc/users. conf to 1002, and the user group to 1002. The permission is: the owner has the read permission, and the user group has the read permission. Others do not have any permissions.
11. set_perm_recursive
Syntax:
Set_perm_recursive (<uid>, <gid>, <dir-mode>, <file-mode>, <path> );
Note:
Set permissions for files in folders and folders
For example:
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
Set the/data/app owner and user group to 1000. The app folder permission is: the owner and group have all permissions, and others have execution permissions. The File Permission under the app folder is: the owner has the read and write permissions, and the Group has the read permission.
12. ui_print
Syntax:
Ui_print ("str ");
Note:
Screen Print Output "str"
For example:
ui_print("It's ready!");
Screen Print It's ready!
13. run_program
Syntax:
Run_program (<path> );
Note:
Run the <path> script
For example:
run_program("/system/xbin/installbusybox.sh");
Run the installbusybox. sh script file
14. write_raw_image
Syntax:
Write_raw_image (<path>, partition );
Note:
Write <path> to partition
For example:
write_raw_image("/tmp/boot.img", "boot")
Write the boot package in yaffs2 format to the boot partition directly.
15. assert
Syntax:
Assert (<sub1>, <sub2>, <sub3> );
Note:
If sub1 is executed and no error is returned, sub2 is executed. If sub2 does not return an error, sub3 is executed and so on.
For example:
assert(package_extract_file("boot.img", "/tmp/boot.img"),
write_raw_image("/tmp/boot.img", "boot"),
delete("/tmp/boot.img"));
Run package_extract_file. If no error is returned, run write_raw_image. If no error is returned, run delete.
References:
1. https://github.com/koush/android_bootable_recovery/blob/eclair/updater/install.c
2. http://wenku.baidu.com/view/49d6b7dace2f0066f53322d3.html
3. http://www.opda.com.cn/thread-266871-1-1.html