| Crates.io | payload_packer |
| lib.rs | payload_packer |
| version | 0.1.1 |
| created_at | 2025-05-17 03:11:49.182878+00 |
| updated_at | 2025-12-26 16:30:16.103648+00 |
| description | A standalone tool for generating full and incremental Android OTA payloads for A/B devices. |
| homepage | https://github.com/rhythmcache/payload_packer |
| repository | https://github.com/rhythmcache/payload_packer |
| max_upload_size | |
| id | 1677624 |
| size | 143,006 |
A standalone tool for generating full and incremental Android OTA payloads for A/B devices.
This is an experimental tool. The official Google delta generator may use different methods and optimisations. Use this tool at your own risk for development and testing purposes.The payloads generated by this tool have not yet been tested on real devices. However, third-party payload dumpers are able to correctly interpret and extract payloads created by this tool.
For an end-to-end proof of concept and validation tests for both full and incremental OTAs, see the tests/ directory.
Generate full OTA payloads from partition images
Generate incremental (delta) OTA payloads between two versions
You can install it using one of the following methods:
cargo install payload_packer
From prebuilt binaries: Download the appropriate binary for your platform from the Releases page
Build from source:
git clone https://github.com/rhythmcache/payload_packer.git
cd payload_packer
cargo build --release
A full payload contains complete partition data and can be installed on any device running the same Android version.
./payload_packer --target-dir /path/to/new/images --output payload.bin
Example with specific partitions:
./payload_packer \
--target-dir /path/to/new/images \
--partitions system,vendor,boot \
--method xz \
--level 5 \
--output payload.bin
An incremental payload contains only the differences between two versions, resulting in smaller file sizes.
./payload_packer \
--delta \
--source-dir /path/to/old/images \
--target-dir /path/to/new/images \
--output delta_payload.bin
Example with compression settings:
./payload_packer \
--delta \
--source-dir /path/to/old/images \
--target-dir /path/to/new/images \
--partitions system,vendor,product \
--method xz \
--level 9 \
--chunk-size 4194304 \
--output incremental_payload.bin
Instead of specifying directories, you can provide individual image files:
./payload_packer \
--target-image /path/to/system.img \
--target-image /path/to/vendor.img \
--target-image /path/to/boot.img \
--output payload.bin
Payload generation is a CPU- and I/O-intensive process.
For large partition images (multiple gigabytes), generating full or incremental payloads can take a significant amount of time depending on image size, storage speed, compression method, and system resources.
Please be patient while the payload is being generated, especially when using high compression levels or processing large images.
| Option | Description |
|---|---|
-o, --output |
Path to output payload.bin file (default: output/payload.bin) |
-t, --target-dir |
Directory containing target (new) .img files |
--target-image |
Individual target image file (can be used multiple times) |
--delta |
Generate incremental payload instead of full payload |
-s, --source-dir |
Directory containing source (old) .img files (required for delta) |
--source-image |
Individual source image file (can be used multiple times) |
-p, --partitions |
Comma-separated list of partitions to include |
-m, --method |
Compression method: xz, zstd, or bz2 (default: xz) |
-l, --level |
Compression level (xz: 0-9, zstd: 1-22, bz2: 1-9) |
--threads |
Number of threads for parallel processing |
-b, --block-size |
Block size in bytes (default: 4096) |
-c, --chunk-size |
Target chunk size per operation in bytes (default: 2097152) |
--skip-properties |
Skip creation of payload_properties.txt file |
--mmap-threshold |
File size threshold for using memory mapping (default: 400MB) |
Full payloads contain complete partition data:
Incremental payloads contain only the differences between source and target versions:
The incremental approach significantly reduces payload size for updates where most partitions remain unchanged or have minor modifications.
payload.bin: The main OTA payload filepayload_properties.txt: Contains metadata including file hash, size, and manifest hash (unless --skip-properties is used)Licensed under the Apache License, Version 2.0. See LICENSE for details.
Contributions are welcome.