I have an Ulefone Armor 11 5G that I rooted with magisk and modded vb-meta. The telphone works fine, a couple of days ago I receive the info of an OTA update that will update my phone to the version available on the site, but even if I flash back again the original vbmeta and boot partition, it says that maps block doesn't match.
I read that updating the whole ROM using Mediatek software and scatter file will do a factory reset of my phone, is it true?
Is it possible to find what this OTA will change and only modifies this partition/files?
TIA
I was able to download the OTA package and I think the problem is that it want to patch the boot.img.
Can somebody help me to mod the update-binary script so that instead of patching boot.img it can install direct a magisk patched image?
Here is the script:
getprop("ro.product.device") == "Armor_11_5G" || abort("E3004: This package is for \"Armor_11_5G\" devices; this is a \"" + getprop("ro.product.device") + "\".");
ui_print("Source: Ulefone/Armor_11_5G_EEA/Armor_11_5G:10/QP1A.190711.020/1608088743:user/release-keys");
ui_print("Target: Ulefone/Armor_11_5G_EEA/Armor_11_5G:10/QP1A.190711.020/1608088743:user/release-keys");
ui_print("Verifying current system...");
getprop("ro.build.fingerprint") == "Ulefone/Armor_11_5G_EEA/Armor_11_5G:10/QP1A.190711.020/1608088743:user/release-keys" ||
getprop("ro.build.fingerprint") == "Ulefone/Armor_11_5G_EEA/Armor_11_5G:10/QP1A.190711.020/1608088743:user/release-keys" ||
abort("E3001: Package expects build fingerprint of Ulefone/Armor_11_5G_EEA/Armor_11_5G:10/QP1A.190711.020/1608088743:user/release-keys or Ulefone/Armor_11_5G_EEA/Armor_11_5G:10/QP1A.190711.020/1608088743:user/release-keys; this device has " + getprop("ro.build.fingerprint") + ".");
patch_partition_check("EMMC:/dev/block/by-name/boot:33554432:223ec34e2968174b6d3da29dac6f8a0bfcca5d0a",
"EMMC:/dev/block/by-name/boot:33554432:4cecdfac1f170168f75e6d211bf6183bccc2c87a") ||
abort("E3005: \"EMMC:/dev/block/by-name/boot:33554432:223ec34e2968174b6d3da29dac6f8a0bfcca5d0a\" or \"EMMC:/dev/block/by-name/boot:33554432:4cecdfac1f170168f75e6d211bf6183bccc2c87a\" has unexpected contents.");
apply_patch_space(56631296) || abort("E3006: Not enough free space on /cache to apply patches.");
patch_partition_check("EMMC:/dev/block/by-name/md1img:66856432:5521bd20270f93c39a09be3cbd530b9297c959b7",
"EMMC:/dev/block/by-name/md1img:66794448:86f1fe5a143a19caf7339b05bf06f139021a4bfe") ||
abort("E3005: \"EMMC:/dev/block/by-name/md1img:66856432:5521bd20270f93c39a09be3cbd530b9297c959b7\" or \"EMMC:/dev/block/by-name/md1img:66794448:86f1fe5a143a19caf7339b05bf06f139021a4bfe\" has unexpected contents.");
apply_patch_space(66856432) || abort("E3006: Not enough free space on /cache to apply patches.");
if (range_sha1(map_partition("system"), "24,1,153,169,180,196,197,208,32770,32865,98306,98401,163842,163937,229378,229473,294914,295009,360480,360491,389561,390752,396945,397037,397038") == "656b63aa2bc44a7f7d7bf43bf9543f2efa3b3786" || block_image_verify(map_partition("system"), package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat")) then
ui_print("Verified system image...");
else
check_first_block(map_partition("system"));
ifelse (block_image_recover(map_partition("system"), "24,1,153,169,180,196,197,208,32770,32865,98306,98401,163842,163937,229378,229473,294914,295009,360480,360491,389561,390752,396945,397037,397038") && block_image_verify(map_partition("system"), package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat"), ui_print("system recovered successfully."), abort("E1004: system partition fails to recover"));
endif;
if (range_sha1(map_partition("vendor"), "62,1,75,612,618,635,636,657,900,1003,1005,1027,1028,3054,3055,14771,15407,16890,16902,16903,16905,16939,16990,17071,17072,17464,17465,17676,17677,17767,17914,27263,27769,27963,27964,28426,28427,29633,29647,29993,29994,30275,30939,31133,31134,32768,32770,32804,32844,49027,49109,51061,51062,53969,98306,98340,131101,131103,139062,139494,141707,141751,141752") == "34846d8a2c7977538dadd1efb5d91f9966e9063e" || block_image_verify(map_partition("vendor"), package_extract_file("vendor.transfer.list"), "vendor.new.dat", "vendor.patch.dat")) then
ui_print("Verified vendor image...");
else
check_first_block(map_partition("vendor"));
ifelse (block_image_recover(map_partition("vendor"), "62,1,75,612,618,635,636,657,900,1003,1005,1027,1028,3054,3055,14771,15407,16890,16902,16903,16905,16939,16990,17071,17072,17464,17465,17676,17677,17767,17914,27263,27769,27963,27964,28426,28427,29633,29647,29993,29994,30275,30939,31133,31134,32768,32770,32804,32844,49027,49109,51061,51062,53969,98306,98340,131101,131103,139062,139494,141707,141751,141752") && block_image_verify(map_partition("vendor"), package_extract_file("vendor.transfer.list"), "vendor.new.dat", "vendor.patch.dat"), ui_print("vendor recovered successfully."), abort("E2004: vendor partition fails to recover"));
endif;
if (range_sha1(map_partition("product"), "352,1,110,5400,5404,8920,8921,13665,13669,16029,16032,18403,18404,25978,25979,27629,27633,31435,31436,32768,32770,32864,32870,38451,38452,39987,39991,42358,42798,42806,42807,48833,48837,53149,53150,53167,53171,53175,53176,53540,53544,54051,54052,54064,54068,54072,54073,60966,60967,61368,61372,62361,62362,62386,62390,62394,62395,62825,62829,62840,62841,64225,64229,64238,64239,65536,65542,67890,67891,68448,68450,69131,69132,69139,69143,71742,71743,78908,78909,86959,86963,89303,89304,98304,98306,98400,98406,100737,100738,101368,101372,111609,111610,111616,111617,119066,119067,125174,125178,130798,130799,130805,130808,130835,130839,130843,130844,130896,130900,130905,130906,130948,130952,130956,130957,131035,131039,131045,131046,131050,131054,131058,131059,131072,131078,140822,140826,140832,140833,152040,152041,159105,159109,163840,163842,163936,163942,164963,164964,165345,165349,165359,165360,180526,180530,180534,180537,180541,180542,185942,185946,190096,190097,196608,196614,206493,206494,208761,208765,209526,209529,210295,210296,215527,215528,216770,216774,220759,220760,227143,227144,229376,229378,229472,229478,234350,234354,240108,240111,245871,245876,250032,250034,250042,250043,250044,250045,250063,250064,250065,250066,250072,250073,250111,250115,250120,250123,250128,250129,250340,250341,250433,250436,250536,250538,250541,250542,250545,250546,250549,250550,250553,250554,250557,250558,250561,250562,250565,250566,250571,250572,250577,250578,250583,250584,250607,250608,250628,250629,250635,250636,250656,250657,250673,250674,250680,250681,250698,250699,250705,250706,250725,250726,250741,250742,250747,250748,250766,250767,250773,250774,250794,250795,250811,250812,250815,250816,250819,250820,250823,250824,250827,250828,250831,250832,250835,250836,250840,250841,250845,250846,250850,250851,250858,251115,251410,251414,251424,251425,251805,251809,251819,251820,255667,255668,255986,255990,256071,256072,257390,257394,257431,257432,257456,257460,257464,257465,258997,259003,259032,259033,262144,262150,263001,263005,263089,263090,279472,279473,285921,285923,288682,288686,288732,288736,289137,289140,289545,289546,289717,289721,289728,289729,289769,289773,289778,289779,289915,289919,289927,289928,291176,291180,291209,291210,292259,292263,292272,292273,292337,292341,292345,294914,295008,327681,327686,360449,360454,386405,387571,393713,393805,393806") == "52984c63abc36a83819c139fa911df1f51ce3922" || block_image_verify(map_partition("product"), package_extract_file("product.transfer.list"), "product.new.dat", "product.patch.dat")) then
ui_print("Verified product image...");
else
ifelse (block_image_recover(map_partition("product"), "352,1,110,5400,5404,8920,8921,13665,13669,16029,16032,18403,18404,25978,25979,27629,27633,31435,31436,32768,32770,32864,32870,38451,38452,39987,39991,42358,42798,42806,42807,48833,48837,53149,53150,53167,53171,53175,53176,53540,53544,54051,54052,54064,54068,54072,54073,60966,60967,61368,61372,62361,62362,62386,62390,62394,62395,62825,62829,62840,62841,64225,64229,64238,64239,65536,65542,67890,67891,68448,68450,69131,69132,69139,69143,71742,71743,78908,78909,86959,86963,89303,89304,98304,98306,98400,98406,100737,100738,101368,101372,111609,111610,111616,111617,119066,119067,125174,125178,130798,130799,130805,130808,130835,130839,130843,130844,130896,130900,130905,130906,130948,130952,130956,130957,131035,131039,131045,131046,131050,131054,131058,131059,131072,131078,140822,140826,140832,140833,152040,152041,159105,159109,163840,163842,163936,163942,164963,164964,165345,165349,165359,165360,180526,180530,180534,180537,180541,180542,185942,185946,190096,190097,196608,196614,206493,206494,208761,208765,209526,209529,210295,210296,215527,215528,216770,216774,220759,220760,227143,227144,229376,229378,229472,229478,234350,234354,240108,240111,245871,245876,250032,250034,250042,250043,250044,250045,250063,250064,250065,250066,250072,250073,250111,250115,250120,250123,250128,250129,250340,250341,250433,250436,250536,250538,250541,250542,250545,250546,250549,250550,250553,250554,250557,250558,250561,250562,250565,250566,250571,250572,250577,250578,250583,250584,250607,250608,250628,250629,250635,250636,250656,250657,250673,250674,250680,250681,250698,250699,250705,250706,250725,250726,250741,250742,250747,250748,250766,250767,250773,250774,250794,250795,250811,250812,250815,250816,250819,250820,250823,250824,250827,250828,250831,250832,250835,250836,250840,250841,250845,250846,250850,250851,250858,251115,251410,251414,251424,251425,251805,251809,251819,251820,255667,255668,255986,255990,256071,256072,257390,257394,257431,257432,257456,257460,257464,257465,258997,259003,259032,259033,262144,262150,263001,263005,263089,263090,279472,279473,285921,285923,288682,288686,288732,288736,289137,289140,289545,289546,289717,289721,289728,289729,289769,289773,289778,289779,289915,289919,289927,289928,291176,291180,291209,291210,292259,292263,292272,292273,292337,292341,292345,294914,295008,327681,327686,360449,360454,386405,387571,393713,393805,393806") && block_image_verify(map_partition("product"), package_extract_file("product.transfer.list"), "product.new.dat", "product.patch.dat"), ui_print("product recovered successfully."), abort("E2004: product partition fails to recover"));
endif;
# ---- start making changes here ----
# --- Start patching dynamic partitions ---
# Update dynamic partition metadata
assert(update_dynamic_partitions(package_extract_file("dynamic_partitions_op_list")));
# Patch partition product
ui_print("Patching product image after verification.");
block_image_update(map_partition("product"), package_extract_file("product.transfer.list"), "product.new.dat", "product.patch.dat") ||
abort("E2001: Failed to update product image.");
# Patch partition vendor
ui_print("Patching vendor image after verification.");
show_progress(0.100000, 0);
block_image_update(map_partition("vendor"), package_extract_file("vendor.transfer.list"), "vendor.new.dat", "vendor.patch.dat") ||
abort("E2001: Failed to update vendor image.");
# Patch partition system
ui_print("Patching system image after verification.");
show_progress(0.800000, 0);
block_image_update(map_partition("system"), package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat") ||
abort("E1001: Failed to update system image.");
# --- End patching dynamic partitions ---
ui_print("Patching boot image...");
show_progress(0.100000, 10);
patch_partition("EMMC:/dev/block/by-name/boot:33554432:223ec34e2968174b6d3da29dac6f8a0bfcca5d0a",
"EMMC:/dev/block/by-name/boot:33554432:4cecdfac1f170168f75e6d211bf6183bccc2c87a",
package_extract_file("boot.img.p")) ||
abort("E3008: Failed to apply patch to EMMC:/dev/block/by-name/boot:33554432:4cecdfac1f170168f75e6d211bf6183bccc2c87a");
show_mtupdate_stage("/cache/recovery/last_mtupdate_stage");
ifelse (
less_than_int(get_mtupdate_stage("/cache/recovery/last_mtupdate_stage"), "1") ,
(
ui_print("start to update general image");
package_extract_file("pi_img.img", "/dev/block/by-name/pi_img");
package_extract_file("cam_vpu3.img", "/dev/block/by-name/cam_vpu3");
package_extract_file("dtbo.img", "/dev/block/by-name/dtbo");
package_extract_file("vbmeta_system.img", "/dev/block/by-name/vbmeta_system");
package_extract_file("vbmeta_vendor.img", "/dev/block/by-name/vbmeta_vendor");
package_extract_file("cam_vpu2.img", "/dev/block/by-name/cam_vpu2");
package_extract_file("cam_vpu1.img", "/dev/block/by-name/cam_vpu1");
ui_print("Patching md1img image...");
show_progress(0.100000, 10);
patch_partition("EMMC:/dev/block/by-name/md1img:66856432:5521bd20270f93c39a09be3cbd530b9297c959b7",
"EMMC:/dev/block/by-name/md1img:66794448:86f1fe5a143a19caf7339b05bf06f139021a4bfe",
package_extract_file("patch/md1img.img.p")) ||
abort("E3008: Failed to apply patch to EMMC:/dev/block/by-name/md1img:66794448:86f1fe5a143a19caf7339b05bf06f139021a4bfe");
package_extract_file("spmfw.img", "/dev/block/by-name/spmfw");
set_mtupdate_stage("/cache/recovery/last_mtupdate_stage", "1");
),
ui_print("general images are already updated");
);
ifelse (
less_than_int(get_mtupdate_stage("/cache/recovery/last_mtupdate_stage"), "3") ,
(
if less_than_int(get_mtupdate_stage("/cache/recovery/last_mtupdate_stage"), "2") then
ui_print("start to update alt loader image");
package_extract_file("sspm.img", "/dev/block/by-name/sspm_2");
package_extract_file("tee.img", "/dev/block/by-name/tee2");
package_extract_file("scp.img", "/dev/block/by-name/scp2");
package_extract_file("mcupm.img", "/dev/block/by-name/mcupm_2");
package_extract_file("lk.img", "/dev/block/by-name/lk2");
package_extract_file("dpm.img", "/dev/block/by-name/dpm_2");
set_mtupdate_stage("/cache/recovery/last_mtupdate_stage", "2");
endif;
switch_active("sspm_1", "sspm_2");
switch_active("tee1", "tee2");
switch_active("scp1", "scp2");
switch_active("mcupm_1", "mcupm_2");
switch_active("lk", "lk2");
switch_active("dpm_1", "dpm_2");
set_mtupdate_stage("/cache/recovery/last_mtupdate_stage", "3");
),
ui_print("alt loder images are already updated");
);
ifelse (
less_than_int(get_mtupdate_stage("/cache/recovery/last_mtupdate_stage"), "5") ,
(
if less_than_int(get_mtupdate_stage("/cache/recovery/last_mtupdate_stage"), "4") then
ui_print("start to update main loader image");
package_extract_file("sspm.img", "/dev/block/by-name/sspm_1");
package_extract_file("tee.img", "/dev/block/by-name/tee1");
package_extract_file("scp.img", "/dev/block/by-name/scp1");
package_extract_file("mcupm.img", "/dev/block/by-name/mcupm_1");
package_extract_file("lk.img", "/dev/block/by-name/lk");
package_extract_file("dpm.img", "/dev/block/by-name/dpm_1");
set_mtupdate_stage("/cache/recovery/last_mtupdate_stage", "4");
endif;
switch_active("sspm_2", "sspm_1");
switch_active("tee2", "tee1");
switch_active("scp2", "scp1");
switch_active("mcupm_2", "mcupm_1");
switch_active("lk2", "lk");
switch_active("dpm_2", "dpm_1");
),
ui_print("main loader images are already updated");
);
delete("/cache/recovery/last_mtupdate_stage");
package_extract_file("vbmeta.img", "/dev/block/by-name/vbmeta");
post_ota_action();
set_progress(1.000000);
Click to expand...
Click to collapse
In bold Are the parts that I think should be modded.
Thanks
P.S.
If I remove:
patch_partition_check("EMMC:/dev/block/by-name/boot:33554432:223ec34e2968174b6d3da29dac6f8a0bfcca5d0a",
"EMMC:/dev/block/by-name/boot:33554432:4cecdfac1f170168f75e6d211bf6183bccc2c87a") ||
abort("E3005: \"EMMC:/dev/block/by-name/boot:33554432:223ec34e2968174b6d3da29dac6f8a0bfcca5d0a\" or \"EMMC:/dev/block/by-name/boot:33554432:4cecdfac1f170168f75e6d211bf6183bccc2c87a\" has unexpected contents.");
apply_patch_space(56631296) || abort("E3006: Not enough free space on /cache to apply patches.");
Click to expand...
Click to collapse
and I change
ui_print("Patching boot image...");
show_progress(0.100000, 10);
patch_partition("EMMC:/dev/block/by-name/boot:33554432:223ec34e2968174b6d3da29dac6f8a0bfcca5d0a",
"EMMC:/dev/block/by-name/boot:33554432:4cecdfac1f170168f75e6d211bf6183bccc2c87a",
package_extract_file("boot.img.p")) ||
abort("E3008: Failed to apply patch to EMMC:/dev/block/by-name/boot:33554432:4cecdfac1f170168f75e6d211bf6183bccc2c87a");
show_mtupdate_stage("/cache/recovery/last_mtupdate_stage");
ifelse (
less_than_int(get_mtupdate_stage("/cache/recovery/last_mtupdate_stage"), "1") ,
(
Click to expand...
Click to collapse
with
ui_print("start to update boot image");
package_extract_file("boot.img", "/dev/block/by-name/boot");
Click to expand...
Click to collapse
updating the right file in update.zip package it should work, am I wrong?
If I repack teh official recovery of the Ulefone without otacerts.zip would it me allow to sideload the update even if is not signed?
A big ;art of me wishes that I could just understand what you are saying and help you with the code changes that you have listed above. I don't have a clue if you have made the correct alterations and I won't even start to pretend I am proficient with rooting. This will be my 6th root and very much my most successful and the smoothest of all. When the OTA update came along I spent a whole night, right from sundown to sunup, looking for the answer that most made sense to me and/or didn't leave me having to download my backup again. After painful amounts of wasted time I took a chance and will say I have successfully updated and have root and nothing else on my phone was altered. I'm not used to being the person who is responsible for posting a-guide-to-what-they-did but I am thrilled to help right now and maybe this will see the eyes of a rare Ulefone Armor 11 5G owner:
- I made sure my phone was backed-up
- Also made sure I had lots of charge (over %50 will suffice)
- (optional and unnecessary) I downloaded the update but didn't allow it to install so I could find the files as I thought I would need to get a boot.img and alter it with Magisk but that was not correct. If you want to find those files I'd have to look again, feel free to ask me for that
- Downloaded the latest official ROM from the Ulefone website (which at the time didn't match the newest OTA update)
- Modified boot.img in magisk
- Moved that file to my laptop
- Removed Magisk
- Flashed the system files from the Official ROM with fastboot
- (if you have the update files) Flash them in fastboot
- If you want to save time just forget that last one and just boot into your phone and update as normal
- When the update is complete made sure to let the OS boot up
- Flashed that file from the other post (I'll find the name)
- Flashed the modified Magisk
- That was it, it worked!
Hope that helps you or someone else
So a small update.
Repacking the recovery without otacert doesn't work, becuase while sideloading it was looking for otacert.
I repack again the official recovery using Carliv image Kitchen for Android and changed the releasekey with the test key that I found in sign-em-anywhere 3.0. Once I did it I flashed the new recovery in my phone.
After that I signed my modded update.zip with MinSignApk.
Now when I launch from recovery adb sideload the process start without showing problem about the signature, but it still stops with an error
Target: Ulefone/Armor_11_5G_EEA/Armor_11_5G: 10/QP1A.190711.020/1608088743:user/release-keys
Verifying current system...
Device was remounted R/W 8 times Last remount happened on Wed Jun 2 11:01:04 2021
unable to use metadata to crrect errors
E1004: system partition fails to recover
E:Error in /sideload/package.zip (status 7)
Install from ADB completed with status 1.
Installation aborted.
E: Fota installation aborted.
E: No such file or directory
E: Fota installation aborted.
E:: Bad file descriptor
Click to expand...
Click to collapse
Can somebody understand where is the problem?
TIA