少妇脱了内裤让我添,久久久久亚洲精品无码网址蜜桃,性色av免费观看,久久人妻av无码中文专区

分享

創(chuàng)建一個刷機包,update-script腳本語法說明

 昵稱128678 2013-01-24

       創(chuàng)建一個刷機包,update-script腳本語法說明


      目前有好幾種方法來安裝軟件或是庫文件到你的Android手機上。你可以使用市場程序來查找并安裝軟件,也可以使用adb命令行工具來安裝或是發(fā)送文件到你的Android文件系統(tǒng)中。這些方法對于操作單個文件來說都挺方便的,但是如果你需要一次性安裝多個軟件或是庫文件時,那么最為方便的方法大概就是使用update.zip(也就是刷機包)文件了。Android系統(tǒng)使用恢復(fù)工具(recovery)來安裝這個update.zip文件中的軟件或庫文件到Android文件系統(tǒng)中。而一個ROM或是主題開發(fā)者通常都是使用這個方式來發(fā)布他們的作品(刷機包)。
      創(chuàng)建一個update.zip文件是很簡單的事情,你所需要做的就是將文件放置到與Android文件系統(tǒng)中相對應(yīng)的文件夾中,然后編寫一個用來復(fù)制這些文件到手機對應(yīng)位置的updater-script, 文件。作為舉例,本文會安裝Calculator.apk到system/app文件夾,復(fù)制libsec-ril.so文件到system/lib文件夾:新建一個空文件夾(本文例:C:\android)新建用來放置Calculator.apk的文件夾C:\android\system\app以及用來放置libsec-ril.so的文件夾C:\android\system\lib。創(chuàng)建用來放置update-script文件的文件夾C:\android\META-INF\com\google\android
      創(chuàng)建一個名為updater-script的文件,其內(nèi)容如下(高亮部分):

  1. show_progress 0.1 0

  2. copy_dir PACKAGE:system SYSTEM:

  3. show_progress 0.1 10

