update.md 3.4 KB
Newer Older
M
mamingshuai 已提交
1
# Update<a name="EN-US_TOPIC_0000001149909821"></a>
L
liudongmiao 已提交
2

M
mamingshuai 已提交
3
## Introduction<a name="section184mcpsimp"></a>
L
liudongmiao 已提交
4

M
mamingshuai 已提交
5
The Update subsystem helps you implement over the air \(OTA\) update of OpenHarmony devices. The update subsystem consists of the following:
L
liudongmiao 已提交
6

M
mamingshuai 已提交
7
1.  Packaging tool
L
liudongmiao 已提交
8

M
mamingshuai 已提交
9
    The packaging tool is developed using Python and deployed on the PC to prepare update packages. It packages each update image, signs the update package, generates the update package execution script, and finally creates an update package. After the execution script is run on a OpenHarmony device, the device parses and executes the script to complete the update process.
L
liudongmiao 已提交
10

M
mamingshuai 已提交
11 12 13 14 15 16 17 18 19 20
    The update package contains two files:  **build\_tools.zip**  and  **update.bin**.

    -   **build\_tools.zip**: update assistance tools, including the executable files and scripts.
    -   **update.bin**: TLV-encoded file, in which update contents are serialized and stored in the TLV format.

    The packaging tool signs the  **update.bin**  file and the generated update package \(**.zip**  file\) independently.

2.  Update service

    The update service is used to search, download, and trigger updates.
L
liudongmiao 已提交
21

M
mamingshuai 已提交
22
3.  Updater
L
liudongmiao 已提交
23

M
mamingshuai 已提交
24
    The updater is the core module of the update subsystem. It provides the following functions:
L
liudongmiao 已提交
25

M
mamingshuai 已提交
26 27 28 29 30
    1.  Obtains update commands from the misc partition and executes different tasks depending on the commands.
    2.  Decompresses the update package and verifies its validity.
    3.  Starts the update process and parses the update script.
    4.  Installs the related component packages based on the update script.
    5.  Performs post-processing after the update is complete, for example, deleting the update package and recording the update status.
L
liudongmiao 已提交
31

M
mamingshuai 已提交
32
4.  Update app
L
liudongmiao 已提交
33

M
mamingshuai 已提交
34
    The upgrade app is used to trigger search and download of update packages.
L
liudongmiao 已提交
35 36


M
mamingshuai 已提交
37
Before you get started, familiarize yourself with the following concepts:
L
liudongmiao 已提交
38

M
mamingshuai 已提交
39
-   OTA
L
liudongmiao 已提交
40

M
mamingshuai 已提交
41
    OTA is an implementation of update over a wireless connection. The update package is downloaded to the device through a wireless connection. The device then performs update through the update subsystem.
L
liudongmiao 已提交
42

M
mamingshuai 已提交
43
-   Full package
L
liudongmiao 已提交
44

M
mamingshuai 已提交
45
    A full package is actually a complete image. The update subsystem writes the full package to a partition to update this partition.
L
liudongmiao 已提交
46

M
mamingshuai 已提交
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
-   Differential package

    A differential package is created based on the difference data of two specific versions \(source version and target version\), which is generated by using bsdiff.


## Directory Structure<a name="section212mcpsimp"></a>

```
base/update             # Update subsystem repository
├── app         		# Update app code
├── packaging_tools     # Packaging tool code
├── updater    			# Updater code
│   ├── interfaces  	# External APIs
│   ├── resources 		# UI image resources of the update subsystem, such as animations and progress bar images
│   ├── services  		# Updater logic code
│   └── utils  			# Common code of the update subsystem, including the string processing functions and file processing functions
└── updateservice 		# Update service code
```
L
liudongmiao 已提交
65

M
mamingshuai 已提交
66
## Repositories Involved<a name="section251mcpsimp"></a>
L
liudongmiao 已提交
67

M
mamingshuai 已提交
68
**Update subsystem**
L
liudongmiao 已提交
69

S
shawn_he 已提交
70
[update\_app](https://gitee.com/openharmony/update_app)
L
liudongmiao 已提交
71

S
shawn_he 已提交
72
[update\_updateservice](https://gitee.com/openharmony/update_updateservice)
L
liudongmiao 已提交
73

S
shawn_he 已提交
74
[update\_updater](https://gitee.com/openharmony/update_updater)
L
liudongmiao 已提交
75

S
shawn_he 已提交
76
[update\_packaging\_tools](https://gitee.com/openharmony/update_packaging_tools)
L
liudongmiao 已提交
77