getprop("ro.product.device") == "urd" || abort("This package is for \"urd\" devices; this is a \"" + getprop("ro.product.device") + "\".");
assert(getprop("ro.product.name") == "P895T20_MPCS");
ui_print("Source: ZTE/P895T20_MPCS/urd:6.0.1/MMB29M/20160622.141326:user/release-keys");
ui_print("Target: ZTE/P895T20_MPCS/urd:6.0.1/MMB29M/20161030.150238:user/release-keys");
ui_print("Verifying current system...");
getprop("ro.build.fingerprint") == "ZTE/P895T20_MPCS/urd:6.0.1/MMB29M/20160622.141326:user/release-keys" ||
getprop("ro.build.fingerprint") == "ZTE/P895T20_MPCS/urd:6.0.1/MMB29M/20161030.150238:user/release-keys" ||
abort("Package expects build fingerprint of ZTE/P895T20_MPCS/urd:6.0.1/MMB29M/20160622.141326:user/release-keys or ZTE/P895T20_MPCS/urd:6.0.1/MMB29M/20161030.150238:user/release-keys; this device has " + getprop("ro.build.fingerprint") + ".");
show_progress(0.400000, 180);
apply_patch_check("EMMC:/dev/block/bootdevice/by-name/keymaster:177568:3ce6072b9916ed474b0894df8ca065bfdecf8f1e:177568:35f8381525ab8c92d575e17f181081b8a0067f44", "3ce6072b9916ed474b0894df8ca065bfdecf8f1e", "35f8381525ab8c92d575e17f181081b8a0067f44") || abort("\"EMMC:/dev/block/bootdevice/by-name/keymaster:177568:3ce6072b9916ed474b0894df8ca065bfdecf8f1e:177568:35f8381525ab8c92d575e17f181081b8a0067f44\" has unexpected contents.");
apply_patch_check("EMMC:/dev/block/bootdevice/by-name/fingerid:32852:068ac7141e4f542f152de1a73c2538261cf60ba6:32852:3b7cb8f151cffec7653fe829024e72744fdee033", "068ac7141e4f542f152de1a73c2538261cf60ba6", "3b7cb8f151cffec7653fe829024e72744fdee033") || abort("\"EMMC:/dev/block/bootdevice/by-name/fingerid:32852:068ac7141e4f542f152de1a73c2538261cf60ba6:32852:3b7cb8f151cffec7653fe829024e72744fdee033\" has unexpected contents.");
apply_patch_check("EMMC:/dev/block/bootdevice/by-name/rpm:166088:b401574da32636f9395ce3964eb1ba23fb5a0f5f:166088:9f41eb1cfad9b56a76617e079f6cd9bf44dfa8ec", "b401574da32636f9395ce3964eb1ba23fb5a0f5f", "9f41eb1cfad9b56a76617e079f6cd9bf44dfa8ec") || abort("\"EMMC:/dev/block/bootdevice/by-name/rpm:166088:b401574da32636f9395ce3964eb1ba23fb5a0f5f:166088:9f41eb1cfad9b56a76617e079f6cd9bf44dfa8ec\" has unexpected contents.");
apply_patch_check("EMMC:/dev/block/bootdevice/by-name/modem:76438016:de3acc0716a8053819b0bb50c02bb1da796da7a0:76585472:87747dc9371cc6503ac340fb55cf27a34b1dda36", "de3acc0716a8053819b0bb50c02bb1da796da7a0", "87747dc9371cc6503ac340fb55cf27a34b1dda36") || abort("\"EMMC:/dev/block/bootdevice/by-name/modem:76438016:de3acc0716a8053819b0bb50c02bb1da796da7a0:76585472:87747dc9371cc6503ac340fb55cf27a34b1dda36\" has unexpected contents.");
apply_patch_check("EMMC:/dev/block/bootdevice/by-name/tz:632644:fbcf8dbae397d91f6f4fc5d6f4160880d36ab43b:632644:07023648051d47bb91463bb3a562dd6a5c2a384c", "fbcf8dbae397d91f6f4fc5d6f4160880d36ab43b", "07023648051d47bb91463bb3a562dd6a5c2a384c") || abort("\"EMMC:/dev/block/bootdevice/by-name/tz:632644:fbcf8dbae397d91f6f4fc5d6f4160880d36ab43b:632644:07023648051d47bb91463bb3a562dd6a5c2a384c\" has unexpected contents.");
apply_patch_check("EMMC:/dev/block/bootdevice/by-name/hyp:73728:eeb375641b66b96dc0336d0abd78e0f8e9b22e95:73728:1c2079d70a233d6117685920aeb3e909362bfbab", "eeb375641b66b96dc0336d0abd78e0f8e9b22e95", "1c2079d70a233d6117685920aeb3e909362bfbab") || abort("\"EMMC:/dev/block/bootdevice/by-name/hyp:73728:eeb375641b66b96dc0336d0abd78e0f8e9b22e95:73728:1c2079d70a233d6117685920aeb3e909362bfbab\" has unexpected contents.");
apply_patch_check("EMMC:/dev/block/bootdevice/by-name/sbl1:321952:7bbc1a2d7fd68ef08c3c036dded254459e083453:322976:abf067334f85bb7854b7241e973e884fc3b7ce7f", "7bbc1a2d7fd68ef08c3c036dded254459e083453", "abf067334f85bb7854b7241e973e884fc3b7ce7f") || abort("\"EMMC:/dev/block/bootdevice/by-name/sbl1:321952:7bbc1a2d7fd68ef08c3c036dded254459e083453:322976:abf067334f85bb7854b7241e973e884fc3b7ce7f\" has unexpected contents.");
apply_patch_check("EMMC:/dev/block/bootdevice/by-name/aboot:891516:89f232cdc51a357933466f9e53b9c32e26e3c59b:902616:f689e5d837c772053fa3f9c344a521d8083b76e6", "89f232cdc51a357933466f9e53b9c32e26e3c59b", "f689e5d837c772053fa3f9c344a521d8083b76e6") || abort("\"EMMC:/dev/block/bootdevice/by-name/aboot:891516:89f232cdc51a357933466f9e53b9c32e26e3c59b:902616:f689e5d837c772053fa3f9c344a521d8083b76e6\" has unexpected contents.");
apply_patch_check("EMMC:/dev/block/bootdevice/by-name/boot:35087544:532a00dec3cd779ede9c48a935de00a860cbe953:35312824:60a0891fdb09b392cc85ae1541e08a72f87c166a", "532a00dec3cd779ede9c48a935de00a860cbe953", "60a0891fdb09b392cc85ae1541e08a72f87c166a") || abort("\"EMMC:/dev/block/bootdevice/by-name/boot:35087544:532a00dec3cd779ede9c48a935de00a860cbe953:35312824:60a0891fdb09b392cc85ae1541e08a72f87c166a\" has unexpected contents.");
apply_patch_check("EMMC:/dev/block/bootdevice/by-name/recovery:33338556:c8f1b92d125277898c5a6deca3a541b126d919c9:33561788:1ea424ce307870c3fdd1577b2bd36bd08cfc70c4", "c8f1b92d125277898c5a6deca3a541b126d919c9", "1ea424ce307870c3fdd1577b2bd36bd08cfc70c4") || abort("\"EMMC:/dev/block/bootdevice/by-name/recovery:33338556:c8f1b92d125277898c5a6deca3a541b126d919c9:33561788:1ea424ce307870c3fdd1577b2bd36bd08cfc70c4\" has unexpected contents.");
if (range_sha1("/dev/block/bootdevice/by-name/system", "98,1,32770,32961,32963,33471,65535,65536,65538,66046,98303,98304,98306,98497,98499,99007,131071,131072,131074,131582,163839,163840,163842,164033,164035,164543,196607,196608,196610,197118,229375,229376,229378,229569,229571,230079,262143,262144,262146,262654,294911,294912,294914,295105,295107,295615,327679,327680,327682,328190,360447,360448,360450,360958,393215,393216,393218,393726,425983,425984,425986,426494,458751,458752,458754,459262,491519,491520,491522,492030,524287,524288,524290,524798,557055,557056,557058,557566,589823,589824,589826,590334,622200,622592,622594,623102,633814,655360,655362,688128,688130,720896,720898,753664,753666,754174,780230,780231,786384") == "55e6914bdff2cb175d56aa068f1ed5927b6a25f1" || block_image_verify("/dev/block/bootdevice/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat")) then
ui_print("Verified system image...");
else
abort("system partition has unexpected contents");
endif;
# ---- start making changes here ----
ui_print("Patching system image after verification.");
show_progress(0.550000, 0);
block_image_update("/dev/block/bootdevice/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat") ||
abort("Failed to update system image.");
show_progress(0.050000, 10);
ui_print("Patching keymaster.mbn image...");
apply_patch("EMMC:/dev/block/bootdevice/by-name/keymaster:177568:3ce6072b9916ed474b0894df8ca065bfdecf8f1e:177568:35f8381525ab8c92d575e17f181081b8a0067f44",
"-", 35f8381525ab8c92d575e17f181081b8a0067f44, 177568,
3ce6072b9916ed474b0894df8ca065bfdecf8f1e, package_extract_file("patch/keymaster.mbn.p"));
ui_print("Patching fingerid.mbn image...");
apply_patch("EMMC:/dev/block/bootdevice/by-name/fingerid:32852:068ac7141e4f542f152de1a73c2538261cf60ba6:32852:3b7cb8f151cffec7653fe829024e72744fdee033",
"-", 3b7cb8f151cffec7653fe829024e72744fdee033, 32852,
068ac7141e4f542f152de1a73c2538261cf60ba6, package_extract_file("patch/fingerid.mbn.p"));
ui_print("Patching adspso.bin image...");
package_extract_file("adspso.bin", "/dev/block/bootdevice/by-name/dsp");
ui_print("Patching rpm.mbn image...");
apply_patch("EMMC:/dev/block/bootdevice/by-name/rpm:166088:b401574da32636f9395ce3964eb1ba23fb5a0f5f:166088:9f41eb1cfad9b56a76617e079f6cd9bf44dfa8ec",
"-", 9f41eb1cfad9b56a76617e079f6cd9bf44dfa8ec, 166088,
b401574da32636f9395ce3964eb1ba23fb5a0f5f, package_extract_file("patch/rpm.mbn.p"));
ui_print("Patching NON-HLOS.bin image...");
apply_patch("EMMC:/dev/block/bootdevice/by-name/modem:76438016:de3acc0716a8053819b0bb50c02bb1da796da7a0:76585472:87747dc9371cc6503ac340fb55cf27a34b1dda36",
"-", 87747dc9371cc6503ac340fb55cf27a34b1dda36, 76585472,
de3acc0716a8053819b0bb50c02bb1da796da7a0, package_extract_file("patch/NON-HLOS.bin.p"));
ui_print("Patching tz.mbn image...");
apply_patch("EMMC:/dev/block/bootdevice/by-name/tz:632644:fbcf8dbae397d91f6f4fc5d6f4160880d36ab43b:632644:07023648051d47bb91463bb3a562dd6a5c2a384c",
"-", 07023648051d47bb91463bb3a562dd6a5c2a384c, 632644,
fbcf8dbae397d91f6f4fc5d6f4160880d36ab43b, package_extract_file("patch/tz.mbn.p"));
ui_print("Patching hyp.mbn image...");
apply_patch("EMMC:/dev/block/bootdevice/by-name/hyp:73728:eeb375641b66b96dc0336d0abd78e0f8e9b22e95:73728:1c2079d70a233d6117685920aeb3e909362bfbab",
"-", 1c2079d70a233d6117685920aeb3e909362bfbab, 73728,
eeb375641b66b96dc0336d0abd78e0f8e9b22e95, package_extract_file("patch/hyp.mbn.p"));
ui_print("Patching sbl1.mbn image...");
apply_patch("EMMC:/dev/block/bootdevice/by-name/sbl1:321952:7bbc1a2d7fd68ef08c3c036dded254459e083453:322976:abf067334f85bb7854b7241e973e884fc3b7ce7f",
"-", abf067334f85bb7854b7241e973e884fc3b7ce7f, 322976,
7bbc1a2d7fd68ef08c3c036dded254459e083453, package_extract_file("patch/sbl1.mbn.p"));
ui_print("Patching emmc_appsboot.mbn image...");
apply_patch("EMMC:/dev/block/bootdevice/by-name/aboot:891516:89f232cdc51a357933466f9e53b9c32e26e3c59b:902616:f689e5d837c772053fa3f9c344a521d8083b76e6",
"-", f689e5d837c772053fa3f9c344a521d8083b76e6, 902616,
89f232cdc51a357933466f9e53b9c32e26e3c59b, package_extract_file("patch/emmc_appsboot.mbn.p"));
ui_print("Patching cmnlib.mbn image...");
package_extract_file("cmnlib.mbn", "/dev/block/bootdevice/by-name/cmnlib");
ui_print("Patching boot image...");
apply_patch("EMMC:/dev/block/bootdevice/by-name/boot:35087544:532a00dec3cd779ede9c48a935de00a860cbe953:35312824:60a0891fdb09b392cc85ae1541e08a72f87c166a",
"-", 60a0891fdb09b392cc85ae1541e08a72f87c166a, 35312824,
532a00dec3cd779ede9c48a935de00a860cbe953, package_extract_file("patch/boot.img.p"));
ui_print("Patching recovery image...");
apply_patch("EMMC:/dev/block/bootdevice/by-name/recovery:33338556:c8f1b92d125277898c5a6deca3a541b126d919c9:33561788:1ea424ce307870c3fdd1577b2bd36bd08cfc70c4",
"-", 1ea424ce307870c3fdd1577b2bd36bd08cfc70c4, 33561788,
c8f1b92d125277898c5a6deca3a541b126d919c9, package_extract_file("patch/recovery.img.p"));
set_progress(1.000000);