Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I recently stumbled upon the applypatch tool, but I couldn't find any documentation for it online. Here is the usage output (this is after typing adb shell)

shell@android:/ $ applypatch --help                                            
usage: applypatch [-b <bonus-file>] <src-file> <tgt-file> <tgt-sha1> <tgt-size> [<src-sha1>:<patch> ...]
   or  applypatch -c <file> [<sha1> ...]
   or  applypatch -s <bytes>
   or  applypatch -l

Filenames may be of the form
  MTD:<partition>:<len_1>:<sha1_1>:<len_2>:<sha1_2>:...
to specify reading from or writing to an MTD partition.

What do the command line options mean? What is MTD? What are all the sha1 hashes for?

Also, could someone with the reputation add an applypatch tag, or maybe a tools tag? Something more descriptive than what I've put.

share|improve this question
2  
This is rather a development oriented question, I'd say? As for MTD, check Wikipedia. –  Izzy Dec 29 '12 at 18:52
    
I wouldn't say it's development oriented. I was just looking at some code someone had written to be executed on a device and saw applypatch and was curious as to how it worked. –  gsingh2011 Dec 29 '12 at 18:56
add comment

2 Answers 2

diff and patch are Unix/Linux commands used to easily check for differences, send updates to huge files by shipping only the differences, etc. (see Wikipedia). They are mostly used in development (to update source code), but can also serve practical purposes in non-development environments.

applypatch is one of those patch-tools on Android, and used e.g. for minor updates (OTA and the like). So it is most likely not intended for the "normal end user" to deal with it directly.

share|improve this answer
add comment

The applypatch command is indeed used for OTA patching. As an example, I have the update.zip provided for my VZW SCH-I915 tablet...in my case, I don't want to allow this OTA update to occur, so I wish to patch /system/build.prop to fool the device into thinking it has already been done. Within the update.zip file, there is an 'updater-script' file which details the patches. The one I sought was:

apply_patch("/system/build.prop", "-", db0889f98b62e625283e5273bf35d790532b10bd, 5934, 7a52fd5ec0d5afcbaf159c330374dfb0c5cbc159, package_extract_file("patch/system/build.prop.p"));

I extracted the appropriate patch file to my sdcard. Then, the syntax to perform this action on a secondary copy of build.prop I had made (so I could check the output before copying into /system) is altered thus:

/system/bin/applypatch "/mnt/sdcard/build.prop" "-" "db0889f98b62e625283e5273bf35d790532b10bd" "5934" 7a52fd5ec0d5afcbaf159c330374dfb0c5cbc159:/mnt/sdcard/build.prop.p

...which created the same build.prop file I would have ended up with had I allowed the OTA to proceed. I hope this helps.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.