summaryrefslogtreecommitdiffstats
path: root/commands/bootm.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-11-28 22:07:15 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-11-29 21:13:13 +0100
commitad4537ba92ef49c4ed0590a52e5f0033efb7e225 (patch)
treea180c8a2a0f3357f8becd13eeed1d897885ad578 /commands/bootm.c
parent62493a5fe14d80807452c5728303157a0194e888 (diff)
downloadbarebox-ad4537ba92ef49c4ed0590a52e5f0033efb7e225.tar.gz
barebox-ad4537ba92ef49c4ed0590a52e5f0033efb7e225.tar.xz
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 <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/bootm.c')
-rw-r--r--commands/bootm.c31
1 files changed, 4 insertions, 27 deletions
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 <command.h>
#include <image.h>
#include <malloc.h>
-#include <gunzip.h>
#include <environment.h>
#include <asm/byteorder.h>
#include <xfuncs.h>
@@ -42,7 +41,7 @@
#include <rtc.h>
#include <init.h>
#include <magicvar.h>
-#include <bunzip2.h>
+#include <uncompress.h>
#include <asm-generic/memory_layout.h>
#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;