Browse Source

make XZ working for old kernel

Waldemar Brodkorb 12 years ago
parent
commit
84a9217d0a
2 changed files with 78 additions and 13 deletions
  1. 1 0
      package/busybox/Config.in.manual
  2. 77 13
      target/linux/patches/2.6.39.4/brcm.patch

+ 1 - 0
package/busybox/Config.in.manual

@@ -9,6 +9,7 @@ config ADK_PACKAGE_BUSYBOX
 	select ADK_COMPILE_BUSYBOX
 	select ADK_COMPILE_BUSYBOX
 	default y if !ADK_TOOLCHAIN_ONLY
 	default y if !ADK_TOOLCHAIN_ONLY
 	select ADK_PACKAGE_LIBTIRPC
 	select ADK_PACKAGE_LIBTIRPC
+	select ADK_PACKAGE_LIBPTHREAD
 	help
 	help
 	  Core utilities for embedded Linux systems
 	  Core utilities for embedded Linux systems
 	  
 	  

+ 77 - 13
target/linux/patches/2.6.39.4/brcm.patch

@@ -1,6 +1,6 @@
 diff -Nur linux-2.6.39.4.orig/arch/mips/Kconfig linux-2.6.39.4/arch/mips/Kconfig
 diff -Nur linux-2.6.39.4.orig/arch/mips/Kconfig linux-2.6.39.4/arch/mips/Kconfig
 --- linux-2.6.39.4.orig/arch/mips/Kconfig	2011-08-03 21:43:28.000000000 +0200
 --- linux-2.6.39.4.orig/arch/mips/Kconfig	2011-08-03 21:43:28.000000000 +0200
-+++ linux-2.6.39.4/arch/mips/Kconfig	2012-01-17 20:37:12.000000000 +0100
++++ linux-2.6.39.4/arch/mips/Kconfig	2012-06-02 20:35:49.000000000 +0200
 @@ -103,6 +103,12 @@
 @@ -103,6 +103,12 @@
  	select GENERIC_GPIO
  	select GENERIC_GPIO
  	select SYS_HAS_EARLY_PRINTK
  	select SYS_HAS_EARLY_PRINTK
@@ -16,7 +16,7 @@ diff -Nur linux-2.6.39.4.orig/arch/mips/Kconfig linux-2.6.39.4/arch/mips/Kconfig
  
  
 diff -Nur linux-2.6.39.4.orig/arch/mips/Makefile linux-2.6.39.4/arch/mips/Makefile
 diff -Nur linux-2.6.39.4.orig/arch/mips/Makefile linux-2.6.39.4/arch/mips/Makefile
 --- linux-2.6.39.4.orig/arch/mips/Makefile	2011-08-03 21:43:28.000000000 +0200
 --- linux-2.6.39.4.orig/arch/mips/Makefile	2011-08-03 21:43:28.000000000 +0200
-+++ linux-2.6.39.4/arch/mips/Makefile	2012-01-17 20:35:09.000000000 +0100
++++ linux-2.6.39.4/arch/mips/Makefile	2012-06-02 20:35:49.000000000 +0200
 @@ -76,6 +76,7 @@
 @@ -76,6 +76,7 @@
  all-$(CONFIG_BOOT_ELF32)	:= $(vmlinux-32)
  all-$(CONFIG_BOOT_ELF32)	:= $(vmlinux-32)
  all-$(CONFIG_BOOT_ELF64)	:= $(vmlinux-64)
  all-$(CONFIG_BOOT_ELF64)	:= $(vmlinux-64)
