Re: [PATCH v6 4/8] init: add support for zstd compressed kernel
From: Arvind Sankar
Date: Tue Jul 07 2020 - 18:11:36 EST
On Mon, Jul 06, 2020 at 08:46:00PM -0700, Nick Terrell wrote:
> From: Nick Terrell <terrelln@xxxxxx>
>
> * Adds the zstd cmd to scripts/Makefile.lib
> * Adds the HAVE_KERNEL_ZSTD and KERNEL_ZSTD options
>
> Architecture specific support is still needed for decompression.
>
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 916b2f7f7098..d960f8815f87 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -413,6 +413,21 @@ quiet_cmd_xzkern = XZKERN $@
> quiet_cmd_xzmisc = XZMISC $@
> cmd_xzmisc = cat $(real-prereqs) | $(XZ) --check=crc32 --lzma2=dict=1MiB > $@
>
> +# ZSTD
> +# ---------------------------------------------------------------------------
> +# Appends the uncompressed size of the data using size_append. The .zst
> +# 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.
> +
> +quiet_cmd_zstd = ZSTD $@
> +cmd_zstd = (cat $(filter-out FORCE,$^) | \
^^ should just be $(real-prereqs)
> + zstd -19 && \
> + $(call size_append, $(filter-out FORCE,$^))) > $@ || \
^^ size_append does not take arguments. It's used as just
$(size_append) and will always output shell code to print the
total size of $(real-prereqs) -- see other compressor command
definitions.
> + (rm -f $@ ; false)
> +
> # ASM offsets
> # ---------------------------------------------------------------------------
>
> --
> 2.27.0
>