[Recovery][UNOFFICIAL] TWRP Dirty Port For G7 Play

Spaceminer

Senior Member
Sep 9, 2016
1,159
547
123
Olympus Mons
So the backups not restoring and boot looping device is not exactly TWRP s fault

Sent from my moto g(7) play using Tapatalk
Yes and no. Some things inside of twrp just needed to be edited. The fact that it's a port, isn't the problem though if that makes sense. If it were built from source there'd be less things that need fixing but the end result is essentially the same.

source > build > test > fix > bug free twrp

vs

port > build > test > fix > bug free twrp


The only major difference is that the official build would get more regular updates, and be synced with the latest commits automagically. With a port you just get it working, and leave it alone until an OTA breaks it.
 

PoochyX

Senior Member
Oct 23, 2016
2,171
417
143
Bro once you get this phone you can make the magic happen all the way threw like you did with the G6

([emoji3590]09-09-18[emoji3590])
 

PoochyX

Senior Member
Oct 23, 2016
2,171
417
143
Update patched dtbo didn't work had black screen so couldn't boot into twrrp, so I held power button and rebooted back into bootloader mode and fastboot dtbo that boots back into twrp (stock dtbo would of also had black screen) fastboot into twrp formated data ran new installer and rebooted into twrp then touch screen became non responsive so held power button rebooted into bootloader mode and fast booted twrrp once in screen was active flashed decrypted you recomended not newest one cuss you said it doesnt decrypt properly and rebooted phone boot looped so I reflashed firmware with just the mod boot and phone still boot (test phone made phone boot loop period) so now reflashing orginal firmware package

([emoji3590]09-09-18[emoji3590])
 
Last edited:

PoochyX

Senior Member
Oct 23, 2016
2,171
417
143
My SD card just bricked on me so it may be slow for me testing stuff until I get payed next week to get another one

Sent from my Phh-Treble vanilla using Tapatalk
 

Spaceminer

Senior Member
Sep 9, 2016
1,159
547
123
Olympus Mons
Update patched dtbo didn't work had black screen so couldn't boot into twrrp, so I held power button and rebooted back into bootloader mode and fastboot dtbo that boots back into twrp (stock dtbo would of also had black screen) fastboot into twrp formated data ran new installer and rebooted into twrp then touch screen became non responsive so held power button rebooted into bootloader mode and fast booted twrrp once in screen was active flashed decrypted you recomended not newest one cuss you said it doesnt decrypt properly and rebooted phone boot looped so I reflashed firmware with just the mod boot and phone still boot (test phone made phone boot loop period) so now reflashing orginal firmware package

([emoji3590]09-09-18[emoji3590])
So the newer twrp worked until after you flashed the disabler; is that correct?

---------- Post added at 08:48 AM ---------- Previous post was at 08:45 AM ----------

My SD card just bricked on me so it may be slow for me testing stuff until I get payed next week to get another one

Sent from my Phh-Treble vanilla using Tapatalk
No worries. I know how that goes. You can't really test without one especially due to the circumstances. I really need to just buy the phone at this point. I'm pretty sure I could figure it out in a few hours if I had one in my hands.
 
  • Like
Reactions: BobbyBlunt

BobbyBlunt

Member
Jan 3, 2014
28
5
0
I've seen that there has been new developments. I will test what you have worked up and report back.

Awfully kind for a guy that doesn't own the device

My biggest worry before was the fact I didn't have all of my 2fa stuff backed up. When you 2fa everything and don't use an online solution, a soft brick becomes a nightmare ?
 
Last edited:
  • Like
Reactions: Spaceminer

aIecxs

Senior Member
Feb 17, 2016
930
291
73
@Spaceminer proof me wrong but i believe G7 uses FBE+metadata encryption (ice) so the right flags for TWRP should look like this (not sure about G7 Play)

Please note the mounttodecrypt flag for modem
 
Last edited:

Spaceminer

Senior Member
Sep 9, 2016
1,159
547
123
Olympus Mons
@Spaceminer proof me wrong but i believe G7 uses FBE+metadata encryption (ice) so the right flags for TWRP should look like this (not sure about G7 Play)

Please note the mounttodecrypt flag for modem
It's device specific. Here's an example of what it took to enable file based decryption for the Pocophone F1. They had to make changes to twrp's BoardConfig.mk before compiling. Most devices are using vold & keymaster. I'm not sure about the G7. Their twrp fstab doesn't have any mention of "mount to decrypt." and neither does the one from their stock boot/recovery.img. What you linked to is for an ASUS device.
 
  • Like
Reactions: aIecxs

Spaceminer

Senior Member
Sep 9, 2016
1,159
547
123
Olympus Mons
For anyone curious, I believe that I've found the source of the problem. It's the dtbo.img. More specifically it's the verify flag. Motorola has set it up so that if this flag exists, then encryption gets forced no matter what. I discovered this inadvertently while trying to roll back my G6 Play to Oreo. This flag for the G6 Play exists in the boot.img. (Because that's where our dtbo sits.) The point is, even with "encryptable=" set in /vendor/etc/fstab.qcom the device still gets encrypted if the verify flag is found. My guess is some lib in vendor gets triggered to encrypt everything. The disabler successfully changes the vendor flag like it should, but neither Magisk or the disabler are patching the dtbo.img. I don't know if not patching the dtbo is a Magisk or twrp issue at this point, so please don't drop any bug reports in the Magisk forums for the time being.

