diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2011-11-28 12:50:28 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-11-29 21:12:27 +0100 |
commit | 5930f100aac7cebd4e45d4ec6c16e1cf5b2a1274 (patch) | |
tree | 25d5eb4517a90e275c2f64eaa110fdfd7ca82e72 /commands | |
parent | f400980638b4d6388689f298c8a538d3979dad39 (diff) | |
download | barebox-5930f100aac7cebd4e45d4ec6c16e1cf5b2a1274.tar.gz barebox-5930f100aac7cebd4e45d4ec6c16e1cf5b2a1274.tar.xz |
use kernel bunzip implementation
The kernel uncompression functions have a unified API. Switch
to the kernel implementation to unify the different uncompression
APIs. As a bonus the kernel implementation is much smaller.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/bootm.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/commands/bootm.c b/commands/bootm.c index 0722e92461..79a16d4745 100644 --- a/commands/bootm.c +++ b/commands/bootm.c @@ -31,7 +31,6 @@ #include <image.h> #include <malloc.h> #include <zlib.h> -#include <bzlib.h> #include <environment.h> #include <asm/byteorder.h> #include <xfuncs.h> @@ -43,6 +42,7 @@ #include <rtc.h> #include <init.h> #include <magicvar.h> +#include <bunzip2.h> #include <asm-generic/memory_layout.h> #ifndef CFG_BOOTM_LEN @@ -57,12 +57,18 @@ struct image_handle_data* image_handle_data_get_by_num(struct image_handle* hand return &handle->data_entries[num]; } +static void unzip_error(char *x) +{ + puts(x); +} + int relocate_image(struct image_handle *handle, void *load_address) { image_header_t *hdr = &handle->header; unsigned long len = image_get_size(hdr); struct image_handle_data *iha; void *data; + int ret; #if defined CONFIG_CMD_BOOTM_ZLIB || defined CONFIG_CMD_BOOTM_BZLIB uint unc_len = BOOTM_LEN; @@ -90,16 +96,11 @@ int relocate_image(struct image_handle *handle, void *load_address) #ifdef CONFIG_CMD_BOOTM_BZLIB case IH_COMP_BZIP2: printf (" Uncompressing ... "); - /* - * If we've got less than 4 MB of malloc() space, - * use slower decompression algorithm which requires - * at most 2300 KB of memory. - */ - if (BZ2_bzBuffToBuffDecompress (load_address, - &unc_len, data, len, - MALLOC_SIZE < (4096 * 1024), 0) - != BZ_OK) - return -1; + + ret = bunzip2(data, len, NULL, NULL, load_address, NULL, + unzip_error); + if (ret) + return ret; break; #endif default: |