linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] extract-vmlinux: Output used decompression method
@ 2025-08-26 19:23 Maxime Thiebaut
  2025-08-28 18:45 ` Nicolas Schier
  2025-08-28 22:35 ` Nathan Chancellor
  0 siblings, 2 replies; 3+ messages in thread
From: Maxime Thiebaut @ 2025-08-26 19:23 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Masahiro Yamada
  Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org

From 3735cd80fa5baf3231f807174395a8252dfb0c4d Mon Sep 17 00:00:00 2001
From: Maxime Thiebaut <maxime+kernel@thiebaut.dev>
Date: Fri, 22 Aug 2025 10:40:03 +0200
Subject: [PATCH] extract-vmlinux: Output used decompression method

When extract-vmlinux succeeds, it doesn't output which decompression method
was found at which offset. Adding this additional output in check_vmlinux()
helps troubleshooting and reverse-engineering images.

The last check_vmlinux() call was also quoted to accept spaces.

Signed-off-by: Maxime Thiebaut <maxime+kernel@thiebaut.dev>
---
 scripts/extract-vmlinux | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/scripts/extract-vmlinux b/scripts/extract-vmlinux
index 189956b5a5c8..266df9bc7a48 100755
--- a/scripts/extract-vmlinux
+++ b/scripts/extract-vmlinux
@@ -10,12 +10,15 @@
 #
 # ----------------------------------------------------------------------
 
+me=${0##*/}
+
 check_vmlinux()
 {
 	if file "$1" | grep -q 'Linux kernel.*boot executable' ||
 		readelf -h "$1" > /dev/null 2>&1
 	then
 		cat "$1"
+		echo "$me: Extracted vmlinux using '$2' from offset $3" >&2
 		exit 0
 	fi
 }
@@ -30,12 +33,11 @@ try_decompress()
 	do
 		pos=${pos%%:*}
 		tail -c+$pos "$img" | $3 > $tmp 2> /dev/null
-		check_vmlinux $tmp
+		check_vmlinux $tmp "$3" $pos
 	done
 }
 
 # Check invocation:
-me=${0##*/}
 img=$1
 if	[ $# -ne 1 -o ! -s "$img" ]
 then
@@ -57,7 +59,7 @@ try_decompress '\002!L\030'   xxx   'lz4 -d'
 try_decompress '(\265/\375'   xxx   unzstd
 
 # Finally check for uncompressed images or objects:
-check_vmlinux $img
+check_vmlinux "$img" cat 0
 
 # Bail out:
 echo "$me: Cannot find vmlinux." >&2

base-commit: 6da752f55bc48fe2cf12ed208ab10295d796c2dd
-- 
2.50.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] extract-vmlinux: Output used decompression method
  2025-08-26 19:23 [PATCH] extract-vmlinux: Output used decompression method Maxime Thiebaut
@ 2025-08-28 18:45 ` Nicolas Schier
  2025-08-28 22:35 ` Nathan Chancellor
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Schier @ 2025-08-28 18:45 UTC (permalink / raw)
  To: Maxime Thiebaut
  Cc: Nathan Chancellor, Masahiro Yamada, linux-kbuild, linux-kernel

On Tue, Aug 26, 2025 at 07:23:49PM +0000, Maxime Thiebaut wrote:
> When extract-vmlinux succeeds, it doesn't output which decompression method
> was found at which offset. Adding this additional output in check_vmlinux()
> helps troubleshooting and reverse-engineering images.
> 
> The last check_vmlinux() call was also quoted to accept spaces.
> 
> Signed-off-by: Maxime Thiebaut <maxime+kernel@thiebaut.dev>
> ---
>  scripts/extract-vmlinux | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)

Thanks, looks good to me.

Reviewed-by: Nicolas Schier <nsc@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] extract-vmlinux: Output used decompression method
  2025-08-26 19:23 [PATCH] extract-vmlinux: Output used decompression method Maxime Thiebaut
  2025-08-28 18:45 ` Nicolas Schier
@ 2025-08-28 22:35 ` Nathan Chancellor
  1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2025-08-28 22:35 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Masahiro Yamada,
	Maxime Thiebaut
  Cc: linux-kbuild, linux-kernel


On Tue, 26 Aug 2025 19:23:49 +0000, Maxime Thiebaut wrote:
> When extract-vmlinux succeeds, it doesn't output which decompression method
> was found at which offset. Adding this additional output in check_vmlinux()
> helps troubleshooting and reverse-engineering images.
> 
> The last check_vmlinux() call was also quoted to accept spaces.
> 
> 
> [...]

Applied, thanks!

[1/1] extract-vmlinux: Output used decompression method
      https://git.kernel.org/kbuild/c/1e150869caf2f

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-28 22:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-26 19:23 [PATCH] extract-vmlinux: Output used decompression method Maxime Thiebaut
2025-08-28 18:45 ` Nicolas Schier
2025-08-28 22:35 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).