mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 10:39:08 +00:00
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>
This commit is contained in:
parent
d77447fdb1
commit
918e9ebb45
2 changed files with 233 additions and 1 deletions
|
@ -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 *));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue