X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fsvn-archive%2Farchive.git;a=blobdiff_plain;f=target%2Flinux%2Fgeneric-2.6%2Fpatches%2F600-x86_lzma.patch;h=168576e02ccee269655721cbc957440ade848d04;hp=1a948839b0da0f4bb54e731507232a1d83177427;hb=5626c056f286f75c77fb44ad60e5f7563c828b2a;hpb=7a4354c2a441194b2af034dbbb2b6abac712e2fe diff --git a/target/linux/generic-2.6/patches/600-x86_lzma.patch b/target/linux/generic-2.6/patches/600-x86_lzma.patch index 1a948839b0..168576e02c 100644 --- a/target/linux/generic-2.6/patches/600-x86_lzma.patch +++ b/target/linux/generic-2.6/patches/600-x86_lzma.patch @@ -1,6 +1,6 @@ -diff -Naur linux-old/arch/i386/boot/compressed/LzmaDecode.c linux-lzma/arch/i386/boot/compressed/LzmaDecode.c ---- linux-old/arch/i386/boot/compressed/LzmaDecode.c 1969-12-31 19:00:00.000000000 -0500 -+++ linux-lzma/arch/i386/boot/compressed/LzmaDecode.c 2005-06-05 00:07:38.000000000 -0400 +diff -Nur linux-2.6.21.1/arch/i386/boot/compressed/LzmaDecode.c linux-2.6.21.1-owrt/arch/i386/boot/compressed/LzmaDecode.c +--- linux-2.6.21.1/arch/i386/boot/compressed/LzmaDecode.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/arch/i386/boot/compressed/LzmaDecode.c 2007-05-14 11:55:38.000000000 +0200 @@ -0,0 +1,586 @@ +/* + LzmaDecode.c @@ -588,9 +588,9 @@ diff -Naur linux-old/arch/i386/boot/compressed/LzmaDecode.c linux-lzma/arch/i386 + *outSizeProcessed = nowPos; + return LZMA_RESULT_OK; +} -diff -Naur linux-old/arch/i386/boot/compressed/LzmaDecode.h linux-lzma/arch/i386/boot/compressed/LzmaDecode.h ---- linux-old/arch/i386/boot/compressed/LzmaDecode.h 1969-12-31 19:00:00.000000000 -0500 -+++ linux-lzma/arch/i386/boot/compressed/LzmaDecode.h 2005-06-05 00:07:39.000000000 -0400 +diff -Nur linux-2.6.21.1/arch/i386/boot/compressed/LzmaDecode.h linux-2.6.21.1-owrt/arch/i386/boot/compressed/LzmaDecode.h +--- linux-2.6.21.1/arch/i386/boot/compressed/LzmaDecode.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/arch/i386/boot/compressed/LzmaDecode.h 2007-05-14 11:55:38.000000000 +0200 @@ -0,0 +1,100 @@ +/* + LzmaDecode.h @@ -692,93 +692,139 @@ diff -Naur linux-old/arch/i386/boot/compressed/LzmaDecode.h linux-lzma/arch/i386 + UInt32 *outSizeProcessed); + +#endif -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 -@@ -2,24 +2,33 @@ - # linux/arch/i386/boot/compressed/Makefile - # - # create a compressed vmlinux image from the original vmlinux -+# patched by Ming-Ching Tiew for kernel 2.6 -+# requires program 'lzma' from LZMA SDK ( http://www.7-zip.org/ ) to work -+# $ mkdir lzma -+# $ cd lzma -+# $ tar tvjf ../lzma417.tar.bz2 -+# $ cd SRC/7zip/Compress/LZMA_Alone -+# $ dos2unix makefile -+# $ make -+# $ su -+# # cp lzma /usr/bin - # -- --targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o -+targets := vmlinux vmlinux.bin vmlinux.bin.lzma head.o lzma_misc.o piggy.o - EXTRA_AFLAGS := -traditional - - LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32 - --$(obj)/vmlinux: $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE -+$(obj)/vmlinux: $(obj)/head.o $(obj)/lzma_misc.o $(obj)/piggy.o FORCE - $(call if_changed,ld) - @: - - $(obj)/vmlinux.bin: vmlinux FORCE - $(call if_changed,objcopy) - --$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE -- $(call if_changed,gzip) -+$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE -+ $(call if_changed,lzma) - - LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T - --$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE -+$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.lzma FORCE - $(call if_changed,ld) -diff -Naur linux-old/arch/i386/boot/compressed/lzma_misc.c linux-lzma/arch/i386/boot/compressed/lzma_misc.c ---- linux-old/arch/i386/boot/compressed/lzma_misc.c 1969-12-31 19:00:00.000000000 -0500 -+++ linux-lzma/arch/i386/boot/compressed/lzma_misc.c 2005-06-04 21:33:48.000000000 -0400 -@@ -0,0 +1,412 @@ +diff -Nur linux-2.6.21.1/arch/i386/boot/compressed/lzma_misc.c linux-2.6.21.1-owrt/arch/i386/boot/compressed/lzma_misc.c +--- linux-2.6.21.1/arch/i386/boot/compressed/lzma_misc.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/arch/i386/boot/compressed/lzma_misc.c 2007-05-14 11:55:38.000000000 +0200 +@@ -0,0 +1,374 @@ +/* + * lzma_misc.c + * ++ * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 ++ * puts by Nick Holloway 1993, better puts by Martin Mares 1995 ++ * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996 ++ * + * Decompress LZMA compressed vmlinuz + * Version 0.9 Copyright (c) Ming-Ching Tiew mctiew@yahoo.com + * Program adapted from misc.c for 2.6 kernel -+ * Date: 3 June 2005 -+ * Source released under GPL ++ * Forward ported to latest 2.6 version of misc.c by ++ * Felix Fietkau + */ + ++#undef CONFIG_PARAVIRT +#include +#include -+#include +#include +#include ++#include ++#include + -+#define OF(args) args -+#define STATIC static -+ -+#undef memset -+#undef memcpy ++/* WARNING!! ++ * This code is compiled with -fPIC and it is relocated dynamically ++ * at run time, but no relocation processing is performed. ++ * This means that it is not safe to place pointers in static structures. ++ */ + +/* -+ * Why do we do this? Don't ask me.. ++ * Getting to provable safe in place decompression is hard. ++ * Worst case behaviours need to be analized. ++ * Background information: ++ * ++ * The file layout is: ++ * magic[2] ++ * method[1] ++ * flags[1] ++ * timestamp[4] ++ * extraflags[1] ++ * os[1] ++ * compressed data blocks[N] ++ * crc[4] orig_len[4] ++ * ++ * resulting in 18 bytes of non compressed data overhead. ++ * ++ * Files divided into blocks ++ * 1 bit (last block flag) ++ * 2 bits (block type) ++ * ++ * 1 block occurs every 32K -1 bytes or when there 50% compression has been achieved. ++ * The smallest block type encoding is always used. ++ * ++ * stored: ++ * 32 bits length in bytes. ++ * ++ * fixed: ++ * magic fixed tree. ++ * symbols. ++ * ++ * dynamic: ++ * dynamic tree encoding. ++ * symbols. ++ * + * -+ * Incomprehensible are the ways of bootloaders. ++ * The buffer for decompression in place is the length of the ++ * uncompressed data, plus a small amount extra to keep the algorithm safe. ++ * The compressed data is placed at the end of the buffer. The output ++ * pointer is placed at the start of the buffer and the input pointer ++ * is placed where the compressed data starts. Problems will occur ++ * when the output pointer overruns the input pointer. ++ * ++ * The output pointer can only overrun the input pointer if the input ++ * pointer is moving faster than the output pointer. A condition only ++ * triggered by data whose compressed form is larger than the uncompressed ++ * form. ++ * ++ * The worst case at the block level is a growth of the compressed data ++ * of 5 bytes per 32767 bytes. ++ * ++ * The worst case internal to a compressed block is very hard to figure. ++ * The worst case can at least be boundined by having one bit that represents ++ * 32764 bytes and then all of the rest of the bytes representing the very ++ * very last byte. ++ * ++ * All of which is enough to compute an amount of extra data that is required ++ * to be safe. To avoid problems at the block level allocating 5 extra bytes ++ * per 32767 bytes of data is sufficient. To avoind problems internal to a block ++ * adding an extra 32767 bytes (the worst case uncompressed block size) is ++ * sufficient, to ensure that in the worst case the decompressed data for ++ * block will stop the byte before the compressed data for a block begins. ++ * To avoid problems with the compressed data's meta information an extra 18 ++ * bytes are needed. Leading to the formula: ++ * ++ * extra_bytes = (uncompressed_size >> 12) + 32768 + 18 + decompressor_size. ++ * ++ * Adding 8 bytes per 32K is a bit excessive but much easier to calculate. ++ * Adding 32768 instead of 32767 just makes for round numbers. ++ * Adding the decompressor_size is necessary as it musht live after all ++ * of the data as well. Last I measured the decompressor is about 14K. ++ * 10K of actuall data and 4K of bss. ++ * ++ */ ++ ++/* ++ * gzip declarations + */ -+static void* memcpy(void *, __const void *, size_t); ++ ++#define OF(args) args ++#define STATIC static ++ ++#undef memcpy + +typedef unsigned char uch; +typedef unsigned short ush; +typedef unsigned long ulg; + -+#define WSIZE 0x8000 /* Window size must be at least 32k, */ -+ /* and a power of two */ ++#define WSIZE 0x80000000 /* Window size must be at least 32k, ++ * and a power of two ++ * We don't actually have a window just ++ * a huge output buffer so I report ++ * a 2G windows size, as that should ++ * always be larger than our output buffer. ++ */ + -+static uch *inbuf; /* input buffer */ ++static uch *inbuf; /* input buffer */ ++static uch *window; /* Sliding window buffer, (and final output buffer) */ + -+static unsigned insize = 0; /* valid bytes in inbuf */ -+static unsigned inptr = 0; /* index of next byte to be processed in inbuf */ ++static unsigned insize; /* valid bytes in inbuf */ ++static unsigned inptr; /* index of next byte to be processed in inbuf */ + +#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) + @@ -800,7 +846,6 @@ diff -Naur linux-old/arch/i386/boot/compressed/lzma_misc.c linux-lzma/arch/i386/ +#endif + +static int fill_inbuf(void); -+static void error(char *m); + +/* + * This is set up by the setup-routine at boot-time @@ -813,30 +858,23 @@ diff -Naur linux-old/arch/i386/boot/compressed/lzma_misc.c linux-lzma/arch/i386/ +#endif +#define RM_SCREEN_INFO (*(struct screen_info *)(real_mode+0)) + -+extern char input_data[]; ++extern unsigned char input_data[]; +extern int input_len; + -+static long bytes_out = 0; -+static uch *output_data; ++static void error(char *x); ++static void *memcpy(void *dest, const void *src, unsigned n); + +static void putstr(const char *); + -+extern int end; -+static long free_mem_ptr = (long)&end; -+static long free_mem_end_ptr; -+ -+#define INPLACE_MOVE_ROUTINE 0x1000 -+#define LOW_BUFFER_START 0x2000 -+#define LOW_BUFFER_MAX 0x90000 -+#define HEAP_SIZE 0x3000 -+static unsigned int low_buffer_end, low_buffer_size; -+static int high_loaded =0; -+static uch *high_buffer_start /* = (uch *)(((ulg)&end) + HEAP_SIZE)*/; -+ +static char *vidmem = (char *)0xb8000; +static int vidport; +static int lines, cols; + ++#ifdef CONFIG_X86_NUMAQ ++void *xquad_portio; ++#endif ++ ++ +static void scroll(void) +{ + int i; @@ -862,7 +900,7 @@ diff -Naur linux-old/arch/i386/boot/compressed/lzma_misc.c linux-lzma/arch/i386/ + y--; + } + } else { -+ vidmem [ ( x + cols * y ) * 2 ] = c; ++ vidmem [ ( x + cols * y ) * 2 ] = c; + if ( ++x >= cols ) { + x = 0; + if ( ++y >= lines ) { @@ -883,14 +921,13 @@ diff -Naur linux-old/arch/i386/boot/compressed/lzma_misc.c linux-lzma/arch/i386/ + outb_p(0xff & (pos >> 1), vidport+1); +} + -+static void* memcpy(void* __dest, __const void* __src, -+ size_t __n) ++static void* memcpy(void* dest, const void* src, unsigned n) +{ + int i; -+ char *d = (char *)__dest, *s = (char *)__src; ++ char *d = (char *)dest, *s = (char *)src; + -+ for (i=0;i<__n;i++) d[i] = s[i]; -+ return __dest; ++ for (i=0;i RM_EXT_MEM_K ? RM_ALT_MEM_K : RM_EXT_MEM_K) < 1024) error("Less than 2MB of memory"); -+#endif -+ output_data = (char *)0x100000; /* Points to 1M */ -+ free_mem_end_ptr = (long)real_mode; -+} -+ -+struct moveparams { -+ uch *low_buffer_start; int lcount; -+ uch *high_buffer_start; int hcount; -+}; -+ -+static void setup_output_buffer_if_we_run_high(struct moveparams *mv) -+{ -+ high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE); -+#ifdef STANDARD_MEMORY_BIOS_CALL -+ if (RM_EXT_MEM_K < (3*1024)) error("Less than 4MB of memory"); -+#else -+ if ((RM_ALT_MEM_K > RM_EXT_MEM_K ? RM_ALT_MEM_K : RM_EXT_MEM_K) < -+ (3*1024)) -+ error("Less than 4MB of memory"); -+#endif -+ mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START; -+ low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX -+ ? LOW_BUFFER_MAX : (unsigned int)real_mode) & ~0xfff; -+ low_buffer_size = low_buffer_end - LOW_BUFFER_START; -+ high_loaded = 1; -+ free_mem_end_ptr = (long)high_buffer_start; -+ if ( (0x100000 + low_buffer_size) > ((ulg)high_buffer_start)) { -+ high_buffer_start = (uch *)(0x100000 + low_buffer_size); -+ mv->hcount = 0; /* say: we need not to move high_buffer */ -+ } -+ else mv->hcount = -1; -+ mv->high_buffer_start = high_buffer_start; -+} -+ -+static void close_output_buffer_if_we_run_high(struct moveparams *mv) -+{ -+ if (bytes_out > low_buffer_size) { -+ mv->lcount = low_buffer_size; -+ if (mv->hcount) -+ mv->hcount = bytes_out - low_buffer_size; -+ } else { -+ mv->lcount = bytes_out; -+ mv->hcount = 0; -+ } -+} + +// When using LZMA in callback, the compressed length is not needed. +// Otherwise you need a special version of lzma compression program @@ -999,16 +961,16 @@ diff -Naur linux-old/arch/i386/boot/compressed/lzma_misc.c linux-lzma/arch/i386/ +{ + + unsigned int i; /* temp value */ -+ unsigned int lc; /* literal context bits */ -+ unsigned int lp; /* literal pos state bits */ -+ unsigned int pb; /* pos state bits */ ++ 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; -+ ++ +#ifdef _LZMA_IN_CB -+ ILzmaInCallback callback; -+ callback.Read = read_byte; ++ ILzmaInCallback callback; ++ callback.Read = read_byte; +#else + unsigned char* inputbuf; + unsigned int lzma_workspace_size; @@ -1018,95 +980,35 @@ diff -Naur linux-old/arch/i386/boot/compressed/lzma_misc.c linux-lzma/arch/i386/ + /* lzma args */ + i = get_byte(); + lc = i % 9, i = i / 9; -+ lp = i % 5, pb = i / 5; -+ -+ /* skip dictionary size */ -+ for (i = 0; i < 4; i++) -+ get_byte(); -+ // get uncompressedSize -+ p= (char*)&uncompressedSize; -+ for (i = 0; i < 4; i++) -+ *p++ = get_byte(); -+ -+ //get compressedSize ++ lp = i % 5, pb = i / 5; ++ ++ /* skip dictionary size */ ++ for (i = 0; i < 4; i++) ++ get_byte(); ++ // get uncompressedSize ++ p= (char*)&uncompressedSize; ++ for (i = 0; i < 4; i++) ++ *p++ = get_byte(); ++ ++ //get compressedSize +#ifdef _LZMA_IN_CB -+ for (i = 0; i < 4; i++) -+ get_byte(); ++ for (i = 0; i < 4; i++) ++ get_byte(); +#else -+ p= (char*)&compressedSize; -+ for (i = 0; i < 4; i++) -+ *p++ = get_byte(); -+#endif -+ -+#if 0 -+ if ( (lc == 5 ) && (lp == 0 ) && ( pb == 0 )) -+ { -+ putstr("got prop!\n"); -+ } -+ -+#ifndef _LZMA_IN_CB -+ if( compressedSize == 496722 ) -+ { -+ putstr( "got the right sizes\n"); -+ } -+ else if ( compressedSize > 496722 ) -+ { -+ putstr( "greater !\n"); -+ } -+ else if ( compressedSize < 496722 ) -+ putstr( "smaller!\n"); -+ ++ p= (char*)&compressedSize; ++ for (i = 0; i < 4; i++) ++ *p++ = get_byte(); +#endif -+ if ( uncompressedSize == 1187168 ) -+ { -+ putstr( "got the right uncompressed size \n"); -+ }else if ( uncompressedSize > 1187168 ) -+ { -+ putstr( "uncompressedSize greater!\n"); -+ }else -+ putstr( "uncompressedSize smaller!|n"); -+#endif -+ -+ // point it beyond uncompresedSize -+ workspace = high_buffer_start + uncompressedSize; -+ // -+#ifndef _LZMA_IN_CB -+ lzma_workspace_size = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp))) * sizeof(CProb); -+ inputbuf = high_buffer_start + uncompressedSize + lzma_workspace_size; -+ // read the compressed data -+ for( i=0; i < compressedSize; i++) -+ { -+ if ( i % ( 1024 * 10 ) == 0 ) -+ putstr("."); -+ *inputbuf++ = get_byte(); -+ } -+#endif -+ ++ ++ // point it beyond uncompresedSize ++ workspace = window + uncompressedSize; ++ + /* decompress kernel */ -+#ifdef _LZMA_IN_CB -+ if (LzmaDecode(workspace, ~0, lc, lp, pb, -+ &callback, -+#else -+ if (LzmaDecode(workspace, lzma_workspace_size, lc, lp, pb, -+ inputbuf - compressedSize, compressedSize, -+#endif -+ (unsigned char*)high_buffer_start, uncompressedSize, &i) == LZMA_RESULT_OK) -+ { -+ if ( i != uncompressedSize ) -+ error( "kernel corrupted!\n"); -+ //copy it back to low_buffer -+ if( uncompressedSize > low_buffer_size ) -+ { -+ memcpy((char*)LOW_BUFFER_START, high_buffer_start, low_buffer_size); -+ memcpy(high_buffer_start, high_buffer_start+low_buffer_size, -+ uncompressedSize-low_buffer_size); -+ } -+ else -+ memcpy((char*)LOW_BUFFER_START, high_buffer_start, uncompressedSize ); -+ bytes_out = i; ++ if (LzmaDecode(workspace, ~0, lc, lp, pb, &callback, ++ (unsigned char*)window, uncompressedSize, &i) == LZMA_RESULT_OK) + return 0; -+ } -+ return 1; ++ else ++ return 1; +} + + @@ -1118,13 +1020,23 @@ diff -Naur linux-old/arch/i386/boot/compressed/lzma_misc.c linux-lzma/arch/i386/ + *bufferSize = 1; + val = get_byte(); + *buffer = &val; -+ if ( i++ % ( 1024 * 50 ) == 0 ) -+ putstr("."); ++ if ( i++ % ( 1024 * 50 ) == 0 ) ++ putstr("."); + return LZMA_RESULT_OK; +} +#endif + -+asmlinkage int decompress_kernel(struct moveparams *mv, void *rmode) ++static void error(char *x) ++{ ++ putstr("\n\n"); ++ putstr(x); ++ putstr("\n\n -- System halted"); ++ ++ while(1); /* Halt */ ++} ++ ++asmlinkage void decompress_kernel(void *rmode, unsigned long end, ++ uch *input_data, unsigned long input_len, uch *output) +{ + real_mode = rmode; + @@ -1139,21 +1051,70 @@ diff -Naur linux-old/arch/i386/boot/compressed/lzma_misc.c linux-lzma/arch/i386/ + lines = RM_SCREEN_INFO.orig_video_lines; + cols = RM_SCREEN_INFO.orig_video_cols; + -+ if (free_mem_ptr < 0x100000) setup_normal_output_buffer(); -+ else setup_output_buffer_if_we_run_high(mv); ++ window = output; ++ inbuf = input_data; /* Input buffer */ ++ insize = input_len; ++ inptr = 0; ++ ++ if ((u32)output & (CONFIG_PHYSICAL_ALIGN -1)) ++ error("Destination address not CONFIG_PHYSICAL_ALIGN aligned"); ++ if (end > ((-__PAGE_OFFSET-(512 <<20)-1) & 0x7fffffff)) ++ error("Destination address too large"); ++#ifndef CONFIG_RELOCATABLE ++ if ((u32)output != LOAD_PHYSICAL_ADDR) ++ error("Wrong destination address"); ++#endif + -+ putstr("LZMA vmlinuz: Ming-Ching Tiew ..."); -+ if( lzma_unzip() != 0 ) -+ { -+ error("inflate error\n"); -+ } ++ putstr("Uncompressing Linux... "); ++ lzma_unzip(); + putstr("Ok, booting the kernel.\n"); -+ if (high_loaded) close_output_buffer_if_we_run_high(mv); -+ return high_loaded; ++ return; +} -diff -urN linux-2.6.19.2/scripts/Makefile.lib linux-2.6.19.2.new/scripts/Makefile.lib ---- linux-2.6.19.2/scripts/Makefile.lib 2007-01-10 20:10:37.000000000 +0100 -+++ linux-2.6.19.2.new/scripts/Makefile.lib 2007-04-15 23:51:54.000000000 +0200 +diff -Nur linux-2.6.21.1/arch/i386/boot/compressed/Makefile linux-2.6.21.1-owrt/arch/i386/boot/compressed/Makefile +--- linux-2.6.21.1/arch/i386/boot/compressed/Makefile 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/arch/i386/boot/compressed/Makefile 2007-05-14 12:01:25.000000000 +0200 +@@ -4,15 +4,15 @@ + # create a compressed vmlinux image from the original vmlinux + # + +-targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o \ ++targets := vmlinux vmlinux.bin vmlinux.bin.lzma head.o lzma_misc.o piggy.o \ + vmlinux.bin.all vmlinux.relocs + EXTRA_AFLAGS := -traditional + + LDFLAGS_vmlinux := -T +-CFLAGS_misc.o += -fPIC ++CFLAGS_lzma_misc.o += -fPIC + hostprogs-y := relocs + +-$(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 @@ + $(call if_changed,relocbin) + + ifdef CONFIG_RELOCATABLE +-$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin.all FORCE +- $(call if_changed,gzip) ++$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin.all FORCE ++ $(call if_changed,lzma) + else +-$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE +- $(call if_changed,gzip) ++$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE ++ $(call if_changed,lzma) + endif + + LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T + +-$(obj)/piggy.o: $(src)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE ++$(obj)/piggy.o: $(src)/vmlinux.scr $(obj)/vmlinux.bin.lzma FORCE + $(call if_changed,ld) +diff -Nur linux-2.6.21.1/scripts/Makefile.lib linux-2.6.21.1-owrt/scripts/Makefile.lib +--- linux-2.6.21.1/scripts/Makefile.lib 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/scripts/Makefile.lib 2007-05-14 11:55:38.000000000 +0200 @@ -162,4 +162,9 @@ quiet_cmd_gzip = GZIP $@ cmd_gzip = gzip -f -9 < $< > $@