ia64/linux-2.6.18-xen.hg

annotate scripts/extract-ikconfig @ 798:b02a90bf5bbc

ACPI: Backport missing part for T-State MSR support

Part of below kernel commit was missed while packporting T-State
support.

commit f79f06ab9f86d7203006d2ec8992ac80df36a34e
Author: Zhao Yakui <yakui.zhao@intel.com>
Date: Thu Nov 15 17:06:36 2007 +0800

ACPI: Enable MSR (FixedHW) support for T-States

Add throttling control via MSR when T-states uses
the FixHW Control Status registers.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Li Shaohua <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>

Signed-off-by: Wei Gang <gang.wei@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Mar 02 10:53:59 2009 +0000 (2009-03-02)
parents 831230e53067
children
rev   line source
ian@0 1 #!/bin/sh
ian@0 2 # extracts .config info from a [b]zImage file
ian@0 3 # uses: binoffset (new), dd, zcat, strings, grep
ian@0 4 # $arg1 is [b]zImage filename
ian@0 5
ian@0 6 binoffset="./scripts/binoffset"
ian@0 7 test -e $binoffset || cc -o $binoffset ./scripts/binoffset.c || exit 1
ian@0 8
ian@0 9 IKCFG_ST="0x49 0x4b 0x43 0x46 0x47 0x5f 0x53 0x54"
ian@0 10 IKCFG_ED="0x49 0x4b 0x43 0x46 0x47 0x5f 0x45 0x44"
ian@0 11 function dump_config {
ian@0 12 typeset file="$1"
ian@0 13
ian@0 14 start=`$binoffset $file $IKCFG_ST 2>/dev/null`
ian@0 15 [ "$?" != "0" ] && start="-1"
ian@0 16 if [ "$start" -eq "-1" ]; then
ian@0 17 return
ian@0 18 fi
ian@0 19 end=`$binoffset $file $IKCFG_ED 2>/dev/null`
ian@0 20
ian@0 21 let start="$start + 8"
ian@0 22 let size="$end - $start"
ian@0 23
ian@0 24 dd if="$file" ibs=1 skip="$start" count="$size" 2>/dev/null | zcat
ian@0 25
ian@0 26 clean_up
ian@0 27 exit 0
ian@0 28 }
ian@0 29
ian@0 30
ian@0 31 usage()
ian@0 32 {
ian@0 33 echo " usage: extract-ikconfig [b]zImage_filename"
ian@0 34 }
ian@0 35
ian@0 36 clean_up()
ian@0 37 {
ian@0 38 if [ "$TMPFILE" != "" ]; then
ian@0 39 rm -f $TMPFILE
ian@0 40 fi
ian@0 41 }
ian@0 42
ian@0 43 if [ $# -lt 1 ]
ian@0 44 then
ian@0 45 usage
ian@0 46 exit 1
ian@0 47 fi
ian@0 48
ian@0 49 TMPFILE=`mktemp -t ikconfig-XXXXXX` || exit 1
ian@0 50 image="$1"
ian@0 51
ian@0 52 # vmlinux: Attempt to dump the configuration from the file directly
ian@0 53 dump_config "$image"
ian@0 54
ian@0 55 GZHDR1="0x1f 0x8b 0x08 0x00"
ian@0 56 GZHDR2="0x1f 0x8b 0x08 0x08"
ian@0 57
ian@0 58 # vmlinux.gz: Check for a compressed images
ian@0 59 off=`$binoffset "$image" $GZHDR1 2>/dev/null`
ian@0 60 [ "$?" != "0" ] && off="-1"
ian@0 61 if [ "$off" -eq "-1" ]; then
ian@0 62 off=`$binoffset "$image" $GZHDR2 2>/dev/null`
ian@0 63 [ "$?" != "0" ] && off="-1"
ian@0 64 fi
ian@0 65 if [ "$off" -eq "0" ]; then
ian@0 66 zcat <"$image" >"$TMPFILE"
ian@0 67 dump_config "$TMPFILE"
ian@0 68 elif [ "$off" -ne "-1" ]; then
ian@0 69 (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \
ian@0 70 zcat >"$TMPFILE"
ian@0 71 dump_config "$TMPFILE"
ian@0 72 fi
ian@0 73
ian@0 74 echo "ERROR: Unable to extract kernel configuration information."
ian@0 75 echo " This kernel image may not have the config info."
ian@0 76
ian@0 77 clean_up
ian@0 78 exit 1