Skip to contentSkip to conversation

convert mkcapflags.pl->mkcapflags.sh

PATCH In review [email protected] 1 participant 1 message Dec 18, 2012 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 convert mkcapflags.pl->mkcapflags.sh

From: Rob Landley <[email protected]>

Generate asm-x86/cpufeature.h with posix-2008 commands instead of perl.

---

 arch/x86/kernel/cpu/Makefile      |    4 +-
 arch/x86/kernel/cpu/mkcapflags.pl |   48 ----------------------------
 arch/x86/kernel/cpu/mkcapflags.sh |   41 +++++++++++++++++++++++
 3 files changed, 43 insertions(+), 50 deletions(-)
arch/x86/kernel/cpu/mkcapflags.pl deleted +0 -48
@@ -1,48 +0,0 @@
-#!/usr/bin/perl -w
-#
-# 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 "#ifndef _ASM_X86_CPUFEATURE_H\n";
-print OUT "#include <asm/cpufeature.h>\n";
-print OUT "#endif\n";
-print OUT "\n";
-print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n";
-
-%features = ();
-$err = 0;
-
-while (defined($line = <IN>)) {
-	if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) {
-		$macro = $1;
-		$feature = "\L$2";
-		$tail = $3;
-		if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) {
-			$feature = "\L$1";
-		}
-
-		next if ($feature eq '');
-
-		if ($features{$feature}++) {
-			print STDERR "$in: duplicate feature name: $feature\n";
-			$err++;
-		}
-		printf OUT "\t%-32s = \"%s\",\n", "[$macro]", $feature;
-	}
-}
-print OUT "};\n";
-
-close(IN);
-close(OUT);
-
-if ($err) {
-	unlink($out);
-	exit(1);
-}
-
-exit(0);
arch/x86/kernel/cpu/mkcapflags.sh new file +41 -0

41 lines not on this page · raw message

arch/x86/kernel/cpu/Makefile +2 -2
index 25f24dc..9edf7e7 100644
@@ -40,10 +40,10 @@ obj-$(CONFIG_MTRR)			+= mtrr/
 obj-$(CONFIG_X86_LOCAL_APIC)		+= perfctr-watchdog.o perf_event_amd_ibs.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)