From ad4537ba92ef49c4ed0590a52e5f0033efb7e225 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 28 Nov 2011 22:07:15 +0100 Subject: bootm: use generic uncompress function This simplifies the code somewhat. The user visible change here is that we now ignore the compression specified in the uImage. Instead we detect the compression type from the data which also means that we now support lzo compressed uImages. Signed-off-by: Sascha Hauer --- commands/bootm.c | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) (limited to 'commands/bootm.c') diff --git a/commands/bootm.c b/commands/bootm.c index 01ad4c7da6..3bef6e78a3 100644 --- a/commands/bootm.c +++ b/commands/bootm.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -42,7 +41,7 @@ #include #include #include -#include +#include #include #ifndef CFG_BOOTM_LEN @@ -57,11 +56,6 @@ 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; @@ -85,30 +79,13 @@ int relocate_image(struct image_handle *handle, void *load_address) memmove(load_address, data, len); } break; -#ifdef CONFIG_ZLIB - case IH_COMP_GZIP: - printf (" Uncompressing ... "); - - ret = gunzip(data, len, NULL, NULL, load_address, NULL, - unzip_error); - if (ret) - return ret; - break; -#endif -#ifdef CONFIG_BZLIB - case IH_COMP_BZIP2: + default: printf (" Uncompressing ... "); - - ret = bunzip2(data, len, NULL, NULL, load_address, NULL, - unzip_error); + ret = uncompress(data, len, NULL, NULL, load_address, NULL, + uncompress_err_stdout); if (ret) return ret; break; -#endif - default: - printf("Unimplemented compression type %d\n", - image_get_comp(hdr)); - return -1; } return 0; -- cgit v1.2.3