为Android Edify扩充功能

为Android Edify扩充功能Edify简介Edify 命令添加Edify命令Edify简介  Android的刷机包文件解压,会有这样的目录:/META-INF/com/google/android/,该目录下有两个文件update-binary和updater-script。updater-script是用Edify语言写成的文本文件,update-binary是源码下/bootab...
摘要由CSDN通过智能技术生成

为Android Edify扩充功能

Edify简介

  Android的刷机包文件解压,会有这样的目录:/META-INF/com/google/android/,该目录下有两个文件update-binary和updater-script。updater-script是用Edify语言写成的文本文件,update-binary是源码下/bootable/recovery/updater目录下文件编译生成的二进制可执行文件,用来解析updater-script中的内容。所以安卓的刷机过程其实就是执行updater-script脚本的过程。

Edify 命令

  在update-binary的main函数中有如下调用

    RegisterBuiltins();
    RegisterInstallFunctions();
    RegisterBlockImageFunctions();
    RegisterDeviceExtensions();

  其中重点是RegisterBuiltins和RegisterInstallFunctions,前者注册了一些表达式,后者注册了安装包用的函数。

void RegisterBuiltins() {
    RegisterFunction("ifelse", IfElseFn);
    RegisterFunction("abort", AbortFn);
    RegisterFunction("assert", AssertFn);
    RegisterFunction("concat", ConcatFn);
    RegisterFunction("is_substring", SubstringFn);
    RegisterFunction("stdout", StdoutFn);
    RegisterFunction("sleep", SleepFn);

    RegisterFunction("less_than_int", LessThanIntFn);
    RegisterFunction("greater_than_int", GreaterThanIntFn);
}
void RegisterInstallFunctions() {
    RegisterFunction("mount", MountFn);
    RegisterFunction("is_mounted", IsMountedFn);
    RegisterFunction("unmount", UnmountFn);
    RegisterFunction("format", FormatFn);
    RegisterFunction("show_progress", ShowProgressFn);
    RegisterFunction("set_progress", SetProgressFn);
    Reg
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值