Flashing stock rom via TWRP - Zenfone 2 Laser Q&A, Help & Troubleshooting

I have zenfone selfie (z00t, zd551kl) on which I have RR 7.1.1 running. However, I want to go back to stock ROM while still keeping root and twrp intact. There is problem with my phone's usb port so it can't communicate with PC anymore, so i can't flash stock firmware via sdcard and then attempt to re-root it via fastboot
Can the stock rom be flashed via TWRP and keeping twrp intact? Or is there any other work around ?

ACFH said:
I think it is possible. But I warning you it too much risky to try change your OS with a broken usb port. If you fail, you cant restore your phone anymore.
Root stick with system so change OS will wipe root. But I think you can keep TWRP.
You need modify update zip file before you can flash it. Open "META-INF\com\google\android\updater-script" file inside update.zip. Find every line have "recovery" and delete it then save. It could be something like:
Code:
package_extract_file("recovery.img", "/dev/block/bootdevice/by-name/recovery");
or
Code:
package_extract_dir("recovery", "/system");
set_metadata("/system/etc/install-recovery.sh", "uid", 0, "gid", 0, "mode", 0544, "capabilities", 0x0);
set_metadata("/system/recovery-from-boot.p", "uid", 0, "gid", 0, "mode", 0644, "capabilities", 0x0);
Since twrp can flash zip without checking signature, you dont need resign update.zip file.
Now you have stock firmware without install recovery, copy new update file to sd card.
In twrp > backup > backup system (just in case). Then wipe > system. You need wipe system because it's non-stock firmware, it can make update stock firmware fail.
Now try flash your firmware, factory reset and reboot your phone (maybe flash su before reboot).
Hope it work. I dont have an experience myself with a broken usb port phone but it seem really promising.
Click to expand...
Click to collapse
Thanks, will try it :good:

ACFH said:
I think it is possible. But I warning you it too much risky to try change your OS with a broken usb port. If you fail, you cant restore your phone anymore.
Root stick with system so change OS will wipe root. But I think you can keep TWRP.
You need modify update zip file before you can flash it. Open "META-INF\com\google\android\updater-script" file inside update.zip. Find every line have "recovery" and delete it then save. It could be something like:
Code:
package_extract_file("recovery.img", "/dev/block/bootdevice/by-name/recovery");
or
Code:
package_extract_dir("recovery", "/system");
set_metadata("/system/etc/install-recovery.sh", "uid", 0, "gid", 0, "mode", 0544, "capabilities", 0x0);
set_metadata("/system/recovery-from-boot.p", "uid", 0, "gid", 0, "mode", 0644, "capabilities", 0x0);
Since twrp can flash zip without checking signature, you dont need resign update.zip file.
Now you have stock firmware without install recovery, copy new update file to sd card.
In twrp > backup > backup system (just in case). Then wipe > system. You need wipe system because it's non-stock firmware, it can make update stock firmware fail.
Now try flash your firmware, factory reset and reboot your phone (maybe flash su before reboot).
Hope it work. I dont have an experience myself with a broken usb port phone but it seem really promising.
Click to expand...
Click to collapse
I downloaded latest stock firmware from asus site (UL-Z00T-WW-21.40.0.1999-user), however I can't find any references to recovery partition in updater script. Does it mean it won't change recovery or could it be that recovery partition is listed under different name? Attaching the updater script, can you please take a look and tell. (I had to zip it as xda was not allowing to upload in default format)
Also not sure, do we need patched boot.img (which disable dm-varity check?). I had this on my other phone, basically it refused to boot stock rom, when TWRP was flashed for recovery. I'm not sure if it is same case with this asus phone as it is old and that one is relatively new phone.

Related

[Q] status 7 error when trying to update to 4.4.2 from 4.4 SOLVED

