Lanchon / REPIT

A Device-Only Data-Sparing Repartitioning Tool For Android
163 stars 26 forks source link

Huawei Y560 (y560) #51

Closed macio525 closed 8 years ago

macio525 commented 8 years ago

Huawei Y560-L01 TWRP 3.0.2-0 unofficial TWRP

Kernel: 3.10.49-g5997823-00001-gcef6b5d release221@yep #1

CM 13: CM 13

Stocks partitions.

Dump: DUMP

Lanchon commented 8 years ago

thanks! i suppose you want to shrink system to 1GB and cache to minimum to gain 1GB extra storage, is that right?

unfortunarely there's an issue:

21      226MiB   258MiB   32.0MiB  ext4         persist
22      258MiB   2216MiB  1958MiB  ext4         system
23      2216MiB  2472MiB  256MiB   ext4         cache
24      2472MiB  2504MiB  32.0MiB               recovery
25      2504MiB  2505MiB  1.00MiB               devinfo
        2505MiB  2560MiB  55.1MiB  Free Space
26      2560MiB  2560MiB  0.50MiB               keystore
27      2561MiB  2624MiB  64.0MiB               oem
28      2625MiB  2625MiB  0.50MiB               config
29      2625MiB  7456MiB  4831MiB  ext4         userdata
        7456MiB  7456MiB  0.01MiB  Free Space

i don't know why the hell some OEMs do stuff like this! recovery after system??? jeez!

so there are 5 extraneous partitions in between system, cache and userdata:

and these are the problems:

  1. some devices could have silly bootloaders that somehow embed the locations of partitions instead of parsing the GPT. imagine that that is done for recovery: then, although recovery is written ok in the moved partition, the bootloader tries to read it from the old place and booting fails. now imagine that this is done for some critical partition (say, devinfo). so the bootloader cant find it and now doesn't even bring up the recovery interface (fastboot or whatever). admittedly i never verified the existence of a bootloader that doesn't parse the GPT, but i do suspect that at least some samsung devices work that way.
  2. imagine that some key piece of data is stored somewhere in these partitions (say, the IMEI). what happens if REPIT dies because, i don't know, you run out of battery? your phone is a semi-brick now because you dont have backups of these partitions.

so with this in mind, do you think it is worth the risk to experiment on your phone for that extra GB?

if you want to continue, there are ways to mitigate risk. first thing, answer some questions:

a) in your phone, what happens if recovery is corrupt? how do you recover? do you have a working, unlocked fastboot mode or equivalent? b) besides recovery, do you have any information on these 5 partitions?

thanks!

macio525 commented 8 years ago

You know how to backup partitions with "Qualcomm HS-USB Android DIAG 901D" ?

Lanchon commented 8 years ago

no idea about anything proprietary. but you didn't answer my questions!

macio525 commented 8 years ago

a. I have unlocked fastboot b. What u mean.?

Lanchon commented 8 years ago

so please confirm that you can flash recovery via fastboot.

then, this is what i propose:

1) backup the partitions. 2) make a reduced repit for you that only works on system and recovery. 3) reduce system a bit and move recovery a bit closer to the start of the disk. 4) test booting into recovery. if it works, it is because the bootloader reads the GPT. 5) flash recovery with fastboot. 6) test booting into recovery. if it works, it is because the fastboot reads the GPT. 7) assume that the bootloader reads the GPT for all partitions (safe assumption if you ask me) and do a full repit version.

it is vital that you have working android with root in android, just in case. the recovery might not work.

otherwise i can build a full repit and you can risk it.

or otherwise we could do nothing.

what do you think?

macio525 commented 8 years ago

3) how to do this?

Lanchon commented 8 years ago

with a reduced version of repit for your device that i would create if you want to go ahead with this.

macio525 commented 8 years ago

i will try

Lanchon commented 8 years ago

ok. start by backing up your 5 partitions: recovery devinfo keystore oem config