The short end is, twrp in it's current state only needs one more flag adjusted, and I'll have to figure out how to either build or patch a dtbo.img for you guys. After that I believe everything should work correctly. I can purchase a G7 Play in just a few more days, so hopefully I'll get this sorted out very soon.
 

PoochyX

Senior Member
Oct 23, 2016
2,171
417
143
For anyone curious, I believe that I've found the source of the problem. It's the dtbo.img. More specifically it's the verify flag. Motorola has set it up so that if this flag exists, then encryption gets forced no matter what. I discovered this inadvertently while trying to roll back my G6 Play to Oreo. This flag for the G6 Play exists in the boot.img. (Because that's where our dtbo sits.) The point is, even with "encryptable=" set in /vendor/etc/fstab.qcom the device still gets encrypted if the verify flag is found. My guess is some lib in vendor gets triggered to encrypt everything. The disabler successfully changes the vendor flag like it should, but neither Magisk or the disabler are patching the dtbo.img. I don't know if not patching the dtbo is a Magisk or twrp issue at this point, so please don't drop any bug reports in the Magisk forums for the time being.



The short end is, twrp in it's current state only needs one more flag adjusted, and I'll have to figure out how to either build or patch a dtbo.img for you guys. After that I believe everything should work correctly. I can purchase a G7 Play in just a few more days, so hopefully I'll get this sorted out very soon.
That is fantastic stuff [emoji817]

([emoji3590]09-09-18[emoji3590])
 

filipedonato

Member
Jul 21, 2013
49
18
0
Queimadas, Paraíba
For anyone curious, I believe that I've found the source of the problem. It's the dtbo.img. More specifically it's the verify flag. Motorola has set it up so that if this flag exists, then encryption gets forced no matter what. I discovered this inadvertently while trying to roll back my G6 Play to Oreo. This flag for the G6 Play exists in the boot.img. (Because that's where our dtbo sits.) The point is, even with "encryptable=" set in /vendor/etc/fstab.qcom the device still gets encrypted if the verify flag is found. My guess is some lib in vendor gets triggered to encrypt everything. The disabler successfully changes the vendor flag like it should, but neither Magisk or the disabler are patching the dtbo.img. I don't know if not patching the dtbo is a Magisk or twrp issue at this point, so please don't drop any bug reports in the Magisk forums for the time being.

The short end is, twrp in it's current state only needs one more flag adjusted, and I'll have to figure out how to either build or patch a dtbo.img for you guys. After that I believe everything should work correctly. I can purchase a G7 Play in just a few more days, so hopefully I'll get this sorted out very soon.
Amazing!
 

PoochyX

Senior Member
Oct 23, 2016
2,171
417
143
Can someone with this device please pull /proc/config.gz and send it to me? I want to make some comparisons against your kernel source. I'm going to try building twrp while I'm waiting to get this phone.



Edit: Got it!
Bro you got the phone you about to drop twrp on dudes [emoji817]

([emoji3590]09-09-18[emoji3590])
 

Spaceminer

Senior Member
Sep 9, 2016
1,159
547
123
Olympus Mons
Haha. @Spaceminer you got your G7 Play. Yessir.... Tried sending you a PM. I need your PayPal address so I can send you a little something for your work. Thanks.
You're either blocked from sending messages, or you need to change your account settings. I tried sending you a pm but it just gives me this instead.
 

Attachments

Spaceminer

Senior Member
Sep 9, 2016
1,159
547
123
Olympus Mons
@PoochyX

Literally 2min of work got me this on the G6 Play with Orange Fox. You can barely see part of it, but there's a "reboot system" button on the bottom and it does work. All this requires is some UI edits, and maybe some image resizing to fix it. I also nixed the installer, just to make sure it'd boot up. That's why it thinks it's not installed. That kind of work is child's play for me. It'll be very easy to port.

By the way, did you ever pull /vendor/bin/init.mmi.hab.sh?

Also, check out the what's in the update binary for Orange Fox. Remember telling me that sometimes the stock recovery would come back? I think this explains it.
 

Attachments

  • Like
Reactions: xtermmin

PoochyX

Senior Member
Oct 23, 2016
2,171
417
143
@PoochyX



Literally 2min of work got me this on the G6 Play with Orange Fox. You can barely see part of it, but there's a "reboot system" button on the bottom and it does work. All this requires is some UI edits, and maybe some image resizing to fix it. I also nixed the installer, just to make sure it'd boot up. That's why it thinks it's not installed. That kind of work is child's play for me. It'll be very easy to port.



By the way, did you ever pull /vendor/bin/init.mmi.hab.sh?



Also, check out the what's in the update binary for Orange Fox. Remember telling me that sometimes the stock recovery would come back? I think this explains it.
Yeah I removed hab.sh on a fresh install while trying to assemble twrp and it still didnt stick with stock and if u meant did I send u hab.sh it's posted in post #356 was looking at the update binary is this the key to getting twrp to function and also we might as well transcend to orange fox and just skip twrp ?

Sent from my moto g(7) play using Tapatalk

---------- Post added at 06:56 PM ---------- Previous post was at 06:46 PM ----------

So basically orange fox is a very plausible scenario for the G6 play and when the twrp is sorted out for the G7 play that same plausibility will be there for G7 play also

Sent from my moto g(7) play using Tapatalk
 
  • Like
Reactions: Spaceminer