[TWRP] Unofficial custom recovery for MT6580-based clones.

Search This thread

blakegriplingph

Senior Member
May 13, 2011
1,069
157
Amazon Fire
Realme C3
My phone is in some strange state:
What I did:

adb devices - successfully listed my device
adb reboot bootloader
fastboot flash recovery c:\adb\recovery.img - got this error message: "FAILED (remote: 'not allowedin locked state')"

Locked bootloader, unlocking ...

fastboot flashing unlock
- (bootloader) Start unlock flow
- OKAY [ 18.800s]
- Finished. Total time: 18.816s

Flashing the recovery.img

fastboot flash recovery c:\adb\recovery.img
Sending 'recovery' (10226 KB) OKAY [ 0.359s]
Writing 'recovery' OKAY [ 0.640s]
Finished. Total time: 1.030s

Success :)

fastboot reboot-bootloader
Rebooting into bootloader OKAY [ 0.000s]
Finished. Total time: 0.016s

fastboot erase cache (I don't know if it was a good idea but it was in the tutorial, I was following)
******** Did you mean to fastboot format this ext4 partition?
Erasing 'cache' OKAY [ 0.109s]
Finished. Total time: 0.125s

fastboot reboot
Rebooting OKAY [ 0.000s]
Finished. Total time: 0.016s

Now when booting the phone complains:
Orange state
Your device has been unlocked and can't be trusted
Your device will boot in 5 seconds

In 5 second it starts to boot but it stays forever on the "POWERED BY android" logo

I can boot to TWRP recovery, so I did and flashed magisk (because the main goal was to root my phone) and selected to delete cache/dalvik.

The phone info changed

BB Chip : mt6580
MS Board. : ALIGATORS5065
Build Time : Tue Jan 23 15:35:41 CST 2018
Krenel Ver. : 3.18.35+ (server@droi) (gcc version 4.8 (GCC)) #2 SMP PREEMPT Tue Jan 23 16:11:14 CST 2018
Android Ver. : 7.0
SW Ver. : alps-mp-n0.mp2-V1-droi6580.weg.n
Custom Build Verno. : unknown
IMEI1 : unknown
IMEI2 : unknown
Modem Ver. ALIGATOR_S5065_OS_1.1_2018 0123
Bar code : unknown

The IMEIs and Bar code are now "uknown".

What did I wrong and what to do, to fix it?

We can continue in this thread https://xdaforums.com/android/help/help-rooting-aligator-s5065-duo-mt6580-t3926132 as it gets a little OT

PS: And it seems I'm not able to switch the phone off - it reboots ...

NVRAM data must have been wiped off somehow, as that's one reason as to why your serial numbers have gone kaput.
 

Zdendav

Senior Member
Jul 22, 2005
61
10
"Ok try this may possibly be like 200kb to big" - meaning the recovery image, could this be the culprit?
I thought, if it was too big, I would get an error message?
But to me it seems, that the recovery partition is not near the NVRAM partition, I've attached the scatter from the downloaded zip.
 

Attachments

  • MT6580_Android_scatter.txt
    8.5 KB · Views: 67

Matty1993

Senior Member
May 7, 2018
629
316
"Ok try this may possibly be like 200kb to big" - meaning the recovery image, could this be the culprit?
I thought, if it was too big, I would get an error message?
But to me it seems, that the recovery partition is not near the NVRAM partition, I've attached the scatter from the downloaded zip.


Glad my TWRP is working well for you glad i used 3.2.3 as its got latest decryption features :)

Anyhow the extra 200kb wont do that to nvram if it was to big for the BOOTIMG partition fastboot would have stopped the flash before it began and given an error message of check the load image size is correct or not

Only thing i can think of is that you installed magisk before decrypting the encrytable storage and then trying to boot, as for orange state format /data in wipe menu it will unencrypt the storage.

