+
+static unsigned insize; /* valid bytes in inbuf */
+static unsigned inptr; /* index of next byte to be processed in inbuf */
++static unsigned long workspace;
+
+#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf())
+
+ unsigned int lc; /* literal context bits */
+ unsigned int lp; /* literal pos state bits */
+ unsigned int pb; /* pos state bits */
-+ unsigned char* workspace;
+ unsigned int uncompressedSize = 0;
+ unsigned char* p;
+
+ get_byte();
+
+ // point it beyond uncompresedSize
-+ workspace = window + uncompressedSize;
++ //workspace = window + uncompressedSize;
+
+ /* decompress kernel */
-+ if (LzmaDecode(workspace, ~0, lc, lp, pb, &callback,
++ if (LzmaDecode((unsigned char*)workspace, ~0, lc, lp, pb, &callback,
+ (unsigned char*)window, uncompressedSize, &i) == LZMA_RESULT_OK)
+ return 0;
+ else
+
+ if ((u32)output & (CONFIG_PHYSICAL_ALIGN -1))
+ error("Destination address not CONFIG_PHYSICAL_ALIGN aligned");
-+ if (end > ((-__PAGE_OFFSET-(512 <<20)-1) & 0x7fffffff))
++ if ((workspace = end) > ((-__PAGE_OFFSET-(512 <<20)-1) & 0x7fffffff))
+ error("Destination address too large");
+#ifndef CONFIG_RELOCATABLE
+ if ((u32)output != LOAD_PHYSICAL_ADDR)
diff -Naur linux-old/arch/i386/boot/compressed/Makefile linux-lzma/arch/i386/boot/compressed/Makefile
--- linux-old/arch/i386/boot/compressed/Makefile 2005-06-04 21:53:40.000000000 -0400
+++ linux-lzma/arch/i386/boot/compressed/Makefile 2005-06-05 00:25:23.000000000 -0400
-@@ -4,15 +4,15 @@
+@@ -4,7 +4,7 @@
# create a compressed vmlinux image from the original vmlinux
#
vmlinux.bin.all vmlinux.relocs
EXTRA_AFLAGS := -traditional
- LDFLAGS_vmlinux := -T
--CFLAGS_misc.o += -fPIC
-+CFLAGS_lzma_misc.o += -fPIC
- hostprogs-y := relocs
+@@ -17,7 +17,7 @@
+ $(call cc-option,-fno-stack-protector)
+ LDFLAGS := -m elf_i386
-$(obj)/vmlinux: $(src)/vmlinux.lds $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE
+$(obj)/vmlinux: $(src)/vmlinux.lds $(obj)/head.o $(obj)/lzma_misc.o $(obj)/piggy.o FORCE
$(call if_changed,ld)
@:
-@@ -32,14 +32,14 @@
+@@ -37,14 +37,14 @@
$(call if_changed,relocbin)
ifdef CONFIG_RELOCATABLE
+# LZMA
+#
+quiet_cmd_lzma = LZMA $@
-+cmd_lzma = lzma e $< $@ -lc7 -lp0 -pb0
++cmd_lzma = bash -e scripts/lzma_kern $< $@ -lc7 -lp0 -pb0
+# to use lzmacomp,
+# cmd_lzma = lzmacomp $< 700 > $@
+diff -u linux/scripts/lzma_kern linux/scripts/lzma_kern
+--- linux/scripts/lzma_kern 2007-07-27 20:18:17.013014750 -0700
++++ linux/scripts/lzma_kern 2007-07-27 20:18:17.013014750 -0700
+@@ -0,0 +1,4 @@
++get-size() { echo "$5" ;}
++printf -v len '%.8x' "$(get-size $(ls -l "$1"))"
++lzma e "$@"
++echo -ne "\x$(echo $len | cut -c 7,8)\x$(echo $len | cut -c 5,6)\x$(echo $len | cut -c 3,4)\x$(echo $len | cut -c 1,2)" >> "$2"