X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/cbeaf6d823b983c52dbbf18466c3eee2fb7b4037..3a065a453ff58430b6915b58cf542e81d143ae3e:/target/linux/rdc-2.6/patches/600-x86_lzma.patch diff --git a/target/linux/rdc-2.6/patches/600-x86_lzma.patch b/target/linux/rdc-2.6/patches/600-x86_lzma.patch index b370827b9..bb10f1fdc 100644 --- a/target/linux/rdc-2.6/patches/600-x86_lzma.patch +++ b/target/linux/rdc-2.6/patches/600-x86_lzma.patch @@ -825,6 +825,7 @@ diff -Naur linux-old/arch/i386/boot/compressed/lzma_misc.c linux-lzma/arch/i386/ + +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()) + @@ -902,7 +903,6 @@ diff -Naur linux-old/arch/i386/boot/compressed/lzma_misc.c linux-lzma/arch/i386/ + 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; + @@ -927,10 +927,10 @@ diff -Naur linux-old/arch/i386/boot/compressed/lzma_misc.c linux-lzma/arch/i386/ + 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 @@ -967,7 +967,7 @@ diff -Naur linux-old/arch/i386/boot/compressed/lzma_misc.c linux-lzma/arch/i386/ + + 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) @@ -980,7 +980,7 @@ diff -Naur linux-old/arch/i386/boot/compressed/lzma_misc.c linux-lzma/arch/i386/ 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 # @@ -989,17 +989,16 @@ diff -Naur linux-old/arch/i386/boot/compressed/Makefile linux-lzma/arch/i386/boo 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 @@ -1030,6 +1029,14 @@ diff -urN linux-2.6.19.2/scripts/Makefile.lib linux-2.6.19.2.new/scripts/Makefil +# 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"