As for getting your imei back you need to flash your stock firmware back and it will come back no problem ive had it dissapear on my MT6737M more times than i can count stock flash always brings it back, i noticed you mentioned about your pmt info being changed for the rom this means that your scatter is not absolute correct in all aspects,

Load each file individually to see if any will give you any errors on any partitions, dont format to change the pmt either youll be stuck on infinite bootlogo with little hope of fixing it more than likely,

And dont flash preloader, or lk with that scatter you will only make things worse rule number 1 with TWRP also always backup EFS/NVRAM before doing anything especially with magisk and all the patching it does.

hope this info helps :)
 
Last edited:

Zdendav

Senior Member
Jul 22, 2005
61
10
First, let me thank you for the recovery image :)

You confirmed, what I thought, that flashing the recovery image is not the culprit.

Could this be the culprit:
fastboot erase cache (it was in the tutorial, I was following)
******** Did you mean to fastboot format this ext4 partition?
Erasing 'cache' OKAY [ 0.109s]
Finished. Total time: 0.125s

After this I rebooted with this command:
fastboot reboot
Rebooting OKAY [ 0.000s]
Finished. Total time: 0.016s

Then came the orange status message, started booting and then it was stuck in the "POWERED BY android" logo.
By a long power button press I made it to reboot and this time I selected recovery by holding the volume button, it booted successfully to TWRP, so I used the opportunity a flashed magisk, I also selected the choice erase cache/dalvik during the magisk flashing.
I rebooted (from the TWRP menu) and again orange status (I thought it is because I unlocked the bootloader) and then stuck in the "POWERED BY android" logo.

I didn't encrypt anything - is it encrypted by default?

I have a full backup - readback in SP Flash tool using the scatter file from the downloaded zip. Flashing it back (without preloader) using the same scatter should bring my phone back, at least I think so ...

But I would like to know the culprit, because after flashing it back, I have to repeat the whole procedure and I want to avoid the error which caused this problem.
 
Last edited:

Matty1993

Senior Member
May 7, 2018
629
316
First, let me thank you for the recovery image :)

You confirmed, what I thought, that flashing the recovery image is not the culprit.

Could this be the culprit:
fastboot erase cache (it was in the tutorial, I was following)
******** Did you mean to fastboot format this ext4 partition?
Erasing 'cache' OKAY [ 0.109s]
Finished. Total time: 0.125s

After this I rebooted with this command:
fastboot reboot
Rebooting OKAY [ 0.000s]
Finished. Total time: 0.016s

Then came the orange status message, started booting and then it was stuck in the "POWERED BY android" logo.
By a long power button press I made it to reboot and this time I selected recovery by holding the volume button, it booted successfully to TWRP, so I used the opportunity a flashed magisk, I also selected the choice erase cache/dalvik during the magisk flashing.
I rebooted (from the TWRP menu) and again orange status (I thought it is because I unlocked the bootloader) and then stuck in the "POWERED BY android" logo.

I didn't encrypt anything - is it encrypted by default?

I have a full backup - readback in SP Flash tool using the scatter file from the downloaded zip. Flashing it back (without preloader) using the same scatter should bring my phone back, at least I think so ...

But I would like to know the culprit, because after flashing it back, I have to repeat the whole procedure and I want to avoid the error which caused this problem.


All good mate :) yeah orange state is because you unlocked bootloader and didnt factory reset and format /data before installing magisk and rebooting

Your device comes with out of the box encryption in your boot.img fstab your system path will be /dev/block/platform/mtk-msdc/******/msdc/by-name/system /system ext4 ro wait, "verify"

You will also more than likely have a .file called verity key in the Initrd,


Wiping cache wouldnt have caused it, its only because you didnt format the data once bootloader was unlocked so the verity key has been flagged as tampered and will not allow boot,

To clear this up boot to TWRP tap the wipe tab, then tap the format tab, type yes & format this will format the encryption from the device

Run a factory reset once the format of /data is complete to wipe magisk as it will have patched the boot.img and it should boot up no problems,

