wok-stable annotate linux/stuff/003-squashfs-x86-support-xz-compressed-kernel.patch @ rev 12465

Up e2fsprogs (1.44.2)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Mar 04 18:42:23 2019 +0100 (2019-03-04)
parents
children
rev   line source
slaxemulator@7650 1 From: Lasse Collin <lasse.collin@tukaani.org>
slaxemulator@7650 2 Date: Thu, 2 Dec 2010 19:14:57 +0000 (+0200)
slaxemulator@7650 3 Subject: x86: Support XZ-compressed kernel
slaxemulator@7650 4 X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fpkl%2Fsquashfs-xz.git;a=commitdiff_plain;h=d4ad78414e5312126127b1f88cdaf8584af3eef1
slaxemulator@7650 5
slaxemulator@7650 6 x86: Support XZ-compressed kernel
slaxemulator@7650 7
slaxemulator@7650 8 This integrates the XZ decompression code to the x86
slaxemulator@7650 9 pre-boot code.
slaxemulator@7650 10
slaxemulator@7650 11 mkpiggy.c is updated to reserve about 32 KiB more buffer safety
slaxemulator@7650 12 margin for kernel decompression. It is done unconditionally for
slaxemulator@7650 13 all decompressors to keep the code simpler.
slaxemulator@7650 14
slaxemulator@7650 15 The XZ decompressor needs around 30 KiB of heap, so the heap size
slaxemulator@7650 16 is increased to 32 KiB on both x86-32 and x86-64.
slaxemulator@7650 17
slaxemulator@7650 18 Documentation/x86/boot.txt is updated to list the XZ magic number.
slaxemulator@7650 19
slaxemulator@7650 20 With the x86 BCJ filter in XZ, XZ-compressed x86 kernel tends to be
slaxemulator@7650 21 a few percent smaller than the equivalent LZMA-compressed kernel.
slaxemulator@7650 22
slaxemulator@7650 23 Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
slaxemulator@7650 24 ---
slaxemulator@7650 25
slaxemulator@7650 26 diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt
slaxemulator@7650 27 index 30b43e1..3988cde 100644
slaxemulator@7650 28 --- a/Documentation/x86/boot.txt
slaxemulator@7650 29 +++ b/Documentation/x86/boot.txt
slaxemulator@7650 30 @@ -621,9 +621,9 @@ Protocol: 2.08+
slaxemulator@7650 31 The payload may be compressed. The format of both the compressed and
slaxemulator@7650 32 uncompressed data should be determined using the standard magic
slaxemulator@7650 33 numbers. The currently supported compression formats are gzip
slaxemulator@7650 34 - (magic numbers 1F 8B or 1F 9E), bzip2 (magic number 42 5A) and LZMA
slaxemulator@7650 35 - (magic number 5D 00). The uncompressed payload is currently always ELF
slaxemulator@7650 36 - (magic number 7F 45 4C 46).
slaxemulator@7650 37 + (magic numbers 1F 8B or 1F 9E), bzip2 (magic number 42 5A), LZMA
slaxemulator@7650 38 + (magic number 5D 00), and XZ (magic number FD 37). The uncompressed
slaxemulator@7650 39 + payload is currently always ELF (magic number 7F 45 4C 46).
slaxemulator@7650 40
slaxemulator@7650 41 Field name: payload_length
slaxemulator@7650 42 Type: read
slaxemulator@7650 43 diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
slaxemulator@7650 44 index cea0cd9..f3db0d7 100644
slaxemulator@7650 45 --- a/arch/x86/Kconfig
slaxemulator@7650 46 +++ b/arch/x86/Kconfig
slaxemulator@7650 47 @@ -51,6 +51,7 @@ config X86
slaxemulator@7650 48 select HAVE_KERNEL_GZIP
slaxemulator@7650 49 select HAVE_KERNEL_BZIP2
slaxemulator@7650 50 select HAVE_KERNEL_LZMA
slaxemulator@7650 51 + select HAVE_KERNEL_XZ
slaxemulator@7650 52 select HAVE_KERNEL_LZO
slaxemulator@7650 53 select HAVE_HW_BREAKPOINT
slaxemulator@7650 54 select HAVE_MIXED_BREAKPOINTS_REGS
slaxemulator@7650 55 diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
slaxemulator@7650 56 index 0c22955..09664ef 100644
slaxemulator@7650 57 --- a/arch/x86/boot/compressed/Makefile
slaxemulator@7650 58 +++ b/arch/x86/boot/compressed/Makefile
slaxemulator@7650 59 @@ -4,7 +4,7 @@
slaxemulator@7650 60 # create a compressed vmlinux image from the original vmlinux
slaxemulator@7650 61 #
slaxemulator@7650 62
slaxemulator@7650 63 -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
slaxemulator@7650 64 +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
slaxemulator@7650 65
slaxemulator@7650 66 KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
slaxemulator@7650 67 KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
slaxemulator@7650 68 @@ -49,12 +49,15 @@ $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
slaxemulator@7650 69 $(call if_changed,bzip2)
slaxemulator@7650 70 $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
slaxemulator@7650 71 $(call if_changed,lzma)
slaxemulator@7650 72 +$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
slaxemulator@7650 73 + $(call if_changed,xzkern)
slaxemulator@7650 74 $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
slaxemulator@7650 75 $(call if_changed,lzo)
slaxemulator@7650 76
slaxemulator@7650 77 suffix-$(CONFIG_KERNEL_GZIP) := gz
slaxemulator@7650 78 suffix-$(CONFIG_KERNEL_BZIP2) := bz2
slaxemulator@7650 79 suffix-$(CONFIG_KERNEL_LZMA) := lzma
slaxemulator@7650 80 +suffix-$(CONFIG_KERNEL_XZ) := xz
slaxemulator@7650 81 suffix-$(CONFIG_KERNEL_LZO) := lzo
slaxemulator@7650 82
slaxemulator@7650 83 quiet_cmd_mkpiggy = MKPIGGY $@
slaxemulator@7650 84 diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
slaxemulator@7650 85 index 8f7bef8..6d4cab7 100644
slaxemulator@7650 86 --- a/arch/x86/boot/compressed/misc.c
slaxemulator@7650 87 +++ b/arch/x86/boot/compressed/misc.c
slaxemulator@7650 88 @@ -139,6 +139,10 @@ static int lines, cols;
slaxemulator@7650 89 #include "../../../../lib/decompress_unlzma.c"
slaxemulator@7650 90 #endif
slaxemulator@7650 91
slaxemulator@7650 92 +#ifdef CONFIG_KERNEL_XZ
slaxemulator@7650 93 +#include "../../../../lib/decompress_unxz.c"
slaxemulator@7650 94 +#endif
slaxemulator@7650 95 +
slaxemulator@7650 96 #ifdef CONFIG_KERNEL_LZO
slaxemulator@7650 97 #include "../../../../lib/decompress_unlzo.c"
slaxemulator@7650 98 #endif
slaxemulator@7650 99 diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c
slaxemulator@7650 100 index 5c22812..646aa78 100644
slaxemulator@7650 101 --- a/arch/x86/boot/compressed/mkpiggy.c
slaxemulator@7650 102 +++ b/arch/x86/boot/compressed/mkpiggy.c
slaxemulator@7650 103 @@ -74,7 +74,7 @@ int main(int argc, char *argv[])
slaxemulator@7650 104
slaxemulator@7650 105 offs = (olen > ilen) ? olen - ilen : 0;
slaxemulator@7650 106 offs += olen >> 12; /* Add 8 bytes for each 32K block */
slaxemulator@7650 107 - offs += 32*1024 + 18; /* Add 32K + 18 bytes slack */
slaxemulator@7650 108 + offs += 64*1024 + 128; /* Add 64K + 128 bytes slack */
slaxemulator@7650 109 offs = (offs+4095) & ~4095; /* Round to a 4K boundary */
slaxemulator@7650 110
slaxemulator@7650 111 printf(".section \".rodata..compressed\",\"a\",@progbits\n");
slaxemulator@7650 112 diff --git a/arch/x86/include/asm/boot.h b/arch/x86/include/asm/boot.h
slaxemulator@7650 113 index 3b62ab5..5e1a2ee 100644
slaxemulator@7650 114 --- a/arch/x86/include/asm/boot.h
slaxemulator@7650 115 +++ b/arch/x86/include/asm/boot.h
slaxemulator@7650 116 @@ -32,11 +32,7 @@
slaxemulator@7650 117 #define BOOT_HEAP_SIZE 0x400000
slaxemulator@7650 118 #else /* !CONFIG_KERNEL_BZIP2 */
slaxemulator@7650 119
slaxemulator@7650 120 -#ifdef CONFIG_X86_64
slaxemulator@7650 121 -#define BOOT_HEAP_SIZE 0x7000
slaxemulator@7650 122 -#else
slaxemulator@7650 123 -#define BOOT_HEAP_SIZE 0x4000
slaxemulator@7650 124 -#endif
slaxemulator@7650 125 +#define BOOT_HEAP_SIZE 0x8000
slaxemulator@7650 126
slaxemulator@7650 127 #endif /* !CONFIG_KERNEL_BZIP2 */
slaxemulator@7650 128