from the pc you can do: adb root then for each partition: adb pull /dev/block/platform/7824900.sdhci/by-name/{{the-partition-name-here}}

macio525 commented 8 years ago

you mean? adb pull /dev/block/platform/soc.0/7824900.sdhci/by-name/

Lanchon commented 8 years ago

actually forget about adb root, and instead boot into TWRP, connect via adb to TWRP, now run the adb pull commands there (the exact way i typed them)

macio525 commented 8 years ago

done 1

Lanchon commented 8 years ago

ok i'll prepare repit for your device when i have some time!

macio525 commented 8 years ago

I NEVER installed CM 12.1... how the hell he got there? ro.cm.display.version]: [12.1-20160420-UNOFFICIAL-KonstaKANG-y560 ro.cm.version]: [12.1-20160420-UNOFFICIAL-KonstaKANG-y560 ro.modversion]: [12.1-20160420-UNOFFICIAL-KonstaKANG-y560

Lanchon commented 8 years ago

what are you talking about?

macio525 commented 8 years ago

i mean CM 12.1 lines in dump file when i never installed CM 12.1

the-gangster commented 8 years ago

Nothing to worry about. These are values that are read out of the ramdrive that was used to create the recovery. I'd bet if you'd extract your devices recovery, you would find these values in its ramdrives /default.prop file. It's the same for i9100 device.

macio525 commented 8 years ago

You make it?

Lanchon commented 8 years ago

no, sorry. i'll do it now.

Lanchon commented 8 years ago

hi, sorry for the delay!

here is the test build. the test procedure is:

  1. back up valuable information from your phone to your PC or some external storage.
  2. boot android and verify that you have working root to help us recover in case of trouble.
  3. download this test build: lanchon-repit-y560_test.tar.gz.
  4. extract the test zip inside and copy it to your sdcard. do not alter the name of the test zip in any way.
  5. boot twrp and flash the test REPIT according to instructions on REPIT's main page.
  6. obtain a copy of the repit log and paste it here.
  7. reboot recovery.

this test zip will shrink cache from 256MB to 255MB and move the recovery partition closer to the start of the drive by 1MB.

if recovery boots from its new location, then this would be a clear indication that the bootloader of your device is reading partition information from the standard GPT partition table. this in turn would mean that we can probably move the problematic partitions (24 through 28) as required without causing issues.

macio525 commented 8 years ago

recovery dont work after flash and cant turn on device when i connect to pc i got Qualcomm HS-USB Diagnostics 900E

Lanchon commented 8 years ago

wow this is unexpected. can you post the log?

macio525 commented 8 years ago

its said "success" but how i can show u the log?

Lanchon commented 8 years ago

well now you can't if you turned off the phone. that's way i asked you to pull the log before rebooting.

so i looked on the web and found this thread... by you! so have you previously bricked your device? you already know how to fix it? http://forum.xda-developers.com/android/help/huawei-y560-l01-bricked-t3451958

macio525 commented 8 years ago

bootloader lock by yourself

Lanchon commented 8 years ago

please try to write more crearly, i can't really understand those short messages.

  1. please confirm that your bootloader was unlocked before trying repit
  2. is your bootloader unlocked now?
  3. do you already know how to recover from this using qualcomm tools?
Lanchon commented 8 years ago

4.can you boot in fastboot mode?

macio525 commented 8 years ago

i cant boot in fastboot mode and yes, i have unlocked bootloader before repit

Lanchon commented 8 years ago

ok you are in qualcomm's EDL. do you know how to recover from this using qualcomm tools?

macio525 commented 8 years ago

i try do something but...

macio525 commented 8 years ago

but idk how to make test point i have 3 pins: VCOM, DM and UP near USB

Lanchon commented 8 years ago

why do you need test points? the device is already in download mode, isnt it?

Lanchon commented 8 years ago

"Qualcomm HS-USB Diagnostics 900E"

macio525 commented 8 years ago

it should be QDLoader

macio525 commented 8 years ago

someone bricked and got QDLoader "Hi. I need help!!! My Huawei y560-L01 bricked after flashing rom, nothing is working, just flash screen with huawei logo and dark. In menager is as Qualcomm HS-USB QDLoader 9008. No phone visible. Any idea?"

Lanchon commented 8 years ago

but YOU posted that a couple of months ago! http://forum.xda-developers.com/android/help/huawei-y560-l01-bricked-t3451958

macio525 commented 8 years ago

yes and after 6 hours i enter to fastboot mode and try to unlock fastboot(was unlocked before..)

Lanchon commented 8 years ago

maybe you want to read this: http://www.androidbrick.com/ultimate-qualcomm-snapdragon-unbrick-guide-snapdragons-are-unbrickable-qhsusb_dload_qpst_qfil/

Lanchon commented 8 years ago

http://www.droidsavvy.com/unbrick-qualcomm-mobiles/

macio525 commented 8 years ago

"First question as always, what did you do to 'brick' your device?

There's no firmware available that you could flash with QPST and those files don't necessarily get you very far. Maybe you can dump the whole eMMC from another working device and restore it on the broken one."

KonstaT from modaco.com

Lanchon commented 8 years ago

i don't know what bricked the device. the standard gdisk was used to change 2 partitions, cache and recovery. nothing else was changed. it looks like maybe the bootloader does some kind of signature verification on the GPT, which in effect means that the device was not really fully unlocked.

Lanchon commented 8 years ago

if you could enter fastboot, the phone would probably recover simply by flashing the GPT. (it would still not enter recovery unless a recovery is flashed. and the cache/ would be 1MB smaller than usual until you format it.)

it seems that you need to flash the stock GPT and that will suffice. i don't know what tools could be used for that.

macio525 commented 8 years ago

stock gpt? that one? image

Lanchon commented 8 years ago

the GPT file for qualcomm fastboot is generally called gpt.bin and can be found in stock images. it is usually flashed using "fastboot flash partition gpt-XXX.bin".

http://forum.xda-developers.com/showpost.php?p=68819815&postcount=30

you cannot pull it as you pull a partition because it is not a partition, it is the partition table. i don't know if the format of the gpt.bin file is known.

macio525 commented 8 years ago

Ok, im done ;/

Lanchon commented 8 years ago

so were you able to recover???? holy $#!+ !!! i'm so glad!

Lanchon commented 8 years ago

thank you for trying. this is the first time a device is bricked by REPIT.

i don't know why it happened, it looks like some kind of anti-tamper protection for the GPT in the bootloader. i don't think huawei is clever enough to do this by themselves, so i have to conclude that qualcomm is probably behind this.

and the corollary is that this issue might affect other recent qualcomm devices.

i have decided not to process port requests for newer qualcomm devices because of this, unless there is a clear unbricking path and the requester is aware of all the facts. in any case, most newer devices are partitioned in a mostly-sane way; the motivation for creating REPIT was fixing older devices with problematic partition layouts.

i'm very glad that you were able to recover your device; you were lucky. i hope this never happens again.

thanks again!

macio525 commented 8 years ago

i mean I'm done with trying to recover this phone :'/ i need file "prog_emmc_firehose_8909.mbn" and convert those files: partition.xml patch0.xml and rawprogram0.xml

Lanchon commented 8 years ago

oh crap i'm sorry to hear that!!

apparently you can download the firmware from: https://boycracked.com/tag/unbrick-huawei-ascend-y5-y560-l01/

the follow instrctions here: WARNING: THESE FILES MIGHT BE TROJANS https://boycracked.com/2016/01/22/how-to-installing-the-firmware-using-qfil-for-all-android-device-based-on-qualcomm-chips/

but that might require "QDLoader 9008" and you have "Diagnostics 900E". have you tried this?

macio525 commented 8 years ago

i need to find that file prog_emmc_firehose_8909.mbn and i have those files image