commit:     a44f851975ac335d3c7565abb15f31cca1b38c6c
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  3 11:35:05 2020 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Mon Aug  3 11:35:05 2020 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=a44f8519

Update ZSTD Patch

Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>

 0000_README                                        | 16 ++--
 ...ZSTD-v10-1-8-prepare-zstd-for-preboot-env.patch | 17 ----
 ...TD-v10-2-8-prepare-xxhash-for-preboot-env.patch | 29 ++++---
 ...STD-v5-2-8-prepare-xxhash-for-preboot-env.patch | 94 ----------------------
 ...TD-v10-3-8-add-zstd-support-to-decompress.patch | 50 +++++++++---
 ...v10-4-8-add-support-for-zstd-compres-kern.patch |  0
 ...add-support-for-zstd-compressed-initramfs.patch |  0
 ...ZSTD-v10-6-8-bump-ZO-z-extra-bytes-margin.patch | 49 ++++++++---
 ...10-7-8-support-for-ZSTD-compressed-kernel.patch |  2 +-
 ...0-8-8-gitignore-add-ZSTD-compressed-files.patch | 12 +++
 10 files changed, 116 insertions(+), 153 deletions(-)

diff --git a/0000_README b/0000_README
index b9ce21a..6e07572 100644
--- a/0000_README
+++ b/0000_README
@@ -71,35 +71,35 @@ Patch:  4567_distro-Gentoo-Kconfig.patch
 From:   Tom Wijsman <tom...@gentoo.org>
 Desc:   Add Gentoo Linux support config settings and defaults.
 
-Patch:         5000_ZSTD-v5-1-8-prepare-zstd-for-preboot-env.patch
+Patch:         5000_ZSTD-v10-1-8-prepare-zstd-for-preboot-env.patch
 From:   https://lkml.org/lkml/2020/4/1/29
 Desc:   lib: prepare zstd for preboot environment
 
-Patch:  5001_ZSTD-v5-2-8-prepare-xxhash-for-preboot-env.patch
+Patch:  5001_ZSTD-v10-2-8-prepare-xxhash-for-preboot-env.patch
 From:   https://lkml.org/lkml/2020/4/1/29
 Desc:   lib: prepare xxhash for preboot environment
 
-Patch:  5002_ZSTD-v5-3-8-add-zstd-support-to-decompress.patch
+Patch:  5002_ZSTD-v10-3-8-add-zstd-support-to-decompress.patch
 From:   https://lkml.org/lkml/2020/4/1/29
 Desc:   lib: add zstd support to decompress
 
-Patch:  5003_ZSTD-v5-4-8-add-support-for-zstd-compres-kern.patch
+Patch:  5003_ZSTD-v10-4-8-add-support-for-zstd-compres-kern.patch
 From:   https://lkml.org/lkml/2020/4/1/29
 Desc:   init: add support for zstd compressed kernel
 
-Patch:  5004_ZSTD-v5-5-8-add-support-for-zstd-compressed-initramfs.patch
+Patch:  5004_ZSTD-v10-5-8-add-support-for-zstd-compressed-initramfs.patch
 From:   https://lkml.org/lkml/2020/4/1/29
 Desc:   usr: add support for zstd compressed initramfs
 
-Patch:  5005_ZSTD-v5-6-8-bump-ZO-z-extra-bytes-margin.patch
+Patch:  5005_ZSTD-v10-6-8-bump-ZO-z-extra-bytes-margin.patch
 From:   https://lkml.org/lkml/2020/4/1/29
 Desc:   x86: bump ZO_z_extra_bytes margin for zstd
 
-Patch:  5006_ZSTD-v5-7-8-support-for-ZSTD-compressed-kernel.patch
+Patch:  5006_ZSTD-v10-7-8-support-for-ZSTD-compressed-kernel.patch
 From:   https://lkml.org/lkml/2020/4/1/29
 Desc:   x86: Add support for ZSTD compressed kernel
 
-Patch:  5007_ZSTD-v5-8-8-gitignore-add-ZSTD-compressed-files.patch
+Patch:  5007_ZSTD-v10-8-8-gitignore-add-ZSTD-compressed-files.patch
 From:   https://lkml.org/lkml/2020/4/1/29
 Desc:   .gitignore: add ZSTD-compressed files
 

