summaryrefslogtreecommitdiff
path: root/common/cmd_bootm.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/cmd_bootm.c')
-rw-r--r--common/cmd_bootm.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 34a74ce..ac9c32e 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -333,8 +333,14 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
#ifdef CONFIG_BZIP2
case IH_COMP_BZIP2:
printf (" Uncompressing %s ... ", name);
+ /*
+ * If we've got less than 4 MB of malloc() space,
+ * use slower decompression algorithm which requires
+ * at most 2300 KB of memory.
+ */
i = BZ2_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
- &unc_len, (char *)data, len, 0, 0);
+ &unc_len, (char *)data, len,
+ CFG_MALLOC_LEN < (4096 * 1024), 0);
if (i != BZ_OK) {
printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);
SHOW_BOOT_PROGRESS (-6);