[RECOVERY] Moto G6 TWRP (Testers needed) - Moto G6 ROMs, Kernels, Recoveries, & Other Develop

Uploaded the recovery from the system dump posted here to TWRP builder and Yshalsager built this recovery for it, need testers for it View attachment TWRP-3.2.1-ali-20180612.img.zip

I'll gladly test it. I've been testing a version of my own but had issues with mounting the external sdcard.
EDIT - Quick test and it shows internal storage separate from external (mine showed the same internal for both) however it does not mount the external sd card.
Added a couple of logs. Sorry, it's been a while since I have had a devices I could unlock/etc... Please let me know if you want more.

likemiketoo said:
Uploaded the recovery from the system dump posted here to TWRP builder and Yshalsager built this recovery for it, need testers for it View attachment 4526176
Click to expand...
Click to collapse
TWRP has been using a boot Twrp.img and an TWRP Installer which installs TWRP to the system, if you dont use installer, you must Fastboot TWRP every time...
---------- Post added at 04:43 PM ---------- Previous post was at 04:04 PM ----------
likemiketoo said:
Uploaded the recovery from the system dump posted here to TWRP builder and Yshalsager built this recovery for it, need testers for it View attachment 4526176
Click to expand...
Click to collapse

do you just do a fastboot flash recovery with this or what? instructions are a little vague

Dadud said:
do you just do a fastboot flash recovery with this or what? instructions are a little vague
Click to expand...
Click to collapse
If it were me, I'd use the following:
Code:
fastboot boot twrp.img
That way you can test it without breaking your stock recovery. If it does end up working you can use it to backup your stock boot.img and recovery.img.

kwiksi1ver said:
If it were me, I'd use the following:
Code:
fastboot boot twrp.img
That way you can test it without breaking your stock recovery. If it does end up working you can use it to backup your stock boot.img and recovery.img.
Click to expand...
Click to collapse
i tried flashing it but it gave me an error saying it wasnt signed correctly, ill get back on with that command and grab the stock boot.img and recovery.img (if it works) and throw them up on google drive for anyone who might need them.
Update: not letting me backup, i have secure boot enabled, though and its not asking me for decryption password when i boot twrp like my nexus 6p did.

Dadud said:
Update: not letting me backup, i have secure boot enabled, though and its not asking me for decryption password when i boot twrp like my nexus 6p did.
Click to expand...
Click to collapse
When you've booted into TWRP does ADB work when you're connected to your PC?

kwiksi1ver said:
When you've booted into TWRP does ADB work when you're connected to your PC?
Click to expand...
Click to collapse
yeah, i can run adb shell no problem

Dadud said:
yeah, i can run adb shell no problem
Click to expand...
Click to collapse
from adb shell run
Code:
cd /dev/block/platform/soc/
ls
the ls command will list a partition or two try to cd to them and look for a structure like this:
/dev/block/platform/soc/c0c4000.sdhci/by-name/
the c0c4000.shci will not match, it will be specific to your device model, but once you find that folder you can try to copy the boot and recovery partitions using commands like this:
Code:
dd if=/dev/block/platform/soc/c0c4000.sdhci/by-name/boot of=/external_sd/boot.img
dd if=/dev/block/platform/soc/c0c4000.sdhci/by-name/recovery of=/external_sd/recovery.img
or if you don't have an external SD card try this
Code:
adb pull /dev/block/platform/soc/7824900.sdhci/by-name/boot stockboot.img
adb pull /dev/block/platform/soc/7824900.sdhci/by-name/recovery stockrecovery.img
Again the folder name after the /soc/ in the path will be different for your device so replace that and you can save your stock boot and recovery images. From there we can use those to build a proper TWRP and get root by disabling dm-verity on the boot.img.

kwiksi1ver said:
from adb shell run
Code:
cd /dev/block/platform/soc/
ls
the ls command will list a partition or two try to cd to them and look for a structure like this:
/dev/block/platform/soc/c0c4000.sdhci/by-name/
the c0c4000.shci will not match, it will be specific to your device model, but once you find that folder you can try to copy the boot and recovery partitions using commands like this:
Code:
dd if=/dev/block/platform/soc/c0c4000.sdhci/by-name/boot of=/external_sd/boot.img
dd if=/dev/block/platform/soc/c0c4000.sdhci/by-name/recovery of=/external_sd/recovery.img
or if you don't have an external SD card try this
Code:
adb pull /dev/block/platform/soc/7824900.sdhci/by-name/boot stockboot.img
adb pull /dev/block/platform/soc/7824900.sdhci/by-name/recovery stockrecovery.img
Again the folder name after the /soc/ in the path will be different for your device so replace that and you can save your stock boot and recovery images. From there we can use those to build a proper TWRP and get root by disabling dm-verity on the boot.img.
Click to expand...
Click to collapse
not seeing a c0c4000.shci or similarly named folder, just a lot of mmcblk folders, a by-name and a by-num folder. i see something called boot and recovery in by-name but when i try to adb pull it returns adb: not found

Dadud said:
not seeing a c0c4000.shci or similarly named folder, just a lot of mmcblk folders, a by-name and a by-num folder. i see something called boot and recovery in by-name but when i try to adb pull it returns adb: not found
Click to expand...
Click to collapse
Sorry, I should have been more clear, you can't be in adb shell when you run the adb pull command.
So you'd find the full path of the "by-name" folder and you'd copy the whole path name. Then exit out of adb shell by typing "exit" and you should be back to the command prompt/terminal on your computer.
Then you run the command: (but replace the path of your boot and recovery files with the file structure on your device)
Code:
adb pull /dev/block/platform/soc/7824900.sdhci/by-name/boot stockboot.img
adb pull /dev/block/platform/soc/7824900.sdhci/by-name/recovery stockrecovery.img

Dadud said:
not seeing a c0c4000.shci or similarly named folder, just a lot of mmcblk folders, a by-name and a by-num folder. i see something called boot and recovery in by-name but when i try to adb pull it returns adb: not found
Click to expand...
Click to collapse
Opening command prompt/powershell (windows) or terminal ( linux) and type:
Code:
adb pull /dev/block/platform/soc/by-name/boot boot.img
adb pull /dev/block/platform/soc/by-name/recovery recovery.img
This works fine for me using my twrp and the twrp from the op. This does not work for you?
I have used this to boot into phh-treble and the lineage-phh-treble roms (with the stock kernel) and have gone back to stock (pulled the system.img before this). I have not been successful with Magisk myself.
EDIT- After typing this I just saw kwiksi1ver's reply...
Not that I've needed to but I had more lines in my fstab so I could mount more partitions like vendor (I believe Magisk wanted to mount it?) Included for whatever purposes. external sdcard not working right and I haven't tested out edits since I first tried it.
*** DISCLAIMER *** It's been a long time since I have messed with this stuff so excuse the messy stuff and my lack of knowledge of mounting flags. Also uh..... I'm not responsible for your choices.....

dejello said:
Opening command prompt/powershell (windows) or terminal ( linux) and type:
Code:
adb pull /dev/block/platform/soc/by-name/boot boot.img
adb pull /dev/block/platform/soc/by-name/recovery recovery.img
This works fine for me using my twrp and the twrp from the op. This does not work for you?
I have used this to boot into phh-treble and the lineage-phh-treble roms (with the stock kernel) and have gone back to stock (pulled the system.img before this). I have not been successful with Magisk myself.
EDIT- After typing this I just saw kwiksi1ver's reply...
Not that I've needed to but I had more lines in my fstab so I could mount more partitions like vendor (I believe Magisk wanted to mount it?) Included for whatever purposes. external sdcard not working right and I haven't tested out edits since I first tried it.
*** DISCLAIMER *** It's been a long time since I have messed with this stuff so excuse the messy stuff and my lack of knowledge of mounting flags. Also uh..... I'm not responsible for your choices.....
Click to expand...
Click to collapse
By chance could you also post the stock recovery.img and boot.img as well?

kwiksi1ver said:
By chance could you also post the boot.img as well?
Click to expand...
Click to collapse
I can. It boots but the sdcard is at least shown better on the op link. I took the one posted for the g6 play and swapped a few things with the stock recovery and came up with this. ***Again, I'm not responsible for how you use this and can't say anything is safe (though I have used it plenty). You WILL lose your data any time you want to mess with anything rom related.*** To get it to read the data partition you have to format it (that includes internal storage).

dejello said:
I can. It boots but the sdcard is at least shown better on the op link. I took the one posted for the g6 play and swapped a few things with the stock recovery and came up with this. ***Again, I'm not responsible for how you use this and can't say anything is safe (though I have used it plenty). You WILL lose your data any time you want to mess with anything rom related.*** To get it to read the data partition you have to format it (that includes internal storage).
Click to expand...
Click to collapse
I don't have a G6 myself, I was just trying to kickstart the development on it.
I have a G6 play, I was the one who made the TWRP image for the G6 Play.