@@ -44,7 +44,7 @@ diff -Nur linux-2.6.39.4.orig/arch/mips/Makefile linux-2.6.39.4/arch/mips/Makefi
  endef
  endef
 diff -Nur linux-2.6.39.4.orig/arch/mips/bcm47xx/Makefile linux-2.6.39.4/arch/mips/bcm47xx/Makefile
 diff -Nur linux-2.6.39.4.orig/arch/mips/bcm47xx/Makefile linux-2.6.39.4/arch/mips/bcm47xx/Makefile
 --- linux-2.6.39.4.orig/arch/mips/bcm47xx/Makefile	2011-08-03 21:43:28.000000000 +0200
 --- linux-2.6.39.4.orig/arch/mips/bcm47xx/Makefile	2011-08-03 21:43:28.000000000 +0200
-+++ linux-2.6.39.4/arch/mips/bcm47xx/Makefile	2012-01-17 20:35:09.000000000 +0100
++++ linux-2.6.39.4/arch/mips/bcm47xx/Makefile	2012-06-02 20:35:49.000000000 +0200
 @@ -3,4 +3,4 @@
 @@ -3,4 +3,4 @@
  # under Linux.
  # under Linux.
  #
  #
@@ -53,7 +53,7 @@ diff -Nur linux-2.6.39.4.orig/arch/mips/bcm47xx/Makefile linux-2.6.39.4/arch/mip
 +obj-y := gpio.o irq.o nvram.o prom.o serial.o setup.o time.o platform.o
 +obj-y := gpio.o irq.o nvram.o prom.o serial.o setup.o time.o platform.o
 diff -Nur linux-2.6.39.4.orig/arch/mips/bcm47xx/platform.c linux-2.6.39.4/arch/mips/bcm47xx/platform.c
 diff -Nur linux-2.6.39.4.orig/arch/mips/bcm47xx/platform.c linux-2.6.39.4/arch/mips/bcm47xx/platform.c
 --- linux-2.6.39.4.orig/arch/mips/bcm47xx/platform.c	1970-01-01 01:00:00.000000000 +0100
 --- linux-2.6.39.4.orig/arch/mips/bcm47xx/platform.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.39.4/arch/mips/bcm47xx/platform.c	2012-01-17 20:35:09.000000000 +0100
