Skip to content

Commit 1e15086

Browse files
Maxime Thiebautnathanchance
authored andcommitted
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 <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> Link: https://lore.kernel.org/r/X6OQ4pHdpreJtlTnf0tFEb4Uxz8T8gFv_7Yw6tpBK4ZBgHYjJr_URwUwCVynpkb-H8Yjk7DdBF01zY-sfqu_7N5trZQfcd6s_4PtdGlHtlA=@thiebaut.dev Signed-off-by: Nathan Chancellor <[email protected]>
1 parent 0354e81 commit 1e15086

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

scripts/extract-vmlinux

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010
#
1111
# ----------------------------------------------------------------------
1212

13+
me=${0##*/}
14+
1315
check_vmlinux()
1416
{
1517
if file "$1" | grep -q 'Linux kernel.*boot executable' ||
1618
readelf -h "$1" > /dev/null 2>&1
1719
then
1820
cat "$1"
21+
echo "$me: Extracted vmlinux using '$2' from offset $3" >&2
1922
exit 0
2023
fi
2124
}
@@ -30,12 +33,11 @@ try_decompress()
3033
do
3134
pos=${pos%%:*}
3235
tail -c+$pos "$img" | $3 > $tmp 2> /dev/null
33-
check_vmlinux $tmp
36+
check_vmlinux $tmp "$3" $pos
3437
done
3538
}
3639

3740
# Check invocation:
38-
me=${0##*/}
3941
img=$1
4042
if [ $# -ne 1 -o ! -s "$img" ]
4143
then
@@ -57,7 +59,7 @@ try_decompress '\002!L\030' xxx 'lz4 -d'
5759
try_decompress '(\265/\375' xxx unzstd
5860

5961
# Finally check for uncompressed images or objects:
60-
check_vmlinux $img
62+
check_vmlinux "$img" cat 0
6163

6264
# Bail out:
6365
echo "$me: Cannot find vmlinux." >&2

0 commit comments

Comments
 (0)