lkml.org 
[lkml]   [2001]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subjectboot time inflation code hack
From
Date
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!
--- 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;
\
 
 \ /
  Last update: 2005-03-22 13:03    [W:0.778 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site