zoukankan      html  css  js  c++  java
  • HIDL interface hashing

    概要

    1. 每一个接口文件对应一个.hal文件
    2. 保护接口文件不被轻易修改。如果修改,编译就会报错,同时会生成一个修改后hashing值
    3. 确保接口变化得到充分审查

    布局

    每一个包根目录下都有一个current.txt文件。例如android.hardware对应hardware/interfaces。
    这个文件包含了发布的所有接口文件即.hal文件以及对应的hashing值。

    Hashing产生

    1.手动添加hash到current.txt

    .hal文件修改后,编译会报错同时生成修改后的hash值,可以手动添加到current.txt。

    2.hidl-gen

    hidl-gen -L hash -r vendor.awesome:vendor/awesome/hardware/interfaces -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport vendor.awesome.nfc@1.0::types
    9626fd18...f9d298a6 vendor.awesome.nfc@1.0::types
    hidl-gen -L hash -r vendor.awesome:vendor/awesome/hardware/interfaces -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport vendor.awesome.nfc@1.0::INfc
    07ac2dc9...11e3cf57 vendor.awesome.nfc@1.0::INfc
    hidl-gen -L hash -r vendor.awesome:vendor/awesome/hardware/interfaces -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport vendor.awesome.nfc@1.0
    9626fd18...f9d298a6 vendor.awesome.nfc@1.0::types
    07ac2dc9...11e3cf57 vendor.awesome.nfc@1.0::INfc
    f2fe5442...72655de6 vendor.awesome.nfc@1.0::INfcClientCallback
    hidl-gen -L hash -r vendor.awesome:vendor/awesome/hardware/interfaces -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport vendor.awesome.nfc@1.0 >> vendor/awesome/hardware/interfaces/current.txt
    

    注意:不要替换前一个已发布的接口hash值。如果修改的化,只需要在current.txt文件的末尾追加即可。
    每一个接口都可以通过调用IBase::getHashChain 获取对应的hash。

    hidl-gen在编译接口时,会在其对应的根目目录下检查current.txt:

    1. 没有找到,接口不发布,编译跳过
    2. Hash不匹配,编译终止,修改current.txt
      对于ABI允许的修改,可以修改current.txt。
      ABI不允许的修改,需要在接口的次版本号或主版本号更新中修改。

    ABI stability

    ABI: Application Binary Interface 。包含了二级制链接、函数调用约定等。如果ABI/API变化,那基于标准接口编译的system.img,可能无法使用该接口功能。
    接口版本化和ABI 稳定性是必要的:

    1. 通过VTS
    2. System 独立 OTA
    3. 作为OEM,提供一个容易使用和兼任的BSP版本
    4. 通过current.txt可以了解接口的发布历史记录

    当在current.txt为一个存在的接口添加一个新的hash时,为了确保ABI stability,需要审查下面的修改类型:

    对于已发布的接口,ABI stability列出了哪些修改允许哪些不允许,对于不允许的修改只能在接口的次版本号或主版本号更新中修改。

  • 相关阅读:
    expect脚本实例
    Linux dialog详解(图形化shell)
    makefile——小试牛刀
    gdb入门
    linux常见系统调用函数列表
    linux前后台任务的切换以及执行暂停
    centos 7.0 lnmp安装部署步骤
    环境列表
    setjmp与longjmp非局部跳转函数的使用
    malloc,calloc,alloca和free函数
  • 原文地址:https://www.cnblogs.com/bobfly1984/p/14409456.html
Copyright © 2011-2022 走看看