diff --git a/5000_ZSTD-v5-1-8-prepare-zstd-for-preboot-env.patch 
b/5000_ZSTD-v10-1-8-prepare-zstd-for-preboot-env.patch
similarity index 82%
rename from 5000_ZSTD-v5-1-8-prepare-zstd-for-preboot-env.patch
rename to 5000_ZSTD-v10-1-8-prepare-zstd-for-preboot-env.patch
index 297a8d4..c13b091 100644
--- a/5000_ZSTD-v5-1-8-prepare-zstd-for-preboot-env.patch
+++ b/5000_ZSTD-v10-1-8-prepare-zstd-for-preboot-env.patch
@@ -1,20 +1,3 @@
-diff --git a/lib/zstd/decompress.c b/lib/zstd/decompress.c
-index 269ee9a796c1..73ded63278cf 100644
---- a/lib/zstd/decompress.c
-+++ b/lib/zstd/decompress.c
-@@ -2490,6 +2490,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, 
ZSTD_outBuffer *output, ZSTD_inB
-       }
- }
- 
-+#ifndef ZSTD_PREBOOT
- EXPORT_SYMBOL(ZSTD_DCtxWorkspaceBound);
- EXPORT_SYMBOL(ZSTD_initDCtx);
- EXPORT_SYMBOL(ZSTD_decompressDCtx);
-@@ -2529,3 +2530,4 @@ EXPORT_SYMBOL(ZSTD_insertBlock);
- 
- MODULE_LICENSE("Dual BSD/GPL");
- MODULE_DESCRIPTION("Zstd Decompressor");
-+#endif
 diff --git a/lib/zstd/fse_decompress.c b/lib/zstd/fse_decompress.c
 index a84300e5a013..0b353530fb3f 100644
 --- a/lib/zstd/fse_decompress.c

diff --git a/5002_ZSTD-v5-3-8-add-zstd-support-to-decompress.patch 
b/5001_ZSTD-v10-2-8-prepare-xxhash-for-preboot-env.patch
similarity index 94%
rename from 5002_ZSTD-v5-3-8-add-zstd-support-to-decompress.patch
rename to 5001_ZSTD-v10-2-8-prepare-xxhash-for-preboot-env.patch
index 1c22fa3..b18164c 100644
--- a/5002_ZSTD-v5-3-8-add-zstd-support-to-decompress.patch
+++ b/5001_ZSTD-v10-2-8-prepare-xxhash-for-preboot-env.patch
@@ -16,10 +16,10 @@ index 000000000000..56d539ae880f
 +         void (*error_fn)(char *x));
 +#endif
 diff --git a/lib/Kconfig b/lib/Kconfig
-index 5d53f9609c25..e883aecb9279 100644
+index df3f3da95990..a5d6f23c4cab 100644
 --- a/lib/Kconfig
 +++ b/lib/Kconfig
-@@ -336,6 +336,10 @@ config DECOMPRESS_LZ4
+@@ -342,6 +342,10 @@ config DECOMPRESS_LZ4
        select LZ4_DECOMPRESS
        tristate
  
@@ -31,10 +31,10 @@ index 5d53f9609c25..e883aecb9279 100644
  # Generic allocator support is selected if needed
  #
 diff --git a/lib/Makefile b/lib/Makefile
-index ab68a8674360..3ce4ac296611 100644
+index b1c42c10073b..2ba9642a3a87 100644
 --- a/lib/Makefile
 +++ b/lib/Makefile
-@@ -166,6 +166,7 @@ lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o
+@@ -170,6 +170,7 @@ lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o
  lib-$(CONFIG_DECOMPRESS_XZ) += decompress_unxz.o
  lib-$(CONFIG_DECOMPRESS_LZO) += decompress_unlzo.o
  lib-$(CONFIG_DECOMPRESS_LZ4) += decompress_unlz4.o
@@ -74,10 +74,10 @@ index 857ab1af1ef3..ab3fc90ffc64 100644
  
 diff --git a/lib/decompress_unzstd.c b/lib/decompress_unzstd.c
 new file mode 100644
