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

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