dejello said:
Opening command prompt/powershell (windows) or terminal ( linux) and type:
Code:
adb pull /dev/block/platform/soc/by-name/boot boot.img
adb pull /dev/block/platform/soc/by-name/recovery recovery.img
This works fine for me using my twrp and the twrp from the op. This does not work for you?
Click to expand...
Click to collapse
no, it doesnt seem to be working, this is a log my my powershell prompt.
PS C:\Users\dadud\Downloads\TWRP-3.2.1-ali-20180612.img> adb shell
~ #  cd /dev/block/platform/soc/
/dev/block/platform/soc # ls
by-name mmcblk0p16 mmcblk0p25 mmcblk0p34 mmcblk0p43 mmcblk0p52
by-num mmcblk0p17 mmcblk0p26 mmcblk0p35 mmcblk0p44 mmcblk0p53
mmcblk0 mmcblk0p18 mmcblk0p27 mmcblk0p36 mmcblk0p45 mmcblk0p6
mmcblk0p1 mmcblk0p19 mmcblk0p28 mmcblk0p37 mmcblk0p46 mmcblk0p7
mmcblk0p10 mmcblk0p2 mmcblk0p29 mmcblk0p38 mmcblk0p47 mmcblk0p8
mmcblk0p11 mmcblk0p20 mmcblk0p3 mmcblk0p39 mmcblk0p48 mmcblk0p9
mmcblk0p12 mmcblk0p21 mmcblk0p30 mmcblk0p4 mmcblk0p49 mmcblk0rpmb
mmcblk0p13 mmcblk0p22 mmcblk0p31 mmcblk0p40 mmcblk0p5
mmcblk0p14 mmcblk0p23 mmcblk0p32 mmcblk0p41 mmcblk0p50
mmcblk0p15 mmcblk0p24 mmcblk0p33 mmcblk0p42 mmcblk0p51
/dev/block/platform/soc # cd by-name
/dev/block/platform/soc/by-name # ls
DDR cmnlib64 fsg mmi_misc prov syscfg
aboot cmnlib64bak hw modem provbak system
abootbak cmnlibbak keymaster modemst1 recovery tz
apdp devcfg keymasterbak modemst2 rpm tzbak
boot devcfgbak kpan mota rpmbak userdata
cache dpo logo msadp sbl1 utags
carrier dsp logs oem sbl1bak utagsBackup
cid frp metadata padA sp vendor
cmnlib fsc misc persist ssd
/dev/block/platform/soc/by-name # exit
PS C:\Users\dadud\Downloads\TWRP-3.2.1-ali-20180612.img> adb pull /dev/block/platform/soc/by-name/boot stockboot.img
remote object '/dev/block/platform/soc/by-name/boot' not a file or directory
PS C:\Users\dadud\Downloads\TWRP-3.2.1-ali-20180612.img>
(ive got adb/fastboot enabled system wide so itll work out of whatever folder i have open)

Dadud said:
no, it doesnt seem to be working, this is a log my my powershell prompt.
PS C:\Users\dadud\Downloads\TWRP-3.2.1-ali-20180612.img> adb shell
~ # [6n cd /dev/block/platform/soc/
/dev/block/platform/soc # [6nls
by-name mmcblk0p16 mmcblk0p25 mmcblk0p34 mmcblk0p43 mmcblk0p52
by-num mmcblk0p17 mmcblk0p26 mmcblk0p35 mmcblk0p44 mmcblk0p53
mmcblk0 mmcblk0p18 mmcblk0p27 mmcblk0p36 mmcblk0p45 mmcblk0p6
mmcblk0p1 mmcblk0p19 mmcblk0p28 mmcblk0p37 mmcblk0p46 mmcblk0p7
mmcblk0p10 mmcblk0p2 mmcblk0p29 mmcblk0p38 mmcblk0p47 mmcblk0p8
mmcblk0p11 mmcblk0p20 mmcblk0p3 mmcblk0p39 mmcblk0p48 mmcblk0p9
mmcblk0p12 mmcblk0p21 mmcblk0p30 mmcblk0p4 mmcblk0p49 mmcblk0rpmb
mmcblk0p13 mmcblk0p22 mmcblk0p31 mmcblk0p40 mmcblk0p5
mmcblk0p14 mmcblk0p23 mmcblk0p32 mmcblk0p41 mmcblk0p50
mmcblk0p15 mmcblk0p24 mmcblk0p33 mmcblk0p42 mmcblk0p51
/dev/block/platform/soc # [6ncd by-name
/dev/block/platform/soc/by-name # [6nls
DDR cmnlib64 fsg mmi_misc prov syscfg
aboot cmnlib64bak hw modem provbak system
abootbak cmnlibbak keymaster modemst1 recovery tz
apdp devcfg keymasterbak modemst2 rpm tzbak
boot devcfgbak kpan mota rpmbak userdata
cache dpo logo msadp sbl1 utags
carrier dsp logs oem sbl1bak utagsBackup
cid frp metadata padA sp vendor
cmnlib fsc misc persist ssd
/dev/block/platform/soc/by-name # [6nexit
PS C:\Users\dadud\Downloads\TWRP-3.2.1-ali-20180612.img> adb pull /dev/block/platform/soc/by-name/boot stockboot.img
remote object '/dev/block/platform/soc/by-name/boot' not a file or directory
PS C:\Users\dadud\Downloads\TWRP-3.2.1-ali-20180612.img>
(ive got adb/fastboot enabled system wide so itll work out of whatever folder i have open)
Click to expand...
Click to collapse
Okay try this from powershell, it should work.
Code:
adb shell
dd if=/dev/block/platform/soc/by-name/boot of=/tmp/stockboot.img
dd if=/dev/block/platform/soc/by-name/recovery of=/tmp/stockrecovery.img
exit
adb pull /tmp/stockboot.img
adb pull /tmp/stockrecovery.img

kwiksi1ver said:
Okay try this from powershell, it should work.
Code:
adb shell
dd if=/dev/block/platform/soc/by-name/boot of=/tmp/stockboot.img
dd if=/dev/block/platform/soc/by-name/recovery of=/tmp/stockrecovery.img
exit
adb pull /tmp/stockboot.img
adb pull /tmp/stockrecovery.img
Click to expand...
Click to collapse
ended up downloading the new (r40) of ADB instead of the old (r32) and using command line, and had success.. ill edit this post with the google drive links to my boot.img and recovery.img as soon as it uploads (stuck on 512k upload and both are about 22 megs, should be done in 10-15 minutes.)
Edit: Links
https://drive.google.com/open?id=1VWK24zyIl2sGz4H99YrG1G0KdTUmBsG3 <- Boot.img
https://drive.google.com/open?id=1xXEj7vdiikBY5ygZANNeMWwvI1S3DO4H <- Recovery.img
---------- Post added at 01:03 PM ---------- Previous post was at 12:32 PM ----------
Dadud said:
ended up downloading the new (r40) of ADB instead of the old (r32) and using command line, and had success.. ill edit this post with the google drive links to my boot.img and recovery.img as soon as it uploads (stuck on 512k upload and both are about 22 megs, should be done in 10-15 minutes.)
Edit: Links
https://drive.google.com/open?id=1VWK24zyIl2sGz4H99YrG1G0KdTUmBsG3 <- Boot.img
https://drive.google.com/open?id=1xXEj7vdiikBY5ygZANNeMWwvI1S3DO4H <- Recovery.img
Click to expand...
Click to collapse
Say i wanted to flash the pixel experience project treble rom, all i'd have to do is flash the system.img from their download through twrp/fastboot and boot? i've already backed up my original system.img.
edit: attempted, failed. just reboots into bootloader every time i try to start it. reflashing stock system.img
edit: that also failed, along with my twrp backup.
edit 3: unbricked with the firmware found on this forum.