Hey all. I am getting an error when trying to sideload the update. I was having trouble with my drivers for a while, and just now got around to fixing them, so I thought that I would update, since I have TWRP, and the OTA obviously doesn't install with that. So anyway, here I am, using the Nexus Root Toolkit to sideload, and everything went well. Until the Nexus was verifying the current systen. Here is the error:
"EMC:/dev/block/platform/sdkci-tegra.3/by-name/LNX:5109760:c804e149ffe2595235595a35a25096d53e1c5ea2:5111808:40ea9855a3b10fd1e65ace0fc3b7bb19bec8bf35" has unexpected contents.
E:Error in /tmp/update.zip
(status 7)
Installization aborted.
Any help would be great. Thanks
LNX is the boot partition.
You could experience that problem if you
- installed a custom kernel
- modifed your ramdisk (and then repacked the boot image)
- anything else that would alter a single byte in the boot image
the solution is to re-install the stock boot image.
The OTA will probably affect your ROM root (usually by changing the setuid permissions on the "su" binary), so be prepared to resolve that.
In general, OTAs are not intended for updating modified devices.
bftb0 said:
LNX is the boot partition.
You could experience that problem if you
- installed a custom kernel
<b>- modifed your ramdisk (and then repacked the boot image)</b>
- anything else that would alter a single byte in the boot image
the solution is to re-install the stock boot image.
...
In general, OTAs are not intended for updating modified devices.
Click to expand...
Click to collapse
Thanks. I forgot to mention that I am just unlocked and rooted running stock. The only thing that is different is that I have MultiRom installed also. I imagine that is what the issue is. I was thinking of trying out the official CM11, but I didn't want that as my primary. Is there a way to leave MultiRom installed and still update?
jma9454 said:
Is there a way to leave MultiRom installed and still update?
Click to expand...
Click to collapse
Sure. You can always unpack the OTA zip file, remove the parts you don't like ( in the command script META-INF/com/google/android/updater-script ), zip the whole shebang back up and flash it. Neither of the custom recoveries seem to give a $hit whether or not the .zips are signed.
Probably a good idea to make a nandroid backup before you begin.
good luck
bftb0 said:
Sure. You can always unpack the OTA zip file, remove the parts you don't like ( in the command script META-INF/com/google/android/updater-script ), zip the whole shebang back up and flash it. Neither of the custom recoveries seem to give a $hit whether or not the .zips are signed.
Probably a good idea to make a nandroid backup before you begin.
good luck
Click to expand...
Click to collapse
so can I take out this whole part?
apply_patch_check("EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5109760:c804e149ffe3595235595a35a25096d53e1c5ea2:5111808:40ea9855a3b10fd1e65ace0fc3b7bb19bec8bf35") || abort("\"EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5109760:c804e149ffe3595235595a35a25096d53e1c5ea2:5111808:40ea9855a3b10fd1e65ace0fc3b7bb19bec8bf35\" has unexpected contents.");
set_progress(1.000000);
(Just to let you know, this comes from almost exactly halfway into the updater-script)
thanks for your help
jma9454 said:
so can I take out this whole part?
apply_patch_check("EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5109760:c804e149ffe3595235595a35a25096d53e1c5ea2:5111808:40ea9855a3b10fd1e65ace0fc3b7bb19bec8bf35") || abort("\"EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5109760:c804e149ffe3595235595a35a25096d53e1c5ea2:5111808:40ea9855a3b10fd1e65ace0fc3b7bb19bec8bf35\" has unexpected contents.");
set_progress(1.000000);
(Just to let you know, this comes from almost exactly halfway into the updater-script)
thanks for your help
Click to expand...
Click to collapse
There are TWO such lines. (First, the check and then later on the actual patching operation)
The OTAs always run through 100% of the checks before a single file is modified. If a single check fails, the OTA stops immediately ... without anything being touched. It has been the convention in OTAs that the very last thing to be checked is the boot image (if it is getting updated)... that's why you are finding that apply_patch_check() about halfway through the file; you will notice that the actual patching of files starts shortly after that, and each file is patched in series in the same order that they were checked.
So, towards the very end of the file you will find the matching patch operation of the LNX (boot) partition; you should remove that line as well because that patching operation will cetainly not produce correct results. (And the boot partition is kinda important, no?)
To anybody else besides the OP who is reading this: for arbitrarily modified ROMs, this approach is not recommended (trying to take only PART of an OTA) as there may be components in an OTA update which are interdependant across multiple files. For an OTA that fails only due to a single modified file, it might be acceptable - but you accept all the risks of fooling with things this way.
EVERYONE should take a Nandroid backup before attempting such mods.
bftb0 said:
There are TWO such lines. (First, the check and then later on the actual patching operation)
The OTAs always run through 100% of the checks before a single file is modified. If a single check fails, the OTA stops immediately ... without anything being touched. It has been the convention in OTAs that the very last thing to be checked is the boot image (if it is getting updated)... that's why you are finding that apply_patch_check() about halfway through the file; you will notice that the actual patching of files starts shortly after that, and each file is patched in series in the same order that they were checked.
So, towards the very end of the file you will find the matching patch operation of the LNX (boot) partition; you should remove that line as well because that patching operation will cetainly not produce correct results. (And the boot partition is kinda important, no?)
...
Click to expand...
Click to collapse
so do I remove this whole part or just everything until the delete script?
ui_print("Patching boot image...");
apply_patch("EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5109760:c804e149ffe3595235595a35a25096d53e1c5ea2:5111808:40ea9855a3b10fd1e65ace0fc3b7bb19bec8bf35",
"-", 40ea9855a3b10fd1e65ace0fc3b7bb19bec8bf35, 5111808,
c804e149ffe3595235595a35a25096d53e1c5ea2, package_extract_file("patch/boot.img.p"));
set_progress(0.999993);
delete("/system/recovery-from-boot.p",
"/system/etc/install-recovery.sh");
Well, I just read your sig
That file is an extremely simple programming language (barely even that as it has no loops, conditionals or jumps). It just executes each "line" in turn one after another unless there is an error; and in that case it just stops.
Like most programming languages, things like balanced parentheses and line termination characters (e.g. semicolons) are significant.
So have a hard look at those lines above, make a decision about what you think is correct... and move forward knowing that if you make a mistake you will have a Nandroid backup waiting to put you back where you were. (To be super sure of that, get a copy of it off your tablet before you start flashing.)
If that makes you uncomfortable, then don't do anything. From here on out, *you* are in charge.
good luck.
Well, I deleted everything till the delete line. Hopefully I don't have problems, as now that I am reading the entirety of it, I should have done the whole thing. It flagged and booted just fine though. Thanks for all the pointers.
Sent from my Nexus 7 using Tapatalk
--------edit--------
Well, no root access, but the simple task of rerooting should do the trick, I think.
I have same issue. After returning to stock 4.4.2 I had difficulties in rooting. Good thing that I managed to install CMW (using Wug's toolkit) and flash a SU to root my device (I searched in help forum).
After having stock 4.4.2, rooted (tested and verified by deleting system APK) and custom recovery, I cannot flash a custom ROM. Let us know if someone can actually solve this!
jma9454 said:
Well, I deleted everything till the delete line. Hopefully I don't have problems, as now that I am reading the entirety of it, I should have done the whole thing. It flagged and booted just fine though. Thanks for all the pointers.
Sent from my Nexus 7 using Tapatalk
--------edit--------
Well, no root access, but the simple task of rerooting should do the trick, I think.
Click to expand...
Click to collapse
* As per link below, TWRP will skip the below asset check (resulting to status 7 error).
* Using Wug's Tool, restore tablet to stock 4.4.2
* I found out that file in "D:\nexus7\data\Recovery_Custom\TWRP" is less than 7.58 MB. So I downloaded TWRP manually in below link. Save this in same location and install TWRP using Wug's tool. You can root as well at the same time (I forgot this step)
* Copy the ROM & GAPPS in tablet and rebooted to TWRP (using Wug's tool).
* Wipe option in TWRP
* Install ROM successfully , then install GAPPS
* Since I forgot to root, TWRP option asked to root my device... I selected root.
Finished...
asset check link: http://highonandroid.com/android-rom...ooted-android/
TWRP link: http://techerrata.com/browse/twrp2/grouper
Wug's Tool: http://forum.xda-developers.com/showthread.php?t=1766475
austin_dreq said:
I have same issue. After returning to stock 4.4.2 I had difficulties in rooting. Good thing that I managed to install CMW (using Wug's toolkit) and flash a SU to root my device (I searched in help forum).
After having stock 4.4.2, rooted (tested and verified by deleting system APK) and custom recovery, I cannot flash a custom ROM. Let us know if someone can actually solve this!
Click to expand...
Click to collapse
jma9454 said:
Well, I deleted everything till the delete line. Hopefully I don't have problems, as now that I am reading the entirety of it, I should have done the whole thing. It flagged and booted just fine though. Thanks for all the pointers.
Sent from my Nexus 7 using Tapatalk
--------edit--------
Well, no root access, but the simple task of rerooting should do the trick, I think.
Click to expand...
Click to collapse
Good job man.
These lines in the updater-script
Code:
set_metadata_recursive("/system/bin", "uid", 0, "gid", 2000, "dmode", 0755, "fmode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/xbin", "uid", 0, "gid", 2000, "dmode", 0755, "fmode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
are what cause the loss of root.
The "su" binary is still present in the ROM ... but the *recursive* (all files underneath the directory given) change of permissions alters the "setuid" nature of the "su" binary so it no longer runs with root identity. (depending on which version of root kit you have, the "su" binary could be in either /system/bin or /system/xbin)
note there is also a non-recursive version of "set_metadata" for dealing with individual files.
You can't just delete the recursive call as it manipulates lots of files other than the one you are trying to protect ("su").
But *after* that recursive mode-setting is done, you could certainly add an instance of set_metadata on the su binary in order to restore the ownership and file modes that the su binary needs to work correctly.
And then you would have - ta-da! - your own customized version of the OTA that skips the stuff that cause failures, and doesn't stomp on root.
Figuring out the correct selinux syntax is left as an exercise for the reader.

Jflte vrs jfltecan vrs jfltexx

I thought after reading a few things that it would be possible to install cm12 jfltexx to my jfltecan b/c of the similar architecture and unification of cm12 for S4. It seems as if they re-branched the releases to separate variants and twrp wont allow me to flash an jfltexx rom. So am I doing something that I shouldn't be. Unfortunately there is still no rls for the jflte or jfltecan which is why I thought I would try the international.
dasbooter said:
I thought after reading a few things that it would be possible to install cm12 jfltexx to my jfltecan b/c of the similar architecture and unification of cm12 for S4. It seems as if they re-branched the releases to separate variants and twrp wont allow me to flash an jfltexx rom. So am I doing something that I shouldn't be. Unfortunately there is still no rls for the jflte or jfltecan which is why I thought I would try the international.
Click to expand...
Click to collapse
You can always try it. It won't brick your device but you might have to Odin the stock firmware. You'll have to edit the updater-script in the the rom to allow you to flash it (assert line)
Sent from my Nexus 5 using XDA Free mobile app
Yes thanks reading a little more and saw some threads where someone flashed jflteatt to there Canadian s4 And had to alter the updater script. I looked briefly through the zip file but couldn't locate it. Now in terms of Odin and flashing back to stock, do you mean if i soft brick flashing the international cm12 rom or do u mean something else.
dasbooter said:
Yes thanks reading a little more and saw some threads where someone flashed jflteatt to there Canadian s4 And had to alter the updater script. I looked briefly through the zip file but couldn't locate it. Now in terms of Odin and flashing back to stock, do you mean if i soft brick flashing the international cm12 rom or do u mean something else.
Click to expand...
Click to collapse
In the zip goto META-INF, com , Google, android. There you'll find the updater-script. There should be a line that starts with "assert". You'll have to delete or edit that line for your device.
If things go wrong, that's where you might have to odin back to stock.
Sent from my Nexus 9 using XDA Free mobile app
Thanks for clarifying and answering my noobish questions. Maybe I'll have a crack at it. Any thoughts on when we will c cm12 for my i337m. Interesting how they forked the ROMs again
Well I was able to install cm12 from jfltexx to I337m variant. I had to delete the assert line as changing the line to jflte didn't work and errored in twrp. Everything seems to work but I'm guessing otas wouldn't work till you changed the updater-script.
Nothing to c here weird repost happened while moving back in the browser
You just removed it?!
dasbooter said:
Well I was able to install cm12 from jfltexx to I337m variant. I had to delete the assert line as changing the line to jflte didn't work and errored in twrp. Everything seems to work but I'm guessing otas wouldn't work till you changed the updater-script.
Click to expand...
Click to collapse
You didn't do anything special to it? Just wanna be sure because I'm new to this as well
No you definitely have to go in and change the updater-script than rezip the ROM. The international rom did install and run fine tho
FYI, I just flashed my i337m with jfltexx and everything is fine except that mobile data does not work.
Are you using the latest modem and bootloader?
audit13 said:
Are you using the latest modem and bootloader?
Click to expand...
Click to collapse
I thought I was because I had applied the stock BMC 5.0.1 ROM before going the custom rom route. So I flashed modem.bin using Odin/CSC and indeed data works now. As for the bootloader I'm using TWRP (latest.)
cythraul said:
I thought I was because I had applied the stock BMC 5.0.1 ROM before going the custom rom route. So I flashed modem.bin using Odin/CSC and indeed data works now. As for the bootloader I'm using TWRP (latest.)
Click to expand...
Click to collapse
Hi,
I'm going to do pretty much the same as you did on my S4 SGH-I337M, but with most recent CM13 found HERE.
I was also wondering if you could point out where I should find the modem files if ever I experience data issues after the flashing.
Thanks & Regards,
chatdeau
EDIT: I made the mistake of re-zipping the ROM folder instead of it's content.
Flashing right now ...
---------- Post added at 11:46 AM ---------- Previous post was at 11:29 AM ----------
chatdeau said:
EDIT: I made the mistake of re-zipping the ROM folder instead of it's content.
Flashing right now ...
Click to expand...
Click to collapse
Alright, I'm now booting CM13 on my Samsung Galaxy S4 SGH-I337M jfltecan !
Testing ... will report back and I might start a new thread (for intermediate users, but relatively CM noobs like me) to explain the whole rooting / cm13 rom mod / flashing procedure I went through to get to this point.
---------- Post added at 12:12 PM ---------- Previous post was at 12:00 PM ----------
Everything seems to be working fine for now. And it's pretty fast!
With the i337m, installing a custom ROM is pretty easy.
download and install the latest stock ROM from sammobile.com to ensure the phone is running the latest bootloader and modem: http://www.sammobile.com/firmwares/database/SGH-I337M/ (this step is not necessary if the phone is running the latest modem and bootloader);
download Odin 3.07 from here: https://www.google.ca/url?;sa=t&rct...QWImOPDJboTA_V3D5S9eA&bvm=bv.112064104,d.amc;
download the latest TWRP from here: https://dl.twrp.me/jflteatt/;
use Cygwin to convert the img file to a tar file for flashing in Odin: http://cygwin.com/install.html;
boot phone into download mode by holding volume down, home, and power button. Release the power button when the phone starts to boot;
open Odin, uncheck everything except f.reset time and connect the phone in download mode;
click on PDA and select the TWRP file that has been converted from an img file to a tar file and flash it;
when you see the word "reset" in the status window, remove USB cable, remove battery, replace battery, use button combination to boot into TWRP (hold volume up, home, power button and release power button when phone starts to boot).
Once TWRP is installed, copy the custom ROM to be installed to the phone's internal memory or a micro SD card and install the ROM from TWRP. The Gapps version should match the ROM version.
Help!
So I'm trying to do this same thing for my SGH-i337m. But every time I try to flash it in TWRP it just says installation aborted. I'm thinking I'm just deleting the wrong portion of the assert line. Could someone please point me in the right direction? Below is the top portion of the script. Could someone please highlight which portion I should delete? Thanks!
assert(getprop("ro.product.device") == "jfltexx" || getprop("ro.build.product") == "jfltexx" || getprop("ro.product.device") == "i9505" || getprop("ro.build.product") == "i9505" || getprop("ro.product.device") == "GT-I9505" || getprop("ro.build.product") == "GT-I9505" || getprop("ro.product.device") == "jgedlte" || getprop("ro.build.product") == "jgedlte" || getprop("ro.product.device") == "i9505g" || getprop("ro.build.product") == "i9505g" || getprop("ro.product.device") == "GT-I9505G" || getprop("ro.build.product") == "GT-I9505G" || getprop("ro.product.device") == "jflte" || getprop("ro.build.product") == "jflte" || abort("This package is for device: jfltexx,i9505,GT-I9505,jgedlte,i9505g,GT-I9505G,jflte; this device is " + getprop("ro.product.device") + ".");
ui_print("Target: samsung/jfltexx/jflte:5.0.1/LRX22C/I9505XXUHPF4:user/release-keys");
ifelse(is_mounted("/system"), unmount("/system"));
package_extract_dir("install", "/tmp/install");
set_metadata_recursive("/tmp/install", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644);
set_metadata_recursive("/tmp/install/bin", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755);
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system", "");
cmjdjm1 said:
So I'm trying to do this same thing for my SGH-i337m. But every time I try to flash it in TWRP it just says installation aborted. I'm thinking I'm just deleting the wrong portion of the assert line. Could someone please point me in the right direction? Below is the top portion of the script. Could someone please highlight which portion I should delete? Thanks!
assert(getprop("ro.product.device") == "jfltexx" || getprop("ro.build.product") == "jfltexx" || getprop("ro.product.device") == "i9505" || getprop("ro.build.product") == "i9505" || getprop("ro.product.device") == "GT-I9505" || getprop("ro.build.product") == "GT-I9505" || getprop("ro.product.device") == "jgedlte" || getprop("ro.build.product") == "jgedlte" || getprop("ro.product.device") == "i9505g" || getprop("ro.build.product") == "i9505g" || getprop("ro.product.device") == "GT-I9505G" || getprop("ro.build.product") == "GT-I9505G" || getprop("ro.product.device") == "jflte" || getprop("ro.build.product") == "jflte" || abort("This package is for device: jfltexx,i9505,GT-I9505,jgedlte,i9505g,GT-I9505G,jflte; this device is " + getprop("ro.product.device") + ".");
ui_print("Target: samsung/jfltexx/jflte:5.0.1/LRX22C/I9505XXUHPF4:user/release-keys");
ifelse(is_mounted("/system"), unmount("/system"));
package_extract_dir("install", "/tmp/install");
set_metadata_recursive("/tmp/install", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644);
set_metadata_recursive("/tmp/install/bin", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755);
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system", "");
Click to expand...
Click to collapse
Personally, I just flashed the TWRP for the i9505 and can flash any ROM I want from the 9505 board on my Canadian SGH-1337M. Obviously not responsible for any issues that may come up - but so far so good
Sent from my Transformer TF101 using Tapatalk
bill_in_mtl said:
Personally, I just flashed the TWRP for the i9505 and can flash any ROM I want from the 9505 board on my Canadian SGH-1337M. Obviously not responsible for any issues that may come up - but so far so good
Sent from my Transformer TF101 using Tapatalk
Click to expand...
Click to collapse
thanks! that worked beautifully! up and running now with no issues that I'm finding at all on the Sept 1st nightly
This may not be the best place to post this, but anybody looking to run cm13 on the Galaxy s4 Canadian (I337M) might notice that the jfltexx recovery and cm13 roms "almost" work flawlessly. The only problem I had was a serious WiFi disconnect/reconnect problem. If you also have this problem, do this:
1. Install TWRP for jfltexx
2. Install cm13 for jfltexx (and gapps etc)
3. Flash modem.bin from the modem files found on this thread: Here
--- For jfltecan download the 11/26/2013 (Canada) file (modemmk6.zip -> modem.bin)
--- Can flash this file with Odin or Heimdall
4. Wipe Cache/Dalvik
5. Reboot
[Edits - Some Notes]
I personally prefer to use Heimdall for flashing TWRP on the s4 as it's very simple. I found Odin can sometimes be tedious and most useful for flashing stock roms... but it's up to preference.
For Heimdall:
1. Boot into download mode (Power down, Hold Power + Vol Dwn + Home until the phone vibrates and release) OR using adb type: "adb reboot download"
2. open terminal in heimdall directory and use command:
"heimdall flash --RECOVERY recovery-img.img --no-reboot"
3. Power down and reboot into recovery immediately or bootloader will overwrite the new recovery image. (Power + Vol Up + Home until it vibrates).
to use heimdall to flash the modem use:
"heimdall flash --MDM modem.bin" optionally use --no-reboot to reboot to recovery manually and wipe cache
[/Edits]
Enjoy cm13 nightly on jfltecan without any wifi problems!
I'm trying to install CM13 for i337m (from Latin-America) and have no luck. The phone is rooted, on stock 5.0.1 UMUGOH3, and I've tried all recoveries TWRP 3.0.2-0 for jflteatt, jfltecan, lfltexx, and CM13 for jflteatt, and other, deleted the FIRST assert line... no results, always error: 7

Has anyone tried yo install russian flyme Roms with integrated TWRP?

Has anyone tried russian flyme twrp roms? There are 3 Roms in their link, but i don't know how to install it.
any link please ?
I can't put links because i have less than 10 post.
I'm sorry.
Write emmaus.pro in google. There are twrp for mx4 and custom roms, flyme and cm12.
I have Flyme 4.5.7i on my MX4 flashed by TWRP recovery.
(original my mx4 was A edition, and I was unlock bootloader and flash custom recovery with instructions found on xda forum)
Instructions How To Edit Official Flyme Rom to be flashed with TWRP:
---------------------------------------------------------------------------------------
1. Unzip update.zip in empty folder
2. Go in folder with unpacking files and delete uboot.img and logo.img
3. Go in META-INF folder and from here delete imei.dat and machine_match
4. Go in COM/GOOGLE/ANDROID folder and edit updater.script
Remove this :
getprop("ro.product.device") == "mx4" || getprop("ro.product.device") == "mx4" || getprop("ro.product.device") == "M460A" || abort("This package is for "mx4" devices; this is a "" + getprop("ro.product.device") + "".");
package_extract_file("META-INF/machine_match", "/tmp/machine_match");
set_perm(0, 0, 0755, "/tmp/machine_match");
package_extract_file("META-INF/imei.dat", "/tmp/imei.dat");
if (run_program("/tmp/machine_match", "/tmp/imei.dat") != "0") then
ui_print("machine not match");
delete(/tmp/imei.dat);
abort();
endif;
delete(/tmp/imei.dat);
And remove this :
assert(package_extract_file("logo.img", "/tmp/logo.img"),
write_raw_image("/tmp/logo.img", "logo"),
delete("/tmp/logo.img"));
assert(package_extract_file("uboot.img", "/tmp/uboot.img"),
write_raw_image("/tmp/uboot.img", "uboot"),
delete("/tmp/uboot.img"));
Save edited file.
5. Pack again files in .zip arhive (any name except update.zip)
6. Remove or rename any update.zip original file from root sd card
Now you can flash rom with twrp recovery and now you have latest Flyme rom but still have unlocked bootloader and twrp recovery.
I find this instructions on russian forums, and I try it and everything works fine.
You can try it on your responsibility.
Ok, thanks. Where have you downloaded twrp recovery?
Now i have philz 6 recovery, if i flash modded flyme ROM, can i flash it with philz?
I'm pretty sure that if you do a clean install (formating /system /data and /cache) Flyme will reinstall stock recovery. You need to delete recovery-from-boot.p and all install-recovery.sh and install-recovery-original.sh from system file
TWRP (uncompiled and recompiled by myself to change splash screen (it now fit the screen) http://www.mediafire.com/download/26b963db1k489db/new-recovery.img
Can i flash it trough flashify app?
I was flash twrp with fastboot
You can via flashify but fastboot is safer
PERFECT ! I worked hard to make it graphically perfect : http://www.mediafire.com/download/z3ssqo6lnyvwki7/TWRPr4.img
Just flash it with "fastboot flash recovery TWRPr4.img"
Are the russian flyme roms modded to can flash it vía twrp?
yes you can flash them Russians have ported this TWRP and are making some good stuff on flyme rom
Ok, i will try those Roms. Thankyou so much.
furious.builder said:
I'm pretty sure that if you do a clean install (formating /system /data and /cache) Flyme will reinstall stock recovery. You need to delete recovery-from-boot.p and all install-recovery.sh and install-recovery-original.sh from system file
Click to expand...
Click to collapse
I can't understand you. If is already tried that you can flash modded flyme Roma from twrp, why you say that flyme will reinstall stock recovery?
Are you sure?
I'm talking about stock Flyme not modded Flyme Stock flyme contains scripts like recovery-from-boot.p and install-recovery.sh in system.new.dat which reinstall stock recovery, it's what it does to my MX4, but modded flyme certainly don't have these scripts
Understood. Thanks!
furious.builder said:
PERFECT ! I worked hard to make it graphically perfect : http://www.mediafire.com/download/z3ssqo6lnyvwki7/TWRPr4.img
Just flash it with "fastboot flash recovery TWRPr4.img"
Click to expand...
Click to collapse
Is there any risk of brick flashing twrp vía fastboot?
I have seen many mx4 bricked flashing custom recovery with flashify.
Via fastboot there is nearly no risks because if it's flashed it will boot, and if there is something wrong during unlock fastboot has not been unlock so it will not flash, but don't use the one from my link, there is a newer from emmaus.pro

TWRP has been ported

just links to original thread where recovery was first installed.
plus warning notes.
important for all who want to install custom recovery and root. It is unknown if it is dangerous to your device to accept OAT updates when you have done this. So If taking update is something you want or need to do you must be able to undo these changes.
howto's on undoing recovery and root to come later(maybe). Basically you need to use the backup you made in first steps of process to undo any system changes you have made then flash stock recovery.img and stock boot.img
http://forum.xda-developers.com/showpost.php?p=67890278&postcount=486
It appears that it's possible to boot both TWRP, and the modified boot.img (for systemless root with SuperSu).
This seems to indicate that the bootloader is unlocked. So free for all !
bibikalka said:
It appears that it's possible to boot both TWRP, and the modified boot.img (for systemless root with SuperSu).
This seems to indicate that the bootloader is unlocked. So free for all !
Click to expand...
Click to collapse
If it is: hyyyyyyyyyyyyype!
CM13 lets go!
mrmazak said:
just links to original thread where recovery was first installed.
plus warning notes.
important for all who want to install custom recovery and root. It is unknown if it is dangerous to your device to accept OAT updates when you have done this. So If taking update is something you want or need to do you must be able to undo these changes.
howto's on undoing recovery and root to come later(maybe). Basically you need to use the backup you made in first steps of process to undo any system changes you have made then flash stock recovery.img and stock boot.img
http://forum.xda-developers.com/showpost.php?p=67890278&postcount=486
Click to expand...
Click to collapse
Please take a look at this post :
http://forum.xda-developers.com/showpost.php?p=68734057&postcount=23
It appears that TWRP cannot write to /dev/block/mmcblk0boot0 for some reason ...
bibikalka said:
Please take a look at this post :
http://forum.xda-developers.com/showpost.php?p=68734057&postcount=23
It appears that TWRP cannot write to /dev/block/mmcblk0boot0 for some reason ...
Click to expand...
Click to collapse
so far all attempts we have tried have failed to write to the preloader.
I am far from professional with this stuff, but i am reading through the update script and I think the little kernel (LK) has something to do with the write protect.
Also the update extracts a u-boot image to the LK partition before coping the lk.bin over that and this is done before the preloader. I think that must be releasing a software write protect on the preloader section. but I have not been able to test this theory yet.
so if this is correct then the new lk.bin while blocking the spft connection, allows the preloader to be writeable.
spft also fails to write to mmcblk0boot0. Attempts to DD to it also give write not allowed.
When i tried to "download" backed-up preloader back to phone, it failed and left phone soft-bricked with DL-TOOL Fail. (an error message generated from LK (little kernel)). Writing preloader back-up back to phone with "Miricle Box" did bring phone back to life. Although so far phone with 6.6 also fails to connect to that software also.
sorry I did not create the recovery, I just announced it. So i dont know how to fix it
bibikalka said:
Please take a look at this post :
http://forum.xda-developers.com/showpost.php?p=68734057&postcount=23
It appears that TWRP cannot write to /dev/block/mmcblk0boot0 for some reason ...
Click to expand...
Click to collapse
i just checked. twrp is able to flash preloader. i went back and forth between prime v6.1 preloader and non-prime v12 and did readback , then verified the md5. I t does work,
mrmazak said:
i just checked. twrp is able to flash preloader. i went back and forth between prime v6.1 preloader and non-prime v12 and did readback , then verified the md5. I t does work,
Click to expand...
Click to collapse
What is the command that you used ???
bibikalka said:
What is the command that you used ???
Click to expand...
Click to collapse
litteraly just used the amazon update but took stuff out
This has only been tested on twrp. The code is unrefined and as with every modification you do on your phone, It is your responsibility to know what you are doing.
edited code to be least amount needed
Code:
ui_print("start to update preloader");
assert(package_extract_file("preloader_p6601.bin", "/tmp/preloader_p6601.bin"),
write_raw_image("/tmp/preloader_p6601.bin", "/dev/block/mmcblk0boot0"),
delete("/tmp/preloader_p6601.bin"));
MD5 for update_non.zip = fb9e2f7fce62a618a5fef69364b2127f
MD5 for update_prime.zip = fda9af43174691d4de50ce438274263c
*****attachments removed for the moment, more testing on 6.6 preloader , is underway*****
One tester claims it worked, but then imeadiatly bricked phone with spft. So now to play it safe for the general public I am looking for more testers to try. Let me know if your interested, and I will release the file for you.
mrmazak said:
This has only been tested on twrp. The code is unrefined and as with every modification you do on your phone, It is your responsibility to know what you are doing.
Code:
mount("ext4", "EMMC", "/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/system", "/system", "max_batch_time=0,commit=1,data=ordered,barrier=1,errors=panic,nodelalloc");
ui_print("Source: BLU/R1_HD/R1_HD:6.0/MRA58K/1469800396:user/release-keys");
ui_print("Target: BLU/R1_HD/R1_HD:6.0/MRA58K/1471954662:user/release-keys");
ui_print("Verifying current system...");
show_progress(0.100000, 0);
assert(run_program("/system/bin/dd", "if=/dev/zero", "of=/proc/driver/mtd_writeable", "bs=3", "count=1"));
assert(package_extract_file("uboot.img", "/tmp/lk.img"),
write_raw_image("/tmp/lk.img", "lk"),
delete("/tmp/lk.img"));
apply_sig(package_extract_file("sig/boot.sig"), "/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/boot");
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("lk.bin", "/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/lk");
package_extract_file("secro.img", "/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/secro");
package_extract_file("logo.bin", "/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/logo");
assert(package_extract_file("preloader_p6601.bin", "/tmp/preloader_p6601.bin"),
write_raw_image("/tmp/preloader_p6601.bin", "/dev/block/mmcblk0boot0"),
delete("/tmp/preloader_p6601.bin"));
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("trustzone.bin", "/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/tee2");
set_mtupdate_stage("/cache/recovery/last_mtupdate_stage", "2");
endif;
switch_active("tee1", "tee2");
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("trustzone.bin", "/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/tee1");
set_mtupdate_stage("/cache/recovery/last_mtupdate_stage", "4");
endif;
switch_active("tee2", "tee1");
),
ui_print("main loader images are already updated");
);
delete("/cache/recovery/last_mtupdate_stage");
ui_print("Patching remaining system files...");
unmount("/system");
MD5 for update_non.zip = fb9e2f7fce62a618a5fef69364b2127f
MD5 for update_prime.zip = fda9af43174691d4de50ce438274263c
Click to expand...
Click to collapse
Sry can you explain to me what your zip/script does please in detail?
KazuDante said:
Sry can you explain to me what your zip/script does please in detail?
Click to expand...
Click to collapse
of course
this update.zip is a project i have been working on. It is the amazon script stripped of the version checks. As far as the reason why it is done they way it is, I dont really know. But I have used it several times. I went back and forth to make sure it did change the preloader. I was able to check by reading the md5 of preloader after each time i ran the update in recovery. It will replace the lk partition(lk.bin or
'llitle boot kernel" and the preloader.
this was an effort to reenable the use of spft, that Amazon or Blu has taken away on the recent 6.6 update.
the lk.bin and preloader_p0661.bin files in the zips are pulled from my two phones. The u-boot.img is from the 6,6 update.
there is some more codes in the script that get skipped as I left the files out of the zip.
mrmazak said:
of course
this update.zip is a project i have been working on. It is the amazon script stripped of the version checks. As far as the reason why it is done they way it is, I dont really know. But I have used it several times. I went back and forth to make sure it did change the preloader. I was able to check by reading the md5 of preloader after each time i ran the update in recovery. It will replace the lk partition(lk.bin or
'llitle boot kernel" and the preloader.
this was an effort to reenable the use of spft, that Amazon or Blu has taken away on the recent 6.6 update.
the lk.bin and preloader_p0661.bin files in the zips are pulled from my two phones. The u-boot.img is from the 6,6 update.
there is some more codes in the script that get skipped as I left the files out of the zip.
Click to expand...
Click to collapse
oh ok I understand , and yea that is a good thing , specially for the future , hope they arent on xda :highfive: .

anyone here use flashfire to ota update (systemless root)?

ok so i have switched from system mode root to systemless rooting in hopes to do ota updates without flashing that 1.5gb install every week.
now i see my phone downloads the small ota file.
obviously when i tried to just simply update that failed.
fiy: i have the following installed
MagiskSU
systemless xposed
automagisk
TWRP recovery
so i tried to use flashfire and flash the ota (system still unmodified)
and the ota "appeared" to be installed and did the whole loading bar on boot. But when that finished i checked in the settings and i wasnt updated.
then i tried flashing back stock recovery for a sec then try ota again. this time i saw a text flash fast this time saying
"Boot has unexpected contents"
does that mean i have to somehow flash stock boot? i thought flashfire is supposed to do that automatically.
anyone have know the way im supposed to install it?
Did you have the ota file? Please post here
http://en.miui.com/extra.php?mod=rom/download&r=303&mobile=no
Sent from my Redmi 3S using Tapatalk
If you rooted, install exposed, or anything which modified boot.img, you will fail to update ota.
Flash new original boot.img (you can get this on your earlier zip rom), and then update ota.
In short way, updater will calculate old boot.img's checksum. If it mismatch, updater stop to work
SILF0X said:
If you rooted, install exposed, or anything which modified boot.img, you will fail to update ota.
Flash new original boot.img (you can get this on your earlier zip rom), and then update ota.
In short way, updater will calculate old boot.img's checksum. If it mismatch, updater stop to work
Click to expand...
Click to collapse
Are you sure? I tried to install OTA in stock rom with TWRP installed. It checks the Recovery too. OTAs won't install if any single partition is modified.
esarve said:
Are you sure? I tried to install OTA in stock rom with TWRP installed. It checks the Recovery too. OTAs won't install if any single partition is modified.
Click to expand...
Click to collapse
Maybe.
Try to remove this line :
Code:
if (range_sha1("/dev/block/bootdevice/by-name/system", "...") == "2f76590739094f44c4606ec916f33ba31bea0630" || 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;
And then this one :
Code:
ui_print("Verifying the updated system image...");
if range_sha1("/dev/block/bootdevice/by-name/system", "...") == "5bde53bfa9f927284e1adabf81fe42b7740a7210" then
if range_sha1("/dev/block/bootdevice/by-name/system", "...") == "fcbc37abfcd8b47199c1236416a106c104cf3cc2" then
ui_print("Verified the updated system image.");
else
abort("system partition has unexpected non-zero contents after OTA update");
endif;
else
abort("system partition has unexpected contents after OTA update");
endif;
SILF0X said:
Maybe.
Try to remove this line :
Code:
if (range_sha1("/dev/block/bootdevice/by-name/system", "...") == "2f76590739094f44c4606ec916f33ba31bea0630" || 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;
And then this one :
Code:
ui_print("Verifying the updated system image...");
if range_sha1("/dev/block/bootdevice/by-name/system", "...") == "5bde53bfa9f927284e1adabf81fe42b7740a7210" then
if range_sha1("/dev/block/bootdevice/by-name/system", "...") == "fcbc37abfcd8b47199c1236416a106c104cf3cc2" then
ui_print("Verified the updated system image.");
else
abort("system partition has unexpected non-zero contents after OTA update");
endif;
else
abort("system partition has unexpected contents after OTA update");
endif;
Click to expand...
Click to collapse
This is a block based OTA I don't think you can edit that part.
Sent from my Redmi 3S using Tapatalk
xdarkmario said:
This is a block based OTA I don't think you can edit that part.
Sent from my Redmi 3S using Tapatalk
Click to expand...
Click to collapse
https://forum.xda-developers.com/xi...or-how-to-flash-miui-ota-incremental-t3570049

Categories

Resources