* show_progress(frac, sec)
ex.
show_progress(0.300000, 0); --- 控制升級時的進度條,第一個參數 0.3 代表顯示進度條到 30% 的位置,第二個參數是預估這個動作的總秒數,可以都為0
* set_progress(frac)
設置進度條
* package_extract_dir(package_path, destination_path)
ex.
package_extract_dir("recovery", "/system"); --- 把升級包裡的 recovery 文件夾下的資料全部提取到 /system 下
package_extract_dir("system", "/system"); --- 把升級包裡的 system 文件夾下的資料全部提取到 /system 下
* package_extract_file(package_path, destination_path) or package_extract_file(package_path)
ex.
package_extract_file("boot.img", "/dev/block/platform/msm_sdcc.1/by-name/boot"); --- 將 boot.img 燒錄至 boot partition
package_extract_file("tmp.zip", "/system"); --- 把升級包的 tmp.zip 提取至 /system 下
* file_getprop(file, key)
沒有試過,在 source code 裡的解釋如下
interprets 'file' as a getprop-style file (key=value pairs, one per line,
# comment lines and blank lines okay), and returns the value for 'key' (or "" if it isn't defined).
* mount(fs_type, partition_type, location, mount_point)
ex.
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system"); --- 將 system partition block 掛載至 /system,第一個參數是硬碟格式,第二個參數是 flash 的類型
mount("ubifs", "UBI", "system", "/system"); --- 同上,硬碟格式及 flash 類型不一樣,需注意的是這裡的第三個參數需要對照到 /etc/recovery.fstab 裡的設定才能對應到正確的 block 位置
* unmount(mount_point)
ex.
unmount("/system"); --- 卸載 /system
* is_mounted(mount_point)
ex.
is_mounted("/system") --- 檢查 /system 是否掛載,成功 return 掛載點,失敗 return null
* format(fs_type, partition_type, location, fs_size, mount_point)
以下是 source code 裡的解釋
// fs_type="yaffs2" partition_type="MTD" location=partition fs_size=<bytes> mount_point=<location>
// fs_type="ext4" partition_type="EMMC" location=device fs_size=<bytes> mount_point=<location>
// if fs_size == 0, then make_ext4fs uses the entire partition.
// if fs_size > 0, that is the size to use
// if fs_size < 0, then reserve that many bytes at the end of the partition
ex.
format("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "0", "/system"); --- 格式化 system partition
* delete(file_1, file_2, ...)
ex.
delete("/system/media/bootanimation.zip"); --- 刪除自訂的 bootanimation,可指定多個欲刪除的檔案
* delete_recusive(dir_1, dir_2, ...)
ex.
delete_recusive("/data/dalvik-cache"); --- 可指定多個欲刪除的資料夾
* symlink(target, src1, src2, ....)
ex.
symlink("mksh", "/system/bin/sh"); --- 建立 sh 符號 link 指向 mksh
symlink("toolbox", "/system/bin/cat", "/system/bin/chmod",
"/system/bin/chown", "/system/bin/cmp", "/system/bin/date",
"/system/bin/dd", "/system/bin/df", "/system/bin/dmesg",
"/system/bin/getevent", "/system/bin/getprop", "/system/bin/hd",
"/system/bin/id", "/system/bin/ifconfig", "/system/bin/iftop"..........); --- 設置 toolbox 的 link,android 的 toolbox 類似於 linux 的 busybox,稍微簡易一些
* set_perm_recursive(uid, gid, dirmode, filemode, dir_1, dir_2, ....)
ex.
set_perm_recursive(0, 0, 0755, 0644, "/system"); --- 設置 /system 的權限
* set_perm(uid, gid, mode, file_1, file_2, ...)
ex.
set_perm(0, 3003, 02750, "/system/bin/netcfg"); --- 設置 /system/bin/netcfg 的權限
set_perm(0, 3004, 02755, "/system/bin/ping");
* ui_print(string_1, string_2, ...)
ex.
ui_print("Writing image boot.img"); --- 升級包運行中要顯示再螢幕的訊息
如果有其他較常用的指令將陸續補上。
留言列表