Lanchon / REPIT

A Device-Only Data-Sparing Repartitioning Tool For Android
159 stars 25 forks source link

LG Nexus 4 (mako) #69

Closed BartMassey closed 4 years ago

BartMassey commented 7 years ago

Thanks much for REPIT. It looks really nice. I would really like to use it on my Nexus 4: I'm trying to install latest CyanogenMod and Gapps-nano won't fit in my system partition. I can fit pico, but I lose some functionality. Anyway...

Thanks much for any help you can give!

Lanchon commented 7 years ago

repit-dump.log

Lanchon commented 7 years ago

EDIT: IGNORE THIS.

hi and thanks for your kind words!

could you please boot TWRP, connect to PC, and adb pull /dev/block/platform/msm_sdcc.1/by-name/aboot and adb pull /dev/block/platform/msm_sdcc.1/by-name/aboot2 and post those files (maybe zipped) here?

thanks!

Lanchon commented 7 years ago

never mind about those partition pulls. i got the latest stock image from google and found the bootloader there.

$ strings bootloader-mako-makoz30f.img | grep -i gpt

`/home/dojip.kim/home2/apq8064_l_mako/non_HLOS/boot_images/core/boot/secboot3/src/boot_gpt_partition_id.c
PPI GPT Secure
PPI GPT Secure
PPI GPT Non Secure
GPT: FAILED to write the partition entry array
GPT: Could not read primary gpt from mmc
GPT: (WARNING) Primary signature invalid
GPT: Could not read backup gpt from mmc
GPT: Primary and backup signatures invalid
GPT: mmc read card failed reading partition entries.
MMC Boot: GPT read failed!
GPT: Primary signature invalid cannot write GPT
GPT: Backup signature invalid cannot write GPT
Failed to write GPT header
Failed to write GPT backup header
GPT: Could not write GPT Partition entries array
Re-reading the GPT Partition Table
GPT: Failure to re- read the GPT Partition table
GPT: Partition Table written
Writing GPT partition
GPT signature does not match.

there are references to a signed GPT, but also to a non-secure mode. i also found a thread in which the GPT is overwritten: https://forum.xda-developers.com/showthread.php?t=2160124 i downloaded those GPT images and they do not sport signatures, AFAICT. it looks as if the signature is not being enforced, but who knows.

modifying the GPT might brick your device. if that happens, the expectation is that you'd land on one of qualcomm's recovery modes, for which recovery files might or might not exist in the wild. what do you want to do?

BartMassey commented 7 years ago

Huh. Thanks for taking such a detailed look at this!

I guess I'm a little confused about the Nexus 4 flash. I keep seeing references to an "external sdcard", and maybe I'm being dumb but I don't see a slot for one anywhere on the device. Is there an internal card my very hw-skilled friends and I could pull out and clone or something? Can we JTAG the thing before we start?

Anyhow, I guess I'm willing to sacrifice my Nexus 4 for science if you think there's a reasonably high chance of success, as it's not doing anything anyway. But maybe if I'm the only one looking for this we should just leave a note and leave it alone: the phone is working fine right now, except missing a few extras from GApps nano.

What would you suggest? tl;dr: it's a free discard phone and I like science, but it seems a shame to brick a working device for no reason.

Again, thanks.

Lanchon commented 7 years ago

Is there an internal card my very hw-skilled friends and I could pull out and clone or something?

no, there's a single, soldered emmc. the "internal sdcard" is an emulation of storage backed by /data/media. the name "sdcard" is a historical artifact having to do with its mount point and what it replaced. but there is no sdcard anywhere.

Can we JTAG the thing before we start?

yes! you can jtag the emmc.

you can also unmount everything adb pull the complete emmc from TWRP. i think 32 bit adbd pull can handle >4GB files without wrap-around issues. (busybox dd's CANT!)

adb pull /dev/block/mmcblk0

you'll later need JTAG to push it back in. unless you get qualcomm mass storage mode when bricked, in which case you can just dd it from a 64 bit linux.

What would you suggest?

lol, it's your phone!

i have very little time to do this now unfortunately. in the meantime you can get a feel in the N4 forum about how many people would like this, cause i cant do it any time soon. (sorry.)

so you tell me :)

Lanchon commented 7 years ago

there has been a new development regarding detection of GPT signatures via strings in the bootloader. it is now known that this method can result in false positives.

please see the details here.

BartMassey commented 7 years ago

It seems perfect to me to leave it for now. I'll try to grab an image and get a JTAG setup figured out at some point, and we can try it then. Thanks huge for all your work on this!

Lanchon commented 4 years ago

i'll reopen the issue if somebody is interested.