Unpacking/Editing a Recovery ROM

flapjack.fiasco

Well-known member
Sep 13, 2011
776
102
0
Visit site
I'd like to take apart a recovery ROM and mess with the insides, but I can't quite figure out how to unpack it, assuming there is a way to unpack it. I searched for a while, and came up with the following method, which didn't work for me. This is what I did so far. Let's say that my recovery is named 'recovery.img'. What I tried was this:

Code:
gunzip -c recovery.img | cpio -i

[Obviously executed in the same directory as recovery.img]

The error I get is:

Code:
recovery.img: not in gzip format

And cpio gives me:

Code:
premature end of archive

I'd like to know if anyone has a method for extracting the contents of a recovery ROM, but I'm starting to think that it's going to have to be built from source. Not that that will be a problem, it's just that I've never done it before. I'm more than willing to learn how.
 

flapjack.fiasco

Well-known member
Sep 13, 2011
776
102
0
Visit site
Really, what I want to do is add a script that does all the standard formatting for a fresh ROM install (dalvik, system, data, boot, etc.) all with one button push. I've been flashing so many ROMs lately, what with all the new alphas out there, and I feel like I'm wearing out my buttons. Maybe this is an unfounded fear, but at least it's motivation for improvement.

Sent from my LG-VM670 using Tapatalk
 

flapjack.fiasco

Well-known member
Sep 13, 2011
776
102
0
Visit site
That's what I was thinking. The touch recovery solves the hard keys wearing out issue, but it would still be nice to clean up for a fresh flash with one button press.

Sent from my LG-VM670 using Tapatalk
 

thewraith420

Well-known member
Sep 6, 2011
1,987
223
63
Visit site
That's what I was thinking. The touch recovery solves the hard keys wearing out issue, but it would still be nice to clean up for a fresh flash with one button press.

Sent from my LG-VM670 using Tapatalk

Sure would be nice. I switched to the touch recovery and it's also much easier on my buttons.

Sent from my LG-VM670 using Tapatalk
 
  • Like
Reactions: flapjack.fiasco

flapjack.fiasco

Well-known member
Sep 13, 2011
776
102
0
Visit site
I haven't actually changed recoveries yet, I want to get the script figured out first. I'm trying to set up a computer to build on, but I'm having trouble initializing repo. I haven't had the chance to read through the entire building your own ROM thread yet, so maybe I'll find my answer there. Once that's done, I'll be on my way to making an improved recovery, I hope ;-).

Sent from my LG-VM670 using Tapatalk
 

flapjack.fiasco

Well-known member
Sep 13, 2011
776
102
0
Visit site
you can unpack a recovery.img with split_bootimg.pl. Then repack it with mkbootfs and mkbootimg just like a boot.img

Thank you Asadullah! I just got my build environment up and running. I built Bobzhome last night. But I still have to find exactly where in the recovery ROM the scripts for wiping/formatting are (if that part is even script based).

Sent from my LG-VM670 using Tapatalk
 

flapjack.fiasco

Well-known member
Sep 13, 2011
776
102
0
Visit site
Okay, so it looks like it's not scripts, correct me if I'm wrong, but it looks like what I need to edit is here: /system/bootable/recovery/recovery.c

So it's written in C? I guess I got the wrong impression from what little I had read on recovery ROMs. I somehow got the idea that the functions performed by the recovery were written in some sort of scripting language. At any rate, it doesn't look like it's going to be that hard to modify the code, after all, it's just combining the existing features.
 

Trending Posts

Forum statistics

Threads
943,177
Messages
6,917,647
Members
3,158,862
Latest member
danishpeer