So.... I have tried installing again and ended in bootloops. I just tried installing AOSP phh-treble via fastboot (system.img doesn't need to be signed) and it is booting with the stock unmodified kernel.

Photos.. Also seen this boot logo randomly.. Thought that was interesting..
I am working to see if I can figure out the external sdcard in twrp (as this thread should be about twrp). Figured a booting image might help in that, dunno.

Related

Minimal system with root

Hi all,
I'm after a system.img that's going to allow me to run adb shell sessions as root. That's all I need. I don't need any of the normal phone fuctions or devices. I'd imagine disabling these would overcome any incompatibility issues... but I don't know.
Naturally, it'd be easier if such an image already existed, but I should be able to follow instructions on how to reconfigure a normal system and pack it to yaffs2 image.
How about the ramdisk of most custom recoveries- or is that too spare? It will give you a kernel, adb, and busybox if you are lucky.
sent from my android tablet
gee one said:
How about the ramdisk of most custom recoveries- or is that too spare? It will give you a kernel, adb, and busybox if you are lucky.
Click to expand...
Click to collapse
As long as I can do an adb shell as root then it's good enough.
I haven't found any compatible custom recovery images that I can flash. Everything I read seems to endup point to clockworkmod and I can't find flashable images for that. It seems to be flashed through rom manager only. I'm probably wrong though.
Depending on your device, there are several ways to flash. These may or may not apply to you:
1) some recovery installer app that you can download, similar to rom manager, or even rom manager itself!
2) a zip file that you make or modify yourself
3) flash through the staging partition, which may or may not be available on your device
4) copy directly into a recovery partition
5) who knows?
What device are you using and what rom and recovery are you using?
Sorry, I should have given you some info about my situation.
My phone is a chinese mt6516 iClone: W008+. It's currently without a working system partition so I flash images via pc using Mediatek flash tool.
For a recovery, I'd need an image file to flash directly. For a system partition I could flash and image file or I can pack a dir structure into a yaffs2 image file for flashing.
That seems above my paygrade... when you say image file, do you mean a packed boot.img that starts with ANDROID!
sent from my cyanogen(mod) vision
gee one said:
That seems above my paygrade... when you say image file, do you mean a packed boot.img that starts with ANDROID!
Click to expand...
Click to collapse
Well, a boot.img would go on the boot partition for booting into android normally. A recovery.img would also start with ANDROID but would go on the ... er... recovery partition. A system image would be different starting something like:
Code:
03 00 00 00 01 00 00 00 ff ff
Ok, it looks like the system.img is yaffs.
I was asking about the boot partition because most recovery images are just boot.img's with the recovery binary in the ramdisk. I made a boot.img once from a recovery partition and flashed it, so I had two recoveries on the same device, and no system! I thought this might be something of what you are looking for. You won't have or need a system since everything will load from the boot.img.
sent from my cyanogen(mod) vision
Yes, anything that gives me a root shell via adb would be good. It's just a question of finding something appropriate to try...
Are there any roms or system images available for your device now? Or can you pull the boot.img from your current device.
sent from my cyanogen(mod) vision
I can't find anything 3rd party for it. But I do have a boot.img that I extracted.
Send me a link and I'll poke around. Do you have a way to flash the boot.img?
sent from my cyanogen(mod) vision
Nice one.
This was ripped with dump_image:
boot.zip
OK, I extracted the ram disk- it was in an odd format. They sure talk funny.
ramdisk_2bb4ad9697.tar
So all the inits are for a fully working system, which you don't have. I guess the next step would be to strip out the inits to just a few basic mount points and then have it start adb. After that, add busybox and whatever goodies, repack it, and then flash away.
I really don't know my way around the init files, so it's mostly hack and slash. If you have any insight on how to strip them down, let's hear it. I'll try to read up on how linux boots. Also, knowing the partition mounts would be helpful, although I suppose you could figure that out with adb, if this actually works.
Cheers for that. Looks quite intriguing... I'm going to need a good deal more reading to make use of it though.
OK, here is a first stab- I modified the default.prop and added busybox and su. I did not touch any of the init's.
Here is the default.prop- insecure and adb enabled. I didn't change the inits, but it does look like they will start adb. They will probably fail to start everything else that it expects to find in system and frameworks, so your syslog will probably be littered with error messages, if there is even a syslog.
Code:
#
# ADDITIONAL_DEFAULT_PROPERTIES
#
ro.secure=0
ro.allow.mock.location=0
ro.debuggable=1
persist.service.adb.enable=1
Here is the ramdisk. I added busybox and su. I'm not sure if these will be helpful, but I figured it couldn't hurt.
edit: I just realized that /xbin is not in the path. "export PATH $PATH:/xbin" should fix it?? "/xbin/busybox --install /system/xbin" should install busybox to /system/xbin.
Code:
total 212
-rw-r--r-- 1 root root 20175 2012-03-08 18:26 advanced_meta_init.rc
drwxrwx--x 2 root root 4096 2012-03-08 18:26 data
-rw-r--r-- 1 root root 118 2012-03-08 20:11 default.prop
drwxr-xr-x 2 root root 4096 2012-03-08 18:26 dev
-rwxr-x--- 1 root root 107436 2012-03-08 18:26 init
-rwxr-x--- 1 root root 5828 2012-03-08 18:26 init.factory.rc
-rwxr-x--- 1 root root 1677 2012-03-08 18:26 init.goldfish.rc
-rwxr-x--- 1 root root 2263 2012-03-08 18:26 init.mt6516.rc
-rwxr-x--- 1 root root 20514 2012-03-08 18:26 init.rc
-rw-r--r-- 1 root root 5529 2012-03-08 18:26 meta_init.rc
drwxr-xr-x 2 root root 4096 2012-03-08 18:26 proc
lrwxrwxrwx 1 root root 11 2012-03-08 18:34 res -> /system/res
drwxr-x--- 2 root root 4096 2012-03-08 20:16 sbin
drwxr-xr-x 2 root root 4096 2012-03-08 18:26 sys
drwxr-xr-x 2 root root 4096 2012-03-08 18:26 system
drwxr-xr-x 2 root root 4096 2012-03-08 18:06 temp
drwxr-xr-x 2 root root 4096 2012-03-08 20:16 xbin
./data:
total 0
./dev:
total 0
./proc:
total 0
./sbin:
total 368
-rwxr-x--- 1 root root 138372 2012-03-08 18:26 adbd
-rwxr-x--- 1 root root 107436 2012-03-08 18:26 advanced_meta_init
-rwxr-x--- 1 root root 103116 2012-03-08 18:26 meta_init
-rwxr-x--- 1 root root 18012 2012-03-08 18:26 meta_tst
./sys:
total 0
./system:
total 0
./temp:
total 0
./xbin:
total 828
-rwxrwxr-x 1 root root 821340 2012-03-08 20:14 busybox
-rwsr-sr-x 1 root root 22364 2012-03-08 20:15 su
I did not change the kernel at all. The kernel and ramdisk have a 512 byte header file- it seems to have a file marker, size of package, and type of partition encoded into it. I'm not even sure this is android? I am certainly NOT an expert at this. For the record, I know nothing about the device that you have. I didn't even google it to see if was indeed an android phone.
All that being said, I will be surprised if this works and I would not be surprised if you end up with a brick. If it were my device, I would only flash this if I had a 100% bulletproof way to flash the stock boot.img externally without relying on the software on the phone. There is no system or frameworks, so it will most likely look like a stuck boot, but adb should be enabled. There is no boot animation or friendly little green android to greet you. I don't know if more stuff is needed in bin or sbin?
Now the disclaimers-
Code:
[SIZE="5"][COLOR="Red"][B]ALL WARRANTIES REGARDING
MERCHANTABILITY AND FITNESS OF PURPOSE,
EXPRESSED OR IMPLIED, ARE DISCLAIMED.
Flashing this boot image can cause
loss of data, loss of device, inability to use device,
spontaneous bricking, and other grave consequences.
Use at your own peril.
If anything bad happens, it's not my fault.[/COLOR][/B]
[/SIZE]
.
Good Luck! If in doubt, don't flash it!
https://rapidshare.com/files/1856533633/boot_adb_4026ab44b0.img
Well, I can't say I understand what you've done here but...
I've now got a working phone with root adb. Brilliant!!! Thanks.
I had to flash another system image (meant for a different phone) so that I could get a shell working otherwise I'd get a 'can't find /system/bin/sh' error. But having done that, it works a treat. The system still needs a bit of work to get my phone as it should be but that's another story.
I'm really interested in how you've managed to do this. How do you unpack/repack the boot.img? I'd love to mess about with this and see how long it takes to blow my phone up. I tried to follow one guide on the net but it just wasn't happening.
Ok, I found the ROOTFS section and pulled it out. So I can see how it all fits together.
According to 7zip, this is a 'Cpio' archive inside a 'Gzip' archive. What's 'Cpio'?
That's the funny part- there is a 512 byte header that has a few id characters, the file size and then "ROOTFS". The kernel image is similar. All the android parts that I've pulled apart didn't have the 512 byte header.
If you strip that out, then you will have a gzipped cpio archive. You can extract it with "gunzip -c <the ramdisk> | cpio -i"
To recompress it, "find . | cpio -o -H newc | gzip >> ../your-new-ramdisk"
You'll have to reattach the 512 byte header and adjust the file size.
sent from my cyanogen(mod) vision
Well I got round to having a little play with this. Thanks for the info Gee, it's been filed safely.
I looked at the recovery image and the init.rc doesn't do alot; Ideal starting place. Nothing is mounted by default so I put a couple of commands to mount /sdcard and /system normally just to test it. I also had to enable adb in the default.prop file as you did before. This was pretty straight forward and worked. I got into adb shell with root, no problem.
Now I thought it would be ideal if I could mount the sdcard as /system and put '/bin/sh' on the sdcard. Androids sh isn't a link like it is on Linux so I thought this should work. It didn't! On issuing the 'adb shell' command, I got:
Code:
link_image[2030]: failed to link /system/bin/sh
CANNOT LINK EXECUTABLE
So I thought I'd try the cache partition. I copied /bin/* to /cache, put the mount commands for /sdcard and cache as /system and this time... I got the same error. I'm surprised the cache partition didn't work. I was able to 'adb pull' the /system/bin/ files from it so I don't know why adb couldn't just execute one of them???
I don't know what to try next as I don't want to be forced to have the system partition mounted just for the sake of adb finding sh. I wouldn't mind if I could just umount it once I'm in the shell... but that would be to easy, wouldn't it.

