• Home
Name Date Size #Lines LOC

..--

lib/12-May-2024-

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-20243.5 KiB8659

blocks_manager.pyD12-May-20247.6 KiB230196

build_update.pyD12-May-202428.9 KiB741656

code_yacc.pyD12-May-20241.4 KiB3919

gigraph_process.pyD12-May-20246.5 KiB188145

image_class.pyD12-May-202418.7 KiB463393

log_exception.pyD12-May-20243.8 KiB11583

patch_package_process.pyD12-May-202424.6 KiB582511

script_generator.pyD12-May-202414.5 KiB418336

transfers_manager.pyD12-May-20245.8 KiB159124

update_package.pyD12-May-202421.1 KiB545473

utils.pyD12-May-202422.3 KiB625502

vendor_script.pyD12-May-20243.6 KiB10170

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-   [说明](#section211mcpsimp)
6-   [相关仓](#section247mcpsimp)
7
8## 简介<a name="section184mcpsimp"></a>
9
10升级包制作工具是用于制作升级包的工具,功能主要包括:全量升级包制作、差分升级包制作以及变分区升级包制作。
11
12- 全量升级包制作:升级包中只包括镜像全量升级相关数据,用于镜像全量升级;
13
14- 差分升级包制作:升级包中只包括镜像差分升级相关数据,用于镜像差分升级;
15
16- 变分区升级包:升级包中包括分区表、镜像全量数据,用于变分区处理和变分区后的镜像恢复。
17
18## 目录<a name="section191mcpsimp"></a>
19
20```
21/base/update/packaging_tools
22├── lib                         # 制作升级包工具依赖库目录
23├── blocks_manager.py           # BlocksManager类定义,用于block块管理
24├── build_update.py             # 差分包制作工具入口代码,入口参数定义
25├── gigraph_process.py          # 生成Stash,重置ActionList的顺序
26├── image_class.py              # 全量镜像、稀疏镜像解析处理
27├── log_exception.py            # 全局log系统定义,自定义exception
28├── patch_package_process.py    # 差分镜像处理,Block差分获取patch差异
29├── script_generator.py         # 升级脚本生成器
30├── transfers_manager.py        # 创建ActionInfo对象
31├── update_package.py           # 升级包格式管理、升级包写入
32├── utils.py                    # Options管理,其他相关功能函数定义
33└── vendor_script.py            # 厂商升级流程脚本扩展
34```
35
36## 说明<a name="section211mcpsimp"></a>
37
38工具运行环境配置:
39
40- Ubuntu18.04或更高版本系统;
41
42- python3.5及以上版本;
43
44- python库xmltodict, 解析xml文件,需要单独安装;
45
46- bsdiff可执行程序,差分计算,比较生成patch;
47
48- imgdiff可执行程序,差分计算,针对zip、gz、lz4类型的文件,对比生成patch;
49
50- e2fsdroid可执行程序,差分计算,用于生成镜像的map文件。
51
52工具参数配置说明:
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, Output update package without zip.
62-pf PARTITION_FILE, --partition_file PARTITION_FILE       Variable partition mode, Partition list file path.
63-sa {ECC,RSA}, --signing_algorithm {ECC,RSA}              The signing algorithm supported by the tool include['ECC', 'RSA'].
64-ha {sha256,sha384}, --hash_algorithm {sha256,sha384}     The hash algorithm  supported by the tool include ['sha256', 'sha384'].
65-pk PRIVATE_KEY, --private_key PRIVATE_KEY                Private key file path.
66```
67
68全量升级包制作命令示例:
69
70```
71python build_update.py ./target/ ./target/package -pk ./target/updater_config/rsa_private_key2048.pem
72```
73
74差分升级包制作命令示例:
75
76```
77python build_update.py -s source.zip ./target/ ./target/package -pk./target/updater_config/rsa_private_key2048.pem
78```
79
80## 相关仓<a name="section247mcpsimp"></a>
81
82升级子系统
83
84**update\_packaging\_tools**
85
86