diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 15:20:36 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 15:20:36 -0700 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /scripts/extract-ikconfig | |
download | kernel-mfld-blackbay-1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.tar.gz kernel-mfld-blackbay-1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.tar.bz2 kernel-mfld-blackbay-1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.zip |
Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'scripts/extract-ikconfig')
-rwxr-xr-x | scripts/extract-ikconfig | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig new file mode 100755 index 00000000000..d9f9f34b22a --- /dev/null +++ b/scripts/extract-ikconfig @@ -0,0 +1,77 @@ +#!/bin/sh +# extracts .config info from a [b]zImage file +# uses: binoffset (new), dd, zcat, strings, grep +# $arg1 is [b]zImage filename + +binoffset="./scripts/binoffset" + +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" + + start=`$binoffset $file $IKCFG_ST 2>/dev/null` + [ "$?" != "0" ] && start="-1" + if [ "$start" -eq "-1" ]; then + return + fi + end=`$binoffset $file $IKCFG_ED 2>/dev/null` + + let start="$start + 8" + let size="$end - $start" + + head --bytes="$end" "$file" | tail --bytes="$size" | zcat + + clean_up + exit 0 +} + + +usage() +{ + echo " usage: extract-ikconfig [b]zImage_filename" +} + +clean_up() +{ + if [ "$TMPFILE" != "" ]; then + rm -f $TMPFILE + fi +} + +if [ $# -lt 1 ] +then + usage + exit 1 +fi + +TMPFILE="/tmp/ikconfig-$$" +image="$1" + +# vmlinux: Attempt to dump the configuration from the file directly +dump_config "$image" + +GZHDR1="0x1f 0x8b 0x08 0x00" +GZHDR2="0x1f 0x8b 0x08 0x08" + +# vmlinux.gz: Check for a compressed images +off=`$binoffset "$image" $GZHDR1 2>/dev/null` +[ "$?" != "0" ] && off="-1" +if [ "$off" -eq "-1" ]; then + off=`$binoffset "$image" $GZHDR2 2>/dev/null` + [ "$?" != "0" ] && off="-1" +fi +if [ "$off" -eq "0" ]; then + zcat <"$image" >"$TMPFILE" + dump_config "$TMPFILE" +elif [ "$off" -ne "-1" ]; then + (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \ + zcat >"$TMPFILE" + dump_config "$TMPFILE" +fi + +echo "ERROR: Unable to extract kernel configuration information." +echo " This kernel image may not have the config info." + +clean_up +exit 1 |