[Q] Another possible way to Install CWM restore partition

UPDATE: Just found information at the following link, see below. Looks like you can't get better backup capability without unlocking the boot loader first. Doing so would destroy the DRM keys (No more Netflix's etc...) Guess I will live with my ROOTED Atrix 4G for now..
http://android.stackexchange.com/questions/15314/cant-boot-to-clockwork-recovery-on-atrix-several-methods-tried
My Atrix 4G phone is currently rooted but does NOT have the bootloader unlocked. I do not plan to (at least for the forseeable future) installing different ROM's but I would like to install (if possible) the CWM restore partition. Unlocking the bootloader wipes the device (backups can be performed to restore the wiped information); likewise, the DRM keys are removed during the bootloader unlocking procedure and there MIGHT be ways to restore them (watching streaming video is important to me).
From what I have read on this forum and others, I should be able to load the CWM restore partition WITHOUT unlocking the bootloader. There are a few methods documented to install the CWM werewithall onto the restore partition BUT would something like the following also work?
From an SSH connection to the rooted phone or an "adb shell" command window (via a USB connection between the Atrix and PC) perform the following:
Backup the current restore partition delivered my Motorola via the following command in case something goes wrong.
dd if=/dev/block/mmcblk0p10 of=/sdcard-ext/recovery.img
Copy the recovery.img file to your PC for additional safe keeping.
Zero out the restore partition before installing the new CWM recovery image.
dd if=/dev/zero of=/dev/block/mmcblk0p10
Copy the new cwm.img image to the recovery partition using the following command:
Note the replacement cwm image file can NOT be larger than 8192 blocks with each block being 512 bytes.
8192 * 512 * 2 = 8,388,608 bytes. If the cwm image is to big, I am not sure if the following dd command would write into the p11 boot partition (NOT good). Verify cwm.img size BEFORE issuing the following DD command.
dd if=/sdcard-ext/cwm.img of=/dev/block/mmcblk0p10
In the avent of a problem, you should be able to restore the original Motorola recovery.img to the /dev/block/mmcblk0p10 partition with the following command:
dd if=/sdcard-ext/recovery.img of=/dev/block/mmcblk0p10
FYI follows are the md5sums from my "Atrix 4g" as delivered original factory boot.img and recovery.img
/mnt/sdcard-ext/root_recovery_orig # cat md5sums.txt
bc6c254bd80bed5a9c0d3c7cd5c77b07 boot.img from /dev/block/mmcblk0p11
7580ad9c3bca264a563c13741162d9b8 recovery.img from /dev/block/mmcblk0p10
/mnt/sdcard-ext/root_recovery_orig # ls -al *.img
----rwxr-x 1 system sdcard_r 8388608 Nov 15 13:20 boot.img
----rwxr-x 1 system sdcard_r 8388608 Nov 15 13:19 recovery.img
I assume the factory LOCKED bootloader located on the first partition /dev/block/mmcblk0p1 does NOT effect booting into the new cwm recovery partition via the "adb reboot recovery" command or by holding the volume down while powering on the phone?
When booting into the new CWM recovery partition, what /dev/block/mmcblk0 partitions are mounted? If any partitions are mounted, are they mounted read-only?
Booting from the content of the CWM recovery partition, can I backup/restore the entire /dev/block/mmcblk0 device (all 18 partitions)? Nothing like creating a full device image (with nothing mounted r/w) for when disaster strikes.
Assuming any of the above is valid, I need get the cwm dd image for somewhere (pointers welcome)
Issuing DD commands can be VERY-VERY-VERY dangerous if done wrong. If you do not understand how dd works, PLEASE do NOT attempt anything you read in this post. Until other forum members comment on this post content, I do NOT plan do anything (neither should anyone else!!!!)
Regards, Ron
Request for info from someone with CWM installed in recovery partition
Could I get someone who has CWM working on their Atrix 4G to please run the following command from the su prompt on the smartphone and post the output.
# fdisk -lu /dev/block/mmcblk0
Also please indicate if you have the bootloader unlocked or not.
Regards Ron
rrolsbe said:
My Atrix 4G phone is currently rooted but does NOT have the bootloader unlocked. I do not plan to (at least for the forseeable future) installing different ROM's but I would like to install (if possible) the CWM restore partition. Unlocking the bootloader wipes the device (backups can be performed to restore the wiped information); likewise, the DRM keys are removed during the bootloader unlocking procedure and there MIGHT be ways to restore them (watching streaming video is important to me).
From what I have read on this forum and others, I should be able to load the CWM restore partition WITHOUT unlocking the bootloader. There are a few methods documented to install the CWM werewithall onto the restore partition BUT would something like the following also work?
From an SSH connection to the rooted phone perform the following:
Backup the current restore partition delivered my Motorola via the following command in case something goes wrong.
dd if=/dev/block/mmcblk0p10 of=/sdcard-ext/recovery.img
Copy the recovery.img file to your PC for additional safe keeping.
Zero out the restore partition before installing the new CWM recovery image.
388,608
dd if=/dev/zero of=/dev/block/mmcblkp10
Copy the new cwm.img image to the recovery partition using the following command:
Note the replacement cwm image file can NOT be larger than 8192 blocks with each block being 512 bytes.
8192 * 512 * 2 = 8,388,608 bytes. If the cwm image is to big, I am not sure if the following dd command would write into the p11 boot partition (NOT good). Verify cwm.img size BEFORE issuing the following DD command.
dd if=/sdcard-ext/cwm.img of=/dev/block/mmcblk0p10
In the avent of a problem, you should be able to restore the original Motorola recovery.img to the /dev/block/mmcblk0p10 partition with the following command:
dd if=/sdcard-ext/recovery.img of=/dev/block/mmcblk0p10
I assume the factory LOCKED bootloader located on the first partition /dev/block/mmcblk0p1 does NOT effect booting into the new cwm recovery partition via the "adb reboot recovery" command or by holding the volume down while powering on the phone?
When booting into the new CWM recovery partition, what /dev/block/mmcblk0 partitions are mounted? If any partitions are mounted, are they mounted read-only?
Booting from the content of the CWM recovery partition, can I backup/restore the entire /dev/block/mmcblk0 device (all 18 partitions)? Nothing like creating a full device image (with nothing mounted r/w) for when disaster strikes.
Assuming any of the above is valid, I need get the cwm dd image for somewhere (pointers welcome)
Issuing DD commands can be VERY-VERY-VERY dangerous if done wrong. If you do not understand how dd works, PLEASE do NOT attempt anything you read in this post. Until other forum members comment on this post content, I do NOT plan do anything (neither should anyone else!!!!)
Regards, Ron
Click to expand...
Click to collapse
Another question/Observation
It might be possible that the factory supplied locked bootloader checks the "Digitial Signature" of the recovery partition before booting into recovery mode is allowed??? If this is true, the signature check of the CWM image would FAIL thus requiring an unlock of the boot loader! Hopefullly, dd'ing the original saved recovery.img back onto the recovery partition would at least get back to factory configuration (IE.. allow booting into factory supplied recovery mode)!!
Again, Thanks for any help regarding this post!
Regards, Ron
rrolsbe said:
Could I get someone who has CWM working on their Atrix 4G to please run the following command from the su prompt on the smartphone and post the output.
# fdisk -lu /dev/block/mmcblk0
Also please indicate if you have the bootloader unlocked or not.
Regards Ron
Click to expand...
Click to collapse
Code:
[B]# fdisk -lu /dev/block/mmcblk0[/b]
Disk /dev/block/mmcblk0: 15.9 GB, 15914762240 bytes
1 heads, 16 sectors/track, 1942720 cylinders, total 31083520 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 1024 8191 3584 83 Linux
Partition 1 does not end on cylinder boundary
/dev/block/mmcblk0p2 8192 9215 512 83 Linux
Partition 2 does not end on cylinder boundary
/dev/block/mmcblk0p3 9216 13311 2048 83 Linux
Partition 3 does not end on cylinder boundary
/dev/block/mmcblk0p4 13312 31005695 15496192 5 Extended
Partition 4 does not end on cylinder boundary
/dev/block/mmcblk0p5 14336 16383 1024 83 Linux
/dev/block/mmcblk0p6 16384 17407 512 83 Linux
/dev/block/mmcblk0p7 17408 18431 512 83 Linux
/dev/block/mmcblk0p8 18432 20479 1024 83 Linux
/dev/block/mmcblk0p9 20480 24575 2048 83 Linux
/dev/block/mmcblk0p10 24576 40959 8192 83 Linux
/dev/block/mmcblk0p11 40960 57343 8192 83 Linux
/dev/block/mmcblk0p12 57344 712703 327680 83 Linux
/dev/block/mmcblk0p13 712704 2285567 786432 83 Linux
/dev/block/mmcblk0p14 2285568 2326527 20480 83 Linux
/dev/block/mmcblk0p15 2326528 3637247 655360 83 Linux
/dev/block/mmcblk0p16 3637248 7831551 2097152 83 Linux
/dev/block/mmcblk0p17 7831552 8538111 353280 83 Linux
/dev/block/mmcblk0p18 8538112 31005695 11233792 83 Linux
As far as installing custom recovery with locked bootloader goes, I'm pretty sure that won't work, or else someone would've come up with that long long time ago.
Thanks!!
ravilov
Thanks for the information in your post. Since it appears that some owners have replaced their recovery partition with CWM having only rooting, I was hoping that the recovery partition might NOT be signed by Motorola and checked during the recovery boot process. BTW, my Atrix 4G is an International carrier unlocked version. I have another Atrix 4G on order, I might try DD'ing to the recovery partition and if that fails roll back the recovery.img backup. If the recovery partition is actually signed and checked during the boot process, returning the partition bit-for-bit with the original SHOULD revert to factory. From my reading, it some cases the recovery partition is NOT signed even though the bootloader/boot partition IS signed.
Again, Thanks Very Much for your post
Regards, Ron

