All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuli Barcohen <yuli@arabellasw.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Patch: bzip2 compression for small memory footprint boards
Date: Mon, 26 Jan 2004 20:16:02 +0200	[thread overview]
Message-ID: <16405.22882.511492.163812@gargle.gargle.HOWL> (raw)

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);

                 reply	other threads:[~2004-01-26 18:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16405.22882.511492.163812@gargle.gargle.HOWL \
    --to=yuli@arabellasw.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.