[U-Boot-Users] Patch: bzip2 compression for small memory footprint boards
Yuli Barcohen
yuli at arabellasw.com
Mon Jan 26 19:16:02 CET 2004
BZIP2 decompression algorithm requires at least 4MB of malloc space. If
such an amount is unavailable, another (slower) algorithm can be used
which requires ~2300KB in the worst case. Attached patch selects the
decompression algorithm according to the available memory.
--
========================================================================
Yuli Barcohen | Phone +972-9-765-1788 | Software Project Leader
yuli at arabellasw.com | Fax +972-9-765-7494 | Arabella Software, Israel
========================================================================
-------------- next part --------------
Index: common/cmd_bootm.c
===================================================================
RCS file: /home/CVS/u-boot/u-boot/common/cmd_bootm.c,v
retrieving revision 1.1.1.9
retrieving revision 1.4
diff -p -u -r1.1.1.9 -r1.4
--- common/cmd_bootm.c 7 Jan 2004 13:32:42 -0000 1.1.1.9
+++ common/cmd_bootm.c 22 Jan 2004 21:14:32 -0000 1.4
@@ -333,8 +333,14 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag
#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);
More information about the U-Boot
mailing list