[Q] New phone can not boot! after titanium backup. Help

Hi.
Thanks to everyone who might give me some help.
I have a new quad-core phone with android 4.2.1, that is now useless. It can not boot, it freeze at second bootlogo, before animation.
It is rooted, and i have made some changes to build.prop. It worked fine, but after some time i realized the gallery and camera app was gone.
Then i did following:
Installed updated standard gallery+camera apk found online, both in the same app. from here http://forum.xda-developers.com/showthread.php?t=2341080
Works great, but i wanted to make it a system app, so did that with titanium backup.
After that, the camera app is gone. Gallery app is still working.
So i tried to change it back to user app, again with titanium, but did not stop working. After some time i took out the battery.
Now it freeze before boot animation.
I tried "wipe data/factory reset" and "wipe cache partition", in system recovery but still not booting!
I tried to backup user data from another phone, same model, and restore on this one but says "Error: checksum compare fail".
Do i need to flash a new rom to the phone with my pc? I have not tried this before, and i want to keep stock rom.
I have read this page:
http://www.chargeforums.com/forum/d...-flashing-roms-return-stock-odin-picture.html
But i can not get it in download mode, with those hotkeys?
If it is to any help, i have acces to other working phones of the same model.
Flashing new? It's look like this. How? I don't know because I have no information over ur phone.
Gesendet von meinem Xperia SP
joke19 said:
Flashing new? It's look like this. How? I don't know because I have no information over ur phone.
Gesendet von meinem Xperia SP
Click to expand...
Click to collapse
Its a noname phone imported from China.
The model is called A999M or Android Grand 1.
I can go in system recovery with volume up + power. But not helping. The only other boot menu i can acces, is only sometimes with volume down + power, i will get a menu but all en chinese.
I managed to get the bad build.prop file from the phone with adb, and see the error in it. But i can not get write acces to change/replace the file.
I compared the build.prop i modified on crashed phone, with working phone and the difference is following all changed to a OEM name (with Capial first letter, that gives problems):
ro.product.name=hexing89_we_jb2
ro.product.device=hexing89_we_jb2
ro.product.board=hexing89_we_jb2
ro.build.product=hexing89_we_jb2
"adb root" returns "adbd cannot run as root in production builds" and all other options like remount for r/w acces gives "remount failed: Operation not permitted"
The phone was rooted with framaroot:
http://forum.xda-developers.com/showthread.php?t=2130276
Would be very glad for some help. If you have the answer to fix it, i might even pay a little for your time.
So adb connects right?
Try this
adb shell
ls -l /dev/block/partitions
And from here keep searching and try to find by name (we are looking for system partition here)
If you can't find it from a shell try
cat /proc/partitions
Or just simply
Mount
If you find system then run this
adb shell
su
mount -o rw,remount /dev/block/mtdblock3 /system
Or whatever path to /system is
Then
You can simply push or use dd commands to push new build.prop and then chmod permissions to 644
Let me know what comes of this, as I know nothing about your phone but it sounds very fixable
Sent from my Nexus 4 using XDA Premium 4 mobile app
demkantor said:
So adb connects right?
Try this
adb shell
ls -l /dev/block/partitions
And from here keep searching and try to find by name (we are looking for system partition here)
If you can't find it from a shell try
cat /proc/partitions
Or just simply
Mount
If you find system then run this
adb shell
su
mount -o rw,remount /dev/block/mtdblock3 /system
Or whatever path to /system is
Then
You can simply push or use dd commands to push new build.prop and then chmod permissions to 644
Let me know what comes of this, as I know nothing about your phone but it sounds very fixable
Sent from my Nexus 4 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Hi.
I can not do that. First i already found the build.prop file. I can simply put "adb shell", and "cd /system", and "ls -all", and then i see the build.prop file.
I can also go youre way and do "mount -o rw,remount /dev/block/mmcblk0p5 /system", but it says "mount: Operation not permitted"
Remember i can not do adb root. I get "adbd cannot run as root in production builds".
I can also not do "su" inside adb shell. Everytime i do, prompt freezes. I think my phone is suposed to prompt me for Su acces, but shows nothing but the boot logo.
So for now, the problem is i have only read acces. No write acces.
Were not looking to list everything in system partition, rather trying to fin the block, I just wrote some random block that I'm sure is not yours unless you have some old mtd phone
In other words don't ls /system but rather /dev/block..... Until you find the block or use cat or mount or whatever to find it so you know what to mount
Also can you get to recovery and use adb there? If so I would recommend this as your system is already goofed up
Sent from my Nexus 7 using XDA Premium 4 mobile app
demkantor said:
Were not looking to list everything in system partition, rather trying to fin the block, I just wrote some random block that I'm sure is not yours unless you have some old mtd phone
In other words don't ls /system but rather /dev/block..... Until you find the block or use cat or mount or whatever to find it so you know what to mount
Also can you get to recovery and use adb there? If so I would recommend this as your system is already goofed up
Sent from my Nexus 7 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Hi.
If i just write "mount" i get:
/[email protected] /system ext4 ro,noatime,noauto_da_alloc,commit=1,data=ordered 0 0
/[email protected] /data ext4 rw,nosuid,nodev,noatime,discard,noauto_da_alloc,data=ordered 0 0
/[email protected] /cache ext4 rw,nosuid,nodev,noatime,discard,noauto_da_alloc,data=ordered 0 0
/dev/block/loop0 /mnt/cd-rom iso9660 ro,relatime 0 0
/[email protected]_f /protect_f ext4 rw,nosuid,nodev,noatime,nodelalloc,noauto_da_alloc,commit=1,data=ordered 0 0
/[email protected]_s /protect_s ext4 rw,nosuid,nodev,noatime,nodelalloc,noauto_da_alloc,commit=1,data=ordered 0 0
If i just write "ls -all" i get:
lrwxrwxrwx root root 1970-01-01 01:00 [email protected] -> /dev/block/mmcblk0p5
lrwxrwxrwx root root 1970-01-01 01:00 [email protected] -> /dev/block/mmcblk0p6
lrwxrwxrwx root root 1970-01-01 01:00 [email protected] -> /dev/block/mmcblk0p1
lrwxrwxrwx root root 1970-01-01 01:00 [email protected] -> /dev/block/mmcblk0p8
lrwxrwxrwx root root 1970-01-01 01:00 [email protected]_f -> /dev/block/mmcblk0p2
lrwxrwxrwx root root 1970-01-01 01:00 [email protected]_s -> /dev/block/mmcblk0p3
lrwxrwxrwx root root 1970-01-01 01:00 [email protected]_ro -> /dev/block/mmcblk0p4
lrwxrwxrwx root root 1970-01-01 01:00 [email protected] -> /dev/block/mmcblk0p7
I hope i got the info you wanted. What should i write next?
Well we know its ext4 file system but we still don't have the block location
Try
ls -l -a /dev/block/platform
And see what you get
Sent from my Nexus 7 using XDA Premium 4 mobile app
Not near a PC so just ran a terminal emulator so I can show you what we hope to find
If you have a by-name directory you're golden, if not we will keep looking
(Hit __ twice by accident in screen shot)
Sent from my Nexus 7 using XDA Premium 4 mobile app
demkantor said:
Well we know its ext4 file system but we still don't have the block location
Try
ls -l -a /dev/block/platform
And see what you get
Sent from my Nexus 7 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Inside "block" i get:
loop0
loop1
loop2
loop3
loop4
loop5
loop6
loop7
mmcblk0
mmcblk0boot0
mmcblk0boot1
mmcblk0p1
mmcblk0p2
mmcblk0p3
mmcblk0p4
mmcblk0p5
mmcblk0p6
mmcblk0p7
mmcblk0p8
mmcblk1
mmcblk1p1
platform
vold
Inside "platform" i get:
mtk-msdc.0
mtk-msdc.1
Inside "mtk-msdc.0" i get:
by-num
mmcblk0 -> /dev/block/mmcblk0
mmcblk0boot0 -> /dev/block/mmcblk0boot0
mmcblk0boot1 -> /dev/block/mmcblk0boot1
mmcblk0p1 -> /dev/block/mmcblk0p1
mmcblk0p2 -> /dev/block/mmcblk0p2
mmcblk0p3 -> /dev/block/mmcblk0p3
mmcblk0p4 -> /dev/block/mmcblk0p4
mmcblk0p5 -> /dev/block/mmcblk0p5
mmcblk0p6 -> /dev/block/mmcblk0p6
mmcblk0p7 -> /dev/block/mmcblk0p7
mmcblk0p8 -> /dev/block/mmcblk0p8
Inside "mtk-msdc.1" i get:
by-num
mmcblk1 -> /dev/block/mmcblk1
mmcblk1p1 -> /dev/block/mmcblk1p1
Sorry I'm blind, your mount showed /system is being called android, so you need to change the mount command from earlier to mmcblk0p5 from mtd....
Also did you try running adb from recovery mode?
Sent from my Nexus 7 using XDA Premium 4 mobile app
demkantor said:
Sorry I'm blind, your mount showed /system is being called android, so you need to change the mount command from earlier to mmcblk0p5 from mtd....
Also did you try running adb from recovery mode?
Sent from my Nexus 7 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
I just tried:
[email protected]:/ $ mount -o rw,remount /dev/block/mmcblk0p5 /system
mount -o rw,remount /dev/block/mmcblk0p5 /system
mount: Operation not permitted
I think its because i can not do "su". Its just stops when i write it, and waiting on an empty line.
In system recovery i tried "wipe data/factory reset" and "wipe cache partition". But it does not help, since it will not recover system files like build.prop that is faulty. I also tried to "apply update" from zip and adb with the correct build.prop. But it can not apply it.
What recovery do you have? Stock? Custom?
Have you tried adb through recovery?
After you hit su does the prompt change from $ to # ?
Actually if you copy and paste all input/output from cmd/terminal when you try them out it is easier to help fix
Sent from my Nexus 7 using XDA Premium 4 mobile app
demkantor said:
What recovery do you have? Stock? Custom?
Have you tried adb through recovery?
After you hit su does the prompt change from $ to # ?
Actually if you copy and paste all input/output from cmd/terminal when you try them out it is easier to help fix
Sent from my Nexus 7 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
I believe its just stock recovery. When im in recovery menu, i can not connect with adb.
C:\Users\Dennis>adb shell
[email protected]:/ $ su
su
-waiting on this empty line-
Mmm.... Does the oem have a website, often if you can find it there will be stock firmware/software with instructions on how to flash it. Like through fastboot or some download mode (maybe that Chinese writing screen - try getting a photo of it and see if someone will be nice and translate it for you)
Often there is some flash suite for these no-name devices like rockchips have as well as some well known OEMS
But without root access and no oem software this may be more difficult than I hoped, check around a bit and let me know what you find
Sent from my Nexus 7 using XDA Premium 4 mobile app
demkantor said:
Mmm.... Does the oem have a website, often if you can find it there will be stock firmware/software with instructions on how to flash it. Like through fastboot or some download mode (maybe that Chinese writing screen - try getting a photo of it and see if someone will be nice and translate it for you)
Often there is some flash suite for these no-name devices like rockchips have as well as some well known OEMS
But without root access and no oem software this may be more difficult than I hoped, check around a bit and let me know what you find
Sent from my Nexus 7 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Okay thank you. Im thinking if its possible to take a nandroid backup from a working phone (my girlfriend have one too), and recover on this one. But dont know if i can recover without root acces?
No worries, does your recovery have a nandroid backup and install function? If so then this would be ideal! The other option maybe to use dd commands to take her system.img and restore to yours through dd, but to me this is always a last resort as dd didn't get/the nickname disk destroyer for nothing! (_although it is safe so long as you don't mistype)
But start by looking for oem software and a flash mode if your recovery doesn't have backup restore options
Sent from my Nexus 7 using XDA Premium 4 mobile app
demkantor said:
No worries, does your recovery have a nandroid backup and install function? If so then this would be ideal! The other option maybe to use dd commands to take her system.img and restore to yours through dd, but to me this is always a last resort as dd didn't get/the nickname disk destroyer for nothing! (_although it is safe so long as you don't mistype)
But start by looking for oem software and a flash mode if your recovery doesn't have backup restore options
Sent from my Nexus 7 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
There is no oem software, i have to work it out myself. The stock recovery only have options to backup and restore "user date". Not the system. But still i already tried to restore a backup from another phone, but get checksum error. I tried a few workaround for this, but didnt help.
I think i need to learn how to do a full nandroid copy. But i just hoped it was possible to just copy the one file i need, and not everything.
...if its just data partition then this won't help. The only ways I know how to do a nandroid is with a custom recovery (you don't have)
Adb http://forum.xda-developers.com/showthread.php?t=1021625
But as you can see requires root
Some apps - you have no os
Utilities like android commander or droid explorer -_ need root
So this leaves dd commands, but maybe keep digging for stock website or getting someone to translate that screen for you (may be what you're after)
Best of luck!
Sent from my Nexus 7 using XDA Premium 4 mobile app

[HOWTO] Convert your Optimus G to a Nexus 4 and Back

DISCLAIMER: THIS IS VERY DANGEROUS COMPARED TO A NORMAL ROM FLASH. DO NOT DO THIS IF YOU DON'T KNOW WHAT YOU'RE DOING OTHER THAN FLASHING ROMS.
IF SOMETHING GOES WRONG, YOU HAVE ONLY YOURSELF TO BLAME. YOU HAVE BEEN WARNED.[/B]
To convert to Nexus 4
First off, there are a few issues.
-SDCard doesn't work.
-Capacitive buttons aren't working. No known way to fix it.
First off, lets flash the N4 Rom.
1) Install LGNPST - Use tSilenzio's AutoLGNPST - http://www.oudhitsquad.com/android/LGE/Firmware/Tools/AutoLGNPST-tSilenzio.zip
2) Download the Nexus 4 Image - https://www.androidfilehost.com/?fid=9390248398092765463
3) Rename the extracted .tot file to a .bin file
4) Put the phone in Download mode. Volume Up + Volume Down While inserting USB cable.
5) Open LGNPST and select the phone - Should be Com[Number]
6) In the DLL section, select LGNPST_LS970.dll
7) In the file selection, select the previously renamed Nexus 4 bin file.
8) Start the flashing process and hold your breath.
9) When it hits 67%, your phone should start booting. DO NOT UNPLUG YET.
10) At 85%, an error will occur saying that the phone was unplugged. Ignore it and close LGNPST. The image is fully flashed.
11) Hold Volume Up + Power to put the phone into FASTBOOT mode.
12) Download the recovery from here and place it into your fastboot directory. - http://forum.xda-developers.com/showthread.php?t=2010984
13) Download the following 3 files and place them on the MicroSD card. - http://d-h.st/cFA - http://d-h.st/yUQ - http://d-h.st/0dH
14) While still in fastboot, type "fastboot boot recovery.img" - This will put the phone on the custom recovery. Make sure the SD card is in.
---Here, we're going to fix the partition tables for 16GB of space and replace the backup GPT so that we can't hardbrick from the backup GPT.
15) Run adb shell to get into a root shell in recovery.
16) Copy the modified DD onto the phone
Code:
# cp /external_sd/dd /
# chmod 755 /dd
17) Backup the partition tables incase something goes wrong.
Code:
# /dd if=/dev/block/mmcblk0 of=/external_sd/pgpt8G.img bs=512 count=34
# /dd if=/dev/block/mmcblk0 of=/external_sd/sgpt8G.img bs=512 skip=30777311
18) Unmount the filesystems so that you can overwrite the partition table.
Code:
# umount /data
# umount /cache
19) Make sure nothing is mounted. It should return this (Other than partition size):
Code:
# df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 911.7M 48.0K 911.6M 0% /dev
/dev/block/mmcblk1p1 59.4G 4.8G 54.6G 8% /external_sd
20) Move the partitions to their new locations. This may take a couple minutes.
Code:
# /dd if=/dev/block/mmcblk0 of=/external_sd/DDR bs=512 skip=15267840 count=2015
# /dd if=/external_sd/DDR of=/dev/block/mmcblk0 bs=512 seek=30775296 conv=notrunc
21) Install the new partition tables.
Code:
# /dd if=/external_sd/sgpt16G.img of=/dev/block/mmcblk0 bs=512 seek=30777311 conv=notrunc
# /dd if=/external_sd/pgpt16G.img of=/dev/block/mmcblk0 bs=512 seek=0 conv=notrunc
22) Make sure no errors occurred. Run 'parted /dev/block/mmcblk0' and check that it returns the same as the below.
Code:
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Model: MMC 016G92 (sd/mmc)
Disk /dev/block/mmcblk0: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 524kB 67.6MB 67.1MB fat16 modem
2 67.6MB 68.2MB 524kB sbl1
3 68.2MB 68.7MB 524kB sbl2
4 68.7MB 70.8MB 2097kB sbl3
5 70.8MB 71.3MB 524kB tz
6 71.3MB 94.4MB 23.1MB boot
7 94.4MB 117MB 23.1MB recovery
8 117MB 118MB 799kB m9kefs1
9 118MB 119MB 799kB m9kefs2
10 119MB 120MB 799kB m9kefs3
11 120MB 121MB 524kB rpm
12 121MB 121MB 524kB aboot
13 121MB 122MB 524kB sbl2b
14 122MB 124MB 2097kB sbl3b
15 124MB 124MB 524kB abootb
16 124MB 125MB 524kB rpmb
17 125MB 125MB 524kB tzb
18 125MB 126MB 524kB metadata
19 126MB 143MB 16.8MB misc
20 143MB 159MB 16.8MB ext4 persist
21 159MB 1040MB 881MB ext4 system
22 1040MB 1627MB 587MB ext4 cache
23 1627MB 15.8GB 14.1GB ext4 userdata
24 15.8GB 15.8GB 524kB DDR
25 15.8GB 15.8GB 507kB grow
23) If something different was returned, run the below code to restore the previous partition tables.
Code:
# /dd if=/external_sd/sgpt8G.img of=/dev/block/mmcblk0 bs=512 seek=30777311 conv=notrunc
# /dd if=/external_sd/pgpt8G.img of=/dev/block/mmcblk0 bs=512 seek=0 conv=notrunc
24) Exit the shell and type 'adb reboot bootloader' or reboot the phone while holding Volume Up.
25) Check that you're in fastboot mode and exit the following commands - This will fix the filesystem to take up the entire partition.
Code:
fastboot erase userdata
fastboot format userdata
fastboot -w
26) Boot the phone and update as needed. Then, put this on the phone and flash in recovery.
27) You are now working other than the SD card and Capacitive buttons.
Credits:
http://forum.xda-developers.com/showthread.php?t=2117576
http://forum.xda-developers.com/showthread.php?t=2099784
http://forum.xda-developers.com/showthread.php?t=2160124
http://forum.xda-developers.com/showthread.php?t=2146816
To convert from Nexus 4
This assumes that you have read the Convert to section.
1) Wipe the phone. Go into fastboot mode [Vol Up + Power] and execute the following commands. This is to prevent corrupted data partitions.
Code:
fastboot -w
fastboot format system
fastboot format userdata
fastboot format cache
fastboot format data
fastboot erase system
fastboot erase userdata
fastboot erase cache
fastboot erase data
2) LGNPST back to stock. You will do this twice to fix some issues.
To get into download mode, turn the phone off and hold Vol Up + Vol Down while inserting the USB cable.
3) Download these 2 images. Mar. 8, 2013 and Sept. 29, 2012
4) Flash the Mar. 8, 2013 firmware in LGNPST (See above for how to flash firmware in LGNPST. As before, the phone will start booting at 67% and LGNPST will show an error at 85%. Ignore the error and close LGNPST.
5) Restart the phone in download mode and now flash the Sept. 29, 2012 firmware. If you don't, your /SDCARD may be corrupted and you cant root.
6) Root the phone and unlock the bootloader. See here
7) If that doesn't work, try Teenybin.
8) Some partitions are broken. Go into CWM recovery and open an 'adb shell'.
9) Execute the following code. This will backup the broken partitions and wipe them.
Code:
dd if=/dev/block/mmcblk0p15 of=/sdcard/mmcblk0p15.bak
dd if=/dev/block/mmcblk0p16 of=/sdcard/mmcblk0p16.bak
dd if=/dev/block/mmcblk0p19 of=/sdcard/mmcblk0p19.bak
mke2fs -T ext4 /dev/block/mmcblk0p15
mke2fs -T ext4 /dev/block/mmcblk0p16
mke2fs -T ext4 /dev/block/mmcblk0p19
---You should now be back to stock--- LGNPST again if you want 'True Stock'
Let me know if you see anything wrong and please leave nasty comments at the door.
Ok, granted. This is more about recovering from flashing to Nexus 4 than about flashing to it. Basically, DON'T DO IT, as it doesn't seem to be worth it. We have AOSP and Cyanogen, etc.
I just posted this because I bought a phone that was flashed and went through hours of work fixing it.
Please read this before you think about flashing. http://forum.xda-developers.com/showpost.php?p=36735476&postcount=149
Its not worth it so much now but it was great when first released and it doesn't take that long to revert your phone. I went back and fourth like 5 times and my phone is fine. I think there is a low chance of your phone bricking as long as you follow instructions. The conversion is still a good option to have.
Sent from my LG Optimus G using XDA Premium 4 mobile app
Dr0!dFreek said:
Its not worth it so much now but it was great when first released and it doesn't take that long to revert your phone. I went back and fourth like 5 times and my phone is fine. I think there is a low chance of your phone bricking as long as you follow instructions. The conversion is still a good option to have.
Sent from my LG Optimus G using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Yeah, it seems nice to have the ability to do so, which is why I wrote the guide (and to give a single comprehensive guide that works).
It's nice to have a perfectly working KitKat rom the day its released, which is why I converted (When KK was released), but now, it doesn't seem worth it (We have AOSP). If you want MultiRom and franco kernel (Like I did), then its nice to have, but otherwise, most people don't need it.
alastair53 said:
13) Download the following 3 files and place them on the MicroSD card. - http://d-h.st/cFA - http://d-h.st/yUQ - http://d-h.st/0dH
Click to expand...
Click to collapse
Is this part SPYWARE? the 3 files downloads a exe and is detetected as virus or something.