If it dosent its probably because theres magisk parts in boot.img still as magisk patches init.rc and a few other places so flash your stock boot.img with fastboot, then boot to TWRP, as soon as it boots go to wipe and format then run factory reset,

Reboot after to see if the orange state is cleared up as very rarely but sometimes magisk can cause issues on some MTK devices so dont flash the before reboot, once /data if formatted in TWRP it stays unencrypted until stock firmware is flashed back and re encrypted,

If you still get dramas with orange state let me know ill manually patch the dm-verity out of your boot.img for you
 
  • Like
Reactions: alecxs

Zdendav

Senior Member
Jul 22, 2005
61
10
I did all the steps:

- wipe, format
- factory reset
hangs on the "POWERED BY android" logo, when trying to boot

- flashed boot.img in fastboot
- reboot
I was not fast enough to go onto TWRP, it tried to boot, hangs on the "POWERED BY android" logo
-reboot into TWRP
- wipe, format
- factory reset
still hangs on the "POWERED BY android" logo, when trying to boot

I can borrow exactly the same phone from a relative (fully working) - maybe I should do a full backup of it, then I'll have "clean" images of boot, recovery etc.

Meanwhile I did another full backup and this time I used WwR MTK v2.30 to create a correct scatter.
I attach both scatter files.
 

Attachments

  • Mine_MT6580_Android_scatter.txt
    9.9 KB · Views: 33
  • From_zip_MT6580_Android_scatter.txt
    8.5 KB · Views: 31

osefstoo

New member
May 8, 2019
1
0
Hi when you have time can you try this boot+recovery+scatter : mega.nz/#!rZ8ngSDA!aV0yUC2CithDxqdkVIxcG7xlh_YNL9CGWk6FW5NA58E
 
Last edited:

mbnshq

Member
May 21, 2019
5
0
Universe
Qmobile S8 Mt6580

Any here Who can tell me that How can i root this phone I have used this all soft but cant root this phone kingroot,kingoroot,iroot,360root,faramaroot please help me how i can root this device thanks
 

blakegriplingph

Senior Member
May 13, 2011
1,069
157
Amazon Fire
Realme C3
Any here Who can tell me that How can i root this phone I have used this all soft but cant root this phone kingroot,kingoroot,iroot,360root,faramaroot please help me how i can root this device thanks

Sounds a little off-topic here, eh? But have you tried Magisk? At least with that you don't have to mess with the system partition, just boot.img.
 
  • Like
Reactions: TheMadScientist

mbnshq

Member
May 21, 2019
5
0
Universe
bro i send you my Phone details as ss can you please guide me
Z71bvGiVzBy1


---------- Post added at 02:04 AM ---------- Previous post was at 02:02 AM ----------

bro can you please guide me
Z71bvGiVzBy1


---------- Post added at 02:07 AM ---------- Previous post was at 02:04 AM ----------

i have done twrp for mt6580 from sp flash tool but it was installed but mobile can't go in recovery mode

---------- Post added at 02:10 AM ---------- Previous post was at 02:07 AM ----------

Ge3Eph7jI4v5
 

blakegriplingph

Senior Member
May 13, 2011
1,069
157
Amazon Fire
Realme C3
bro i send you my Phone details as ss can you please guide me
Z71bvGiVzBy1


---------- Post added at 02:04 AM ---------- Previous post was at 02:02 AM ----------

bro can you please guide me
Z71bvGiVzBy1


---------- Post added at 02:07 AM ---------- Previous post was at 02:04 AM ----------

i have done twrp for mt6580 from sp flash tool but it was installed but mobile can't go in recovery mode

---------- Post added at 02:10 AM ---------- Previous post was at 02:07 AM ----------

Ge3Eph7jI4v5

Mind if I refer you to this thread? Don't have the time and/or patience to do TWRP recoveries by request anymore, sorry:
https://xdaforums.com/android/general/unofficial-twrps-devices-source-code-t3833338
 
