1 Star 0 Fork 243

yangfan / update_updater

forked from OpenHarmony / update_updater 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 4.12 KB
一键复制 编辑 原始数据 按行查看 历史
Mr_YX 提交于 2022-05-09 18:31 . update

Updater

Introduction

The updater runs in the updater partition. It reads the misc partition information to obtain the update package status and verifies the update package to ensure that the update package is valid. Then, the updater parses the executable program from the update package, creates a subprocess, and starts the update program. After that, update operations will be automatically implemented by the update script.

Directory Structure

base/update/updater/
├── resources           # UI image resources of the update subsystem
├── services            # Service code of the updater
│   ├── applypatch      # Update package data update code
│   ├── fs_manager      # File system and partition management code
│   ├── include         # Header files for the update subsystem
│   ├── log             # Log module of the update subsystem
│   ├── package         # Update packages
│   ├── script          # Update scripts
│   ├── diffpatch       # Differential package restore code
│   ├── sparse_image    # Sparse image parsing code
│   ├── ui              # UI code
│   └── updater_binary  # Executable programs
├── interfaces
│   └── kits            # External APIs
└── utils               # Common utilities of the update subsystem
    └── include         # Header files for general functions of the update subsystem

Usage

Usage Guidelines

The updater runs in the updater partition. To ensure proper functioning of the updater, perform the following operations:

  1. Create a updater partition.

The updater partition is independent of other partitions. It is recommended that the size of the updater partition be greater than or equal to 20 MB. The updater partition image is an ext4 file system. Ensure that the config option of the ext4 file system in the system kernel is enabled.

  1. Create the misc partition.

The misc partition stores metadata required by the update subsystem during the update process. Such data includes update commands and records of resumable data transfer upon power-off. This partition is a raw partition and its size is about 1 MB. You do not need to create a file system for the misc partition, because the update subsystem can directly access this partition.

  1. Prepare the partition configuration table.

During the update process, the updater needs to operate the partitions through the partition configuration table. The default file name of the partition configuration table is fstab.updater. You need to pack the fstab.updater file into the updater during compilation.

  1. Start the updater.

The init process in the updater partition has an independent configuration file named init.cfg. The startup configuration of the updater is stored in this file.

  1. Compile the updater.

a. Add the updater configurations to the build/subsystem_config.json file.

Example configuration:

"updater": {
"project": "hmf/updater",
"path": "base/update/updater",
"name": "updater",
"dir": "base/update"
},

b. Add the updater for the desired product.

For example, to add the updater for Hi3516D V300, add the following code to the productdefine/common/products/Hi3516DV300.json file.

     "updater:updater":{},
  1. Compile the updater partition image.

Add the compilation configuration to the build_updater_image.sh script, which is stored in the build repository and called by the OpenHarmony compilation system.

Repositories Involved

Update subsystem

update_updater

build

productdefine_common

1
https://gitee.com/yang-fan_dev/update_updater.git
git@gitee.com:yang-fan_dev/update_updater.git
yang-fan_dev
update_updater
update_updater
master

搜索帮助