applypatch changes for patching recovery image

Make some changes needed to applypatch in order to store the recovery
image in the system partition as a binary patch relative to the boot
image:

  - make applypatch use shared libraries, so it's smaller.  It will
    need to be on the main system so it can install the recovery
    image.  Make an applypatch_static binary for use in recovery
    packages (still needed for updating cupcake devices to donut).

  - output the results of patching to an in-memory buffer and write
    that to the partition; there's no convenient /tmp for us to us.
    (This should be basically a no-op in recovery, since /tmp is a
    ramdisk anyway.)
This commit is contained in:
Doug Zongker
2009-07-22 18:27:31 -07:00
parent 289d80eee4
commit 6c770467fb
7 changed files with 101 additions and 63 deletions

View File

@@ -84,7 +84,7 @@ static off_t offtin(u_char *buf)
int ApplyBSDiffPatch(const unsigned char* old_data, ssize_t old_size,
const char* patch_filename, ssize_t patch_offset,
FILE* output, SHA_CTX* ctx) {
SinkFn sink, void* token, SHA_CTX* ctx) {
unsigned char* new_data;
ssize_t new_size;
@@ -93,7 +93,7 @@ int ApplyBSDiffPatch(const unsigned char* old_data, ssize_t old_size,
return -1;
}
if (fwrite(new_data, 1, new_size, output) < new_size) {
if (sink(new_data, new_size, token) < new_size) {
fprintf(stderr, "short write of output: %d (%s)\n", errno, strerror(errno));
return 1;
}