復(fù)制代碼
行1和行5:顯示進度條
行3:復(fù)制刷機包中的system文件夾到Android的/system
注意:你應(yīng)該在文件的最末尾多添加一個空行(也就是行6)C:\android壓縮中的所有內(nèi)容壓縮為zip包(千萬記住:是壓縮android這個文件夾中的內(nèi)容,不是android文件夾本身)android.zip簽名
注意:你可以在[url=http://bbs./android-1154798-1-1.html]這個帖子[/url]中找到為刷機包簽名的教程和工具update.zip文件復(fù)制到SD卡中,然后手機進入recovery界面來刷入這個刷機包

一. 基礎(chǔ)語法篇
1.copy_dir
語法:copy_dir <src-dir> <dst-dir> [<timestamp>]
< src-dir>表示原文件夾,<dst-dir>表示目的文件夾,[<timestamp>]表示時間戳
作用:將<src-dir>文件夾中的內(nèi)容復(fù)制到<dst-dir>文件夾中。<dst-dir>文件夾中的原始內(nèi)容將會保存不變,除非<src-dir>文件夾中有相同的內(nèi)容,這樣<dst-dir>中的內(nèi)容將被覆蓋
舉例:copy_dir PACKAGE:system SYSTEM:(將升級包中的system文件夾復(fù)制到手機中)

2.format
語法:format <root>
< root>表示要格式化的分區(qū)
作用:格式化一個分區(qū)
舉例:format SYSTEM:(將手機/system分區(qū)完全格式化)
注意:格式化之后的數(shù)據(jù)是不可以恢復(fù)的

3.delete
語法:delete <file1> [... <fileN>]
< file1> [... <fileN>]表示要格式化的文件,可以是多個文件用空格隔開
作用:刪除文件1,2到n
舉例:delete SYSTEM:app/Calculator.apk(刪除手機systen文件夾中app中的Calculator.apk文件)

4.delete_recursive
語法:delete_recursive <file-or-dir1> [... <file-or-dirN>]
< file-or-dir1> [... <file-or-dirN>]表示要刪除的文件或文件夾,可以使多個,中間用空格隔開
作用:刪除文件或者目錄,刪除目錄時會將目錄中的所有內(nèi)容全部刪除
舉例:delete_recursive DATA:dalvik-cache(刪除/data/dalvik-cache文件夾下的所有內(nèi)容)

5.run_program
語法:run_program <program-file> [<args> ...]
< program-file>表示要運行的程序,[<args> ...]表示運行程序所加的參數(shù)
作用:運行終端程序
舉例:run_program PACKAGE:install_busybox.sh(執(zhí)行升級包中的install_busybox.sh腳本)

6.set_perm
語法:set_perm <uid> <gid> <mode> <path> [... <pathN>]
< uid>表示用戶名稱,<gid>表示用戶組名稱,<mode>,表示權(quán)限模式,<path> [... <pathN>]表示文件路徑,可以使多個,用空格隔開
作用:設(shè)置單個文件或目錄的所有者和權(quán)限,像linux中的chmod、chown或chgrp命令一樣,只是集中在了一個命令當(dāng)中
舉例:set_perm 0 2000 0550 SYSTEM:etc/init.goldfish.sh(設(shè)置手機system中的etc/init.goldfish.sh的用戶為root,用戶組為shell,所有者以及所屬用戶組成員可以進行讀取和執(zhí)行操作,其他用戶無操作權(quán)限)

7.set_perm_recursive
語法:set_perm_recursive <uid> <gid> <dir-mode> <file-mode> <path> [... <pathN>]
< uid>表示用戶,<gid>表示用戶組,<dir-mode>表示文件夾的權(quán)限,<file-mode>表示文件的權(quán)限,<path> [... <pathN>]表示文件夾的路徑,可以多個,用空格分開
作用:設(shè)置文件夾及文件夾中的文件的所有者和用戶組
舉例:set_perm_recursive 0 0 0755 0644 SYSTEM:app(設(shè)置手機system/app文件夾及其中文件的用戶為root,用戶組為root,app文件夾權(quán)限為所有者可以進行讀、寫、執(zhí)行操作,其他用戶可以進行讀取和執(zhí)行操作,其中的文件的權(quán)限為所有者可以進行讀寫操作,其他用戶可以進行讀取操作)

8.show_progress
語法:show_progress <fraction> <duration>
< 表示一個小部分> <表示一個小部分的持續(xù)時間>
作用:為下面進行的程序操作顯示進度條,進度條會根據(jù)<duration>進行前進,當(dāng)操作時間是確定的時候會更快
舉例:show_progress 0.1 0(顯示進度條當(dāng)操作完成后前進10%)

9.symlink
語法:symlink <link-target> <link-path>
< link-target>表示鏈接到的目標(biāo),<link-path>表示快捷方式的路徑
作用:相當(dāng)于linux中的ln命令,將<link-target>在<link-path>處創(chuàng)建一個軟鏈接,<link-target>的格式應(yīng)為絕對路徑(或許相對路徑也可以),<link-path>為“根目錄:路徑”的形式
舉例:symlink /system/bin/su SYSTEM:xbin/su(在手機中system中的xbin中建立一個/system/bin/su的快捷方式)
10.assert
語法:assert <boolexpr>

作用:此命令用來判斷表達式boolexpr的正確與否,當(dāng)表達式錯誤時程序終止執(zhí)行※此作用有待驗證

11.package_extract_file/dir語法:package_extract_file(file/dir,file/dir)
作用:提取包中文件/路徑
舉例:package_extract_dir("system", "/system");
        package_extract_file("system/bin/modelid_cfg.sh", "/tmp/modelid_cfg.sh");


12.write_radio_image

語法:write_radio_image <src-image>
作用:將基帶部分的鏡像寫入手機,<src-image>表示鏡像文件
舉例:write_radio_image PACKAGE:radio.img

13.write_hboot_image

語法:write_hboot_image <src-image>
作用:將系統(tǒng)bootloader鏡像寫入手機,<src-image>表示鏡像位置,此命令在直到在所有的程序安裝結(jié)束之后才會起作用

舉例:write_hboot_image PACKAGE:hboot.img
14.write_raw_image語法:write_raw_image <src-image> <dest-root>
作用:將boot.img寫入手機,里面包含了內(nèi)核和ram盤
舉例:write_raw_image PACKAGE:boot.img BOOT:


二、根目錄以及分區(qū)的定義(在Android源代碼的root.c文件中定義)
根目錄: Linux 塊設(shè)備 /掛載點/ 文件系統(tǒng) 大小 描述
BOOT: /dev/mtdblock[?] / (RAM) Raw 內(nèi)核、內(nèi)存盤和引導(dǎo)配置。
DATA: /dev/mtdblock5 /data/ yaffs2 91904kb 用戶、系統(tǒng)配置,軟件配置以及軟件(沒有a2sd的話)
CACHE: /dev/mtdblock4 /cache/ yaffs2 30720kb OTA緩存,recovery/更新配置及臨時文件夾
MISC: /dev/mtdblock[?] N/A Raw,[?]kb (等待添加)
PACKAGE: (相對于刷機包) N/A 刷機包的偽文件系統(tǒng)。
RECOVERY: /dev/mtdblock[?] / (RAM) Raw,[?]kb recovery和更新環(huán)境的內(nèi)核和內(nèi)存盤。類似于BOOT:。
SDCARD: /dev/mmcblk0(p1) /sdcard/ fat32 32MB-32GB TF卡。通常刷機包就放在這里。
SYSTEM: /dev/mtdblock3 /system/ yaffs2 92160kb 系統(tǒng)分區(qū),靜態(tài)且是只讀的。
TMP: /tmp/ (RAM) 標(biāo)準(zhǔn)的Linux臨時文件夾 在關(guān)機/重啟時清空。

三. 實例分析進階篇

呵呵,大家來看看這段代碼是不是有種熟悉的感覺啊,這就是在SwiftDroid_v1.8_recovery_BY_mur4ik刷機包中的updater-script文件!

  1. assert(getprop("ro.product.device") == "swift" || getprop("ro.build.product") == "swift" || getprop("ro.product.board") == "swift");
  2. package_extract_file("system/bin/backuptool.sh", "/tmp/backuptool.sh");
  3. set_perm(0, 0, 0777, "/tmp/backuptool.sh");
  4. run_program("/tmp/backuptool.sh", "backup");
  5. show_progress(0.500000, 0);
  6. format("yaffs2", "MTD", "system");
  7. mount("yaffs2", "MTD", "system", "/system");
  8. package_extract_dir("recovery", "/system");
  9. package_extract_dir("system", "/system");
  10. symlink("busybox", "/system/xbin/[", "/system/xbin/[[",
  11.         "/system/xbin/arp", "/system/xbin/ash", "/system/xbin/awk",
  12.         "/system/xbin/basename", "/system/xbin/bbconfig", "/system/xbin/brctl",
  13.         "/system/xbin/bunzip2", "/system/xbin/bzcat", "/system/xbin/bzip2",
  14.         "/system/xbin/cal", "/system/xbin/cat", "/system/xbin/catv",
  15.         "/system/xbin/chgrp", "/system/xbin/chmod", "/system/xbin/chown",
  16.         "/system/xbin/chroot", "/system/xbin/cksum", "/system/xbin/clear",
  17.         "/system/xbin/cmp", "/system/xbin/cp", "/system/xbin/cpio",
  18.         "/system/xbin/cut", "/system/xbin/date", "/system/xbin/dc",
  19.         "/system/xbin/dd", "/system/xbin/depmod", "/system/xbin/devmem",
  20.         "/system/xbin/df", "/system/xbin/diff", "/system/xbin/dirname",
  21.         "/system/xbin/dmesg", "/system/xbin/dnsd", "/system/xbin/dos2unix",
  22.         "/system/xbin/du", "/system/xbin/echo", "/system/xbin/ed",
  23.         "/system/xbin/egrep", "/system/xbin/env", "/system/xbin/expr",
  24.         "/system/xbin/false", "/system/xbin/fdisk", "/system/xbin/fgrep",
  25.         "/system/xbin/find", "/system/xbin/fold", "/system/xbin/free",
  26.         "/system/xbin/freeramdisk", "/system/xbin/fuser", "/system/xbin/getopt",
  27.         "/system/xbin/grep", "/system/xbin/gunzip", "/system/xbin/gzip",
  28.         "/system/xbin/head", "/system/xbin/hexdump", "/system/xbin/id",
  29.         "/system/xbin/ifconfig", "/system/xbin/insmod", "/system/xbin/install",
  30.         "/system/xbin/ip", "/system/xbin/kill", "/system/xbin/killall",
  31.         "/system/xbin/killall5", "/system/xbin/length", "/system/xbin/less",
  32.         "/system/xbin/ln", "/system/xbin/losetup", "/system/xbin/ls",
  33.         "/system/xbin/lsmod", "/system/xbin/lspci", "/system/xbin/lsusb",
  34.         "/system/xbin/lzop", "/system/xbin/lzopcat", "/system/xbin/md5sum",
  35.         "/system/xbin/mkdir", "/system/xbin/mke2fs", "/system/xbin/mkfifo",
  36.         "/system/xbin/mkfs.ext2", "/system/xbin/mknod", "/system/xbin/mkswap",
  37.         "/system/xbin/mktemp", "/system/xbin/modprobe", "/system/xbin/more",
  38.         "/system/xbin/mount", "/system/xbin/mountpoint", "/system/xbin/mv",
  39.         "/system/xbin/netstat", "/system/xbin/nice", "/system/xbin/nohup",
  40.         "/system/xbin/nslookup", "/system/xbin/ntpd", "/system/xbin/od",
  41.         "/system/xbin/patch", "/system/xbin/pgrep", "/system/xbin/pidof",
  42.         "/system/xbin/ping", "/system/xbin/pkill", "/system/xbin/printenv",
  43.         "/system/xbin/printf", "/system/xbin/ps", "/system/xbin/pwd",
  44.         "/system/xbin/rdev", "/system/xbin/readlink", "/system/xbin/realpath",
  45.         "/system/xbin/renice", "/system/xbin/reset", "/system/xbin/rm",
  46.         "/system/xbin/rmdir", "/system/xbin/rmmod", "/system/xbin/route",
  47.         "/system/xbin/run-parts", "/system/xbin/sed", "/system/xbin/seq",
  48.         "/system/xbin/setsid", "/system/xbin/sh", "/system/xbin/sha1sum",
  49.         "/system/xbin/sha256sum", "/system/xbin/sha512sum",
  50.         "/system/xbin/sleep", "/system/xbin/sort", "/system/xbin/split",
  51.         "/system/xbin/stat", "/system/xbin/strings", "/system/xbin/stty",
  52.         "/system/xbin/swapoff", "/system/xbin/swapon", "/system/xbin/sync",
  53.         "/system/xbin/sysctl", "/system/xbin/tac", "/system/xbin/tail",
  54.         "/system/xbin/tar", "/system/xbin/tee", "/system/xbin/telnet",
  55.         "/system/xbin/test", "/system/xbin/tftp", "/system/xbin/time",
  56.         "/system/xbin/top", "/system/xbin/touch", "/system/xbin/tr",
  57.         "/system/xbin/traceroute", "/system/xbin/true", "/system/xbin/tty",
  58.         "/system/xbin/tune2fs", "/system/xbin/umount", "/system/xbin/uname",
  59.         "/system/xbin/uniq", "/system/xbin/unix2dos", "/system/xbin/unlzop",
  60.         "/system/xbin/unzip", "/system/xbin/uptime", "/system/xbin/usleep",
  61.         "/system/xbin/uudecode", "/system/xbin/uuencode", "/system/xbin/vi",
  62.         "/system/xbin/watch", "/system/xbin/wc", "/system/xbin/wget",
  63.         "/system/xbin/which", "/system/xbin/whoami", "/system/xbin/xargs",
  64.         "/system/xbin/yes",
  65.         "/system/xbin/zcat");
  66. symlink("iwmulticall", "/system/xbin/iwconfig", "/system/xbin/iwgetid",
  67.         "/system/xbin/iwlist", "/system/xbin/iwpriv",
  68.         "/system/xbin/iwspy");
  69. symlink("toolbox", "/system/bin/cat", "/system/bin/cmp",
  70.         "/system/bin/date", "/system/bin/dd", "/system/bin/dmesg",
  71.         "/system/bin/getevent", "/system/bin/getprop", "/system/bin/hd",
  72.         "/system/bin/id", "/system/bin/ifconfig", "/system/bin/iftop",
  73.         "/system/bin/insmod", "/system/bin/ioctl", "/system/bin/ionice",
  74.         "/system/bin/kill", "/system/bin/log", "/system/bin/lsmod",
  75.         "/system/bin/mkdir", "/system/bin/nandread", "/system/bin/netstat",
  76.         "/system/bin/newfs_msdos", "/system/bin/notify", "/system/bin/printenv",
  77.         "/system/bin/ps", "/system/bin/reboot", "/system/bin/renice",
  78.         "/system/bin/rmdir", "/system/bin/rmmod", "/system/bin/route",
  79.         "/system/bin/schedtop", "/system/bin/sendevent",
  80.         "/system/bin/setconsole", "/system/bin/setprop", "/system/bin/sleep",
  81.         "/system/bin/smd", "/system/bin/start", "/system/bin/stop",
  82.         "/system/bin/sync", "/system/bin/top", "/system/bin/uptime",
  83.         "/system/bin/vmstat", "/system/bin/watchprops",
  84.         "/system/bin/wipe");
  85. set_perm_recursive(0, 0, 0755, 0644, "/system");
  86. set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
  87. set_perm(0, 3003, 02750, "/system/bin/netcfg");
  88. set_perm(0, 3004, 02755, "/system/bin/ping");
  89. set_perm(0, 2000, 06750, "/system/bin/run-as");
  90. set_perm_recursive(1002, 1002, 0755, 0440, "/system/etc/bluetooth");
  91. set_perm(0, 0, 0755, "/system/etc/bluetooth");
  92. set_perm(1000, 1000, 0640, "/system/etc/bluetooth/auto_pairing.conf");
  93. set_perm(3002, 3002, 0444, "/system/etc/bluetooth/blacklist.conf");
  94. set_perm(1002, 1002, 0440, "/system/etc/dbus.conf");
  95. set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
  96. set_perm_recursive(0, 2000, 0755, 0750, "/system/etc/init.d");
  97. set_perm(0, 0, 0755, "/system/etc/init.d");
  98. set_perm(0, 2000, 0550, "/system/etc/init.goldfish.sh");
  99. set_perm(0, 0, 0544, "/system/etc/install-recovery.sh");
  100. set_perm_recursive(0, 0, 0755, 0555, "/system/etc/ppp");
  101. set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
  102. set_perm(0, 0, 06755, "/system/xbin/hcitool");
  103. set_perm(0, 0, 06755, "/system/xbin/librank");
  104. set_perm(0, 0, 06755, "/system/xbin/procmem");
  105. set_perm(0, 0, 06755, "/system/xbin/procrank");
  106. set_perm(0, 0, 06755, "/system/xbin/su");
  107. set_perm(0, 0, 06755, "/system/xbin/tcpdump");
  108. show_progress(0.200000, 0);
  109. show_progress(0.200000, 10);
  110. package_extract_file("system/bin/backuptool.sh", "/tmp/backuptool.sh");
  111. set_perm(0, 0, 0777, "/tmp/backuptool.sh");
  112. run_program("/tmp/backuptool.sh", "restore");
  113. package_extract_file("system/bin/modelid_cfg.sh", "/tmp/modelid_cfg.sh");
  114. set_perm(0, 0, 0777, "/tmp/modelid_cfg.sh");
  115. run_program("/tmp/modelid_cfg.sh");
  116. package_extract_file("system/bin/verify_cache_partition_size.sh", "/tmp/verify_cache_partition_size.sh");
  117. set_perm(0, 0, 0777, "/tmp/verify_cache_partition_size.sh");
  118. run_program("/tmp/verify_cache_partition_size.sh");
  119. show_progress(0.200000, 10);
  120. assert(package_extract_file("boot.img", "/tmp/boot.img"),
  121.        write_raw_image("/tmp/boot.img", "boot"),
  122.        delete("/tmp/boot.img"));
  123. show_progress(0.100000, 0);
  124. unmount("/system");
復(fù)制代碼

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多

    主站蜘蛛池模板: 亚洲a∨国产高清av手机在线| 欧美色欧美亚洲另类二区| 成人精品国产区在线观看| 起碰97在线视频国产| 国产av一区二区三区日韩| 亚洲国内成人精品网| 久青草影院在线观看国产| 日本 欧美 制服 中文 国产| 久青草影院在线观看国产| 欧美老熟妇牲交| 亚洲熟妇国产熟妇肥婆| 88国产精品欧美一区二区三区| 国模吧双双大尺度炮交gogo| 中文字幕丝袜精品久久| 亚洲日韩中文在线精品第一| 精品成在人线av无码免费看| 久久五月丁香合缴情网| 亚洲一卡一卡二新区无人区| 国产在线无遮挡免费观看| 国语自产少妇精品视频蜜桃| 女同久久精品国产99国产精品| 少妇乱人伦无码视频| 欧美老熟妇牲交| 国产精品无码a∨精品影院| 亚洲综合av色婷婷五月蜜臀| 色欲香天天天综合网站无码| 国产欧美视频综合二区| 国产露脸无套对白在线播放| 日日摸日日碰人妻无码老牲| 18禁超污无遮挡无码免费网站国产| 亚洲熟妇少妇任你躁在线观看无码| 高清自拍亚洲精品二区| 国产97色在线 | 国产| 久久97精品久久久久久久不卡| 亚洲国产中文在线视频| 国产情侣真实露脸在线| 国产精品毛片大码女人| (无码视频)在线观看| 日韩人妻无码精品一专区二区三区| 免费人成年小说在线观看| 国产成人一区二区三区app|