X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=scripts%2Fextract-ikconfig;h=72997c353cb363961139a8adf3dfa4ad1ae22d5a;hb=c197facc8ea08062f8f949aade6a33649ee06771;hp=d9f9f34b22abb1eb8dd6995e06ffe25ac230a4a2;hpb=1da177e4c3f41524e886b7f1b8a0c1fc7321cac2;p=safe%2Fjmp%2Flinux-2.6 diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig index d9f9f34..72997c3 100755 --- a/scripts/extract-ikconfig +++ b/scripts/extract-ikconfig @@ -4,11 +4,12 @@ # $arg1 is [b]zImage filename binoffset="./scripts/binoffset" +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,10 +18,10 @@ function dump_config { fi end=`$binoffset $file $IKCFG_ED 2>/dev/null` - let start="$start + 8" - let size="$end - $start" + start=`expr $start + 8` + size=`expr $end - $start` - head --bytes="$end" "$file" | tail --bytes="$size" | zcat + dd if="$file" ibs=1 skip="$start" count="$size" 2>/dev/null | zcat clean_up exit 0 @@ -45,7 +46,7 @@ then exit 1 fi -TMPFILE="/tmp/ikconfig-$$" +TMPFILE=`mktemp -t ikconfig-XXXXXX` || exit 1 image="$1" # vmlinux: Attempt to dump the configuration from the file directly