使用 system.patch.dat 修补 img 文件,类似 PC 上的 OTA zip
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"
For Building this tool you need :
It currently supports Linux x86/x64 & MacOS, Not tested on Windows.
usage: ./BlockImageUpdate args:
./ApplyPatchfn [init_sha1(2)] [patch(2)]...usage: ./scriptpatcher.sh args:
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 f32a854298814c18b12d56412f6e3a31afc95e42scriptpatcher.sh will generate all commands automatically from updater script so run it like:
~$ ./scriptpatcher.sh META-INF/com/google/android/updater-script > fullpatch.shcheck 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
For more information about this tools, visit https://forum.xda-developers.com/android/software-hacking/dev-img-patch-tools-sdat2img-ota-zips-t3640308.
暂无开放 Issues,或尚未同步最近议题。