1 |
commit: a44f851975ac335d3c7565abb15f31cca1b38c6c |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Aug 3 11:35:05 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Aug 3 11:35:05 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=a44f8519 |
7 |
|
8 |
Update ZSTD Patch |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 16 ++-- |
13 |
...ZSTD-v10-1-8-prepare-zstd-for-preboot-env.patch | 17 ---- |
14 |
...TD-v10-2-8-prepare-xxhash-for-preboot-env.patch | 29 ++++--- |
15 |
...STD-v5-2-8-prepare-xxhash-for-preboot-env.patch | 94 ---------------------- |
16 |
...TD-v10-3-8-add-zstd-support-to-decompress.patch | 50 +++++++++--- |
17 |
...v10-4-8-add-support-for-zstd-compres-kern.patch | 0 |
18 |
...add-support-for-zstd-compressed-initramfs.patch | 0 |
19 |
...ZSTD-v10-6-8-bump-ZO-z-extra-bytes-margin.patch | 49 ++++++++--- |
20 |
...10-7-8-support-for-ZSTD-compressed-kernel.patch | 2 +- |
21 |
...0-8-8-gitignore-add-ZSTD-compressed-files.patch | 12 +++ |
22 |
10 files changed, 116 insertions(+), 153 deletions(-) |
23 |
|
24 |
diff --git a/0000_README b/0000_README |
25 |
index b9ce21a..6e07572 100644 |
26 |
--- a/0000_README |
27 |
+++ b/0000_README |
28 |
@@ -71,35 +71,35 @@ Patch: 4567_distro-Gentoo-Kconfig.patch |
29 |
From: Tom Wijsman <TomWij@g.o> |
30 |
Desc: Add Gentoo Linux support config settings and defaults. |
31 |
|
32 |
-Patch: 5000_ZSTD-v5-1-8-prepare-zstd-for-preboot-env.patch |
33 |
+Patch: 5000_ZSTD-v10-1-8-prepare-zstd-for-preboot-env.patch |
34 |
From: https://lkml.org/lkml/2020/4/1/29 |
35 |
Desc: lib: prepare zstd for preboot environment |
36 |
|
37 |
-Patch: 5001_ZSTD-v5-2-8-prepare-xxhash-for-preboot-env.patch |
38 |
+Patch: 5001_ZSTD-v10-2-8-prepare-xxhash-for-preboot-env.patch |
39 |
From: https://lkml.org/lkml/2020/4/1/29 |
40 |
Desc: lib: prepare xxhash for preboot environment |
41 |
|
42 |
-Patch: 5002_ZSTD-v5-3-8-add-zstd-support-to-decompress.patch |
43 |
+Patch: 5002_ZSTD-v10-3-8-add-zstd-support-to-decompress.patch |
44 |
From: https://lkml.org/lkml/2020/4/1/29 |
45 |
Desc: lib: add zstd support to decompress |
46 |
|
47 |
-Patch: 5003_ZSTD-v5-4-8-add-support-for-zstd-compres-kern.patch |
48 |
+Patch: 5003_ZSTD-v10-4-8-add-support-for-zstd-compres-kern.patch |
49 |
From: https://lkml.org/lkml/2020/4/1/29 |
50 |
Desc: init: add support for zstd compressed kernel |
51 |
|
52 |
-Patch: 5004_ZSTD-v5-5-8-add-support-for-zstd-compressed-initramfs.patch |
53 |
+Patch: 5004_ZSTD-v10-5-8-add-support-for-zstd-compressed-initramfs.patch |
54 |
From: https://lkml.org/lkml/2020/4/1/29 |
55 |
Desc: usr: add support for zstd compressed initramfs |
56 |
|
57 |
-Patch: 5005_ZSTD-v5-6-8-bump-ZO-z-extra-bytes-margin.patch |
58 |
+Patch: 5005_ZSTD-v10-6-8-bump-ZO-z-extra-bytes-margin.patch |
59 |
From: https://lkml.org/lkml/2020/4/1/29 |
60 |
Desc: x86: bump ZO_z_extra_bytes margin for zstd |
61 |
|
62 |
-Patch: 5006_ZSTD-v5-7-8-support-for-ZSTD-compressed-kernel.patch |
63 |
+Patch: 5006_ZSTD-v10-7-8-support-for-ZSTD-compressed-kernel.patch |
64 |
From: https://lkml.org/lkml/2020/4/1/29 |
65 |
Desc: x86: Add support for ZSTD compressed kernel |
66 |
|
67 |
-Patch: 5007_ZSTD-v5-8-8-gitignore-add-ZSTD-compressed-files.patch |
68 |
+Patch: 5007_ZSTD-v10-8-8-gitignore-add-ZSTD-compressed-files.patch |
69 |
From: https://lkml.org/lkml/2020/4/1/29 |
70 |
Desc: .gitignore: add ZSTD-compressed files |
71 |
|
72 |
|
73 |
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 |
74 |
similarity index 82% |
75 |
rename from 5000_ZSTD-v5-1-8-prepare-zstd-for-preboot-env.patch |
76 |
rename to 5000_ZSTD-v10-1-8-prepare-zstd-for-preboot-env.patch |
77 |
index 297a8d4..c13b091 100644 |
78 |
--- a/5000_ZSTD-v5-1-8-prepare-zstd-for-preboot-env.patch |
79 |
+++ b/5000_ZSTD-v10-1-8-prepare-zstd-for-preboot-env.patch |
80 |
@@ -1,20 +1,3 @@ |
81 |
-diff --git a/lib/zstd/decompress.c b/lib/zstd/decompress.c |
82 |
-index 269ee9a796c1..73ded63278cf 100644 |
83 |
---- a/lib/zstd/decompress.c |
84 |
-+++ b/lib/zstd/decompress.c |
85 |
-@@ -2490,6 +2490,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB |
86 |
- } |
87 |
- } |
88 |
- |
89 |
-+#ifndef ZSTD_PREBOOT |
90 |
- EXPORT_SYMBOL(ZSTD_DCtxWorkspaceBound); |
91 |
- EXPORT_SYMBOL(ZSTD_initDCtx); |
92 |
- EXPORT_SYMBOL(ZSTD_decompressDCtx); |
93 |
-@@ -2529,3 +2530,4 @@ EXPORT_SYMBOL(ZSTD_insertBlock); |
94 |
- |
95 |
- MODULE_LICENSE("Dual BSD/GPL"); |
96 |
- MODULE_DESCRIPTION("Zstd Decompressor"); |
97 |
-+#endif |
98 |
diff --git a/lib/zstd/fse_decompress.c b/lib/zstd/fse_decompress.c |
99 |
index a84300e5a013..0b353530fb3f 100644 |
100 |
--- a/lib/zstd/fse_decompress.c |
101 |
|
102 |
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 |
103 |
similarity index 94% |
104 |
rename from 5002_ZSTD-v5-3-8-add-zstd-support-to-decompress.patch |
105 |
rename to 5001_ZSTD-v10-2-8-prepare-xxhash-for-preboot-env.patch |
106 |
index 1c22fa3..b18164c 100644 |
107 |
--- a/5002_ZSTD-v5-3-8-add-zstd-support-to-decompress.patch |
108 |
+++ b/5001_ZSTD-v10-2-8-prepare-xxhash-for-preboot-env.patch |
109 |
@@ -16,10 +16,10 @@ index 000000000000..56d539ae880f |
110 |
+ void (*error_fn)(char *x)); |
111 |
+#endif |
112 |
diff --git a/lib/Kconfig b/lib/Kconfig |
113 |
-index 5d53f9609c25..e883aecb9279 100644 |
114 |
+index df3f3da95990..a5d6f23c4cab 100644 |
115 |
--- a/lib/Kconfig |
116 |
+++ b/lib/Kconfig |
117 |
-@@ -336,6 +336,10 @@ config DECOMPRESS_LZ4 |
118 |
+@@ -342,6 +342,10 @@ config DECOMPRESS_LZ4 |
119 |
select LZ4_DECOMPRESS |
120 |
tristate |
121 |
|
122 |
@@ -31,10 +31,10 @@ index 5d53f9609c25..e883aecb9279 100644 |
123 |
# Generic allocator support is selected if needed |
124 |
# |
125 |
diff --git a/lib/Makefile b/lib/Makefile |
126 |
-index ab68a8674360..3ce4ac296611 100644 |
127 |
+index b1c42c10073b..2ba9642a3a87 100644 |
128 |
--- a/lib/Makefile |
129 |
+++ b/lib/Makefile |
130 |
-@@ -166,6 +166,7 @@ lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o |
131 |
+@@ -170,6 +170,7 @@ lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o |
132 |
lib-$(CONFIG_DECOMPRESS_XZ) += decompress_unxz.o |
133 |
lib-$(CONFIG_DECOMPRESS_LZO) += decompress_unlzo.o |
134 |
lib-$(CONFIG_DECOMPRESS_LZ4) += decompress_unlz4.o |
135 |
@@ -74,10 +74,10 @@ index 857ab1af1ef3..ab3fc90ffc64 100644 |
136 |
|
137 |
diff --git a/lib/decompress_unzstd.c b/lib/decompress_unzstd.c |
138 |
new file mode 100644 |
139 |
-index 000000000000..f317afab502f |
140 |
+index 000000000000..0ad2c15479ed |
141 |
--- /dev/null |
142 |
+++ b/lib/decompress_unzstd.c |
143 |
-@@ -0,0 +1,342 @@ |
144 |
+@@ -0,0 +1,345 @@ |
145 |
+// SPDX-License-Identifier: GPL-2.0 |
146 |
+ |
147 |
+/* |
148 |
@@ -139,12 +139,14 @@ index 000000000000..f317afab502f |
149 |
+ * zstd's only source dependeny is xxhash, which has no source |
150 |
+ * dependencies. |
151 |
+ * |
152 |
-+ * zstd and xxhash avoid declaring themselves as modules |
153 |
-+ * when ZSTD_PREBOOT and XXH_PREBOOT are defined. |
154 |
++ * When UNZSTD_PREBOOT is defined we declare __decompress(), which is |
155 |
++ * used for kernel decompression, instead of unzstd(). |
156 |
++ * |
157 |
++ * Define __DISABLE_EXPORTS in preboot environments to prevent symbols |
158 |
++ * from xxhash and zstd from being exported by the EXPORT_SYMBOL macro. |
159 |
+ */ |
160 |
+#ifdef STATIC |
161 |
-+# define ZSTD_PREBOOT |
162 |
-+# define XXH_PREBOOT |
163 |
++# define UNZSTD_PREBOOT |
164 |
+# include "xxhash.c" |
165 |
+# include "zstd/entropy_common.c" |
166 |
+# include "zstd/fse_decompress.c" |
167 |
@@ -159,10 +161,11 @@ index 000000000000..f317afab502f |
168 |
+ |
169 |
+/* 128MB is the maximum window size supported by zstd. */ |
170 |
+#define ZSTD_WINDOWSIZE_MAX (1 << ZSTD_WINDOWLOG_MAX) |
171 |
-+/* Size of the input and output buffers in multi-call mode. |
172 |
++/* |
173 |
++ * Size of the input and output buffers in multi-call mode. |
174 |
+ * Pick a larger size because it isn't used during kernel decompression, |
175 |
+ * since that is single pass, and we have to allocate a large buffer for |
176 |
-+ * zstd's window anyways. The larger size speeds up initramfs decompression. |
177 |
++ * zstd's window anyway. The larger size speeds up initramfs decompression. |
178 |
+ */ |
179 |
+#define ZSTD_IOBUF_SIZE (1 << 17) |
180 |
+ |
181 |
@@ -399,7 +402,7 @@ index 000000000000..f317afab502f |
182 |
+ return err; |
183 |
+} |
184 |
+ |
185 |
-+#ifndef ZSTD_PREBOOT |
186 |
++#ifndef UNZSTD_PREBOOT |
187 |
+STATIC int INIT unzstd(unsigned char *buf, long len, |
188 |
+ long (*fill)(void*, unsigned long), |
189 |
+ long (*flush)(void*, unsigned long), |
190 |
|
191 |
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 |
192 |
deleted file mode 100644 |
193 |
index 88e4674..0000000 |
194 |
--- a/5001_ZSTD-v5-2-8-prepare-xxhash-for-preboot-env.patch |
195 |
+++ /dev/null |
196 |
@@ -1,94 +0,0 @@ |
197 |
-diff --git a/lib/xxhash.c b/lib/xxhash.c |
198 |
-index aa61e2a3802f..b4364e011392 100644 |
199 |
---- a/lib/xxhash.c |
200 |
-+++ b/lib/xxhash.c |
201 |
-@@ -80,13 +80,11 @@ void xxh32_copy_state(struct xxh32_state *dst, const struct xxh32_state *src) |
202 |
- { |
203 |
- memcpy(dst, src, sizeof(*dst)); |
204 |
- } |
205 |
--EXPORT_SYMBOL(xxh32_copy_state); |
206 |
- |
207 |
- void xxh64_copy_state(struct xxh64_state *dst, const struct xxh64_state *src) |
208 |
- { |
209 |
- memcpy(dst, src, sizeof(*dst)); |
210 |
- } |
211 |
--EXPORT_SYMBOL(xxh64_copy_state); |
212 |
- |
213 |
- /*-*************************** |
214 |
- * Simple Hash Functions |
215 |
-@@ -151,7 +149,6 @@ uint32_t xxh32(const void *input, const size_t len, const uint32_t seed) |
216 |
- |
217 |
- return h32; |
218 |
- } |
219 |
--EXPORT_SYMBOL(xxh32); |
220 |
- |
221 |
- static uint64_t xxh64_round(uint64_t acc, const uint64_t input) |
222 |
- { |
223 |
-@@ -234,7 +231,6 @@ uint64_t xxh64(const void *input, const size_t len, const uint64_t seed) |
224 |
- |
225 |
- return h64; |
226 |
- } |
227 |
--EXPORT_SYMBOL(xxh64); |
228 |
- |
229 |
- /*-************************************************** |
230 |
- * Advanced Hash Functions |
231 |
-@@ -251,7 +247,6 @@ void xxh32_reset(struct xxh32_state *statePtr, const uint32_t seed) |
232 |
- state.v4 = seed - PRIME32_1; |
233 |
- memcpy(statePtr, &state, sizeof(state)); |
234 |
- } |
235 |
--EXPORT_SYMBOL(xxh32_reset); |
236 |
- |
237 |
- void xxh64_reset(struct xxh64_state *statePtr, const uint64_t seed) |
238 |
- { |
239 |
-@@ -265,7 +260,6 @@ void xxh64_reset(struct xxh64_state *statePtr, const uint64_t seed) |
240 |
- state.v4 = seed - PRIME64_1; |
241 |
- memcpy(statePtr, &state, sizeof(state)); |
242 |
- } |
243 |
--EXPORT_SYMBOL(xxh64_reset); |
244 |
- |
245 |
- int xxh32_update(struct xxh32_state *state, const void *input, const size_t len) |
246 |
- { |
247 |
-@@ -334,7 +328,6 @@ int xxh32_update(struct xxh32_state *state, const void *input, const size_t len) |
248 |
- |
249 |
- return 0; |
250 |
- } |
251 |
--EXPORT_SYMBOL(xxh32_update); |
252 |
- |
253 |
- uint32_t xxh32_digest(const struct xxh32_state *state) |
254 |
- { |
255 |
-@@ -372,7 +365,6 @@ uint32_t xxh32_digest(const struct xxh32_state *state) |
256 |
- |
257 |
- return h32; |
258 |
- } |
259 |
--EXPORT_SYMBOL(xxh32_digest); |
260 |
- |
261 |
- int xxh64_update(struct xxh64_state *state, const void *input, const size_t len) |
262 |
- { |
263 |
-@@ -439,7 +431,6 @@ int xxh64_update(struct xxh64_state *state, const void *input, const size_t len) |
264 |
- |
265 |
- return 0; |
266 |
- } |
267 |
--EXPORT_SYMBOL(xxh64_update); |
268 |
- |
269 |
- uint64_t xxh64_digest(const struct xxh64_state *state) |
270 |
- { |
271 |
-@@ -494,7 +485,19 @@ uint64_t xxh64_digest(const struct xxh64_state *state) |
272 |
- |
273 |
- return h64; |
274 |
- } |
275 |
-+ |
276 |
-+#ifndef XXH_PREBOOT |
277 |
-+EXPORT_SYMBOL(xxh32_copy_state); |
278 |
-+EXPORT_SYMBOL(xxh64_copy_state); |
279 |
-+EXPORT_SYMBOL(xxh32); |
280 |
-+EXPORT_SYMBOL(xxh64); |
281 |
-+EXPORT_SYMBOL(xxh32_reset); |
282 |
-+EXPORT_SYMBOL(xxh64_reset); |
283 |
-+EXPORT_SYMBOL(xxh32_update); |
284 |
-+EXPORT_SYMBOL(xxh32_digest); |
285 |
-+EXPORT_SYMBOL(xxh64_update); |
286 |
- EXPORT_SYMBOL(xxh64_digest); |
287 |
- |
288 |
- MODULE_LICENSE("Dual BSD/GPL"); |
289 |
- MODULE_DESCRIPTION("xxHash"); |
290 |
-+#endif |
291 |
|
292 |
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 |
293 |
similarity index 52% |
294 |
rename from 5003_ZSTD-v5-4-8-add-support-for-zstd-compres-kern.patch |
295 |
rename to 5002_ZSTD-v10-3-8-add-zstd-support-to-decompress.patch |
296 |
index d9dc79e..a277f5e 100644 |
297 |
--- a/5003_ZSTD-v5-4-8-add-support-for-zstd-compres-kern.patch |
298 |
+++ b/5002_ZSTD-v10-3-8-add-zstd-support-to-decompress.patch |
299 |
@@ -1,8 +1,29 @@ |
300 |
+diff --git a/Makefile b/Makefile |
301 |
+index 229e67f2ff75..565084f347bd 100644 |
302 |
+--- a/Makefile |
303 |
++++ b/Makefile |
304 |
+@@ -464,6 +464,7 @@ KLZOP = lzop |
305 |
+ LZMA = lzma |
306 |
+ LZ4 = lz4c |
307 |
+ XZ = xz |
308 |
++ZSTD = zstd |
309 |
+ |
310 |
+ CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ |
311 |
+ -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF) |
312 |
+@@ -512,7 +513,7 @@ CLANG_FLAGS := |
313 |
+ export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC |
314 |
+ export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF PAHOLE LEX YACC AWK INSTALLKERNEL |
315 |
+ export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX |
316 |
+-export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ |
317 |
++export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD |
318 |
+ export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE |
319 |
+ |
320 |
+ export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS |
321 |
diff --git a/init/Kconfig b/init/Kconfig |
322 |
-index 492bb7000aa4..806874fdd663 100644 |
323 |
+index 0498af567f70..2b6409fec53f 100644 |
324 |
--- a/init/Kconfig |
325 |
+++ b/init/Kconfig |
326 |
-@@ -176,13 +176,16 @@ config HAVE_KERNEL_LZO |
327 |
+@@ -191,13 +191,16 @@ config HAVE_KERNEL_LZO |
328 |
config HAVE_KERNEL_LZ4 |
329 |
bool |
330 |
|
331 |
@@ -20,7 +41,7 @@ index 492bb7000aa4..806874fdd663 100644 |
332 |
help |
333 |
The linux kernel is a kind of self-extracting executable. |
334 |
Several compression algorithms are available, which differ |
335 |
-@@ -261,6 +264,16 @@ config KERNEL_LZ4 |
336 |
+@@ -276,6 +279,16 @@ config KERNEL_LZ4 |
337 |
is about 8% bigger than LZO. But the decompression speed is |
338 |
faster than LZO. |
339 |
|
340 |
@@ -32,18 +53,18 @@ index 492bb7000aa4..806874fdd663 100644 |
341 |
+ with fast decompression speed. It will compress better than GZIP and |
342 |
+ decompress around the same speed as LZO, but slower than LZ4. You |
343 |
+ will need at least 192 KB RAM or more for booting. The zstd command |
344 |
-+ line tools is required for compression. |
345 |
++ line tool is required for compression. |
346 |
+ |
347 |
config KERNEL_UNCOMPRESSED |
348 |
bool "None" |
349 |
depends on HAVE_KERNEL_UNCOMPRESSED |
350 |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib |
351 |
-index b12dd5ba4896..efe69b78d455 100644 |
352 |
+index 916b2f7f7098..54f7b7eb580b 100644 |
353 |
--- a/scripts/Makefile.lib |
354 |
+++ b/scripts/Makefile.lib |
355 |
-@@ -405,6 +405,21 @@ quiet_cmd_xzkern = XZKERN $@ |
356 |
+@@ -413,6 +413,28 @@ quiet_cmd_xzkern = XZKERN $@ |
357 |
quiet_cmd_xzmisc = XZMISC $@ |
358 |
- cmd_xzmisc = cat $(real-prereqs) | xz --check=crc32 --lzma2=dict=1MiB > $@ |
359 |
+ cmd_xzmisc = cat $(real-prereqs) | $(XZ) --check=crc32 --lzma2=dict=1MiB > $@ |
360 |
|
361 |
+# ZSTD |
362 |
+# --------------------------------------------------------------------------- |
363 |
@@ -51,14 +72,21 @@ index b12dd5ba4896..efe69b78d455 100644 |
364 |
+# format has the size information available at the beginning of the file too, |
365 |
+# but it's in a more complex format and it's good to avoid changing the part |
366 |
+# of the boot code that reads the uncompressed size. |
367 |
++# |
368 |
+# Note that the bytes added by size_append will make the zstd tool think that |
369 |
+# the file is corrupt. This is expected. |
370 |
++# |
371 |
++# zstd uses a maximum window size of 8 MB. zstd22 uses a maximum window size of |
372 |
++# 128 MB. zstd22 is used for kernel compression because it is decompressed in a |
373 |
++# single pass, so zstd doesn't need to allocate a window buffer. When streaming |
374 |
++# decompression is used, like initramfs decompression, zstd22 should likely not |
375 |
++# be used because it would require zstd to allocate a 128 MB buffer. |
376 |
+ |
377 |
+quiet_cmd_zstd = ZSTD $@ |
378 |
-+cmd_zstd = (cat $(filter-out FORCE,$^) | \ |
379 |
-+ zstd -19 && \ |
380 |
-+ $(call size_append, $(filter-out FORCE,$^))) > $@ || \ |
381 |
-+ (rm -f $@ ; false) |
382 |
++ cmd_zstd = { cat $(real-prereqs) | $(ZSTD) -19; $(size_append); } > $@ |
383 |
++ |
384 |
++quiet_cmd_zstd22 = ZSTD22 $@ |
385 |
++ cmd_zstd22 = { cat $(real-prereqs) | $(ZSTD) -22 --ultra; $(size_append); } > $@ |
386 |
+ |
387 |
# ASM offsets |
388 |
# --------------------------------------------------------------------------- |
389 |
|
390 |
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 |
391 |
similarity index 100% |
392 |
rename from 5004_ZSTD-v5-5-8-add-support-for-zstd-compressed-initramfs.patch |
393 |
rename to 5003_ZSTD-v10-4-8-add-support-for-zstd-compres-kern.patch |
394 |
|
395 |
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 |
396 |
similarity index 100% |
397 |
rename from 5005_ZSTD-v5-6-8-bump-ZO-z-extra-bytes-margin.patch |
398 |
rename to 5004_ZSTD-v10-5-8-add-support-for-zstd-compressed-initramfs.patch |
399 |
|
400 |
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 |
401 |
similarity index 67% |
402 |
rename from 5006_ZSTD-v5-7-8-support-for-ZSTD-compressed-kernel.patch |
403 |
rename to 5005_ZSTD-v10-6-8-bump-ZO-z-extra-bytes-margin.patch |
404 |
index 6147136..c9615c0 100644 |
405 |
--- a/5006_ZSTD-v5-7-8-support-for-ZSTD-compressed-kernel.patch |
406 |
+++ b/5005_ZSTD-v10-6-8-bump-ZO-z-extra-bytes-margin.patch |
407 |
@@ -1,5 +1,5 @@ |
408 |
diff --git a/Documentation/x86/boot.rst b/Documentation/x86/boot.rst |
409 |
-index fa7ddc0428c8..0404e99dc1d4 100644 |
410 |
+index 5325c71ca877..7fafc7ac00d7 100644 |
411 |
--- a/Documentation/x86/boot.rst |
412 |
+++ b/Documentation/x86/boot.rst |
413 |
@@ -782,9 +782,9 @@ Protocol: 2.08+ |
414 |
@@ -16,10 +16,10 @@ index fa7ddc0428c8..0404e99dc1d4 100644 |
415 |
============ ============== |
416 |
Field name: payload_length |
417 |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig |
418 |
-index 886fa8368256..912f783bc01a 100644 |
419 |
+index 883da0abf779..4a64395bc35d 100644 |
420 |
--- a/arch/x86/Kconfig |
421 |
+++ b/arch/x86/Kconfig |
422 |
-@@ -185,6 +185,7 @@ config X86 |
423 |
+@@ -188,6 +188,7 @@ config X86 |
424 |
select HAVE_KERNEL_LZMA |
425 |
select HAVE_KERNEL_LZO |
426 |
select HAVE_KERNEL_XZ |
427 |
@@ -28,7 +28,7 @@ index 886fa8368256..912f783bc01a 100644 |
428 |
select HAVE_KPROBES_ON_FTRACE |
429 |
select HAVE_FUNCTION_ERROR_INJECTION |
430 |
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile |
431 |
-index 7619742f91c9..471e61400a2e 100644 |
432 |
+index 5a828fde7a42..c08714ae76ec 100644 |
433 |
--- a/arch/x86/boot/compressed/Makefile |
434 |
+++ b/arch/x86/boot/compressed/Makefile |
435 |
@@ -26,7 +26,7 @@ OBJECT_FILES_NON_STANDARD := y |
436 |
@@ -40,16 +40,24 @@ index 7619742f91c9..471e61400a2e 100644 |
437 |
|
438 |
KBUILD_CFLAGS := -m$(BITS) -O2 |
439 |
KBUILD_CFLAGS += -fno-strict-aliasing $(call cc-option, -fPIE, -fPIC) |
440 |
-@@ -145,6 +145,8 @@ $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE |
441 |
+@@ -42,6 +42,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, gnu) |
442 |
+ KBUILD_CFLAGS += -Wno-pointer-sign |
443 |
+ KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) |
444 |
+ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables |
445 |
++KBUILD_CFLAGS += -D__DISABLE_EXPORTS |
446 |
+ |
447 |
+ KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ |
448 |
+ GCOV_PROFILE := n |
449 |
+@@ -145,6 +146,8 @@ $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE |
450 |
$(call if_changed,lzo) |
451 |
$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE |
452 |
$(call if_changed,lz4) |
453 |
+$(obj)/vmlinux.bin.zst: $(vmlinux.bin.all-y) FORCE |
454 |
-+ $(call if_changed,zstd) |
455 |
++ $(call if_changed,zstd22) |
456 |
|
457 |
suffix-$(CONFIG_KERNEL_GZIP) := gz |
458 |
suffix-$(CONFIG_KERNEL_BZIP2) := bz2 |
459 |
-@@ -152,6 +154,7 @@ suffix-$(CONFIG_KERNEL_LZMA) := lzma |
460 |
+@@ -152,6 +155,7 @@ suffix-$(CONFIG_KERNEL_LZMA) := lzma |
461 |
suffix-$(CONFIG_KERNEL_XZ) := xz |
462 |
suffix-$(CONFIG_KERNEL_LZO) := lzo |
463 |
suffix-$(CONFIG_KERNEL_LZ4) := lz4 |
464 |
@@ -57,6 +65,24 @@ index 7619742f91c9..471e61400a2e 100644 |
465 |
|
466 |
quiet_cmd_mkpiggy = MKPIGGY $@ |
467 |
cmd_mkpiggy = $(obj)/mkpiggy $< > $@ |
468 |
+diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c |
469 |
+index d7408af55738..0048269180d5 100644 |
470 |
+--- a/arch/x86/boot/compressed/kaslr.c |
471 |
++++ b/arch/x86/boot/compressed/kaslr.c |
472 |
+@@ -19,13 +19,6 @@ |
473 |
+ */ |
474 |
+ #define BOOT_CTYPE_H |
475 |
+ |
476 |
+-/* |
477 |
+- * _ctype[] in lib/ctype.c is needed by isspace() of linux/ctype.h. |
478 |
+- * While both lib/ctype.c and lib/cmdline.c will bring EXPORT_SYMBOL |
479 |
+- * which is meaningless and will cause compiling error in some cases. |
480 |
+- */ |
481 |
+-#define __DISABLE_EXPORTS |
482 |
+- |
483 |
+ #include "misc.h" |
484 |
+ #include "error.h" |
485 |
+ #include "../string.h" |
486 |
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c |
487 |
index 9652d5c2afda..39e592d0e0b4 100644 |
488 |
--- a/arch/x86/boot/compressed/misc.c |
489 |
@@ -73,10 +99,10 @@ index 9652d5c2afda..39e592d0e0b4 100644 |
490 |
* NOTE: When adding a new decompressor, please update the analysis in |
491 |
* ../header.S. |
492 |
diff --git a/arch/x86/include/asm/boot.h b/arch/x86/include/asm/boot.h |
493 |
-index 680c320363db..d6dd43d25d9f 100644 |
494 |
+index 680c320363db..9191280d9ea3 100644 |
495 |
--- a/arch/x86/include/asm/boot.h |
496 |
+++ b/arch/x86/include/asm/boot.h |
497 |
-@@ -24,9 +24,11 @@ |
498 |
+@@ -24,9 +24,16 @@ |
499 |
# error "Invalid value for CONFIG_PHYSICAL_ALIGN" |
500 |
#endif |
501 |
|
502 |
@@ -85,6 +111,11 @@ index 680c320363db..d6dd43d25d9f 100644 |
503 |
# define BOOT_HEAP_SIZE 0x400000 |
504 |
-#else /* !CONFIG_KERNEL_BZIP2 */ |
505 |
+#elif defined(CONFIG_KERNEL_ZSTD) |
506 |
++/* |
507 |
++ * Zstd needs to allocate the ZSTD_DCtx in order to decompress the kernel. |
508 |
++ * The ZSTD_DCtx is ~160KB, so set the heap size to 192KB because it is a |
509 |
++ * round number and to allow some slack. |
510 |
++ */ |
511 |
+# define BOOT_HEAP_SIZE 0x30000 |
512 |
+#else |
513 |
# define BOOT_HEAP_SIZE 0x10000 |
514 |
|
515 |
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 |
516 |
similarity index 80% |
517 |
rename from 5007_ZSTD-v5-8-8-gitignore-add-ZSTD-compressed-files.patch |
518 |
rename to 5006_ZSTD-v10-7-8-support-for-ZSTD-compressed-kernel.patch |
519 |
index adf8578..ec12df5 100644 |
520 |
--- a/5007_ZSTD-v5-8-8-gitignore-add-ZSTD-compressed-files.patch |
521 |
+++ b/5006_ZSTD-v10-7-8-support-for-ZSTD-compressed-kernel.patch |
522 |
@@ -1,5 +1,5 @@ |
523 |
diff --git a/.gitignore b/.gitignore |
524 |
-index 2258e906f01c..23871de69072 100644 |
525 |
+index d5f4804ed07c..162bd2b67bdf 100644 |
526 |
--- a/.gitignore |
527 |
+++ b/.gitignore |
528 |
@@ -44,6 +44,7 @@ |
529 |
|
530 |
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 |
531 |
new file mode 100644 |
532 |
index 0000000..3c9ea69 |
533 |
--- /dev/null |
534 |
+++ b/5007_ZSTD-v10-8-8-gitignore-add-ZSTD-compressed-files.patch |
535 |
@@ -0,0 +1,12 @@ |
536 |
+diff --git a/Documentation/dontdiff b/Documentation/dontdiff |
537 |
+index ef9519c32c55..e361fc95ca29 100644 |
538 |
+--- a/Documentation/dontdiff |
539 |
++++ b/Documentation/dontdiff |
540 |
+@@ -55,6 +55,7 @@ |
541 |
+ *.ver |
542 |
+ *.xml |
543 |
+ *.xz |
544 |
++*.zst |
545 |
+ *_MODULES |
546 |
+ *_vga16.c |
547 |
+ *~ |