boot time inflation code hack

Takehiro Tominaga (tominaga@isoternet.org)
Tue, 11 Sep 2001 22:40:24 +0900


----Next_Part(Tue_Sep_11_22:40:22_2001_809)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

hi all,

On some architectures, linux kernel image can be stored in compressed
format(with gzip) and boot loader will inflate the compression.

I found linux/lib/inflate.c is the boot-time inflating routine and
is not used from another part of kernel. In the inflate.c, there
are some malloc() and free().

inflate.c is included from linux/arch/*/boot/compressed/misc.c, which
provides these functions.

but, for each architecture, free() does nothing at all. So we can remove
some part of inflate.c. the patch is attached.

I just tested it on IA32 platform only. please review on your architecture.
---
Takehiro TOMINAGA // may the source be with you!

----Next_Part(Tue_Sep_11_22:40:22_2001_809)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=inflation-diff

--- lib/inflate.c.bak Wed Mar 7 12:44:37 2001
+++ lib/inflate.c Tue Sep 11 21:35:37 2001
@@ -140,7 +140,11 @@
/* Function prototypes */
STATIC int huft_build OF((unsigned *, unsigned, unsigned,
const ush *, const ush *, struct huft **, int *));
-STATIC int huft_free OF((struct huft *));
+#ifdef SOMETHINGINFREE
+ STATIC int huft_free OF((struct huft *));
+#else
+ #define huft_free(dummy) 0
+#endif
STATIC int inflate_codes OF((struct huft *, struct huft *, int, int));
STATIC int inflate_stored OF((void));
STATIC int inflate_fixed OF((void));
@@ -489,6 +493,7 @@



+#ifdef SOMETHINGINFREE
STATIC int huft_free(t)
struct huft *t; /* table to free */
/* Free the malloc'ed tables built by huft_build(), which makes a linked
@@ -508,7 +513,7 @@
}
return 0;
}
-
+#endif

STATIC int inflate_codes(tl, td, bl, bd)
struct huft *tl, *td; /* literal/length and distance decoder tables */
@@ -1026,6 +1031,7 @@
int i; /* counter for all possible eight bit values */
int k; /* byte being shifted into crc apparatus */

+#if 0
/* terms of polynomial defining this crc (except x^32): */
static const int p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};

@@ -1033,6 +1039,9 @@
e = 0;
for (i = 0; i < sizeof(p)/sizeof(int); i++)
e |= 1L << (31 - p[i]);
+#else
+ e = 0xedb88320;
+#endif

crc_32_tab[0] = 0;

----Next_Part(Tue_Sep_11_22:40:22_2001_809)----
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/