From: Ard Biesheuvel <ardb@kernel.org>
To: linux-efi@vger.kernel.org
Cc: Ard Biesheuvel <ardb@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nsc@kernel.org>,
linux-kbuild@vger.kernel.org
Subject: [PATCH 1/2] scripts/Makefile.lib: Capture decompressed size in ZSTD22 metadata
Date: Thu, 26 Nov 2026 23:44:02 +0100 [thread overview]
Message-ID: <20261126224400.10147-5-ardb@kernel.org> (raw)
In-Reply-To: <20261126224400.10147-4-ardb@kernel.org>
Tweak the [unused] ZSTD22 compression rule so that the combined size of
the uncompressed input is recorded in the ZSTD metadata. This allows
ZSTD standard tooling to query it.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
scripts/Makefile.lib | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 19e96b30a122f..5b58577b158af 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -344,13 +344,17 @@ quiet_cmd_gzip = GZIP $@
# Bzip2 and LZMA do not include size in file... so we have to fake that;
# append the size as a 32-bit littleendian number as gzip does.
-size_append = printf $(shell \
+total_file_size = $(shell \
dec_size=0; \
for F in $(real-prereqs); do \
fsize=$$($(CONFIG_SHELL) $(srctree)/scripts/file-size.sh $$F); \
dec_size=$$(expr $$dec_size + $$fsize); \
done; \
-printf "%08x\n" $$dec_size | \
+printf "%d\n" $$dec_size \
+)
+
+size_append = printf $(shell \
+printf "%08x\n" $(total_file_size) | \
sed 's/\(..\)/\1 /g' | { \
read ch0 ch1 ch2 ch3; \
for ch in $$ch3 $$ch2 $$ch1 $$ch0; do \
@@ -479,7 +483,7 @@ quiet_cmd_zstd = ZSTD $@
cmd_zstd = cat $(real-prereqs) | $(ZSTD) -19 > $@
quiet_cmd_zstd22 = ZSTD22 $@
- cmd_zstd22 = cat $(real-prereqs) | $(ZSTD) -22 --ultra > $@
+ cmd_zstd22 = cat $(real-prereqs) | $(ZSTD) -22 --ultra --stream-size=$(total_file_size) > $@
quiet_cmd_zstd22_with_size = ZSTD22 $@
cmd_zstd22_with_size = { cat $(real-prereqs) | $(ZSTD) -22 --ultra; $(size_append); } > $@
--
2.47.3
next prev parent reply other threads:[~2026-11-26 22:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 22:44 [PATCH 0/2] efi/zboot: Put ZSTD output size where it belongs Ard Biesheuvel
2026-11-26 22:44 ` Ard Biesheuvel [this message]
2026-11-28 20:14 ` [PATCH 1/2] scripts/Makefile.lib: Capture decompressed size in ZSTD22 metadata Nathan Chancellor
2026-11-30 16:19 ` Ard Biesheuvel
2026-11-26 22:44 ` [PATCH 2/2] efi/zboot: Use ZSTD frame header for uncompressed payload size Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126224400.10147-5-ardb@kernel.org \
--to=ardb@kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.