public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	Masahiro Yamada <masahiroy@kernel.org>
Subject: [PATCH 5/5] kbuild: add cmd_file_size
Date: Mon, 10 Jan 2022 03:15:29 +0900	[thread overview]
Message-ID: <20220109181529.351420-5-masahiroy@kernel.org> (raw)
In-Reply-To: <20220109181529.351420-1-masahiroy@kernel.org>

Some architectures support self-extracting kernel, which embeds the
compressed vmlinux.

It has 4 byte data at the end so the decompressor can know the vmlinux
size beforehand.

GZIP natively has it in the trailer, but for the other compression
algorithms, the hand-crafted trailer is added.

It is unneeded to generate such _corrupted_ compressed files because
it is possible to pass the size data separately.

For example, the assembly code:

     .incbin "compressed-vmlinux-with-size-data-appended"

can be transformed to:

     .incbin "compressed-vmlinux"
     .incbin "size-data"

My hope is, after some reworks of the decompressors, the macros
cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22} will go away.

This new macro, cmd_file_size, will be useful to generate a separate
size-data file.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/Makefile.lib | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 4207a72d429f..05ca77706f6b 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -394,6 +394,9 @@ printf "%08x\n" $$dec_size |						\
 	}								\
 )
 
+quiet_cmd_file_size = GEN     $@
+      cmd_file_size = $(size_append) > $@
+
 quiet_cmd_bzip2 = BZIP2   $@
       cmd_bzip2 = cat $(real-prereqs) | $(KBZIP2) -9 > $@
 
-- 
2.32.0


  parent reply	other threads:[~2022-01-09 18:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-09 18:15 [PATCH 1/5] sh: rename suffix-y to suffix_y Masahiro Yamada
2022-01-09 18:15 ` [PATCH 2/5] kbuild: drop $(size_append) from cmd_zstd Masahiro Yamada
2022-01-10 11:32   ` Nicolas Schier
2022-01-09 18:15 ` [PATCH 3/5] kbuild: rename cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22} Masahiro Yamada
2022-01-10 11:33   ` Nicolas Schier
2023-06-23 14:45     ` Eugeniu Rosca
2023-07-19 19:09       ` Eugeniu Rosca
2023-07-22 16:08         ` Masahiro Yamada
2023-07-25  9:24           ` Eugeniu Rosca
2023-08-02  9:21             ` Masahiro Yamada
2023-08-11 11:25               ` Eugeniu Rosca
2022-01-09 18:15 ` [PATCH 4/5] arch: decompressor: remove useless vmlinux.bin.all-y Masahiro Yamada
2022-01-10 11:33   ` Nicolas Schier
2022-01-09 18:15 ` Masahiro Yamada [this message]
2022-01-10 11:33   ` [PATCH 5/5] kbuild: add cmd_file_size Nicolas Schier
2022-01-10 11:31 ` [PATCH 1/5] sh: rename suffix-y to suffix_y Nicolas Schier

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=20220109181529.351420-5-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox