Page 1 of 1

Reinstall stock recovery

PostPosted: January 26th, 2011, 6:55 am
by Fonefixer
Im trying to reinstall stock recovery (thanks to those who have helped so far) to no avail.

Ive been poking my nose in a few files and have come across these lines in the install-recovery.sh file:
#!/system/bin/sh
if ! applypatch -c

I know nothing about android but I have an idea that this code is a reference to an sh file that I have on my scroll (ive checked, it is there). My question is this, what does the "!" mean? Is it saying something like " if the system/bin/sh file is not there or corrupt, apply the patch (ie reinstall original recovery)" if so what should i do, modify the sh file, delete it?

Ive googled the first line of code and there are suggestions that a line of code is missing, something like "mount -o rw /system"

Am I barking up the wrong tree?

TIA

Re: Reinstall stock recovery

PostPosted: January 26th, 2011, 7:51 am
by Panrider
The first line invokes the shell.

Not sure about the second line - have got to go to work so have run out of time to look for it :)

Mark

Re: Reinstall stock recovery

PostPosted: January 26th, 2011, 8:19 am
by Diego
! is a negation -ie == is 'equal to' and != is 'not equal to'- so I'd say your guess is most likely accurate.

Re: Reinstall stock recovery

PostPosted: January 26th, 2011, 9:42 am
by Charlie
in the init.rc file there is this service call line:

Code: Select all

service flash_recovery /system/etc/install-recovery.sh
    oneshot

Each time the OS boots it therefore runs /system/etc/install-recovery.sh.

Code: Select all
#!/system/bin/sh
if ! applypatch -c MTD:recovery:2048:039c557a915d0952eba272ceddb5824efff621ad; then
  log -t recovery "Installing new recovery image"
  applypatch MTD:boot:5165056:2da0a439bb088865736290b16e8277d47cfd5d6d MTD:recovery 1975102594023372b9758eb4e3dcd288564e6971 5423104 2da0a439bb088865736290b16e8277d47cfd5d6d:/system/recovery-from-boot.p
else
  log -t recovery "Recovery image already installed"
fi

What this does is look at the first 2K block of the recovery partition image and take a SHA1 has of it. If the hash isn't the one shown then it calls "applypatch". Applypatch uses the first 2,875,392 bytes of the boot partition image (headers, kernel, and ramdisk) and the contents of /system/recovery-from-boot.p (a "diff" file) to mathematically reconstruct an image of the recovery partition.

Re: Reinstall stock recovery

PostPosted: January 26th, 2011, 10:31 am
by Fonefixer
A minor update in this...

Ive removed the root from my device (using z4root) and the other stuff (supermanager et al) no joy.

I still have a working cwm installed. Oh well, at least I can still do backups