Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755502AbZADB3p (ORCPT ); Sat, 3 Jan 2009 20:29:45 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751567AbZADB3g (ORCPT ); Sat, 3 Jan 2009 20:29:36 -0500 Received: from static-71-162-243-5.phlapa.fios.verizon.net ([71.162.243.5]:35232 "EHLO grelber.thyrsus.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750863AbZADB3f (ORCPT ); Sat, 3 Jan 2009 20:29:35 -0500 From: Rob Landley Organization: Boundaries Unlimited To: Embedded Linux mailing list Subject: PATCH [3/3]: Convert kernel/cpu/mkcapflags.pl to kernel/cpu/mkcapflags.sh Date: Sat, 3 Jan 2009 19:29:31 -0600 User-Agent: KMail/1.10.1 (Linux/2.6.27-7-generic; KDE/4.1.2; x86_64; ; ) Cc: linux-kernel@vger.kernel.org, Andrew Morton , "H. Peter Anvin" , Sam Ravnborg References: <200901020207.30359.rob@landley.net> <200901031924.15869.rob@landley.net> In-Reply-To: <200901031924.15869.rob@landley.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Message-Id: <200901031929.32074.rob@landley.net> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by alpha id n041TmwM029252 Content-Length: 3463 Lines: 7 From: Rob Landley Convert kernel/cpu/mkcapflags.pl to kernel/cpu/mkcapflags.sh. This script generates kernel/cpu/capflags.c from include/asm/cpufeature.h. Changes from last time: changed shebang to #!/bin/sh and tested under bashand dash. Signed-off-by: Rob Landley --- arch/x86/kernel/cpu/Makefile | 4 +-- arch/x86/kernel/cpu/mkcapflags.pl | 32 ---------------------------- arch/x86/kernel/cpu/mkcapflags.sh | 28 ++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 34 deletions(-) diff -ruN linux-2.6.28/arch/x86/kernel/cpu/Makefile linux-2.6.28-new/arch/x86/kernel/cpu/Makefile--- linux-2.6.28/arch/x86/kernel/cpu/Makefile 2008-12-24 17:26:37.000000000 -0600+++ linux-2.6.28-new/arch/x86/kernel/cpu/Makefile 2009-01-02 01:10:00.000000000 -0600@@ -23,10 +23,10 @@ obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o quiet_cmd_mkcapflags = MKCAP $@- cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@+ cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $< $@ cpufeature = $(src)/../../include/asm/cpufeature.h targets += capflags.c-$(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.pl FORCE+$(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.sh FORCE $(call if_changed,mkcapflags)diff -ruN linux-2.6.28/arch/x86/kernel/cpu/mkcapflags.pl linux-2.6.28-new/arch/x86/kernel/cpu/mkcapflags.pl--- linux-2.6.28/arch/x86/kernel/cpu/mkcapflags.pl 2008-12-24 17:26:37.000000000 -0600+++ linux-2.6.28-new/arch/x86/kernel/cpu/mkcapflags.pl 1969-12-31 18:00:00.000000000 -0600@@ -1,32 +0,0 @@-#!/usr/bin/perl-#-# Generate the x86_cap_flags[] array from include/asm-x86/cpufeature.h-#--($in, $out) = @ARGV;--open(IN, "< $in\0") or die "$0: cannot open: $in: $!\n";-open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n";--print OUT "#include \n\n";-print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n";--while (defined($line = )) {- if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) {- $macro = $1;- $feature = $2;- $tail = $3;- if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) {- $feature = $1;- }-- if ($feature ne '') {- printf OUT "\t%-32s = \"%s\",\n",- "[$macro]", "\L$feature";- }- }-}-print OUT "};\n";--close(IN);-close(OUT);diff -ruN linux-2.6.28/arch/x86/kernel/cpu/mkcapflags.sh linux-2.6.28-new/arch/x86/kernel/cpu/mkcapflags.sh--- linux-2.6.28/arch/x86/kernel/cpu/mkcapflags.sh 1969-12-31 18:00:00.000000000 -0600+++ linux-2.6.28-new/arch/x86/kernel/cpu/mkcapflags.sh 2009-01-02 01:10:00.000000000 -0600@@ -0,0 +1,28 @@+#!/bin/sh+#+# Generate the x86_cap_flags[] array from include/asm/cpufeature.h+#++IN=$1+OUT=$2++(+ echo "#include "+ echo ""+ echo "const char * const x86_cap_flags[NCAPINTS*32] = {"++ # Iterate through any input lines starting with #define X86_FEATURE_+ sed -n -e 's/\t/ /g' -e 's/^ *# *define *X86_FEATURE_//p' $IN |+ while read i+ do+ # Name is everything up to the first whitespace+ NAME="$(echo "$i" | sed 's/ .*//')"++ # If the /* comment */ starts with a quote string, grab that.+ VALUE="$(echo "$i" | sed -n 's@.*/\* *\("[^"]*"\).*\*/@\1@p')"+ [ -z "$VALUE" ] && VALUE="\"$(echo "$NAME" | tr A-Z a-z)\""++ [ "$VALUE" != '""' ] && echo " [X86_FEATURE_$NAME] = $VALUE,"+ done+ echo "};"+) > $OUT????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?