• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Update<a name="EN-US_TOPIC_0000001149909821"></a>
2
3-   [Introduction](#section184mcpsimp)
4-   [Directory Structure](#section212mcpsimp)
5-   [Repositories Involved](#section251mcpsimp)
6
7## Introduction<a name="section184mcpsimp"></a>
8
9The Update subsystem helps you implement over the air \(OTA\) update of OpenHarmony devices. The update subsystem consists of the following:
10
111.  Packaging tool
12
13    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.
14
15    The update package contains two files:  **build\_tools.zip**  and  **update.bin**.
16
17    -   **build\_tools.zip**: update assistance tools, including the executable files and scripts.
18    -   **update.bin**: TLV-encoded file, in which update contents are serialized and stored in the TLV format.
19
20    The packaging tool signs the  **update.bin**  file and the generated update package \(**.zip**  file\) independently.
21
222.  Update service
23
24    The update service is used to search, download, and trigger updates.
25
263.  Updater
27
28    The updater is the core module of the update subsystem. It provides the following functions:
29
30    1.  Obtains update commands from the misc partition and executes different tasks depending on the commands.
31    2.  Decompresses the update package and verifies its validity.
32    3.  Starts the update process and parses the update script.
33    4.  Installs the related component packages based on the update script.
34    5.  Performs post-processing after the update is complete, for example, deleting the update package and recording the update status.
35
364.  Update app
37
38    The upgrade app is used to trigger search and download of update packages.
39
40
41Before you get started, familiarize yourself with the following concepts:
42
43-   OTA
44
45    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.
46
47-   Full package
48
49    A full package is actually a complete image. The update subsystem writes the full package to a partition to update this partition.
50
51-   Differential package
52
53    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.
54
55
56## Directory Structure<a name="section212mcpsimp"></a>
57
58```
59base/update             # Update subsystem repository
60├── app         		# Update app code
61├── packaging_tools     # Packaging tool code
62├── updater    			# Updater code
63│   ├── interfaces  	# External APIs
64│   ├── resources 		# UI image resources of the update subsystem, such as animations and progress bar images
65│   ├── services  		# Updater logic code
66│   └── utils  			# Common code of the update subsystem, including the string processing functions and file processing functions
67└── updateservice 		# Update service code
68```
69
70## Repositories Involved<a name="section251mcpsimp"></a>
71
72**Update subsystem**
73
74update\_app
75
76update\_updateservice
77
78update\_updater
79
80update\_packaging\_tools
81
82