README.md
1# OTA<a name="EN-US_TOPIC_0000001078451366"></a>
2
3- [Introduction](#section11660541593)
4- [Directory Structure](#section1464106163817)
5- [Constraints](#section1718733212019)
6- [Usage](#section18867101215181)
7- [Repositories Involved](#section68521336131912)
8
9## Introduction<a name="section11660541593"></a>
10
11Over the Air \(OTA\) provides the remote device update capability. Your devices will be able to support OTA update after secondary development based on the provided APIs. By providing unified update APIs externally, the update subsystem shields the differences of underlying chips.
12
13## Directory Structure<a name="section1464106163817"></a>
14
15```
16/base/update/sys_installer_lite
17.
18├── frameworks # OTA update implementation, including update package parsing, verification, writing, and updating
19│ ├── source # updater module source code
20│ │ ├── updater # updater module code
21│ │ └── verify # Verification algorithm code
22│ └── test # Self-test code
23│ └── unittest # Unit test code
24├── hals # Chip adaptation code
25└── interfaces # External APIs
26 └── kits # OTA update APIs
27```
28
29## Constraints<a name="section1718733212019"></a>
30
31The update subsystem is compiled using the C language. Currently, only the Hi3518EV300, Hi3516DV300, and Hi3861 development boards are supported. If you want to support devices that use other chips, you can implement the OpenHarmony integration APIs in the **vendor** directory. Currently, only the full-package update is supported.
32
33## Usage<a name="section18867101215181"></a>
34
35Add the dependency on the update subsystem. The following uses the Hi3516D V300 development board as an example.
36
37- Add **update** to the **subsystem\_list field in the vendor\\hisilicon\\ipcamera\_hi3516dv300\_liteos\\config.json** file, and add the following code under **subsystem\_list**:
38
39 ```
40 {
41 "subsystem": "update",
42 "components": [
43 { "component": "hota", "features": [] }
44 ]
45 },
46 ```
47
48
49- Add the **update.json** file to the **build\\lite\\components** directory.
50
51 ```
52 "components": [
53 {
54 "component": "hota",
55 "description": "",
56 "optional": "false",
57 "dirs": [
58 "base/update/sys_installer_lite/frameworks",
59 "base/update/sys_installer_lite/interfaces/kits"
60 ],
61 "targets": [
62 "//base/update/sys_installer_lite/frameworks:sys_installer_lite"
63 ],
64 ...
65 ```
66
67
68- Add test code. For example, add **subsystem\_test** to the **base\\update\\ota\_lite\\frameworks\\BUILD.gn** file.
69
70- Run the following commands to compile the system. You can experience the OTA update function after flashing the system to the Hi3516 chip.
71
72 ```
73 hb set
74 hb build
75 ```
76
77
78## Repositories Involved<a name="section68521336131912"></a>
79
80[Update subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/update.md)
81
82**update\_ota\_lite**
83
84[device\_hisilicon\_hardware](https://gitee.com/openharmony/device_hisilicon_hardware/blob/master/README.md)
85
86