A Python library/script to automatically generate TWRP-compatible device tree from a boot/recovery image
Project description
TWRP device tree generator
Create a TWRP-compatible device tree only from an Android recovery image (or a boot image if the device uses non-dynamic partitions A/B) of your device's stock ROM It has been confirmed that this script supports images built starting from Android 4.4 up to Android 12
Installation
pip3 install twrpdtgen
The module is supported on Python 3.9 and above.
Linux only: Be sure to have cpio installed in your system (Install cpio using sudo apt install cpio
or sudo pacman -S cpio
based on what package manager you're using)
How to use
$ python3 -m twrpdtgen -h
TWRP device tree generator
Version 2.2.0
usage: python3 -m twrpdtgen [-h] [-o OUTPUT] [--git] [-d] image
positional arguments:
image path to an image (recovery image or boot image if the
device is A/B)
optional arguments:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
custom output folder
--git create a git repo after the generation
-d, --debug enable debugging features
When an image is provided, if everything goes well, there will be a device tree at output/manufacturer/codename
You can also use the module in a script, with the following code:
from twrpdtgen.devicetree import DeviceTree
# Get image info
devicetree = DeviceTree(image_path)
# Dump device tree to folder
devicetree.dump_to_folder(output_path)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for twrpdtgen-2.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e134271ac8afb7b6088f00b8c95460532ca81a2272de0429cf1d9ae6a3b6037 |
|
MD5 | 3c1bef5e44c6bb97073d0d7dafa3add6 |
|
BLAKE2b-256 | eac99af9a07f780a23ec4aa567ff8dd602302f50d0a748520104e7b12dca229e |