[Guide] Resizing LG G2 partition size

Resizing LG G2 partition size​Must have: Latest TWRP Recovery, ADB experience and gdisk for arm in attached zip.
Clean /system partition (unused apps, bloatware, garbage and so on...)
Backup everything important from /sdcard.
Reboot to TWRP and connect ADB (if "ADB devices" fails, check windows "Device Management" and install "Android Sooner Single ADB Interface" for your unrecognized phone).
In TWRP backup /system and /data and download /sdcard/TWRP folder via MTP to your PC.
Now it's ADB time:
Code:
[B]# check /system used space (in Mb) and remember it, as we should cut no more than "Available" space:[/B]
adb shell "mount /system"
adb shell "df -m /system"
[B]# un-mount partitions:[/B]
adb shell "umount /system"
adb shell "umount /data"
adb shell "umount /sdcard"
adb shell "umount /cache"
[B]# unzip gdisk in your ADB folder and install it:[/B]
adb push gdisk /sbin
adb shell "chmod 0755 /sbin/gdisk"
[B]# check partitions info:[/B]
adb shell "/sbin/gdisk -l /dev/block/mmcblk0" >gpt.txt
[B]# open new gpt.txt file in your ADB folder
# now you should recalculate your new partitions (30-36) size and position (in sectors)
# partition start-sector should be even, end-sector should be odd
# to make it simplier, use formula: (new size in MB) * 2048 + 1 = (new size in sectors)[/B]
Check my examples:
Code:
default (4.4.2 firmware):
30 819200 6488063 2.7 GiB 0700 system
31 6488064 7733247 608.0 MiB 0700 cache
32 7733248 7897087 80.0 MiB 0700 tombstones
33 7897088 7929855 16.0 MiB 0700 spare
34 7929856 8028159 48.0 MiB 0700 cust
35 8028160 60948479 25.2 GiB 0700 userdata
36 60948480 61071326 60.0 MiB 0700 grow
my mod v1:
(30) 800000 3526297 1.3 GiB system
(31) 3526298 3853977 160 MiB cache
(32) 3853978 3858073 2 MiB tombstones
(33) 3858074 3862169 2 MiB spare
(34) 3862170 3866265 2 MiB cust
(35) 3866266 61067229 27.2 GiB userdata
(36) 61067230 61071326 2 MiB grow
my_mod_v2:
(30) 800000 2897153 1 GiB system
(31) 2897154 3122433 110 MiB cache
(32) --- --- deleted tombstones
(33) --- --- deleted spare
(34) 3122434 3126531 2 MiB cust
(35) 3126532 61071326 27.6 GiB userdata
(36) --- --- deleted grow
Important! It's only mine D802 4.4.2 example. You should calculate your own values, because of your /system used size, /cust size for unlock, etc.
/spare and /grow partitions unused on our phones. /tombstones is obesolete since it mounts from /data, anyway.
After all checks and calculations, let's do the magic:
Code:
[B]# run gdisk:[/B]
adb shell
cd /sbin
gdisk /dev/block/mmcblk0
[B]# no real changes applied to the phone, before "w" command.
# if you did something wrong, exit by "q" command
# you can check youreself with "p" command (partition list with virtual changes you made).
# OK, let's delete our old partitons and create them anew:[/B]
"d" command > enter partition number (for all 30-36 partitons).
"n" command > enter partition number > start > end > code (start & end = new values in sectors, code = 0700)
"c" command > enter partition number > name (system, cache, etc.)
[B]# if all seems fine, and you're pretty sure of youreself:[/B]
"w" command > "Y" answer
[B]# there is no FS on new partitions, so format them:[/B]
mke2fs -t ext4 /dev/block/mmcblk0p30
mke2fs -t ext4 /dev/block/mmcblk0p31
mke2fs -t ext4 /dev/block/mmcblk0p34
mke2fs -t ext4 /dev/block/mmcblk0p35
[B]# there is no point to format others, because they have no fs by default.
# if using kernel with F2FS support (like Dorimanx), you can format some of them as F2FS:[/B]
mkfs.f2fs /dev/block/mmcblk0p35
[B]# to make TWRP realise, horrors we just did - reboot it:[/B]
reboot recovery
[B]# after reboot, we can optimize /userdata a bit (ext4 only), with this:[/B]
adb shell "tune2fs -m 0 /dev/block/platform/msm_sdcc.1/by-name/userdata"
[B]# bring backups from PC to /sdcard via MTP and restore them, as usual
# now you can reboot to your system with custom-sized partitions!
# P.S. If you notice your /sdcard permissions glith a bit after all this - flash "sdcard Fix Permissions script" from [URL="http://forum.xda-developers.com/showthread.php?t=2239421"]this[/URL] thread.[/B]
Good luck.
Awesome :good: this guide will help 16GB user like me to increase data/sdcard partition
Too bad I don't have pc to play around with....
so, stock, user-usable fresh after format on KK4.4 we have 24GB on the /sdcard part. Would we want to use this to go smaller? Would there be a benefit to that? Or would I want to use it to go larger, shrinking my /sdcard
I know it can go both ways, but which are people more interested in here?
rancur3p1c said:
I know it can go both ways, but which are people more interested in here?
Click to expand...
Click to collapse
Who knows? It's not that hard, it takes 5 minutes, it gets you + 1-3 Gib on the phone (without SD-Card support), and it's safe - coz we don't touch bootloader or recovery partitions... It's worth it.
THIS is just pure awesome
I've followed the guide and successfully added almost 2gb to userdata on my 16gb d802
This is my gpt for now
30 791568 4158721 1.6 GiB 0700 system
31 4158722 4306179 72.0 MiB 0700 cache
34 4306180 4310277 2.0 MiB 0700 cust
35 4310278 30777310 12.6 GiB 0700 userdata
And this is my aim, if i have time to do it again
30 791568 3937297 1.5 GiB 0700 system
31 3937298 3961875 12.0 MiB 0700 cache
34 3961876 3965973 2.0 MiB 0700 cust
35 3965974 30777310 12.7 GiB 0700 userdata
Also, i've notice this in the gpt.txt file
Total free space is 230360 sectors (112.5 MiB)
So can we get even more from our phone?
Hello everybody
first of all I ll thank you for your guide Resizing LG G2 partition size.
But no I have problems with installing a new rom. Everytime I enter twrp I get the message "Can't mount /system". So its impossible for me to install a new rom.
All partitions seems to be fine. gdisk works perfect without any errors.
My partition table looks like:
Code:
30 819200 3686401 1.4 GiB 0700 system
31 3686402 4014083 160.0 MiB 0700 cache
34 4014084 4034565 10.0 MiB 0700 cust
35 4034566 30777310 12.8 GiB 0700 userdata
If someone have any idea how I can solve this problem?
Thanks
Chris
I am thinking to try this tool, but I would like to know if flashing kdz will work in case I screw things up, or am I risking to permanently brick the phone?
Okay, going back to stock partitions will fix my problem and my system partition is again 2.7 GB
With the customised partitions i was unable to install neither Resurrection Remix Rom nor Google Edition 1.5. Both return an error in twrp.
Backfisch said:
Everytime I enter twrp I get the message "Can't mount /system". So its impossible for me to install a new rom.
All partitions seems to be fine. gdisk works perfect without any errors.
Click to expand...
Click to collapse
I have the same problem. Did you fix it by any chance?
Yes, going back to the stock values of the partition using the gdisk again.
Its also import to make sure the partition format works correct. Better format twice....
Backfisch said:
But no I have problems with installing a new rom. Everytime I enter twrp I get the message "Can't mount /system". So its impossible for me to install a new rom.
Click to expand...
Click to collapse
Okay, the fix is that you have to restore TWRP backup, in my case CM13 booted all good. But now I have a different problem, the MTP connection is really unstable, disconnects and reconnects for no reason. Same problem using twrp mtp or cm mtp. Tried two different cables, two different pc, and resized the partitions twice using different values. Still no luck. Anyone had any similar experience?
EDIT: Seems my charging port is failing. Many cables have hard time being stable, but some of them work better.
Backfisch said:
Yes, going back to the stock values of the partition using the gdisk again.
Its also import to make sure the partition format works correct. Better format twice....
Click to expand...
Click to collapse
Back when I tried to resize the /system partition, all non-lg rom doesnt install because of that error, and they are the ones that has the most potential of freeing some space
you can only get some space from /cache and other partitions without getting errors
I have gained 2 Gb extra space on the internal memory, and it works great so far. The only problem is that flashing roms from twrp returns the error /system can not be mounted, and you have to install the rom by restoring twrp backups.
Am I right in thinking that you cant install an rom update with modified partitions by flashing it in twrp?
If restoring my backup is the only way to install my rom, I will delete some music and pictures on the userdata partition...
You can install roms with "system" folder and files in it, on modified partitions (if you have enough space in /system, of course).
But you won't be able to install CyanogenMod-based roms with partition image in them (system.img, system.bin, etc.)
I played with this a bit and something went wrong Now i can't flash any os neither TOT or KDZ. I dismantled my phone to enter 9006 mode and recover it from there. But with no success :c What should i do now? I have my stock values of 30f saved, but after flashing kdz and tot i have stock recovery. It doesn't have adb suppor so i can't start gdisk operation. And i can't push any rom or recovery by sideload. When recovery starts I have list of errors. It can't mount system, data etc. I think I bricked it quite well xd
SantoSubito said:
I played with this a bit and something went wrong Now i can't flash any os neither TOT or KDZ. I dismantled my phone to enter 9006 mode and recover it from there. But with no success :c What should i do now? I have my stock values of 30f saved, but after flashing kdz and tot i have stock recovery. It doesn't have adb suppor so i can't start gdisk operation. And i can't push any rom or recovery by sideload. When recovery starts I have list of errors. It can't mount system, data etc. I think I bricked it quite well xd
Click to expand...
Click to collapse
Did you fix it yet? Does download mode work? Why didn't work flashing kdz in the first place?
Yes it does. After flashing kdz phone enters recovery and I have list of errors. And when i tried to flash tot i have error something with laf partition and gpt. Yesterday i tried to recover it from 9008 but I'm also getting error :c
SantoSubito said:
And when i tried to flash tot i have error something with laf partition and gpt.
Click to expand...
Click to collapse
Try to flash TOT-firmware with modded dll (bypass gpt-error). One of this should do the trick.
Yeah it worked. But not in 100%. When its 94% my phone reboots and LG Tool shows:
...
CACHE
CACHE
CUST
Wiating for the device 120s
then device reboots and get bootloop
BoardDiag have this wierd dload error and also i cant do nothing with this tool

Categories

Resources