Android ROM开发(二)——ROM架构以及Updater-Script脚本分析,常见的Status错误解决办法
怪自己二了,写好的不小心弄没了,现在只好重新写一些了,上篇简单的配置了一下环境,这里呢,就来讲一下相关的只是点
我们先下载一个ROM,随便下,原理都是差不多的,这里我就下载一个红米Note的MIUI稳定版
1.ROM结构
ROM根据厂商的定制可能有所不同,但是大体是不变的
-
data
内置一些软件
-
META-INF
脚本文件
- update-binary 二进制文件
- updater-script 刷机脚本
-
recovery
官方的recovery,我们定制的时候需要删掉
-
system
手机的一些资源
-
boot.img
内核镜像
-
logo.img
开机第一屏
-
uboot.img
启动内核的镜像
2.updater-script刷机脚本
路径在META-INF/google/android/updater-script,我们用notpad++打开,我用注释来分析一下
//机型验证,用了||运算
getprop("ro.product.device") == "lcsh92_wet_tdd" || abort("This package is for \"lcsh92_wet_tdd\" devices; this is a \"" + getprop("ro.product.device") + "\".");
//挂载分区
mount("ext4", "EMMC", "/dev/block/mmcblk0p3", "/data");
//进度
show_progress(0.500000, 0);
format("ext4", "EMMC", "/dev/block/mmcblk0p6", "0", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p6", "/system");
//把recovery文件夹下的内容解压到system中去
package_extract_dir("recovery", "/system") || abort("Failed to extract dir from \"recovery\" to \"/system\".");
//把system文件夹下的内容解压到system中
package_extract_dir("system", "/system") || abort("Failed to extract dir from \"system\" to \"/system\".");
//创建文件
symlink("../ui/MessageComplete.ogg", "/system/media/audio/notifications/MessageComplete.ogg");
symlink("../ui/MessageIncoming.ogg", "/system/media/audio/notifications/MessageIncoming.ogg");
symlink("/data/miui/miuisdk.apk", "/system/framework/miuisdk.jar");
symlink("/data/miui/miuisystem.apk", "/system/framework/miuisystem.jar");
symlink("Roboto-Bold.ttf", "/system/fonts/DroidSans-Bold.ttf");
symlink("Roboto-Regular.ttf", "/system/fonts/DroidSans.ttf");
symlink("aee_aed", "/system/bin/debuggerd");
symlink("libGLESv2.so", "/system/lib/libGLESv3.so");
symlink("mksh", "/system/bin/sh");
symlink("toolbox", "/system/bin/cat", "/system/bin/chcon",
"/system/bin/chmod", "/system/bin/chown", "/system/bin/clear",
"/system/bin/cmp", "/system/bin/cp", "/system/bin/date",
"/system/bin/dd", "/system/bin/df", "/system/bin/dmesg",
"/system/bin/du", "/system/bin/getenforce", "/system/bin/getevent",
"/system/bin/getprop", "/system/bin/getsebool", "/system/bin/grep",
"/system/bin/hd", "/system/bin/id", "/system/bin/ifconfig",
"/system/bin/iftop", "/system/bin/insmod", "/system/bin/ioctl",
"/system/bin/ionice", "/system/bin/kill", "/system/bin/ln",
"/system/bin/load_policy", "/system/bin/log", "/system/bin/ls",
"/system/bin/lsmod", "/system/bin/lsof", "/system/bin/md5",
"/system/bin/mkdir", "/system/bin/mkswap", "/system/bin/mount",
"/system/bin/mv", "/system/bin/nandread", "/system/bin/netstat",
"/system/bin/newfs_msdos", "/system/bin/notify", "/system/bin/printenv",
"/system/bin/ps", "/system/bin/readlink", "/system/bin/renice",
"/system/bin/restorecon", "/system/bin/rm", "/system/bin/rmdir",
"/system/bin/rmmod", "/system/bin/route", "/system/bin/runcon",
"/system/bin/schedtop", "/system/bin/sendevent",
"/system/bin/setconsole", "/system/bin/setenforce",
"/system/bin/setprop", "/system/bin/setsebool", "/system/bin/sleep",
"/system/bin/smd", "/system/bin/start", "/system/bin/stop",
"/system/bin/swapoff", "/system/bin/swapon", "/system/bin/sync",
"/system/bin/top", "/system/bin/touch", "/system/bin/umount",
"/system/bin/uptime", "/system/bin/vmstat", "/system/bin/watchprops",
"/system/bin/wipe");
//设置权限
set_metadata_recursive("/system", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/bin", "uid", 0, "gid", 2000, "dmode", 0755, "fmode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/bin/6620_launcher", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:mtk_6620_launcher_exec:s0");
set_metadata("/system/bin/6620_wmt_concurrency", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:mtk_6620_wmt_concurrency_exec:s0");
set_metadata("/system/bin/6620_wmt_lpbk", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:mtk_6620_wmt_lpbk_exec:s0");
set_metadata("/system/bin/adb", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:adb_exec:s0");
set_metadata("/system/bin/aee", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:aee_exec:s0");
set_metadata("/system/bin/aee_aed", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:aee_aed_exec:s0");
set_metadata("/system/bin/aee_core_forwarder", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:aee_core_forwarder_exec:s0");
set_metadata("/system/bin/aee_dumpstate", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:aee_dumpstate_exec:s0");
set_metadata("/system/bin/akmd09911", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:akmd09911_exec:s0");
set_metadata("/system/bin/akmd8963", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:akmd8963_exec:s0");
set_metadata("/system/bin/akmd8975", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:akmd8975_exec:s0");
set_metadata("/system/bin/am", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:am_exec:s0");
set_metadata("/system/bin/ami304d", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:ami304d_exec:s0");
set_metadata("/system/bin/app_process", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:zygote_exec:s0");
set_metadata("/system/bin/applypatch", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:applypatch_exec:s0");
set_metadata("/system/bin/atcid", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:atcid_exec:s0");
set_metadata("/system/bin/atrace", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:atrace_exec:s0");
set_metadata("/system/bin/audiocmdservice_atci", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:audiocmdservice_atci_exec:s0");
set_metadata("/system/bin/badblocks", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:badblocks_exec:s0");
set_metadata("/system/bin/batterywarning", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:batterywarning_exec:s0");
set_metadata("/system/bin/bmgr", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:bmgr_exec:s0");
set_metadata("/system/bin/bmm050d", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:bmm050d_exec:s0");
set_metadata("/system/bin/boot_logo_updater", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:boot_logo_updater_exec:s0");
set_metadata("/system/bin/bootanimation", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:bootanimation_exec:s0");
set_metadata("/system/bin/btconfig", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:btconfig_exec:s0");
set_metadata("/system/bin/btlogmask", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:btlogmask_exec:s0");
set_metadata("/system/bin/bu", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:bu_exec:s0");
set_metadata("/system/bin/bugreport", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:bugreport_exec:s0");
set_metadata("/system/bin/ccci_fsd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:ccci_fsd_exec:s0");
set_metadata("/system/bin/ccci_mdinit", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:ccci_mdinit_exec:s0");
set_metadata("/system/bin/clatd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:clatd_exec:s0");
set_metadata("/system/bin/content", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:content_exec:s0");
set_metadata("/system/bin/dalvikvm", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:dalvikvm_exec:s0");
set_metadata("/system/bin/dexopt", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:dexopt_exec:s0");
set_metadata("/system/bin/dhcp6c", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:dhcp6c_exec:s0");
set_metadata("/system/bin/dhcp6ctl", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:dhcp6ctl_exec:s0");
set_metadata("/system/bin/dhcp6s", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:dhcp6s_exec:s0");
set_metadata("/system/bin/dhcpcd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:dhcp_exec:s0");
set_metadata("/system/bin/dm_agent_binder", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:dm_agent_binder_exec:s0");
set_metadata("/system/bin/dnsmasq", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:dnsmasq_exec:s0");
set_metadata("/system/bin/drmserver", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:drmserver_exec:s0");
set_metadata("/system/bin/dualmdlogger", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:dualmdlogger_exec:s0");
set_metadata("/system/bin/dumpstate", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:dumpstate_exec:s0");
set_metadata("/system/bin/dumpsys", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:dumpsys_exec:s0");
set_metadata("/system/bin/em_svr", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:em_svr_exec:s0");
set_metadata("/system/bin/emcsmdlogger", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:emcsmdlogger_exec:s0");
set_metadata("/system/bin/ext4_resize", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:ext4_resize_exec:s0");
set_metadata("/system/bin/factory", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:factory_exec:s0");
set_metadata("/system/bin/fsck_msdos", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:fsck_msdos_exec:s0");
set_metadata("/system/bin/fsck_msdos_mtk", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:fsck_msdos_mtk_exec:s0");
set_metadata("/system/bin/geomagneticd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:geomagneticd_exec:s0");
set_metadata("/system/bin/gsm0710muxd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:gsm0710muxd_exec:s0");
set_metadata("/system/bin/gsm0710muxdmd2", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:gsm0710muxdmd2_exec:s0");
set_metadata("/system/bin/gzip", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:gzip_exec:s0");
set_metadata("/system/bin/hostapd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:hostapd_exec:s0");
set_metadata("/system/bin/ime", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:ime_exec:s0");
set_metadata("/system/bin/input", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:input_exec:s0");
set_metadata("/system/bin/installd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:installd_exec:s0");
set_metadata("/system/bin/ip", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:ip_exec:s0");
set_metadata("/system/bin/ip6tables", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:ip6tables_exec:s0");
set_metadata("/system/bin/ipod", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:ipod_exec:s0");
set_metadata("/system/bin/ipohctl", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:ipohctl_exec:s0");
set_metadata("/system/bin/iptables", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:iptables_exec:s0");
set_metadata("/system/bin/keystore", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:keystore_exec:s0");
set_metadata("/system/bin/lcdc_screen_cap", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:lcdc_screen_cap_exec:s0");
set_metadata("/system/bin/linker", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:linker_exec:s0");
set_metadata("/system/bin/logcat", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:logcat_exec:s0");
set_metadata("/system/bin/logwrapper", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:logwrapper_exec:s0");
set_metadata("/system/bin/lsm303md", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:lsm303md_exec:s0");
set_metadata("/system/bin/magd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:magd_exec:s0");
set_metadata("/system/bin/make_ext4fs", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:make_ext4fs_exec:s0");
set_metadata("/system/bin/matv", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:matv_exec:s0");
set_metadata("/system/bin/mc6420d", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:mc6420d_exec:s0");
set_metadata("/system/bin/md_minilog_util", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:md_minilog_util_exec:s0");
set_metadata("/system/bin/mdlogger", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:mdlogger_exec:s0");
set_metadata("/system/bin/mdnsd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:mdnsd_exec:s0");
set_metadata("/system/bin/media", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:media_exec:s0");
set_metadata("/system/bin/mediaserver", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:mediaserver_exec:s0");
set_metadata("/system/bin/memorydumper", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:memorydumper_exec:s0");
set_metadata("/system/bin/memsicd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:memsicd_exec:s0");
set_metadata("/system/bin/memsicd3416x", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:memsicd3416x_exec:s0");
set_metadata("/system/bin/mfv_ut", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:mfv_ut_exec:s0");
set_metadata("/system/bin/mke2fs", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:mke2fs_exec:s0");
set_metadata("/system/bin/mksh", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:shell_exec:s0");
set_metadata("/system/bin/mobile_log_d", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:mobile_log_d_exec:s0");
set_metadata("/system/bin/monkey", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:monkey_exec:s0");
set_metadata("/system/bin/msensord", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:msensord_exec:s0");
set_metadata("/system/bin/mtk_agpsd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:mtk_agpsd_exec:s0");
set_metadata("/system/bin/mtkbt", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:mtkbt_exec:s0");
set_metadata("/system/bin/mtpd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:mtp_exec:s0");
set_metadata("/system/bin/muxreport", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:muxreport_exec:s0");
set_metadata("/system/bin/ndc", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:ndc_exec:s0");
set_metadata("/system/bin/netcfg", "uid", 0, "gid", 3003, "mode", 02750, "capabilities", 0x0, "selabel", "u:object_r:netcfg_exec:s0");
set_metadata("/system/bin/netd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:netd_exec:s0");
set_metadata("/system/bin/netdiag", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:netdiag_exec:s0");
set_metadata("/system/bin/nvram_agent_binder", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:nvram_agent_binder_exec:s0");
set_metadata("/system/bin/nvram_daemon", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:nvram_daemon_exec:s0");
set_metadata("/system/bin/orientationd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:orientationd_exec:s0");
set_metadata("/system/bin/permission_check", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:permission_check_exec:s0");
set_metadata("/system/bin/ping", "uid", 0, "gid", 0, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:ping_exec:s0");
set_metadata("/system/bin/ping6", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:ping6_exec:s0");
set_metadata("/system/bin/pm", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:pm_exec:s0");
set_metadata("/system/bin/poad", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:poad_exec:s0");
set_metadata("/system/bin/pppd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:ppp_exec:s0");
set_metadata("/system/bin/pppd_dt", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:pppd_dt_exec:s0");
set_metadata("/system/bin/pq", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:pq_exec:s0");
set_metadata("/system/bin/qmc5983d", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:qmc5983d_exec:s0");
set_metadata("/system/bin/racoon", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:racoon_exec:s0");
set_metadata("/system/bin/radvd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:radvd_exec:s0");
set_metadata("/system/bin/requestsync", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:requestsync_exec:s0");
set_metadata("/system/bin/resize2fs", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:resize2fs_exec:s0");
set_metadata("/system/bin/rild", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:rild_exec:s0");
set_metadata("/system/bin/rildmd2", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:rildmd2_exec:s0");
set_metadata("/system/bin/rtt", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:rtt_exec:s0");
set_metadata("/system/bin/run-as", "uid", 0, "gid", 2000, "mode", 0750, "capabilities", 0xc0, "selabel", "u:object_r:runas_exec:s0");
set_metadata("/system/bin/s62xd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:s62xd_exec:s0");
set_metadata("/system/bin/schedtest", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:schedtest_exec:s0");
set_metadata("/system/bin/screencap", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:screencap_exec:s0");
set_metadata("/system/bin/screenshot", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:screenshot_exec:s0");
set_metadata("/system/bin/sdcard", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:sdcardd_exec:s0");
set_metadata("/system/bin/sdiotool", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:sdiotool_exec:s0");
set_metadata("/system/bin/sensorservice", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:sensorservice_exec:s0");
set_metadata("/system/bin/service", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:service_exec:s0");
set_metadata("/system/bin/servicemanager", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:servicemanager_exec:s0");
set_metadata("/system/bin/settings", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:settings_exec:s0");
set_metadata("/system/bin/shutdown", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:shutdown_exec:s0");
set_metadata("/system/bin/sn", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:sn_exec:s0");
set_metadata("/system/bin/superumount", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:superumount_exec:s0");
set_metadata("/system/bin/surfaceflinger", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:surfaceflinger_exec:s0");
set_metadata("/system/bin/svc", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:svc_exec:s0");
set_metadata("/system/bin/tc", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:tc_exec:s0");
set_metadata("/system/bin/terservice", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:terservice_exec:s0");
set_metadata("/system/bin/thermal", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:thermal_exec:s0");
set_metadata("/system/bin/thermal_manager", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:thermal_manager_exec:s0");
set_metadata("/system/bin/tiny_mkswap", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:tiny_mkswap_exec:s0");
set_metadata("/system/bin/tiny_swapoff", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:tiny_swapoff_exec:s0");
set_metadata("/system/bin/tiny_swapon", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:tiny_swapon_exec:s0");
set_metadata("/system/bin/tiny_switch", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:tiny_switch_exec:s0");
set_metadata("/system/bin/toolbox", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:toolbox_exec:s0");
set_metadata("/system/bin/uiautomator", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:uiautomator_exec:s0");
set_metadata("/system/bin/vdc", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:vdc_exec:s0");
set_metadata("/system/bin/vold", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:vold_exec:s0");
set_metadata("/system/bin/wlan_loader", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:wlan_loader_exec:s0");
set_metadata("/system/bin/wm", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:wm_exec:s0");
set_metadata("/system/bin/wmt_loader", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:wmt_loader_exec:s0");
set_metadata("/system/bin/wpa_cli", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:wpa_cli_exec:s0");
set_metadata("/system/bin/wpa_supplicant", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:wpa_exec:s0");
set_metadata("/system/bin/xlog", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:xlog_exec:s0");
//设置文件夹权限
set_metadata_recursive("/system/etc/dhcpcd", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644, "capabilities", 0x0, "selabel", "u:object_r:dhcp_system_file:s0");
set_metadata("/system/etc/dhcpcd/dhcpcd-run-hooks", "uid", 1014, "gid", 2000, "mode", 0550, "capabilities", 0x0, "selabel", "u:object_r:dhcp_system_file:s0");
set_metadata("/system/etc/install-recovery.sh", "uid", 0, "gid", 0, "mode", 0544, "capabilities", 0x0);
set_metadata_recursive("/system/etc/ppp", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0555, "capabilities", 0x0, "selabel", "u:object_r:ppp_system_file:s0");
set_metadata("/system/etc/wide-dhcpv6/dhcp6c.script", "uid", 1014, "gid", 2000, "mode", 0550, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/recovery-from-boot.p", "uid", 0, "gid", 0, "mode", 0644, "capabilities", 0x0);
set_metadata("/system/vendor", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/vendor/etc", "uid", 0, "gid", 2000, "dmode", 0755, "fmode", 0644, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/vendor/etc/diracmobile.config", "uid", 0, "gid", 0, "mode", 0644, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/vendor/lib", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/vendor/lib/drm", "uid", 0, "gid", 2000, "dmode", 0755, "fmode", 0644, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/vendor/lib/drm/libdrmwvmplugin.so", "uid", 0, "gid", 0, "mode", 0644, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/vendor/lib/hw", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/vendor/lib/mediadrm", "uid", 0, "gid", 2000, "dmode", 0755, "fmode", 0644, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/vendor/lib/mediadrm/libwvdrmengine.so", "uid", 0, "gid", 0, "mode", 0644, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/xbin", "uid", 0, "gid", 2000, "dmode", 0755, "fmode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/xbin/BGW", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:BGW_exec:s0");
set_metadata("/system/xbin/dexdump", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:dexdump_exec:s0");
set_metadata("/system/xbin/mnld", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:mnld_exec:s0");
set_metadata("/system/xbin/shelld", "uid", 0, "gid", 1000, "mode", 06754, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/xbin/showmap", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:showmap_exec:s0");
set_metadata("/system/xbin/tcpdump", "uid", 0, "gid", 0, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:tcpdump_exec:s0");
//显示进度
show_progress(0.200000, 0);
show_progress(0.200000, 10);
//刷入内核
assert(package_extract_file("boot.img", "/tmp/boot.img"),
write_raw_image("/tmp/boot.img", "bootimg"),
delete("/tmp/boot.img"));
assert(run_program("/system/bin/dd", "if=/dev/zero", "of=/proc/driver/mtd_writeable", "bs=3c", "count=1"));
//刷入开机屏
assert(package_extract_file("logo.img", "/tmp/logo.img"),
write_raw_image("/tmp/logo.img", "logo"),
delete("/tmp/logo.img"));
//刷入uboot
assert(package_extract_file("uboot.img", "/tmp/uboot.img"),
write_raw_image("/tmp/uboot.img", "uboot"),
delete("/tmp/uboot.img"));
show_progress(0.100000, 0);
//删除软件
delete("/data/miui/apps/GoogleTTS.apk");
delete("/data/app/GoogleTTS.apk");
//删除文件夹
delete_recursive("/data/miui/cust/cn/app_overlay");
delete_recursive("/data/miui/cust/cn_chinamobile/app_overlay");
delete_recursive("/data/miui/cust/cn_chinatelecom/app_overlay");
delete_recursive("/data/miui/cust/cn_chinaunicom/app_overlay");
delete_recursive("/data/miui/cust/hk/app_overlay");
delete_recursive("/data/miui/cust/id/app_overlay");
delete_recursive("/data/miui/cust/in/app_overlay");
delete_recursive("/data/miui/cust/my/app_overlay");
delete_recursive("/data/miui/cust/ph/app_overlay");
delete_recursive("/data/miui/cust/sg/app_overlay");
delete_recursive("/data/miui/cust/th/app_overlay");
delete_recursive("/data/miui/cust/tw/app_overlay");
//刷入内置软件
package_extract_dir("data", "/data");
package_extract_file("META-INF/com/miui/miui_update", "/cache/miui_update");
set_metadata("/cache/miui_update", "uid", 0, "gid", 0, "mode", 0555, "capabilities", 0x0);
run_program("/cache/miui_update");
delete("/cache/miui_update");
set_metadata_recursive("/data/miui", "uid", 1000, "gid", 1000, "dmode", 0755, "fmode", 0644, "capabilities", 0x0);
delete_recursive("/data/miui/preinstall_apps");
delete_recursive("/data/miui/cust/preinstall_apps");
delete("/data/miui/cust/cn/theme/operator/boots/bootanimation.zip");
//卸载data/syatem分区
unmount("/data");
unmount("/system");
看完这些你应该对语法有个大致的了解了
3.常见的Status错误解决办法
我们在调试的审核后也是一定会遇到刷入错误的情况,这个时候就需要我们调试了,刷机过程中,所有的log日志都存放在recovery.log这个文件里,我们这里删掉一些刷机脚本中的机型验证,刷入手机测试
他会提示错误,我的机型验证出现了问题,这样我们就可以快速的找到错误了