2 # extracts .config info from a [b]zImage file
3 # uses: binoffset (new), dd, zcat, strings, grep
4 # $arg1 is [b]zImage filename
10 echo " usage: extract-ikconfig [b]zImage_filename"
29 # There are two gzip headers, as well as arches which don't compress their
31 GZHDR
="0x1f 0x8b 0x08 0x00"
32 if [ `binoffset $image $GZHDR >/dev/null 2>&1 ; echo $?` -ne 0 ]
34 GZHDR
="0x1f 0x8b 0x08 0x08"
35 if [ `binoffset $image $GZHDR >/dev/null 2>&1 ; echo $?` -ne 0 ]
43 # Extract and uncompress the kernel image if necessary
46 TMPFILE
="/tmp/`basename $image`.vmlin.$PID"
47 dd if=$image bs
=1 skip
=`binoffset $image $GZHDR` 2> /dev
/null | zcat
> $TMPFILE
53 strings $TMPFILE |
grep "CONFIG_BEGIN=n" > /dev
/null
56 strings $TMPFILE |
awk "/CONFIG_BEGIN=n/,/CONFIG_END=n/" > $image.oldconfig.
$PID
58 echo "ERROR: Unable to extract kernel configuration information."
59 echo " This kernel image may not have the config info."
64 echo "Kernel configuration written to $image.oldconfig.$PID"