diff options
author | Eric Nelson <eric.nelson@boundarydevices.com> | 2015-02-17 11:30:30 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-04-22 12:14:55 -0400 |
commit | 918e9ebb45a12342c3d65df12ccc78431d6d0b72 (patch) | |
tree | aa04a7815b960d306471fdc1bad47785656b0369 /include/common.h | |
parent | d77447fdb122dab290fb1ad184a62456011e6e06 (diff) | |
download | u-boot-918e9ebb45a12342c3d65df12ccc78431d6d0b72.tar.gz |
gunzip: add gzwrite routine for extracting compresed images to block device
Initial filesystem images are generally highly compressible.
Add a routine gzwrite that allows gzip-compressed images to be
written to block devices.
Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
Reviewed-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'include/common.h')
-rw-r--r-- | include/common.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h index f570550438..cde3474b18 100644 --- a/include/common.h +++ b/include/common.h @@ -743,6 +743,45 @@ int gunzip(void *, int, unsigned char *, unsigned long *); int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp, int stoponerr, int offset); +/** + * gzwrite progress indicators: defined weak to allow board-specific + * overrides: + * + * gzwrite_progress_init called on startup + * gzwrite_progress called during decompress/write loop + * gzwrite_progress_finish called at end of loop to + * indicate success (retcode=0) or failure + */ +void gzwrite_progress_init(u64 expected_size); + +void gzwrite_progress(int iteration, + u64 bytes_written, + u64 total_bytes); + +void gzwrite_progress_finish(int retcode, + u64 totalwritten, + u64 totalsize, + u32 expected_crc, + u32 calculated_crc); + +/** + * decompress and write gzipped image from memory to block device + * + * @param src compressed image address + * @param len compressed image length in bytes + * @param dev block device descriptor + * @param szwritebuf bytes per write (pad to erase size) + * @param startoffs offset in bytes of first write + * @param szexpected expected uncompressed length + * may be zero to use gzip trailer + * for files under 4GiB + */ +int gzwrite(unsigned char *src, int len, + struct block_dev_desc *dev, + unsigned long szwritebuf, + u64 startoffs, + u64 szexpected); + /* lib/qsort.c */ void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); |