++++ linux-2.6.39.4/arch/mips/bcm47xx/platform.c	2012-06-02 20:35:49.000000000 +0200
 @@ -0,0 +1,146 @@
 @@ -0,0 +1,146 @@
 +/*
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * This file is subject to the terms and conditions of the GNU General Public
@@ -203,8 +203,16 @@ diff -Nur linux-2.6.39.4.orig/arch/mips/bcm47xx/platform.c linux-2.6.39.4/arch/m
 +device_initcall(bcm47xx_register_devices);
 +device_initcall(bcm47xx_register_devices);
 diff -Nur linux-2.6.39.4.orig/arch/mips/boot/compressed/Makefile linux-2.6.39.4/arch/mips/boot/compressed/Makefile
 diff -Nur linux-2.6.39.4.orig/arch/mips/boot/compressed/Makefile linux-2.6.39.4/arch/mips/boot/compressed/Makefile
 --- linux-2.6.39.4.orig/arch/mips/boot/compressed/Makefile	2011-08-03 21:43:28.000000000 +0200
 --- linux-2.6.39.4.orig/arch/mips/boot/compressed/Makefile	2011-08-03 21:43:28.000000000 +0200
-+++ linux-2.6.39.4/arch/mips/boot/compressed/Makefile	2012-01-17 20:35:09.000000000 +0100
-@@ -58,8 +58,13 @@
++++ linux-2.6.39.4/arch/mips/boot/compressed/Makefile	2012-06-02 20:37:43.000000000 +0200
+@@ -44,6 +44,7 @@
+ tool_$(CONFIG_KERNEL_BZIP2)   = bzip2
+ tool_$(CONFIG_KERNEL_LZMA)    = lzma
+ tool_$(CONFIG_KERNEL_LZO)     = lzo
++tool_$(CONFIG_KERNEL_XZ)      = xzkern
+ 
+ targets += vmlinux.bin.z
+ $(obj)/vmlinux.bin.z: $(obj)/vmlinux.bin FORCE
+@@ -58,8 +59,13 @@
  # Calculate the load address of the compressed kernel image
  # Calculate the load address of the compressed kernel image
  hostprogs-y := calc_vmlinuz_load_addr
  hostprogs-y := calc_vmlinuz_load_addr
  
  
@@ -218,7 +226,7 @@ diff -Nur linux-2.6.39.4.orig/arch/mips/boot/compressed/Makefile linux-2.6.39.4/
  
  
  vmlinuzobjs-y += $(obj)/piggy.o
  vmlinuzobjs-y += $(obj)/piggy.o
  
  
-@@ -105,4 +110,12 @@
+@@ -105,4 +111,12 @@
  vmlinuz.srec: vmlinuz
  vmlinuz.srec: vmlinuz
  	$(call cmd,objcopy)
  	$(call cmd,objcopy)
  
  
@@ -232,9 +240,41 @@ diff -Nur linux-2.6.39.4.orig/arch/mips/boot/compressed/Makefile linux-2.6.39.4/
 +	$(LD) $(LDFLAGS) -T arch/mips/boot/compressed/selfreloc.lds arch/mips/boot/compressed/selfreloc.o -o $@
 +	$(LD) $(LDFLAGS) -T arch/mips/boot/compressed/selfreloc.lds arch/mips/boot/compressed/selfreloc.o -o $@
 +
 +
 +clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec,elf} $(objtree)/arch/mips/boot/compressed/selfreloc.{o,lds}
 +clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec,elf} $(objtree)/arch/mips/boot/compressed/selfreloc.{o,lds}
+diff -Nur linux-2.6.39.4.orig/arch/mips/boot/compressed/decompress.c linux-2.6.39.4/arch/mips/boot/compressed/decompress.c
+--- linux-2.6.39.4.orig/arch/mips/boot/compressed/decompress.c	2011-08-03 21:43:28.000000000 +0200
++++ linux-2.6.39.4/arch/mips/boot/compressed/decompress.c	2012-06-02 20:39:09.000000000 +0200
+@@ -43,7 +43,7 @@
+ /* activate the code for pre-boot environment */
+ #define STATIC static
+ 
+-#ifdef CONFIG_KERNEL_GZIP
++#if defined(CONFIG_KERNEL_GZIP) || defined(CONFIG_KERNEL_XZ)
+ void *memcpy(void *dest, const void *src, size_t n)
+ {
+ 	int i;
+@@ -54,6 +54,8 @@
+ 		d[i] = s[i];
+ 	return dest;
+ }
++#endif
++#ifdef CONFIG_KERNEL_GZIP
+ #include "../../../../lib/decompress_inflate.c"
+ #endif
+ 
+@@ -78,6 +80,10 @@
+ #include "../../../../lib/decompress_unlzo.c"
+ #endif
+ 
++#ifdef CONFIG_KERNEL_XZ
++#include "../../../../lib/decompress_unxz.c"
++#endif
++
+ void decompress_kernel(unsigned long boot_heap_start)
+ {
+ 	unsigned long zimage_start, zimage_size;
 diff -Nur linux-2.6.39.4.orig/arch/mips/boot/compressed/selfreloc.S linux-2.6.39.4/arch/mips/boot/compressed/selfreloc.S
 diff -Nur linux-2.6.39.4.orig/arch/mips/boot/compressed/selfreloc.S linux-2.6.39.4/arch/mips/boot/compressed/selfreloc.S
 --- linux-2.6.39.4.orig/arch/mips/boot/compressed/selfreloc.S	1970-01-01 01:00:00.000000000 +0100
 --- linux-2.6.39.4.orig/arch/mips/boot/compressed/selfreloc.S	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.39.4/arch/mips/boot/compressed/selfreloc.S	2012-01-17 20:35:09.000000000 +0100
++++ linux-2.6.39.4/arch/mips/boot/compressed/selfreloc.S	2012-06-02 20:35:49.000000000 +0200
 @@ -0,0 +1,54 @@
 @@ -0,0 +1,54 @@
 +/*-
 +/*-
 + * written 2011 by Thorsten Glaser <tg@freewrt.org> based on
 + * written 2011 by Thorsten Glaser <tg@freewrt.org> based on
@@ -292,7 +332,7 @@ diff -Nur linux-2.6.39.4.orig/arch/mips/boot/compressed/selfreloc.S linux-2.6.39
 +imgend:
 +imgend:
 diff -Nur linux-2.6.39.4.orig/arch/mips/boot/compressed/selfreloc.lds.S linux-2.6.39.4/arch/mips/boot/compressed/selfreloc.lds.S
 diff -Nur linux-2.6.39.4.orig/arch/mips/boot/compressed/selfreloc.lds.S linux-2.6.39.4/arch/mips/boot/compressed/selfreloc.lds.S
 --- linux-2.6.39.4.orig/arch/mips/boot/compressed/selfreloc.lds.S	1970-01-01 01:00:00.000000000 +0100
 --- linux-2.6.39.4.orig/arch/mips/boot/compressed/selfreloc.lds.S	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.39.4/arch/mips/boot/compressed/selfreloc.lds.S	2012-01-17 20:35:09.000000000 +0100
++++ linux-2.6.39.4/arch/mips/boot/compressed/selfreloc.lds.S	2012-06-02 20:35:49.000000000 +0200
 @@ -0,0 +1,39 @@
 @@ -0,0 +1,39 @@
 +/*-
 +/*-
 + * written 2010 by Thorsten Glaser <tg@debian.org> based on
 + * written 2010 by Thorsten Glaser <tg@debian.org> based on
@@ -335,7 +375,7 @@ diff -Nur linux-2.6.39.4.orig/arch/mips/boot/compressed/selfreloc.lds.S linux-2.
 +}
 +}
 diff -Nur linux-2.6.39.4.orig/arch/mips/boot/compressed/uart-16550.c linux-2.6.39.4/arch/mips/boot/compressed/uart-16550.c
 diff -Nur linux-2.6.39.4.orig/arch/mips/boot/compressed/uart-16550.c linux-2.6.39.4/arch/mips/boot/compressed/uart-16550.c
 --- linux-2.6.39.4.orig/arch/mips/boot/compressed/uart-16550.c	2011-08-03 21:43:28.000000000 +0200
 --- linux-2.6.39.4.orig/arch/mips/boot/compressed/uart-16550.c	2011-08-03 21:43:28.000000000 +0200
-+++ linux-2.6.39.4/arch/mips/boot/compressed/uart-16550.c	2012-01-17 20:35:09.000000000 +0100
++++ linux-2.6.39.4/arch/mips/boot/compressed/uart-16550.c	2012-06-02 20:35:49.000000000 +0200
 @@ -18,6 +18,11 @@
 @@ -18,6 +18,11 @@
  #define PORT(offset) (CKSEG1ADDR(AR7_REGS_UART0) + (4 * offset))
  #define PORT(offset) (CKSEG1ADDR(AR7_REGS_UART0) + (4 * offset))
  #endif
  #endif
@@ -350,7 +390,7 @@ diff -Nur linux-2.6.39.4.orig/arch/mips/boot/compressed/uart-16550.c linux-2.6.3
  #endif
  #endif
 diff -Nur linux-2.6.39.4.orig/drivers/ssb/driver_mipscore.c linux-2.6.39.4/drivers/ssb/driver_mipscore.c
 diff -Nur linux-2.6.39.4.orig/drivers/ssb/driver_mipscore.c linux-2.6.39.4/drivers/ssb/driver_mipscore.c
 --- linux-2.6.39.4.orig/drivers/ssb/driver_mipscore.c	2011-08-03 21:43:28.000000000 +0200
 --- linux-2.6.39.4.orig/drivers/ssb/driver_mipscore.c	2011-08-03 21:43:28.000000000 +0200
-+++ linux-2.6.39.4/drivers/ssb/driver_mipscore.c	2012-01-17 20:35:09.000000000 +0100
++++ linux-2.6.39.4/drivers/ssb/driver_mipscore.c	2012-06-02 20:35:49.000000000 +0200
 @@ -190,10 +190,11 @@
 @@ -190,10 +190,11 @@
  {
  {
  	struct ssb_bus *bus = mcore->dev->bus;
  	struct ssb_bus *bus = mcore->dev->bus;
@@ -366,7 +406,7 @@ diff -Nur linux-2.6.39.4.orig/drivers/ssb/driver_mipscore.c linux-2.6.39.4/drive
  			mcore->flash_buswidth = 1;
  			mcore->flash_buswidth = 1;
 diff -Nur linux-2.6.39.4.orig/init/Kconfig linux-2.6.39.4/init/Kconfig
 diff -Nur linux-2.6.39.4.orig/init/Kconfig linux-2.6.39.4/init/Kconfig
 --- linux-2.6.39.4.orig/init/Kconfig	2011-08-03 21:43:28.000000000 +0200
 --- linux-2.6.39.4.orig/init/Kconfig	2011-08-03 21:43:28.000000000 +0200
-+++ linux-2.6.39.4/init/Kconfig	2012-01-17 20:35:09.000000000 +0100
++++ linux-2.6.39.4/init/Kconfig	2012-06-02 20:36:11.000000000 +0200
 @@ -156,6 +156,7 @@
 @@ -156,6 +156,7 @@
  config KERNEL_GZIP
  config KERNEL_GZIP
  	bool "Gzip"
  	bool "Gzip"
@@ -391,7 +431,15 @@ diff -Nur linux-2.6.39.4.orig/init/Kconfig linux-2.6.39.4/init/Kconfig
  	help
  	help
  	  The most recent compression algorithm.
  	  The most recent compression algorithm.
  	  Its ratio is best, decompression speed is between the other
  	  Its ratio is best, decompression speed is between the other
-@@ -197,6 +200,7 @@
+@@ -182,6 +185,7 @@
+ config KERNEL_XZ
+ 	bool "XZ"
+ 	depends on HAVE_KERNEL_XZ
++	select DECOMPRESS_XZ
+ 	help
+ 	  XZ uses the LZMA2 algorithm and instruction set specific
+ 	  BCJ filters which can improve compression ratio of executable
+@@ -197,6 +201,7 @@
  config KERNEL_LZO
  config KERNEL_LZO
  	bool "LZO"
  	bool "LZO"
  	depends on HAVE_KERNEL_LZO
  	depends on HAVE_KERNEL_LZO
@@ -399,3 +447,19 @@ diff -Nur linux-2.6.39.4.orig/init/Kconfig linux-2.6.39.4/init/Kconfig
  	help
  	help
  	  Its compression ratio is the poorest among the 4. The kernel
  	  Its compression ratio is the poorest among the 4. The kernel
  	  size is about 10% bigger than gzip; however its speed
  	  size is about 10% bigger than gzip; however its speed
+diff -Nur linux-2.6.39.4.orig/lib/xz/xz_stream.h linux-2.6.39.4/lib/xz/xz_stream.h
+--- linux-2.6.39.4.orig/lib/xz/xz_stream.h	2011-08-03 21:43:28.000000000 +0200
++++ linux-2.6.39.4/lib/xz/xz_stream.h	2012-06-02 20:40:18.000000000 +0200
+@@ -40,7 +40,12 @@
+  * compressed size of the file to less than 256 MiB and may also weaken
+  * error detection slightly.
+  */
++
++#ifdef __mips__
++typedef uint32_t vli_type;
++#else
+ typedef uint64_t vli_type;
++#endif
+ 
+ #define VLI_MAX ((vli_type)-1 / 2)
+ #define VLI_UNKNOWN ((vli_type)-1)