File tree Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -464,6 +464,7 @@ KLZOP = lzop
464
464
LZMA = lzma
465
465
LZ4 = lz4c
466
466
XZ = xz
467
+ ZSTD = zstd
467
468
468
469
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
469
470
-Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF )
@@ -512,7 +513,7 @@ CLANG_FLAGS :=
512
513
export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC
513
514
export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF PAHOLE LEX YACC AWK INSTALLKERNEL
514
515
export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
515
- export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ
516
+ export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD
516
517
export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE
517
518
518
519
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
Original file line number Diff line number Diff line change @@ -191,13 +191,16 @@ config HAVE_KERNEL_LZO
191
191
config HAVE_KERNEL_LZ4
192
192
bool
193
193
194
+ config HAVE_KERNEL_ZSTD
195
+ bool
196
+
194
197
config HAVE_KERNEL_UNCOMPRESSED
195
198
bool
196
199
197
200
choice
198
201
prompt "Kernel compression mode"
199
202
default KERNEL_GZIP
200
- depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA || HAVE_KERNEL_XZ || HAVE_KERNEL_LZO || HAVE_KERNEL_LZ4 || HAVE_KERNEL_UNCOMPRESSED
203
+ depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA || HAVE_KERNEL_XZ || HAVE_KERNEL_LZO || HAVE_KERNEL_LZ4 || HAVE_KERNEL_ZSTD || HAVE_KERNEL_UNCOMPRESSED
201
204
help
202
205
The linux kernel is a kind of self-extracting executable.
203
206
Several compression algorithms are available, which differ
@@ -276,6 +279,16 @@ config KERNEL_LZ4
276
279
is about 8% bigger than LZO. But the decompression speed is
277
280
faster than LZO.
278
281
282
+ config KERNEL_ZSTD
283
+ bool "ZSTD"
284
+ depends on HAVE_KERNEL_ZSTD
285
+ help
286
+ ZSTD is a compression algorithm targeting intermediate compression
287
+ with fast decompression speed. It will compress better than GZIP and
288
+ decompress around the same speed as LZO, but slower than LZ4. You
289
+ will need at least 192 KB RAM or more for booting. The zstd command
290
+ line tool is required for compression.
291
+
279
292
config KERNEL_UNCOMPRESSED
280
293
bool "None"
281
294
depends on HAVE_KERNEL_UNCOMPRESSED
Original file line number Diff line number Diff line change @@ -413,6 +413,28 @@ quiet_cmd_xzkern = XZKERN $@
413
413
quiet_cmd_xzmisc = XZMISC $@
414
414
cmd_xzmisc = cat $(real-prereqs) | $(XZ) --check=crc32 --lzma2=dict=1MiB > $@
415
415
416
+ # ZSTD
417
+ # ---------------------------------------------------------------------------
418
+ # Appends the uncompressed size of the data using size_append. The .zst
419
+ # format has the size information available at the beginning of the file too,
420
+ # but it's in a more complex format and it's good to avoid changing the part
421
+ # of the boot code that reads the uncompressed size.
422
+ #
423
+ # Note that the bytes added by size_append will make the zstd tool think that
424
+ # the file is corrupt. This is expected.
425
+ #
426
+ # zstd uses a maximum window size of 8 MB. zstd22 uses a maximum window size of
427
+ # 128 MB. zstd22 is used for kernel compression because it is decompressed in a
428
+ # single pass, so zstd doesn't need to allocate a window buffer. When streaming
429
+ # decompression is used, like initramfs decompression, zstd22 should likely not
430
+ # be used because it would require zstd to allocate a 128 MB buffer.
431
+
432
+ quiet_cmd_zstd = ZSTD $@
433
+ cmd_zstd = { cat $(real-prereqs) | $(ZSTD) -19; $(size_append); } > $@
434
+
435
+ quiet_cmd_zstd22 = ZSTD22 $@
436
+ cmd_zstd22 = { cat $(real-prereqs) | $(ZSTD) -22 --ultra; $(size_append); } > $@
437
+
416
438
# ASM offsets
417
439
# ---------------------------------------------------------------------------
418
440
You can’t perform that action at this time.
0 commit comments