-index 000000000000..f317afab502f
+index 000000000000..0ad2c15479ed
 --- /dev/null
 +++ b/lib/decompress_unzstd.c
-@@ -0,0 +1,342 @@
+@@ -0,0 +1,345 @@
 +// SPDX-License-Identifier: GPL-2.0
 +
 +/*
@@ -139,12 +139,14 @@ index 000000000000..f317afab502f
 + * zstd's only source dependeny is xxhash, which has no source
 + * dependencies.
 + *
-+ * zstd and xxhash avoid declaring themselves as modules
-+ * when ZSTD_PREBOOT and XXH_PREBOOT are defined.
++ * When UNZSTD_PREBOOT is defined we declare __decompress(), which is
++ * used for kernel decompression, instead of unzstd().
++ *
++ * Define __DISABLE_EXPORTS in preboot environments to prevent symbols
++ * from xxhash and zstd from being exported by the EXPORT_SYMBOL macro.
 + */
 +#ifdef STATIC
-+# define ZSTD_PREBOOT
-+# define XXH_PREBOOT
++# define UNZSTD_PREBOOT
 +# include "xxhash.c"
 +# include "zstd/entropy_common.c"
 +# include "zstd/fse_decompress.c"
@@ -159,10 +161,11 @@ index 000000000000..f317afab502f
 +
 +/* 128MB is the maximum window size supported by zstd. */
 +#define ZSTD_WINDOWSIZE_MAX   (1 << ZSTD_WINDOWLOG_MAX)
-+/* Size of the input and output buffers in multi-call mode.
++/*
++ * Size of the input and output buffers in multi-call mode.
 + * Pick a larger size because it isn't used during kernel decompression,
 + * since that is single pass, and we have to allocate a large buffer for
-+ * zstd's window anyways. The larger size speeds up initramfs decompression.
++ * zstd's window anyway. The larger size speeds up initramfs decompression.
 + */
 +#define ZSTD_IOBUF_SIZE               (1 << 17)
 +
@@ -399,7 +402,7 @@ index 000000000000..f317afab502f
 +      return err;
 +}
 +