Aug 22, 2018
36
7
I recently received a counterfeit MT6580 clone of a K20 Pro. I am happy to struggle through the TWRP porting process for this guy. I cloned your repo but ran into build problems concerning the omni device not being immediately found. Are there any other steps I should try outside of your compilation bullets on github?

If you are detached from supporting this type of port I could definitely use a pointer to a TWRP porting guide. I am comfortable building Android/Lineage environments but TWRP builds are new to me.
 
Aug 22, 2018
36
7
maybe a bit outdated but MT6580 is old device https://xdaforums.com/showthread.php?t=2798257 (you can use Generic TWRP v3.3.1-0 from Samad Segmane as base i have ported MT6580 myself too)

Thanks for the link. I looked into EasyMagic quite a bit but ran into the "Aborting: Img too big. Partitions overlap." I've attempted the fixes listed in the forum topic but nothing seems to ever change during the process and the tool does not provide much more than the same abort strings in a log.txt file.

When you say you used Samad Segmane as a base and ported do you mean I could clone that TWRP source down and follow this guide?
 
Aug 22, 2018
36
7
with porting i mean just replace kernel file from your stock recovery, no need to compile from source

This bit of advice worked perfectly. I unpacked the twrp image "twrp-3-3-1-0-recovery-for-MT6580_cubot_king_kong.zip" and then replaced the existing zImage with the kernel I lifted from my device. I pulled the mkbootimg source and fixed the address offsets mentioned during the unpacking phase of my original recovery. After rebuilding the new TWRP image I flashed it down and it booted!

Now onto building a kernel image.
 
Aug 22, 2018
36
7
just a hint AIK is very noob friendly one-klick-tool. all you need to do is disable Antivir (will give false heuristic for sudo.exe but you can trust osm0sis) download the zip, extract it run the unpackimg.bat

I wanted to test out using AIK but I use Linux 95% of the time for the build environment and the descriptions implied it was a Windows tool. Most of the random Android kernels I have experience with are a lot less painful to build in the Linux environment.

Unfortunately my clone's kernel tag, "ALPS.L1.MP6.V2.19_FLYCOM6580.WE.9.L_P1", doesn't seem to return any hits and there is no config built into the image. The closest thing I have found to kernel source are instructions on building the clone's kernel in a foreign language and this github repository. I have no idea how close or far off this might be for building but I think I can use TWRP to get /proc/last_kmsg out after a build attempt.
 
  • Like
