2 # ----------------------------------------------------------------------
3 # extract-ikconfig - Extract the .config file from a kernel image
5 # This will only work when the kernel was compiled with CONFIG_IKCONFIG.
7 # The obscure use of the "tr" filter is to work around older versions of
8 # "grep" that report the byte offset of the line instead of the pattern.
10 # (c) 2009, Dick Streefland <dick@streefland.net>
11 # Licensed under the terms of the GNU General Public License.
12 # ----------------------------------------------------------------------
16 cf1
='IKCFG_ST\037\213\010'
21 if pos
=`tr "$cf1\n$cf2" "\n$cf2=" < "$1" | grep -abo "^$cf2"`
24 tail -c+$
(($pos+8)) "$1" | zcat
-q
32 if [ $# -ne 1 -o ! -s "$img" ]
34 echo "Usage: $me <kernel-image>" >&2
38 # Initial attempt for uncompressed images or objects:
41 # That didn't work, so decompress and try again:
44 for pos
in `tr "$gz1\n$gz2" "\n$gz2=" < "$img" | grep -abo "^$gz2"`
47 tail -c+$pos "$img" | zcat
2> /dev
/null
> $tmp
52 echo "$me: Cannot find kernel config." >&2