-+#ifndef ZSTD_PREBOOT
++#ifndef UNZSTD_PREBOOT
 +STATIC int INIT unzstd(unsigned char *buf, long len,
 +                     long (*fill)(void*, unsigned long),
 +                     long (*flush)(void*, unsigned long),

diff --git a/5001_ZSTD-v5-2-8-prepare-xxhash-for-preboot-env.patch 
b/5001_ZSTD-v5-2-8-prepare-xxhash-for-preboot-env.patch
deleted file mode 100644
index 88e4674..0000000
--- a/5001_ZSTD-v5-2-8-prepare-xxhash-for-preboot-env.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-diff --git a/lib/xxhash.c b/lib/xxhash.c
-index aa61e2a3802f..b4364e011392 100644
---- a/lib/xxhash.c
-+++ b/lib/xxhash.c
-@@ -80,13 +80,11 @@ void xxh32_copy_state(struct xxh32_state *dst, const 
struct xxh32_state *src)
- {
-       memcpy(dst, src, sizeof(*dst));
- }
--EXPORT_SYMBOL(xxh32_copy_state);
- 
- void xxh64_copy_state(struct xxh64_state *dst, const struct xxh64_state *src)
- {
-       memcpy(dst, src, sizeof(*dst));
- }
--EXPORT_SYMBOL(xxh64_copy_state);
- 
- /*-***************************
-  * Simple Hash Functions
-@@ -151,7 +149,6 @@ uint32_t xxh32(const void *input, const size_t len, const 
uint32_t seed)
- 
-       return h32;
- }
--EXPORT_SYMBOL(xxh32);
- 
- static uint64_t xxh64_round(uint64_t acc, const uint64_t input)
- {
-@@ -234,7 +231,6 @@ uint64_t xxh64(const void *input, const size_t len, const 
uint64_t seed)
- 
-       return h64;
- }
--EXPORT_SYMBOL(xxh64);
- 
- /*-**************************************************
-  * Advanced Hash Functions
-@@ -251,7 +247,6 @@ void xxh32_reset(struct xxh32_state *statePtr, const 
uint32_t seed)
-       state.v4 = seed - PRIME32_1;
-       memcpy(statePtr, &state, sizeof(state));
- }
--EXPORT_SYMBOL(xxh32_reset);
- 
- void xxh64_reset(struct xxh64_state *statePtr, const uint64_t seed)
- {
-@@ -265,7 +260,6 @@ void xxh64_reset(struct xxh64_state *statePtr, const 
uint64_t seed)
-       state.v4 = seed - PRIME64_1;
-       memcpy(statePtr, &state, sizeof(state));
- }
--EXPORT_SYMBOL(xxh64_reset);
- 
- int xxh32_update(struct xxh32_state *state, const void *input, const size_t 
len)
- {
-@@ -334,7 +328,6 @@ int xxh32_update(struct xxh32_state *state, const void 
*input, const size_t len)
- 
-       return 0;
- }
--EXPORT_SYMBOL(xxh32_update);
- 
- uint32_t xxh32_digest(const struct xxh32_state *state)
- {
-@@ -372,7 +365,6 @@ uint32_t xxh32_digest(const struct xxh32_state *state)
- 
-       return h32;
- }
--EXPORT_SYMBOL(xxh32_digest);
- 
- int xxh64_update(struct xxh64_state *state, const void *input, const size_t 
len)
- {
-@@ -439,7 +431,6 @@ int xxh64_update(struct xxh64_state *state, const void 
*input, const size_t len)
- 
-       return 0;
- }
--EXPORT_SYMBOL(xxh64_update);
- 
- uint64_t xxh64_digest(const struct xxh64_state *state)
- {
-@@ -494,7 +485,19 @@ uint64_t xxh64_digest(const struct xxh64_state *state)
- 
-       return h64;
- }
-+
-+#ifndef XXH_PREBOOT
-+EXPORT_SYMBOL(xxh32_copy_state);
-+EXPORT_SYMBOL(xxh64_copy_state);
-+EXPORT_SYMBOL(xxh32);
-+EXPORT_SYMBOL(xxh64);
-+EXPORT_SYMBOL(xxh32_reset);
-+EXPORT_SYMBOL(xxh64_reset);
-+EXPORT_SYMBOL(xxh32_update);
-+EXPORT_SYMBOL(xxh32_digest);
-+EXPORT_SYMBOL(xxh64_update);
- EXPORT_SYMBOL(xxh64_digest);
- 
- MODULE_LICENSE("Dual BSD/GPL");
- MODULE_DESCRIPTION("xxHash");
-+#endif

diff --git a/5003_ZSTD-v5-4-8-add-support-for-zstd-compres-kern.patch 
b/5002_ZSTD-v10-3-8-add-zstd-support-to-decompress.patch
similarity index 52%
rename from 5003_ZSTD-v5-4-8-add-support-for-zstd-compres-kern.patch
rename to 5002_ZSTD-v10-3-8-add-zstd-support-to-decompress.patch
index d9dc79e..a277f5e 100644
--- a/5003_ZSTD-v5-4-8-add-support-for-zstd-compres-kern.patch
+++ b/5002_ZSTD-v10-3-8-add-zstd-support-to-decompress.patch
@@ -1,8 +1,29 @@
+diff --git a/Makefile b/Makefile
+index 229e67f2ff75..565084f347bd 100644
+--- a/Makefile
++++ b/Makefile
+@@ -464,6 +464,7 @@ KLZOP              = lzop
+ LZMA          = lzma
+ LZ4           = lz4c
+ XZ            = xz
++ZSTD          = zstd
+ 
+ CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
+                 -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
+@@ -512,7 +513,7 @@ CLANG_FLAGS :=
+ export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE 
LD CC
+ export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF PAHOLE LEX YACC AWK 
INSTALLKERNEL
+ export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
+-export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ
++export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD
+ export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE
+ 
+ export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
 diff --git a/init/Kconfig b/init/Kconfig
-index 492bb7000aa4..806874fdd663 100644
+index 0498af567f70..2b6409fec53f 100644
 --- a/init/Kconfig
 +++ b/init/Kconfig
-@@ -176,13 +176,16 @@ config HAVE_KERNEL_LZO
+@@ -191,13 +191,16 @@ config HAVE_KERNEL_LZO
  config HAVE_KERNEL_LZ4
        bool
  
@@ -20,7 +41,7 @@ index 492bb7000aa4..806874fdd663 100644
        help
          The linux kernel is a kind of self-extracting executable.
          Several compression algorithms are available, which differ
-@@ -261,6 +264,16 @@ config KERNEL_LZ4
+@@ -276,6 +279,16 @@ config KERNEL_LZ4
          is about 8% bigger than LZO. But the decompression speed is
          faster than LZO.
  
@@ -32,18 +53,18 @@ index 492bb7000aa4..806874fdd663 100644
 +        with fast decompression speed. It will compress better than GZIP and
 +        decompress around the same speed as LZO, but slower than LZ4. You
 +        will need at least 192 KB RAM or more for booting. The zstd command
-+        line tools is required for compression.
++        line tool is required for compression.
 +
  config KERNEL_UNCOMPRESSED
        bool "None"
        depends on HAVE_KERNEL_UNCOMPRESSED
 diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
-index b12dd5ba4896..efe69b78d455 100644
+index 916b2f7f7098..54f7b7eb580b 100644
 --- a/scripts/Makefile.lib
 +++ b/scripts/Makefile.lib
-@@ -405,6 +405,21 @@ quiet_cmd_xzkern = XZKERN  $@
+@@ -413,6 +413,28 @@ quiet_cmd_xzkern = XZKERN  $@
  quiet_cmd_xzmisc = XZMISC  $@
-       cmd_xzmisc = cat $(real-prereqs) | xz --check=crc32 --lzma2=dict=1MiB > 
$@
+       cmd_xzmisc = cat $(real-prereqs) | $(XZ) --check=crc32 
--lzma2=dict=1MiB > $@
  
 +# ZSTD
 +# ---------------------------------------------------------------------------
@@ -51,14 +72,21 @@ index b12dd5ba4896..efe69b78d455 100644
 +# format has the size information available at the beginning of the file too,
 +# but it's in a more complex format and it's good to avoid changing the part
 +# of the boot code that reads the uncompressed size.
++#
 +# Note that the bytes added by size_append will make the zstd tool think that
 +# the file is corrupt. This is expected.
++#
++# zstd uses a maximum window size of 8 MB. zstd22 uses a maximum window size 
of
++# 128 MB. zstd22 is used for kernel compression because it is decompressed in 
a
++# single pass, so zstd doesn't need to allocate a window buffer. When 
streaming
++# decompression is used, like initramfs decompression, zstd22 should likely 
not
++# be used because it would require zstd to allocate a 128 MB buffer.
 +
 +quiet_cmd_zstd = ZSTD    $@
-+cmd_zstd = (cat $(filter-out FORCE,$^) | \
-+      zstd -19 && \
-+        $(call size_append, $(filter-out FORCE,$^))) > $@ || \
-+      (rm -f $@ ; false)
++      cmd_zstd = { cat $(real-prereqs) | $(ZSTD) -19; $(size_append); } > $@
++
++quiet_cmd_zstd22 = ZSTD22  $@
++      cmd_zstd22 = { cat $(real-prereqs) | $(ZSTD) -22 --ultra; 
$(size_append); } > $@
 +
  # ASM offsets
  # ---------------------------------------------------------------------------

diff --git a/5004_ZSTD-v5-5-8-add-support-for-zstd-compressed-initramfs.patch 
b/5003_ZSTD-v10-4-8-add-support-for-zstd-compres-kern.patch
similarity index 100%
rename from 5004_ZSTD-v5-5-8-add-support-for-zstd-compressed-initramfs.patch
rename to 5003_ZSTD-v10-4-8-add-support-for-zstd-compres-kern.patch

diff --git a/5005_ZSTD-v5-6-8-bump-ZO-z-extra-bytes-margin.patch 
b/5004_ZSTD-v10-5-8-add-support-for-zstd-compressed-initramfs.patch
similarity index 100%
rename from 5005_ZSTD-v5-6-8-bump-ZO-z-extra-bytes-margin.patch
rename to 5004_ZSTD-v10-5-8-add-support-for-zstd-compressed-initramfs.patch

diff --git a/5006_ZSTD-v5-7-8-support-for-ZSTD-compressed-kernel.patch 
b/5005_ZSTD-v10-6-8-bump-ZO-z-extra-bytes-margin.patch
similarity index 67%
rename from 5006_ZSTD-v5-7-8-support-for-ZSTD-compressed-kernel.patch
rename to 5005_ZSTD-v10-6-8-bump-ZO-z-extra-bytes-margin.patch
index 6147136..c9615c0 100644
--- a/5006_ZSTD-v5-7-8-support-for-ZSTD-compressed-kernel.patch
+++ b/5005_ZSTD-v10-6-8-bump-ZO-z-extra-bytes-margin.patch
@@ -1,5 +1,5 @@
 diff --git a/Documentation/x86/boot.rst b/Documentation/x86/boot.rst
-index fa7ddc0428c8..0404e99dc1d4 100644
+index 5325c71ca877..7fafc7ac00d7 100644
 --- a/Documentation/x86/boot.rst
 +++ b/Documentation/x86/boot.rst
 @@ -782,9 +782,9 @@ Protocol:  2.08+
@@ -16,10 +16,10 @@ index fa7ddc0428c8..0404e99dc1d4 100644
  ============  ==============
  Field name:   payload_length
 diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
-index 886fa8368256..912f783bc01a 100644
+index 883da0abf779..4a64395bc35d 100644
 --- a/arch/x86/Kconfig
 +++ b/arch/x86/Kconfig
-@@ -185,6 +185,7 @@ config X86
+@@ -188,6 +188,7 @@ config X86
        select HAVE_KERNEL_LZMA
        select HAVE_KERNEL_LZO
        select HAVE_KERNEL_XZ
@@ -28,7 +28,7 @@ index 886fa8368256..912f783bc01a 100644
        select HAVE_KPROBES_ON_FTRACE
        select HAVE_FUNCTION_ERROR_INJECTION
 diff --git a/arch/x86/boot/compressed/Makefile 
b/arch/x86/boot/compressed/Makefile
-index 7619742f91c9..471e61400a2e 100644
+index 5a828fde7a42..c08714ae76ec 100644
 --- a/arch/x86/boot/compressed/Makefile
 +++ b/arch/x86/boot/compressed/Makefile
 @@ -26,7 +26,7 @@ OBJECT_FILES_NON_STANDARD    := y
@@ -40,16 +40,24 @@ index 7619742f91c9..471e61400a2e 100644
  
  KBUILD_CFLAGS := -m$(BITS) -O2
  KBUILD_CFLAGS += -fno-strict-aliasing $(call cc-option, -fPIE, -fPIC)
-@@ -145,6 +145,8 @@ $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
+@@ -42,6 +42,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
+ KBUILD_CFLAGS += -Wno-pointer-sign
+ KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
+ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
++KBUILD_CFLAGS += -D__DISABLE_EXPORTS
+ 
+ KBUILD_AFLAGS  := $(KBUILD_CFLAGS) -D__ASSEMBLY__
+ GCOV_PROFILE := n
+@@ -145,6 +146,8 @@ $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
        $(call if_changed,lzo)
  $(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE
        $(call if_changed,lz4)
 +$(obj)/vmlinux.bin.zst: $(vmlinux.bin.all-y) FORCE
-+      $(call if_changed,zstd)
++      $(call if_changed,zstd22)
  
  suffix-$(CONFIG_KERNEL_GZIP)  := gz
  suffix-$(CONFIG_KERNEL_BZIP2) := bz2
-@@ -152,6 +154,7 @@ suffix-$(CONFIG_KERNEL_LZMA)       := lzma
+@@ -152,6 +155,7 @@ suffix-$(CONFIG_KERNEL_LZMA)       := lzma
  suffix-$(CONFIG_KERNEL_XZ)    := xz
  suffix-$(CONFIG_KERNEL_LZO)   := lzo
  suffix-$(CONFIG_KERNEL_LZ4)   := lz4
@@ -57,6 +65,24 @@ index 7619742f91c9..471e61400a2e 100644
  
  quiet_cmd_mkpiggy = MKPIGGY $@
        cmd_mkpiggy = $(obj)/mkpiggy $< > $@
+diff --git a/arch/x86/boot/compressed/kaslr.c 
b/arch/x86/boot/compressed/kaslr.c
+index d7408af55738..0048269180d5 100644
+--- a/arch/x86/boot/compressed/kaslr.c
++++ b/arch/x86/boot/compressed/kaslr.c
+@@ -19,13 +19,6 @@
+  */
+ #define BOOT_CTYPE_H
+ 
+-/*
+- * _ctype[] in lib/ctype.c is needed by isspace() of linux/ctype.h.
+- * While both lib/ctype.c and lib/cmdline.c will bring EXPORT_SYMBOL
+- * which is meaningless and will cause compiling error in some cases.
+- */
+-#define __DISABLE_EXPORTS
+-
+ #include "misc.h"
+ #include "error.h"
+ #include "../string.h"
 diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
 index 9652d5c2afda..39e592d0e0b4 100644
 --- a/arch/x86/boot/compressed/misc.c
@@ -73,10 +99,10 @@ index 9652d5c2afda..39e592d0e0b4 100644
   * NOTE: When adding a new decompressor, please update the analysis in
   * ../header.S.
 diff --git a/arch/x86/include/asm/boot.h b/arch/x86/include/asm/boot.h
-index 680c320363db..d6dd43d25d9f 100644
+index 680c320363db..9191280d9ea3 100644
 --- a/arch/x86/include/asm/boot.h
 +++ b/arch/x86/include/asm/boot.h
-@@ -24,9 +24,11 @@
+@@ -24,9 +24,16 @@
  # error "Invalid value for CONFIG_PHYSICAL_ALIGN"
  #endif
  
@@ -85,6 +111,11 @@ index 680c320363db..d6dd43d25d9f 100644
  # define BOOT_HEAP_SIZE               0x400000
 -#else /* !CONFIG_KERNEL_BZIP2 */
 +#elif defined(CONFIG_KERNEL_ZSTD)
++/*
++ * Zstd needs to allocate the ZSTD_DCtx in order to decompress the kernel.
++ * The ZSTD_DCtx is ~160KB, so set the heap size to 192KB because it is a
++ * round number and to allow some slack.
++ */
 +# define BOOT_HEAP_SIZE                0x30000
 +#else
  # define BOOT_HEAP_SIZE                0x10000

diff --git a/5007_ZSTD-v5-8-8-gitignore-add-ZSTD-compressed-files.patch 
b/5006_ZSTD-v10-7-8-support-for-ZSTD-compressed-kernel.patch
similarity index 80%
rename from 5007_ZSTD-v5-8-8-gitignore-add-ZSTD-compressed-files.patch
rename to 5006_ZSTD-v10-7-8-support-for-ZSTD-compressed-kernel.patch
index adf8578..ec12df5 100644
--- a/5007_ZSTD-v5-8-8-gitignore-add-ZSTD-compressed-files.patch
+++ b/5006_ZSTD-v10-7-8-support-for-ZSTD-compressed-kernel.patch
@@ -1,5 +1,5 @@
 diff --git a/.gitignore b/.gitignore
-index 2258e906f01c..23871de69072 100644
+index d5f4804ed07c..162bd2b67bdf 100644
 --- a/.gitignore
 +++ b/.gitignore
 @@ -44,6 +44,7 @@

diff --git a/5007_ZSTD-v10-8-8-gitignore-add-ZSTD-compressed-files.patch 
b/5007_ZSTD-v10-8-8-gitignore-add-ZSTD-compressed-files.patch
new file mode 100644
index 0000000..3c9ea69
--- /dev/null
+++ b/5007_ZSTD-v10-8-8-gitignore-add-ZSTD-compressed-files.patch
@@ -0,0 +1,12 @@
+diff --git a/Documentation/dontdiff b/Documentation/dontdiff
+index ef9519c32c55..e361fc95ca29 100644
+--- a/Documentation/dontdiff
++++ b/Documentation/dontdiff
+@@ -55,6 +55,7 @@
+ *.ver
+ *.xml
+ *.xz
++*.zst
+ *_MODULES
+ *_vga16.c
+ *~

Reply via email to