Reactions: blakegriplingph

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    DISCLAIMER: I am not responsible if your device gets messed up royally, explodes or causes you to go nuts because you couldn't get this thing to work. I'm no expert coder either, but I am willing to fix things as much as I can.

    I actually did this as there's practically no support whatsoever for that counterfeit phone of mine (yeah I know, you get what you pay for, but I bought this Galaxy S7 clone mostly for science). None of the existing porting tools work for the MT6580, and while manually porting an existing TWRP image to my phone works, it simply isn't cutting it as most of these recoveries are designed for a conventional framebuffer setup, not on devices with flipped LCDs. Fortunately there's this source tree for the Infinix Hot 2 TWRP port, and as the partition setup seems to be largely the same apart from differing capacities and the aforementioned LCD issue, this had to be done.

    This should theoretically work on HDC S7 clones and a few others albeit with a few modifications, though I ported this from source with the Z6U030/GXQ6580 in mind. I know the latter isn't as widely known as the HDC model, let alone the original, but oh well...

    SCREENSHOTS:
    YJSB3lUl.png
    mFVIRE4l.png

    xFWKUcKl.png
    jzHIDJgl.png


    DOWNLOADS:
    You may download the initial recovery release here: https://github.com/huckleberrypie/android_device_alps_z6u030_twrp/releases

    The recovery should work best on this ROM, but may also work on other devices provided you replaced the kernel with the one that came with your device:
    http://www.4shared.com/rar/6mMhYIk5ce/Galaxy_S7_mt6580_Z6U030HA_V105.html

    And as for the sources, you can download the device tree here: https://github.com/huckleberrypie/android_device_alps_z6u030_twrp

    Credits
    My biggest props to the TeamWin team for making this little project of mine possible, as they're basically the ones who made this in the first place; I merely forked it to account for my device's configuration anyway. I'd also like to thank my pals over at American Girl Adult Collectors especially Amy and Molly, Arnee Libelo and Arturo of Driving Passion, and my buds Andy Vandjick and HardcoreHacker for the fun and expertise they shared. :D
    3
    backup is useless because corrupt preloader is unrecoverable. it's not even on region EMMC_USER but has it's own region. therefore always uncheck preloader in SP Flash Tool before flashing any ROM. just don't touch it and nothing can harm it

    Are you sure the preloader is unrecoverable? Many informative videos and writeups I pulled yesterday suggested using META mode to re-write the preloader area through SP Flash Tool. I confirmed this mode by removing the battery, holding volume up, and then plugging in the usb cable. In Linux it enumerates as an MT USB device.

    I agree it should be left alone. Unfortunately when there is a dead battery present the screen flashes a "plug out usb" error message which is not a good indicator of state. Most search results online relate that error message to a corrupt preloader.
    2
    Can someone please build a custom TWRP recovery image for me?
    Phone - Aligator S5065 Duo, Android 7.0, kernel 3.18.35+

    Additional Info:
    BB Chip : mt6580
    MS Board. : ALIGATORS5065
    Build Time : Tue Jan 23 15:35:41 CST 2018
    Krenel Ver. : 3.18.35+ (server@droi) (gcc version 4.8 (GCC)) #2 SMP PREEMPT Tue Jan 23 16:11:14 CST 2018
    Android Ver. : 7.0
    SW Ver. : alps-mp-n0.mp2-V1-droi6580.weg.n
    Custom Build Verno. : unknown
    IMEI1 : xxx
    IMEI2 : xxx
    Modem Ver. ALIGATOR_S5065_OS_1.1_2018 0123
    Bar code : 010901MT000000000000003891_155648

    Recovery images: https://ulozto.net/!xdJM9EOid1zh/aligator-zip
    The archive contains two files:
    1) recovery.img - recovery image from my phone read back using SP Flash Tool and scatter file form a downloaded firmware, which I don't really know if it is correct
    2) from_zip.img - recovery image from the mentioned downloaded firmware, which should be for my phone but I'm not sure

    Thank you very much :)


    Ill see what i can do for you :)
    2
    Apologies if I am unable to do TWRP images for your phones as I've been incredibly busy lately. I'll see if I could accommodate you guys though.
    2
    "Ok try this may possibly be like 200kb to big" - meaning the recovery image, could this be the culprit?
    I thought, if it was too big, I would get an error message?
    But to me it seems, that the recovery partition is not near the NVRAM partition, I've attached the scatter from the downloaded zip.


    Glad my TWRP is working well for you glad i used 3.2.3 as its got latest decryption features :)

    Anyhow the extra 200kb wont do that to nvram if it was to big for the BOOTIMG partition fastboot would have stopped the flash before it began and given an error message of check the load image size is correct or not

    Only thing i can think of is that you installed magisk before decrypting the encrytable storage and then trying to boot, as for orange state format /data in wipe menu it will unencrypt the storage.

    As for getting your imei back you need to flash your stock firmware back and it will come back no problem ive had it dissapear on my MT6737M more times than i can count stock flash always brings it back, i noticed you mentioned about your pmt info being changed for the rom this means that your scatter is not absolute correct in all aspects,

    Load each file individually to see if any will give you any errors on any partitions, dont format to change the pmt either youll be stuck on infinite bootlogo with little hope of fixing it more than likely,

    And dont flash preloader, or lk with that scatter you will only make things worse rule number 1 with TWRP also always backup EFS/NVRAM before doing anything especially with magisk and all the patching it does.

    hope this info helps :)