Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erfanoabdi/imgpatchtools
Patch img files with system.patch.dat, like OTA zip on PC
https://github.com/erfanoabdi/imgpatchtools
Last synced: 3 days ago
JSON representation
Patch img files with system.patch.dat, like OTA zip on PC
- Host: GitHub
- URL: https://github.com/erfanoabdi/imgpatchtools
- Owner: erfanoabdi
- License: gpl-3.0
- Created: 2017-07-21T05:44:47.000Z (over 7 years ago)
- Default Branch: Stable
- Last Pushed: 2023-10-12T11:41:46.000Z (about 1 year ago)
- Last Synced: 2024-12-12T12:45:33.725Z (10 days ago)
- Language: C++
- Homepage:
- Size: 1.23 MB
- Stars: 174
- Watchers: 21
- Forks: 51
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# IMG Patch Tools
Patch image (.img) using sparse Android data image (.dat) in OTA zip with "BlockImageUpdate"
Patch other files (boot.img, firmwares) using patch file (.p) with "ApplyPatchfn"## Downloads
[Github Release](https://github.com/erfanoabdi/imgpatchtools/releases)## Requirements
For Building this tool you need :* zlib
* libbz2
* opensslIt currently supports Linux x86/x64 & MacOS, Not tested on Windows.
## Usage
```
usage: ./BlockImageUpdate
```
args:
- `` = block device (or file) to modify in-place
- `` = transfer list (blob) from OTA/rom zip
- `` = new data stream from OTA/rom zip
- `` = patch stream from OTA/rom zip```
./ApplyPatchfn [init_sha1(2)] [patch(2)]...
```
- `` = source file from rom zip
- `` = target file (use "-" to patch source file)
- `` = target SHA1 Sum after patching
- `` = file size
- `` = file SHA1 sum
- `` = patch file (.p) from OTA zip```
usage: ./scriptpatcher.sh
```
args:
- `` = updater-script from OTA zip to patch recovery commands## Example
for example from updater-script of OTA we have:
```
block_image_update("/dev/block/bootdevice/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat")apply_patch("EMMC:/dev/block/bootdevice/by-name/boot:33554432:f32a854298814c18b12d56412f6e3a31afc95e42:33554432:0041a4df844d4b14c0085921d84572f48cc79ff4",
"-", 0041a4df844d4b14c0085921d84572f48cc79ff4, 33554432,
f32a854298814c18b12d56412f6e3a31afc95e42,
package_extract_file("patch/boot.img.p"))
```
after getting system.img and boot.img from firmware
This is equals of previous functions on PC with this tools:
```
~$ ./BlockImageUpdate system.img system.transfer.list system.new.dat system.patch.dat
~$ ./ApplyPatchfn boot.img - 0041a4df844d4b14c0085921d84572f48cc79ff4 33554432 f32a854298814c18b12d56412f6e3a31afc95e42
```
scriptpatcher.sh will generate all commands automatically from updater script so run it like:
```
~$ ./scriptpatcher.sh META-INF/com/google/android/updater-script > fullpatch.sh
```
check fullpatch.sh your self, you need to provide all images and files in correct name and patch as mentioned in mount and other commands of fullpatch.sh### Youtube
[![IMG Patch Tools](https://img.youtube.com/vi/GjPoPe7IgHg/0.jpg)](https://www.youtube.com/watch?v=GjPoPe7IgHg "IMG Patch Tools")## Info
For more information about this tools, visit https://forum.xda-developers.com/android/software-hacking/dev-img-patch-tools-sdat2img-ota-zips-t3640308.