• Home
Name Date Size #Lines LOC

..--

test/12-May-2024-1,6421,301

.gitattributesD12-May-2024631 1615

LICENSED12-May-20249.9 KiB177150

OAT.xmlD12-May-20245 KiB7816

README.mdD12-May-20243.8 KiB8659

README_zh.mdD12-May-20244.1 KiB9867

blocks_manager.pyD12-May-20247.6 KiB230196

build_pkcs7.pyD12-May-20246.8 KiB220154

build_update.pyD12-May-202434.9 KiB917797

code_yacc.pyD12-May-20241.4 KiB3919

create_update_package.pyD12-May-202412.1 KiB312256

gigraph_process.pyD12-May-20246.4 KiB188145

image_class.pyD12-May-202415.8 KiB388333

log_exception.pyD12-May-20243.8 KiB11583

patch_package_process.pyD12-May-202423.5 KiB554482

script_generator.pyD12-May-202415.3 KiB438354

transfers_manager.pyD12-May-20245.8 KiB159124

unpack_updater_package.pyD12-May-20247.1 KiB186146

update_package.pyD12-May-202418.8 KiB496420

utils.pyD12-May-202423.4 KiB654529

vendor_script.pyD12-May-20243.6 KiB10270

README.md

1# Packaging Tool<a name="EN-US_TOPIC_0000001101934690"></a>
2
3-   [Introduction](#section184mcpsimp)
4-   [Directory Structure](#section191mcpsimp)
5-   [Description](#section211mcpsimp)
6-   [Repositories Involved](#section247mcpsimp)
7
8## Introduction<a name="section184mcpsimp"></a>
9
10The packaging tool is used to prepare an update package. It provides the following functions:
11
12- Creating a full update package: The update package contains only the data necessary for full image update.
13
14- Creating a differential update package: The update package contains only the data necessary for differential image update.
15
16- Creating an update package with changeable partitions: The update package contains the partition table and full image data, which are used for partition change processing and image restoration after partition change.
17
18## Directory Structure<a name="section191mcpsimp"></a>
19
20```
21/base/update/packaging_tools
22├── lib                         # Dependency libraries of the packaging tool.
23├── blocks_manager.py           # BlocksManager class for block management
24├── build_update.py             # Access to the packaging tool for differential update packages
25├── gigraph_process.py          # Stash for re-sorting the ActionList
26├── image_class.py              # Full image and sparse image parsing
27├── log_exception.py            # Global log system with custom exceptions
28├── patch_package_process.py    # Differential image processing for obtaining patch difference through differential calculation on blocks
29├── script_generator.py         # Update script generator
30├── transfers_manager.py        # ActionInfo object creation
31├── update_package.py           # Update package format management and update package writing
32├── utils.py                    # Options management and related functions
33└── vendor_script.py            # Extended update scripts
34```
35
36## Description<a name="section211mcpsimp"></a>
37
38Running environment:
39
40- Ubuntu 18.04 or later
41
42- Python 3.5 or later
43
44- Python library xmltodict, which is used to parse XML files and needs to be installed independently.
45
46- bsdiff executable program, which performs differential calculation to generate the patch package
47
48- imgdiff executable program, which performs differential calculation on the zip, gz, and lz4 files to generate the patch package
49
50- e2fsdroid executable program, which performs differential calculation to generate the map files of an image
51
52Parameter configuration:
53
54```
55Positional arguments:
56target_package         Target package file path.
57update_package        Update package file path.
58Optional arguments:
59-h, --help                                                Show this help message and exit.
60-s SOURCE_PACKAGE, --source_package SOURCE_PACKAGE        Source package file path.
61-nz, --no_zip                                             No zip mode, which means to output update package without zip.
62-pf PARTITION_FILE, --partition_file PARTITION_FILE       Variable partition mode, which means to partition list file path.
63-sa {ECC,RSA}, --signing_algorithm {ECC,RSA}              Signing algorithms supported by the tool, including ECC and RSA.
64-ha {sha256,sha384}, --hash_algorithm {sha256,sha384}     Hash algorithms supported by the tool, including sha256 and sha384.
65-pk PRIVATE_KEY, --private_key PRIVATE_KEY                Private key file path.
66```
67
68Example code for creating a full update package:
69
70```
71python build_update.py ./target/ ./target/package -pk ./target/updater_config/rsa_private_key2048.pem
72```
73
74Example code for creating a differential update package:
75
76```
77python build_update.py -s source.zip ./target/ ./target/package -pk./target/updater_config/rsa_private_key2048.pem
78```
79
80## Repositories Involved<a name="section247mcpsimp"></a>
81
82Update subsystem
83
84**update\_packaging\_tools**
85
86

README_zh.md

1# 升级包制作工具<a name="ZH-CN_TOPIC_0000001101934690"></a>
2
3-   [简介](#section184mcpsimp)
4-   [目录](#section191mcpsimp)
5-   [约束](#section120mcpsimp)
6-   [说明](#section211mcpsimp)
7    -   [使用说明](#section220mcpsimp)
8
9-   [相关仓](#section247mcpsimp)
10
11## 简介<a name="section184mcpsimp"></a>
12
13升级包制作工具是用于制作升级包的工具,功能主要包括:全量升级包制作、差分升级包制作以及变分区升级包制作。
14
15- 全量升级包制作:升级包中只包括镜像全量升级相关数据,用于镜像全量升级;
16
17- 差分升级包制作:升级包中只包括镜像差分升级相关数据,用于镜像差分升级;
18
19- 变分区升级包:升级包中包括分区表、镜像全量数据,用于变分区处理和变分区后的镜像恢复。
20
21更多升级子系统相关概念,请参考:[升级子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E5%8D%87%E7%BA%A7%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
22
23## 目录<a name="section191mcpsimp"></a>
24
25```
26/base/update/packaging_tools
27├── lib                         # 制作升级包工具依赖库目录
28├── blocks_manager.py           # BlocksManager类定义,用于block块管理
29├── build_update.py             # 差分包制作工具入口代码,入口参数定义
30├── build_pkcs7.py              # 升级包签名
31├── create_update_package.py    # 升级包制作
32├── gigraph_process.py          # 生成Stash,重置ActionList的顺序
33├── image_class.py              # 全量镜像、稀疏镜像解析处理
34├── log_exception.py            # 全局log系统定义,自定义exception
35├── patch_package_process.py    # 差分镜像处理,Block差分获取patch差异
36├── script_generator.py         # 升级脚本生成器
37├── transfers_manager.py        # 创建ActionInfo对象
38├── unpack_update_package.py    # 升级包反解
39├── update_package.py           # 升级包格式管理、升级包写入
40├── utils.py                    # Options管理,其他相关功能函数定义
41└── vendor_script.py            # 厂商升级流程脚本扩展
42```
43
44## 约束<a name="section120mcpsimp"></a>
45
46工具运行环境配置:
47
48- Ubuntu18.04或更高版本系统;
49
50- python3.5及以上版本;
51
52- python库xmltodict, 解析xml文件,需要单独安装;
53
54## 说明<a name="section211mcpsimp"></a>
55
56### 使用说明<a name="section220mcpsimp"></a>
57
58- bsdiff可执行程序,差分计算,比较生成patch;
59
60- imgdiff可执行程序,差分计算,针对zip、gz、lz4类型的文件,对比生成patch;
61
62- e2fsdroid可执行程序,差分计算,用于生成镜像的map文件。
63
64工具参数配置说明:
65
66```
67positional arguments:
68target_package         Target package file path.
69update_package        Update package file path.
70optional arguments:
71-h, --help                                                show this help message and exit
72-s SOURCE_PACKAGE, --source_package SOURCE_PACKAGE        Source package file path.
73-nz, --no_zip                                             No zip mode, Output update package without zip.
74-pf PARTITION_FILE, --partition_file PARTITION_FILE       Variable partition mode, Partition list file path.
75-sa {ECC,RSA}, --signing_algorithm {ECC,RSA}              The signing algorithm supported by the tool include['ECC', 'RSA'].
76-ha {sha256,sha384}, --hash_algorithm {sha256,sha384}     The hash algorithm  supported by the tool include ['sha256', 'sha384'].
77-pk PRIVATE_KEY, --private_key PRIVATE_KEY                Private key file path.
78```
79
80全量升级包制作命令示例:
81
82```
83python build_update.py ./target/ ./target/package -pk ./target/updater_config/rsa_private_key2048.pem
84```
85
86差分升级包制作命令示例:
87
88```
89python build_update.py -s source.zip ./target/ ./target/package -pk./target/updater_config/rsa_private_key2048.pem
90```
91
92## 相关仓<a name="section247mcpsimp"></a>
93
94[升级子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E5%8D%87%E7%BA%A7%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
95
96[**update\_packaging\_tools**](https://gitee.com/openharmony/update_packaging_tools)
97
98