| .. | .. |
|---|
| 1 | 1 | #!/bin/sh |
|---|
| 2 | +# SPDX-License-Identifier: GPL-2.0-only |
|---|
| 2 | 3 | # ---------------------------------------------------------------------- |
|---|
| 3 | 4 | # extract-vmlinux - Extract uncompressed vmlinux from a kernel image |
|---|
| 4 | 5 | # |
|---|
| .. | .. |
|---|
| 7 | 8 | # |
|---|
| 8 | 9 | # (c) 2011 Corentin Chary <corentin.chary@gmail.com> |
|---|
| 9 | 10 | # |
|---|
| 10 | | -# Licensed under the GNU General Public License, version 2 (GPLv2). |
|---|
| 11 | 11 | # ---------------------------------------------------------------------- |
|---|
| 12 | 12 | |
|---|
| 13 | 13 | check_vmlinux() |
|---|
| .. | .. |
|---|
| 48 | 48 | tmp=$(mktemp /tmp/vmlinux-XXX) |
|---|
| 49 | 49 | trap "rm -f $tmp" 0 |
|---|
| 50 | 50 | |
|---|
| 51 | | -# Initial attempt for uncompressed images or objects: |
|---|
| 52 | | -check_vmlinux $img |
|---|
| 53 | | - |
|---|
| 54 | 51 | # That didn't work, so retry after decompression. |
|---|
| 55 | 52 | try_decompress '\037\213\010' xy gunzip |
|---|
| 56 | 53 | try_decompress '\3757zXZ\000' abcde unxz |
|---|
| .. | .. |
|---|
| 60 | 57 | try_decompress '\002!L\030' xxx 'lz4 -d' |
|---|
| 61 | 58 | try_decompress '(\265/\375' xxx unzstd |
|---|
| 62 | 59 | |
|---|
| 60 | +# Finally check for uncompressed images or objects: |
|---|
| 61 | +check_vmlinux $img |
|---|
| 62 | + |
|---|
| 63 | 63 | # Bail out: |
|---|
| 64 | 64 | echo "$me: Cannot find vmlinux." >&2 |
|---|