X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=scripts%2Fextract-ikconfig;h=de233ff43c1c3e73b0b93cf04bcbb9105db16570;hb=cd8c20b650f49354722b8cc1f03320b004815a0a;hp=8187e6f0dc2fe6da060f99f9980dbf90707c02cf;hpb=008accbbae6b2f18c2039d563f28d46ff4388d36;p=safe%2Fjmp%2Flinux-2.6 diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig index 8187e6f..de233ff 100755 --- a/scripts/extract-ikconfig +++ b/scripts/extract-ikconfig @@ -8,8 +8,8 @@ test -e $binoffset || cc -o $binoffset ./scripts/binoffset.c || exit 1 IKCFG_ST="0x49 0x4b 0x43 0x46 0x47 0x5f 0x53 0x54" IKCFG_ED="0x49 0x4b 0x43 0x46 0x47 0x5f 0x45 0x44" -function dump_config { - typeset file="$1" +dump_config() { + file="$1" start=`$binoffset $file $IKCFG_ST 2>/dev/null` [ "$?" != "0" ] && start="-1" @@ -17,9 +17,13 @@ function dump_config { return fi end=`$binoffset $file $IKCFG_ED 2>/dev/null` + [ "$?" != "0" ] && end="-1" + if [ "$end" -eq "-1" ]; then + return + fi - let start="$start + 8" - let size="$end - $start" + start=`expr $start + 8` + size=`expr $end - $start` dd if="$file" ibs=1 skip="$start" count="$size" 2>/dev/null | zcat @@ -55,6 +59,8 @@ dump_config "$image" GZHDR1="0x1f 0x8b 0x08 0x00" GZHDR2="0x1f 0x8b 0x08 0x08" +ELFHDR="0x7f 0x45 0x4c 0x46" + # vmlinux.gz: Check for a compressed images off=`$binoffset "$image" $GZHDR1 2>/dev/null` [ "$?" != "0" ] && off="-1" @@ -69,6 +75,14 @@ elif [ "$off" -ne "-1" ]; then (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \ zcat >"$TMPFILE" dump_config "$TMPFILE" + +# check if this is simply an ELF file +else + off=`$binoffset "$image" $ELFHDR 2>/dev/null` + [ "$?" != "0" ] && off="-1" + if [ "$off" -eq "0" ]; then + dump_config "$image" + fi fi echo "ERROR: Unable to extract kernel configuration information."