• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# OTA组件<a name="ZH-CN_TOPIC_0000001078451366"></a>
2
3-   [简介](#section11660541593)
4-   [目录](#section1464106163817)
5-   [约束](#section1718733212019)
6-   [使用](#section18867101215181)
7-   [相关仓](#section68521336131912)
8
9## 简介<a name="section11660541593"></a>
10
11OTA(Over the Air)提供对设备远程升级能力,基于提供的接口进行二次开发后,可以让您的设备轻松支持OTA升级能力。升级子系统对用户屏蔽了底层芯片的差异,对外提供了统一的升级接口。
12
13## 目录<a name="section1464106163817"></a>
14
15```
16/base/update/ota_lite
17├── frameworks        # OTA升级实现,主要包括升级包解析验证、写入、升级的功能
18│   └── test          # 自测试代码存放目录
19│   └── unittest      # 单元测试代码存放目录
20│   └── source        # updater组件代码存放目录
21│       └── updater   # updater组件代码目录
22│       └── verify    # 效验算法代码目录
23├── interfaces
24│   └── kits          # OTA升级接口,对外接口存放目录
25├── hals              # 芯片适配层,比如实现海思芯片实现位于device\hisilicon\hardware\update
26```
27
28## 约束<a name="section1718733212019"></a>
29
30升级子系统使用C语言编写,目前支持Hi3518EV300、Hi3516DV300、Hi3861开发板。如果您想接入其它芯片,通过实现vendor路径下的OpenHarmony集成接口,可以适配不同芯片的产品。目前仅支持全量包升级方式。
31
32## 使用<a name="section18867101215181"></a>
33
34添加对升级子系统的依赖,以hi3516dv300开发板为例。
35
36-   vendor\\hisilicon\\ipcamera\_hi3516dv300\_liteos\\config.json中添加update,在subsystem\_list字段下面添加:
37
38    ```
39    {
40            "subsystem": "update",
41            "components": [
42              { "component": "hota", "features": [] }
43            ]
44     },
45    ```
46
47
48-   在build\\lite\\components下,添加update.json文件:
49
50    ```
51    "components": [
52        {
53          "component": "hota",
54          "description": "",
55          "optional": "false",
56          "dirs": [
57            "base/update/ota_lite/frameworks",
58            "base/update/ota_lite/interfaces/kits"
59          ],
60          "targets": [
61            "//base/update/ota_lite/frameworks:ota_lite"
62          ],
63      ......
64    ```
65
66
67-   添加测试代码,这里以test为例,将subsystem\_test加入到base\\update\\ota\_lite\\frameworks\\BUILD.gn中。
68
69-   添加完上述的配置后,执行如下命令编译整个系统,烧录到3516芯片平台上即可体验OTA功能。
70
71    ```
72    hb set
73    hb build
74    ```
75
76
77## 相关仓<a name="section68521336131912"></a>
78
79[升级服务子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E5%8D%87%E7%BA%A7%E6%9C%8D%E5%8A%A1%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
80
81**update\_ota\_lite**
82
83[device\_hisilicon\_hardware](https://gitee.com/openharmony/device_hisilicon_hardware)
84
85