wok-current diff linux-libre/stuff/003-squashfs-x86-support-xz-compressed-kernel.patch @ rev 12624

exosip: update WGET_URL
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Apr 29 12:18:27 2012 +0200 (2012-04-29)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/linux-libre/stuff/003-squashfs-x86-support-xz-compressed-kernel.patch	Sun Apr 29 12:18:27 2012 +0200
     1.3 @@ -0,0 +1,128 @@
     1.4 +From: Lasse Collin <lasse.collin@tukaani.org>
     1.5 +Date: Thu, 2 Dec 2010 19:14:57 +0000 (+0200)
     1.6 +Subject: x86: Support XZ-compressed kernel
     1.7 +X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fpkl%2Fsquashfs-xz.git;a=commitdiff_plain;h=d4ad78414e5312126127b1f88cdaf8584af3eef1
     1.8 +
     1.9 +x86: Support XZ-compressed kernel
    1.10 +
    1.11 +This integrates the XZ decompression code to the x86
    1.12 +pre-boot code.
    1.13 +
    1.14 +mkpiggy.c is updated to reserve about 32 KiB more buffer safety
    1.15 +margin for kernel decompression. It is done unconditionally for
    1.16 +all decompressors to keep the code simpler.
    1.17 +
    1.18 +The XZ decompressor needs around 30 KiB of heap, so the heap size
    1.19 +is increased to 32 KiB on both x86-32 and x86-64.
    1.20 +
    1.21 +Documentation/x86/boot.txt is updated to list the XZ magic number.
    1.22 +
    1.23 +With the x86 BCJ filter in XZ, XZ-compressed x86 kernel tends to be
    1.24 +a few percent smaller than the equivalent LZMA-compressed kernel.
    1.25 +
    1.26 +Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
    1.27 +---
    1.28 +
    1.29 +diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt
    1.30 +index 30b43e1..3988cde 100644
    1.31 +--- a/Documentation/x86/boot.txt
    1.32 ++++ b/Documentation/x86/boot.txt
    1.33 +@@ -621,9 +621,9 @@ Protocol:	2.08+
    1.34 +   The payload may be compressed. The format of both the compressed and
    1.35 +   uncompressed data should be determined using the standard magic
    1.36 +   numbers.  The currently supported compression formats are gzip
    1.37 +-  (magic numbers 1F 8B or 1F 9E), bzip2 (magic number 42 5A) and LZMA
    1.38 +-  (magic number 5D 00).  The uncompressed payload is currently always ELF
    1.39 +-  (magic number 7F 45 4C 46).
    1.40 ++  (magic numbers 1F 8B or 1F 9E), bzip2 (magic number 42 5A), LZMA
    1.41 ++  (magic number 5D 00), and XZ (magic number FD 37).  The uncompressed
    1.42 ++  payload is currently always ELF (magic number 7F 45 4C 46).
    1.43 +   
    1.44 + Field name:	payload_length
    1.45 + Type:		read
    1.46 +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
    1.47 +index cea0cd9..f3db0d7 100644
    1.48 +--- a/arch/x86/Kconfig
    1.49 ++++ b/arch/x86/Kconfig
    1.50 +@@ -51,6 +51,7 @@ config X86
    1.51 + 	select HAVE_KERNEL_GZIP
    1.52 + 	select HAVE_KERNEL_BZIP2
    1.53 + 	select HAVE_KERNEL_LZMA
    1.54 ++	select HAVE_KERNEL_XZ
    1.55 + 	select HAVE_KERNEL_LZO
    1.56 + 	select HAVE_HW_BREAKPOINT
    1.57 + 	select HAVE_MIXED_BREAKPOINTS_REGS
    1.58 +diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
    1.59 +index 0c22955..09664ef 100644
    1.60 +--- a/arch/x86/boot/compressed/Makefile
    1.61 ++++ b/arch/x86/boot/compressed/Makefile
    1.62 +@@ -4,7 +4,7 @@
    1.63 + # create a compressed vmlinux image from the original vmlinux
    1.64 + #
    1.65 + 
    1.66 +-targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.lzo head_$(BITS).o misc.o string.o cmdline.o early_serial_console.o piggy.o
    1.67 ++targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo head_$(BITS).o misc.o string.o cmdline.o early_serial_console.o piggy.o
    1.68 + 
    1.69 + KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
    1.70 + KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
    1.71 +@@ -49,12 +49,15 @@ $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
    1.72 + 	$(call if_changed,bzip2)
    1.73 + $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
    1.74 + 	$(call if_changed,lzma)
    1.75 ++$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
    1.76 ++	$(call if_changed,xzkern)
    1.77 + $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
    1.78 + 	$(call if_changed,lzo)
    1.79 + 
    1.80 + suffix-$(CONFIG_KERNEL_GZIP)	:= gz
    1.81 + suffix-$(CONFIG_KERNEL_BZIP2)	:= bz2
    1.82 + suffix-$(CONFIG_KERNEL_LZMA)	:= lzma
    1.83 ++suffix-$(CONFIG_KERNEL_XZ)	:= xz
    1.84 + suffix-$(CONFIG_KERNEL_LZO) 	:= lzo
    1.85 + 
    1.86 + quiet_cmd_mkpiggy = MKPIGGY $@
    1.87 +diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
    1.88 +index 8f7bef8..6d4cab7 100644
    1.89 +--- a/arch/x86/boot/compressed/misc.c
    1.90 ++++ b/arch/x86/boot/compressed/misc.c
    1.91 +@@ -139,6 +139,10 @@ static int lines, cols;
    1.92 + #include "../../../../lib/decompress_unlzma.c"
    1.93 + #endif
    1.94 + 
    1.95 ++#ifdef CONFIG_KERNEL_XZ
    1.96 ++#include "../../../../lib/decompress_unxz.c"
    1.97 ++#endif
    1.98 ++
    1.99 + #ifdef CONFIG_KERNEL_LZO
   1.100 + #include "../../../../lib/decompress_unlzo.c"
   1.101 + #endif
   1.102 +diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c
   1.103 +index 5c22812..646aa78 100644
   1.104 +--- a/arch/x86/boot/compressed/mkpiggy.c
   1.105 ++++ b/arch/x86/boot/compressed/mkpiggy.c
   1.106 +@@ -74,7 +74,7 @@ int main(int argc, char *argv[])
   1.107 + 
   1.108 + 	offs = (olen > ilen) ? olen - ilen : 0;
   1.109 + 	offs += olen >> 12;	/* Add 8 bytes for each 32K block */
   1.110 +-	offs += 32*1024 + 18;	/* Add 32K + 18 bytes slack */
   1.111 ++	offs += 64*1024 + 128;	/* Add 64K + 128 bytes slack */
   1.112 + 	offs = (offs+4095) & ~4095; /* Round to a 4K boundary */
   1.113 + 
   1.114 + 	printf(".section \".rodata..compressed\",\"a\",@progbits\n");
   1.115 +diff --git a/arch/x86/include/asm/boot.h b/arch/x86/include/asm/boot.h
   1.116 +index 3b62ab5..5e1a2ee 100644
   1.117 +--- a/arch/x86/include/asm/boot.h
   1.118 ++++ b/arch/x86/include/asm/boot.h
   1.119 +@@ -32,11 +32,7 @@
   1.120 + #define BOOT_HEAP_SIZE             0x400000
   1.121 + #else /* !CONFIG_KERNEL_BZIP2 */
   1.122 + 
   1.123 +-#ifdef CONFIG_X86_64
   1.124 +-#define BOOT_HEAP_SIZE	0x7000
   1.125 +-#else
   1.126 +-#define BOOT_HEAP_SIZE	0x4000
   1.127 +-#endif
   1.128 ++#define BOOT_HEAP_SIZE	0x8000
   1.129 + 
   1.130 + #endif /* !CONFIG_KERNEL_BZIP2 */
   1.131 +