diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2009-09-22 19:49:27 -0400 |
---|---|---|
committer | Anton Vorontsov <avorontsov@ru.mvista.com> | 2009-09-22 19:49:27 -0400 |
commit | f056878332a91ed984a116bad4e7d49aefff9e6e (patch) | |
tree | 572f4757c8e7811d45e0be0c2ae529c78fb63441 /scripts | |
parent | 3961f7c3cf247eee5df7fabadc7a40f2deeb98f3 (diff) | |
parent | 7fa07729e439a6184bd824746d06a49cca553f15 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
drivers/power/wm97xx_battery.c
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/.gitignore | 1 | ||||
-rw-r--r-- | scripts/Makefile | 1 | ||||
-rw-r--r-- | scripts/Makefile.modpost | 12 | ||||
-rw-r--r-- | scripts/basic/fixdep.c | 4 | ||||
-rwxr-xr-x | scripts/checkpatch.pl | 106 | ||||
-rwxr-xr-x | scripts/extract-ikconfig | 14 | ||||
-rwxr-xr-x | scripts/get_maintainer.pl | 429 | ||||
-rw-r--r-- | scripts/kconfig/Makefile | 34 | ||||
-rw-r--r-- | scripts/kconfig/lxdialog/util.c | 2 | ||||
-rw-r--r-- | scripts/kconfig/mconf.c | 2 | ||||
-rw-r--r-- | scripts/kconfig/streamline_config.pl | 366 | ||||
-rwxr-xr-x | scripts/kernel-doc | 25 | ||||
-rw-r--r-- | scripts/markup_oops.pl | 5 | ||||
-rw-r--r-- | scripts/mod/sumversion.c | 2 | ||||
-rw-r--r-- | scripts/module-common.lds | 8 | ||||
-rw-r--r-- | scripts/package/builddeb | 4 | ||||
-rw-r--r-- | scripts/pnmtologo.c | 4 | ||||
-rwxr-xr-x | scripts/recordmcount.pl | 13 | ||||
-rw-r--r-- | scripts/tracing/power.pl | 108 |
19 files changed, 895 insertions, 245 deletions
diff --git a/scripts/.gitignore b/scripts/.gitignore index b939fbd01195..52cab46ae35a 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore | |||
@@ -7,3 +7,4 @@ pnmtologo | |||
7 | bin2c | 7 | bin2c |
8 | unifdef | 8 | unifdef |
9 | binoffset | 9 | binoffset |
10 | ihex2fw | ||
diff --git a/scripts/Makefile b/scripts/Makefile index 9dd5b25a1d53..842dbc2d5aed 100644 --- a/scripts/Makefile +++ b/scripts/Makefile | |||
@@ -10,7 +10,6 @@ | |||
10 | hostprogs-$(CONFIG_KALLSYMS) += kallsyms | 10 | hostprogs-$(CONFIG_KALLSYMS) += kallsyms |
11 | hostprogs-$(CONFIG_LOGO) += pnmtologo | 11 | hostprogs-$(CONFIG_LOGO) += pnmtologo |
12 | hostprogs-$(CONFIG_VT) += conmakehash | 12 | hostprogs-$(CONFIG_VT) += conmakehash |
13 | hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash | ||
14 | hostprogs-$(CONFIG_IKCONFIG) += bin2c | 13 | hostprogs-$(CONFIG_IKCONFIG) += bin2c |
15 | 14 | ||
16 | always := $(hostprogs-y) $(hostprogs-m) | 15 | always := $(hostprogs-y) $(hostprogs-m) |
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index f4053dc7b5d6..8f14c81abbc7 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost | |||
@@ -13,7 +13,6 @@ | |||
13 | # 2) modpost is then used to | 13 | # 2) modpost is then used to |
14 | # 3) create one <module>.mod.c file pr. module | 14 | # 3) create one <module>.mod.c file pr. module |
15 | # 4) create one Module.symvers file with CRC for all exported symbols | 15 | # 4) create one Module.symvers file with CRC for all exported symbols |
16 | # 4a) [CONFIG_MARKERS] create one Module.markers file listing defined markers | ||
17 | # 5) compile all <module>.mod.c files | 16 | # 5) compile all <module>.mod.c files |
18 | # 6) final link of the module to a <module.ko> file | 17 | # 6) final link of the module to a <module.ko> file |
19 | 18 | ||
@@ -59,10 +58,6 @@ include scripts/Makefile.lib | |||
59 | 58 | ||
60 | kernelsymfile := $(objtree)/Module.symvers | 59 | kernelsymfile := $(objtree)/Module.symvers |
61 | modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers | 60 | modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers |
62 | kernelmarkersfile := $(objtree)/Module.markers | ||
63 | modulemarkersfile := $(firstword $(KBUILD_EXTMOD))/Module.markers | ||
64 | |||
65 | markersfile = $(if $(KBUILD_EXTMOD),$(modulemarkersfile),$(kernelmarkersfile)) | ||
66 | 61 | ||
67 | # Step 1), find all modules listed in $(MODVERDIR)/ | 62 | # Step 1), find all modules listed in $(MODVERDIR)/ |
68 | __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) | 63 | __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) |
@@ -85,8 +80,6 @@ modpost = scripts/mod/modpost \ | |||
85 | $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ | 80 | $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ |
86 | $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ | 81 | $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ |
87 | $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ | 82 | $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ |
88 | $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \ | ||
89 | $(if $(CONFIG_MARKERS),-M $(markersfile)) \ | ||
90 | $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \ | 83 | $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \ |
91 | $(if $(cross_build),-c) | 84 | $(if $(cross_build),-c) |
92 | 85 | ||
@@ -101,17 +94,12 @@ quiet_cmd_kernel-mod = MODPOST $@ | |||
101 | cmd_kernel-mod = $(modpost) $@ | 94 | cmd_kernel-mod = $(modpost) $@ |
102 | 95 | ||
103 | vmlinux.o: FORCE | 96 | vmlinux.o: FORCE |
104 | @rm -fr $(kernelmarkersfile) | ||
105 | $(call cmd,kernel-mod) | 97 | $(call cmd,kernel-mod) |
106 | 98 | ||
107 | # Declare generated files as targets for modpost | 99 | # Declare generated files as targets for modpost |
108 | $(symverfile): __modpost ; | 100 | $(symverfile): __modpost ; |
109 | $(modules:.ko=.mod.c): __modpost ; | 101 | $(modules:.ko=.mod.c): __modpost ; |
110 | 102 | ||
111 | ifdef CONFIG_MARKERS | ||
112 | $(markersfile): __modpost ; | ||
113 | endif | ||
114 | |||
115 | 103 | ||
116 | # Step 5), compile all *.mod.c files | 104 | # Step 5), compile all *.mod.c files |
117 | 105 | ||
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 72c15205bb2b..8ab448611680 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c | |||
@@ -16,8 +16,7 @@ | |||
16 | * tells make when to remake a file. | 16 | * tells make when to remake a file. |
17 | * | 17 | * |
18 | * To use this list as-is however has the drawback that virtually | 18 | * To use this list as-is however has the drawback that virtually |
19 | * every file in the kernel includes <linux/config.h> which then again | 19 | * every file in the kernel includes <linux/autoconf.h>. |
20 | * includes <linux/autoconf.h> | ||
21 | * | 20 | * |
22 | * If the user re-runs make *config, linux/autoconf.h will be | 21 | * If the user re-runs make *config, linux/autoconf.h will be |
23 | * regenerated. make notices that and will rebuild every file which | 22 | * regenerated. make notices that and will rebuild every file which |
@@ -126,7 +125,6 @@ char *depfile; | |||
126 | char *cmdline; | 125 | char *cmdline; |
127 | 126 | ||
128 | void usage(void) | 127 | void usage(void) |
129 | |||
130 | { | 128 | { |
131 | fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n"); | 129 | fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n"); |
132 | exit(1); | 130 | exit(1); |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2d5ece798c4c..87bbb8bce9bf 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -10,7 +10,7 @@ use strict; | |||
10 | my $P = $0; | 10 | my $P = $0; |
11 | $P =~ s@.*/@@g; | 11 | $P =~ s@.*/@@g; |
12 | 12 | ||
13 | my $V = '0.28'; | 13 | my $V = '0.29'; |
14 | 14 | ||
15 | use Getopt::Long qw(:config no_auto_abbrev); | 15 | use Getopt::Long qw(:config no_auto_abbrev); |
16 | 16 | ||
@@ -28,6 +28,41 @@ my $mailback = 0; | |||
28 | my $summary_file = 0; | 28 | my $summary_file = 0; |
29 | my $root; | 29 | my $root; |
30 | my %debug; | 30 | my %debug; |
31 | my $help = 0; | ||
32 | |||
33 | sub help { | ||
34 | my ($exitcode) = @_; | ||
35 | |||
36 | print << "EOM"; | ||
37 | Usage: $P [OPTION]... [FILE]... | ||
38 | Version: $V | ||
39 | |||
40 | Options: | ||
41 | -q, --quiet quiet | ||
42 | --no-tree run without a kernel tree | ||
43 | --no-signoff do not check for 'Signed-off-by' line | ||
44 | --patch treat FILE as patchfile (default) | ||
45 | --emacs emacs compile window format | ||
46 | --terse one line per report | ||
47 | -f, --file treat FILE as regular source file | ||
48 | --subjective, --strict enable more subjective tests | ||
49 | --root=PATH PATH to the kernel tree root | ||
50 | --no-summary suppress the per-file summary | ||
51 | --mailback only produce a report in case of warnings/errors | ||
52 | --summary-file include the filename in summary | ||
53 | --debug KEY=[0|1] turn on/off debugging of KEY, where KEY is one of | ||
54 | 'values', 'possible', 'type', and 'attr' (default | ||
55 | is all off) | ||
56 | --test-only=WORD report only warnings/errors containing WORD | ||
57 | literally | ||
58 | -h, --help, --version display this help and exit | ||
59 | |||
60 | When FILE is - read standard input. | ||
61 | EOM | ||
62 | |||
63 | exit($exitcode); | ||
64 | } | ||
65 | |||
31 | GetOptions( | 66 | GetOptions( |
32 | 'q|quiet+' => \$quiet, | 67 | 'q|quiet+' => \$quiet, |
33 | 'tree!' => \$tree, | 68 | 'tree!' => \$tree, |
@@ -35,7 +70,7 @@ GetOptions( | |||
35 | 'patch!' => \$chk_patch, | 70 | 'patch!' => \$chk_patch, |
36 | 'emacs!' => \$emacs, | 71 | 'emacs!' => \$emacs, |
37 | 'terse!' => \$terse, | 72 | 'terse!' => \$terse, |
38 | 'file!' => \$file, | 73 | 'f|file!' => \$file, |
39 | 'subjective!' => \$check, | 74 | 'subjective!' => \$check, |
40 | 'strict!' => \$check, | 75 | 'strict!' => \$check, |
41 | 'root=s' => \$root, | 76 | 'root=s' => \$root, |
@@ -45,22 +80,16 @@ GetOptions( | |||
45 | 80 | ||
46 | 'debug=s' => \%debug, | 81 | 'debug=s' => \%debug, |
47 | 'test-only=s' => \$tst_only, | 82 | 'test-only=s' => \$tst_only, |
48 | ) or exit; | 83 | 'h|help' => \$help, |
84 | 'version' => \$help | ||
85 | ) or help(1); | ||
86 | |||
87 | help(0) if ($help); | ||
49 | 88 | ||
50 | my $exit = 0; | 89 | my $exit = 0; |
51 | 90 | ||
52 | if ($#ARGV < 0) { | 91 | if ($#ARGV < 0) { |
53 | print "usage: $P [options] patchfile\n"; | 92 | print "$P: no input files\n"; |
54 | print "version: $V\n"; | ||
55 | print "options: -q => quiet\n"; | ||
56 | print " --no-tree => run without a kernel tree\n"; | ||
57 | print " --terse => one line per report\n"; | ||
58 | print " --emacs => emacs compile window format\n"; | ||
59 | print " --file => check a source file\n"; | ||
60 | print " --strict => enable more subjective tests\n"; | ||
61 | print " --root => path to the kernel tree root\n"; | ||
62 | print " --no-summary => suppress the per-file summary\n"; | ||
63 | print " --summary-file => include the filename in summary\n"; | ||
64 | exit(1); | 93 | exit(1); |
65 | } | 94 | } |
66 | 95 | ||
@@ -153,7 +182,7 @@ our $UTF8 = qr { | |||
153 | }x; | 182 | }x; |
154 | 183 | ||
155 | our $typeTypedefs = qr{(?x: | 184 | our $typeTypedefs = qr{(?x: |
156 | (?:__)?(?:u|s|be|le)(?:\d|\d\d)| | 185 | (?:__)?(?:u|s|be|le)(?:8|16|32|64)| |
157 | atomic_t | 186 | atomic_t |
158 | )}; | 187 | )}; |
159 | 188 | ||
@@ -356,6 +385,13 @@ sub sanitise_line { | |||
356 | $off++; | 385 | $off++; |
357 | next; | 386 | next; |
358 | } | 387 | } |
388 | if ($sanitise_quote eq '' && substr($line, $off, 2) eq '//') { | ||
389 | $sanitise_quote = '//'; | ||
390 | |||
391 | substr($res, $off, 2, $sanitise_quote); | ||
392 | $off++; | ||
393 | next; | ||
394 | } | ||
359 | 395 | ||
360 | # A \ in a string means ignore the next character. | 396 | # A \ in a string means ignore the next character. |
361 | if (($sanitise_quote eq "'" || $sanitise_quote eq '"') && | 397 | if (($sanitise_quote eq "'" || $sanitise_quote eq '"') && |
@@ -379,6 +415,8 @@ sub sanitise_line { | |||
379 | #print "c<$c> SQ<$sanitise_quote>\n"; | 415 | #print "c<$c> SQ<$sanitise_quote>\n"; |
380 | if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") { | 416 | if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") { |
381 | substr($res, $off, 1, $;); | 417 | substr($res, $off, 1, $;); |
418 | } elsif ($off != 0 && $sanitise_quote eq '//' && $c ne "\t") { | ||
419 | substr($res, $off, 1, $;); | ||
382 | } elsif ($off != 0 && $sanitise_quote && $c ne "\t") { | 420 | } elsif ($off != 0 && $sanitise_quote && $c ne "\t") { |
383 | substr($res, $off, 1, 'X'); | 421 | substr($res, $off, 1, 'X'); |
384 | } else { | 422 | } else { |
@@ -386,6 +424,10 @@ sub sanitise_line { | |||
386 | } | 424 | } |
387 | } | 425 | } |
388 | 426 | ||
427 | if ($sanitise_quote eq '//') { | ||
428 | $sanitise_quote = ''; | ||
429 | } | ||
430 | |||
389 | # The pathname on a #include may be surrounded by '<' and '>'. | 431 | # The pathname on a #include may be surrounded by '<' and '>'. |
390 | if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) { | 432 | if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) { |
391 | my $clean = 'X' x length($1); | 433 | my $clean = 'X' x length($1); |
@@ -1336,6 +1378,18 @@ sub process { | |||
1336 | WARN("adding a line without newline at end of file\n" . $herecurr); | 1378 | WARN("adding a line without newline at end of file\n" . $herecurr); |
1337 | } | 1379 | } |
1338 | 1380 | ||
1381 | # Blackfin: use hi/lo macros | ||
1382 | if ($realfile =~ m@arch/blackfin/.*\.S$@) { | ||
1383 | if ($line =~ /\.[lL][[:space:]]*=.*&[[:space:]]*0x[fF][fF][fF][fF]/) { | ||
1384 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
1385 | ERROR("use the LO() macro, not (... & 0xFFFF)\n" . $herevet); | ||
1386 | } | ||
1387 | if ($line =~ /\.[hH][[:space:]]*=.*>>[[:space:]]*16/) { | ||
1388 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
1389 | ERROR("use the HI() macro, not (... >> 16)\n" . $herevet); | ||
1390 | } | ||
1391 | } | ||
1392 | |||
1339 | # check we are in a valid source file C or perl if not then ignore this hunk | 1393 | # check we are in a valid source file C or perl if not then ignore this hunk |
1340 | next if ($realfile !~ /\.(h|c|pl)$/); | 1394 | next if ($realfile !~ /\.(h|c|pl)$/); |
1341 | 1395 | ||
@@ -1355,6 +1409,16 @@ sub process { | |||
1355 | WARN("CVS style keyword markers, these will _not_ be updated\n". $herecurr); | 1409 | WARN("CVS style keyword markers, these will _not_ be updated\n". $herecurr); |
1356 | } | 1410 | } |
1357 | 1411 | ||
1412 | # Blackfin: don't use __builtin_bfin_[cs]sync | ||
1413 | if ($line =~ /__builtin_bfin_csync/) { | ||
1414 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
1415 | ERROR("use the CSYNC() macro in asm/blackfin.h\n" . $herevet); | ||
1416 | } | ||
1417 | if ($line =~ /__builtin_bfin_ssync/) { | ||
1418 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
1419 | ERROR("use the SSYNC() macro in asm/blackfin.h\n" . $herevet); | ||
1420 | } | ||
1421 | |||
1358 | # Check for potential 'bare' types | 1422 | # Check for potential 'bare' types |
1359 | my ($stat, $cond, $line_nr_next, $remain_next, $off_next); | 1423 | my ($stat, $cond, $line_nr_next, $remain_next, $off_next); |
1360 | if ($realcnt && $line =~ /.\s*\S/) { | 1424 | if ($realcnt && $line =~ /.\s*\S/) { |
@@ -1372,6 +1436,8 @@ sub process { | |||
1372 | # Ignore functions being called | 1436 | # Ignore functions being called |
1373 | } elsif ($s =~ /^.\s*$Ident\s*\(/s) { | 1437 | } elsif ($s =~ /^.\s*$Ident\s*\(/s) { |
1374 | 1438 | ||
1439 | } elsif ($s =~ /^.\s*else\b/s) { | ||
1440 | |||
1375 | # declarations always start with types | 1441 | # declarations always start with types |
1376 | } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+?)\b(?:\s+$Sparse)?\s*\**\s*(?:$Ident|\(\*[^\)]*\))(?:\s*$Modifier)?\s*(?:;|=|,|\()/s) { | 1442 | } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+?)\b(?:\s+$Sparse)?\s*\**\s*(?:$Ident|\(\*[^\)]*\))(?:\s*$Modifier)?\s*(?:;|=|,|\()/s) { |
1377 | my $type = $1; | 1443 | my $type = $1; |
@@ -1532,8 +1598,9 @@ sub process { | |||
1532 | $s =~ /^\s*#\s*?/ || | 1598 | $s =~ /^\s*#\s*?/ || |
1533 | $s =~ /^\s*$Ident\s*:/) { | 1599 | $s =~ /^\s*$Ident\s*:/) { |
1534 | $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0; | 1600 | $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0; |
1535 | $s =~ s/^.*?\n//; | 1601 | if ($s =~ s/^.*?\n//) { |
1536 | $cond_lines++; | 1602 | $cond_lines++; |
1603 | } | ||
1537 | } | 1604 | } |
1538 | } | 1605 | } |
1539 | 1606 | ||
@@ -1891,7 +1958,7 @@ sub process { | |||
1891 | # A unary '*' may be const | 1958 | # A unary '*' may be const |
1892 | 1959 | ||
1893 | } elsif ($ctx =~ /.xW/) { | 1960 | } elsif ($ctx =~ /.xW/) { |
1894 | ERROR("Aspace prohibited after that '$op' $at\n" . $hereptr); | 1961 | ERROR("space prohibited after that '$op' $at\n" . $hereptr); |
1895 | } | 1962 | } |
1896 | 1963 | ||
1897 | # unary ++ and unary -- are allowed no space on one side. | 1964 | # unary ++ and unary -- are allowed no space on one side. |
@@ -2243,7 +2310,8 @@ sub process { | |||
2243 | DECLARE_PER_CPU| | 2310 | DECLARE_PER_CPU| |
2244 | DEFINE_PER_CPU| | 2311 | DEFINE_PER_CPU| |
2245 | __typeof__\(| | 2312 | __typeof__\(| |
2246 | \.$Ident\s*=\s* | 2313 | \.$Ident\s*=\s*| |
2314 | ^\"|\"$ | ||
2247 | }x; | 2315 | }x; |
2248 | #print "REST<$rest> dstat<$dstat>\n"; | 2316 | #print "REST<$rest> dstat<$dstat>\n"; |
2249 | if ($rest ne '') { | 2317 | if ($rest ne '') { |
diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig index 72997c353cb3..de233ff43c1c 100755 --- a/scripts/extract-ikconfig +++ b/scripts/extract-ikconfig | |||
@@ -17,6 +17,10 @@ dump_config() { | |||
17 | return | 17 | return |
18 | fi | 18 | fi |
19 | end=`$binoffset $file $IKCFG_ED 2>/dev/null` | 19 | end=`$binoffset $file $IKCFG_ED 2>/dev/null` |
20 | [ "$?" != "0" ] && end="-1" | ||
21 | if [ "$end" -eq "-1" ]; then | ||
22 | return | ||
23 | fi | ||
20 | 24 | ||
21 | start=`expr $start + 8` | 25 | start=`expr $start + 8` |
22 | size=`expr $end - $start` | 26 | size=`expr $end - $start` |
@@ -55,6 +59,8 @@ dump_config "$image" | |||
55 | GZHDR1="0x1f 0x8b 0x08 0x00" | 59 | GZHDR1="0x1f 0x8b 0x08 0x00" |
56 | GZHDR2="0x1f 0x8b 0x08 0x08" | 60 | GZHDR2="0x1f 0x8b 0x08 0x08" |
57 | 61 | ||
62 | ELFHDR="0x7f 0x45 0x4c 0x46" | ||
63 | |||
58 | # vmlinux.gz: Check for a compressed images | 64 | # vmlinux.gz: Check for a compressed images |
59 | off=`$binoffset "$image" $GZHDR1 2>/dev/null` | 65 | off=`$binoffset "$image" $GZHDR1 2>/dev/null` |
60 | [ "$?" != "0" ] && off="-1" | 66 | [ "$?" != "0" ] && off="-1" |
@@ -69,6 +75,14 @@ elif [ "$off" -ne "-1" ]; then | |||
69 | (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \ | 75 | (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \ |
70 | zcat >"$TMPFILE" | 76 | zcat >"$TMPFILE" |
71 | dump_config "$TMPFILE" | 77 | dump_config "$TMPFILE" |
78 | |||
79 | # check if this is simply an ELF file | ||
80 | else | ||
81 | off=`$binoffset "$image" $ELFHDR 2>/dev/null` | ||
82 | [ "$?" != "0" ] && off="-1" | ||
83 | if [ "$off" -eq "0" ]; then | ||
84 | dump_config "$image" | ||
85 | fi | ||
72 | fi | 86 | fi |
73 | 87 | ||
74 | echo "ERROR: Unable to extract kernel configuration information." | 88 | echo "ERROR: Unable to extract kernel configuration information." |
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 3e733146cd51..cdb44b63342e 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
@@ -13,7 +13,7 @@ | |||
13 | use strict; | 13 | use strict; |
14 | 14 | ||
15 | my $P = $0; | 15 | my $P = $0; |
16 | my $V = '0.16'; | 16 | my $V = '0.20'; |
17 | 17 | ||
18 | use Getopt::Long qw(:config no_auto_abbrev); | 18 | use Getopt::Long qw(:config no_auto_abbrev); |
19 | 19 | ||
@@ -27,7 +27,10 @@ my $email_git = 1; | |||
27 | my $email_git_penguin_chiefs = 0; | 27 | my $email_git_penguin_chiefs = 0; |
28 | my $email_git_min_signatures = 1; | 28 | my $email_git_min_signatures = 1; |
29 | my $email_git_max_maintainers = 5; | 29 | my $email_git_max_maintainers = 5; |
30 | my $email_git_min_percent = 5; | ||
30 | my $email_git_since = "1-year-ago"; | 31 | my $email_git_since = "1-year-ago"; |
32 | my $email_git_blame = 0; | ||
33 | my $email_remove_duplicates = 1; | ||
31 | my $output_multiline = 1; | 34 | my $output_multiline = 1; |
32 | my $output_separator = ", "; | 35 | my $output_separator = ", "; |
33 | my $scm = 0; | 36 | my $scm = 0; |
@@ -35,6 +38,7 @@ my $web = 0; | |||
35 | my $subsystem = 0; | 38 | my $subsystem = 0; |
36 | my $status = 0; | 39 | my $status = 0; |
37 | my $from_filename = 0; | 40 | my $from_filename = 0; |
41 | my $pattern_depth = 0; | ||
38 | my $version = 0; | 42 | my $version = 0; |
39 | my $help = 0; | 43 | my $help = 0; |
40 | 44 | ||
@@ -65,7 +69,10 @@ if (!GetOptions( | |||
65 | 'git-chief-penguins!' => \$email_git_penguin_chiefs, | 69 | 'git-chief-penguins!' => \$email_git_penguin_chiefs, |
66 | 'git-min-signatures=i' => \$email_git_min_signatures, | 70 | 'git-min-signatures=i' => \$email_git_min_signatures, |
67 | 'git-max-maintainers=i' => \$email_git_max_maintainers, | 71 | 'git-max-maintainers=i' => \$email_git_max_maintainers, |
72 | 'git-min-percent=i' => \$email_git_min_percent, | ||
68 | 'git-since=s' => \$email_git_since, | 73 | 'git-since=s' => \$email_git_since, |
74 | 'git-blame!' => \$email_git_blame, | ||
75 | 'remove-duplicates!' => \$email_remove_duplicates, | ||
69 | 'm!' => \$email_maintainer, | 76 | 'm!' => \$email_maintainer, |
70 | 'n!' => \$email_usename, | 77 | 'n!' => \$email_usename, |
71 | 'l!' => \$email_list, | 78 | 'l!' => \$email_list, |
@@ -76,6 +83,7 @@ if (!GetOptions( | |||
76 | 'status!' => \$status, | 83 | 'status!' => \$status, |
77 | 'scm!' => \$scm, | 84 | 'scm!' => \$scm, |
78 | 'web!' => \$web, | 85 | 'web!' => \$web, |
86 | 'pattern-depth=i' => \$pattern_depth, | ||
79 | 'f|file' => \$from_filename, | 87 | 'f|file' => \$from_filename, |
80 | 'v|version' => \$version, | 88 | 'v|version' => \$version, |
81 | 'h|help' => \$help, | 89 | 'h|help' => \$help, |
@@ -99,14 +107,19 @@ if ($#ARGV < 0) { | |||
99 | die "$P: argument missing: patchfile or -f file please\n"; | 107 | die "$P: argument missing: patchfile or -f file please\n"; |
100 | } | 108 | } |
101 | 109 | ||
110 | if ($output_separator ne ", ") { | ||
111 | $output_multiline = 0; | ||
112 | } | ||
113 | |||
102 | my $selections = $email + $scm + $status + $subsystem + $web; | 114 | my $selections = $email + $scm + $status + $subsystem + $web; |
103 | if ($selections == 0) { | 115 | if ($selections == 0) { |
104 | usage(); | 116 | usage(); |
105 | die "$P: Missing required option: email, scm, status, subsystem or web\n"; | 117 | die "$P: Missing required option: email, scm, status, subsystem or web\n"; |
106 | } | 118 | } |
107 | 119 | ||
108 | if ($email && ($email_maintainer + $email_list + $email_subscriber_list | 120 | if ($email && |
109 | + $email_git + $email_git_penguin_chiefs) == 0) { | 121 | ($email_maintainer + $email_list + $email_subscriber_list + |
122 | $email_git + $email_git_penguin_chiefs + $email_git_blame) == 0) { | ||
110 | usage(); | 123 | usage(); |
111 | die "$P: Please select at least 1 email option\n"; | 124 | die "$P: Please select at least 1 email option\n"; |
112 | } | 125 | } |
@@ -132,6 +145,10 @@ while (<MAINT>) { | |||
132 | $value =~ s@\.@\\\.@g; ##Convert . to \. | 145 | $value =~ s@\.@\\\.@g; ##Convert . to \. |
133 | $value =~ s/\*/\.\*/g; ##Convert * to .* | 146 | $value =~ s/\*/\.\*/g; ##Convert * to .* |
134 | $value =~ s/\?/\./g; ##Convert ? to . | 147 | $value =~ s/\?/\./g; ##Convert ? to . |
148 | ##if pattern is a directory and it lacks a trailing slash, add one | ||
149 | if ((-d $value)) { | ||
150 | $value =~ s@([^/])$@$1/@; | ||
151 | } | ||
135 | } | 152 | } |
136 | push(@typevalue, "$type:$value"); | 153 | push(@typevalue, "$type:$value"); |
137 | } elsif (!/^(\s)*$/) { | 154 | } elsif (!/^(\s)*$/) { |
@@ -141,26 +158,61 @@ while (<MAINT>) { | |||
141 | } | 158 | } |
142 | close(MAINT); | 159 | close(MAINT); |
143 | 160 | ||
161 | my %mailmap; | ||
162 | |||
163 | if ($email_remove_duplicates) { | ||
164 | open(MAILMAP, "<${lk_path}.mailmap") || warn "$P: Can't open .mailmap\n"; | ||
165 | while (<MAILMAP>) { | ||
166 | my $line = $_; | ||
167 | |||
168 | next if ($line =~ m/^\s*#/); | ||
169 | next if ($line =~ m/^\s*$/); | ||
170 | |||
171 | my ($name, $address) = parse_email($line); | ||
172 | $line = format_email($name, $address); | ||
173 | |||
174 | next if ($line =~ m/^\s*$/); | ||
175 | |||
176 | if (exists($mailmap{$name})) { | ||
177 | my $obj = $mailmap{$name}; | ||
178 | push(@$obj, $address); | ||
179 | } else { | ||
180 | my @arr = ($address); | ||
181 | $mailmap{$name} = \@arr; | ||
182 | } | ||
183 | } | ||
184 | close(MAILMAP); | ||
185 | } | ||
186 | |||
144 | ## use the filenames on the command line or find the filenames in the patchfiles | 187 | ## use the filenames on the command line or find the filenames in the patchfiles |
145 | 188 | ||
146 | my @files = (); | 189 | my @files = (); |
190 | my @range = (); | ||
147 | 191 | ||
148 | foreach my $file (@ARGV) { | 192 | foreach my $file (@ARGV) { |
149 | next if ((-d $file)); | 193 | ##if $file is a directory and it lacks a trailing slash, add one |
150 | if (!(-f $file)) { | 194 | if ((-d $file)) { |
195 | $file =~ s@([^/])$@$1/@; | ||
196 | } elsif (!(-f $file)) { | ||
151 | die "$P: file '${file}' not found\n"; | 197 | die "$P: file '${file}' not found\n"; |
152 | } | 198 | } |
153 | if ($from_filename) { | 199 | if ($from_filename) { |
154 | push(@files, $file); | 200 | push(@files, $file); |
155 | } else { | 201 | } else { |
156 | my $file_cnt = @files; | 202 | my $file_cnt = @files; |
203 | my $lastfile; | ||
157 | open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; | 204 | open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; |
158 | while (<PATCH>) { | 205 | while (<PATCH>) { |
159 | if (m/^\+\+\+\s+(\S+)/) { | 206 | if (m/^\+\+\+\s+(\S+)/) { |
160 | my $filename = $1; | 207 | my $filename = $1; |
161 | $filename =~ s@^[^/]*/@@; | 208 | $filename =~ s@^[^/]*/@@; |
162 | $filename =~ s@\n@@; | 209 | $filename =~ s@\n@@; |
210 | $lastfile = $filename; | ||
163 | push(@files, $filename); | 211 | push(@files, $filename); |
212 | } elsif (m/^\@\@ -(\d+),(\d+)/) { | ||
213 | if ($email_git_blame) { | ||
214 | push(@range, "$lastfile:$1:$2"); | ||
215 | } | ||
164 | } | 216 | } |
165 | } | 217 | } |
166 | close(PATCH); | 218 | close(PATCH); |
@@ -193,6 +245,7 @@ foreach my $file (@files) { | |||
193 | if ($type eq 'X') { | 245 | if ($type eq 'X') { |
194 | if (file_match_pattern($file, $value)) { | 246 | if (file_match_pattern($file, $value)) { |
195 | $exclude = 1; | 247 | $exclude = 1; |
248 | last; | ||
196 | } | 249 | } |
197 | } | 250 | } |
198 | } | 251 | } |
@@ -200,35 +253,45 @@ foreach my $file (@files) { | |||
200 | 253 | ||
201 | if (!$exclude) { | 254 | if (!$exclude) { |
202 | my $tvi = 0; | 255 | my $tvi = 0; |
256 | my %hash; | ||
203 | foreach my $line (@typevalue) { | 257 | foreach my $line (@typevalue) { |
204 | if ($line =~ m/^(\C):\s*(.*)/) { | 258 | if ($line =~ m/^(\C):\s*(.*)/) { |
205 | my $type = $1; | 259 | my $type = $1; |
206 | my $value = $2; | 260 | my $value = $2; |
207 | if ($type eq 'F') { | 261 | if ($type eq 'F') { |
208 | if (file_match_pattern($file, $value)) { | 262 | if (file_match_pattern($file, $value)) { |
209 | add_categories($tvi); | 263 | my $value_pd = ($value =~ tr@/@@); |
264 | my $file_pd = ($file =~ tr@/@@); | ||
265 | $value_pd++ if (substr($value,-1,1) ne "/"); | ||
266 | if ($pattern_depth == 0 || | ||
267 | (($file_pd - $value_pd) < $pattern_depth)) { | ||
268 | $hash{$tvi} = $value_pd; | ||
269 | } | ||
210 | } | 270 | } |
211 | } | 271 | } |
212 | } | 272 | } |
213 | $tvi++; | 273 | $tvi++; |
214 | } | 274 | } |
275 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | ||
276 | add_categories($line); | ||
277 | } | ||
215 | } | 278 | } |
216 | 279 | ||
217 | if ($email && $email_git) { | 280 | if ($email && $email_git) { |
218 | recent_git_signoffs($file); | 281 | recent_git_signoffs($file); |
219 | } | 282 | } |
220 | 283 | ||
284 | if ($email && $email_git_blame) { | ||
285 | git_assign_blame($file); | ||
286 | } | ||
221 | } | 287 | } |
222 | 288 | ||
223 | if ($email) { | 289 | if ($email) { |
224 | foreach my $chief (@penguin_chief) { | 290 | foreach my $chief (@penguin_chief) { |
225 | if ($chief =~ m/^(.*):(.*)/) { | 291 | if ($chief =~ m/^(.*):(.*)/) { |
226 | my $email_address; | 292 | my $email_address; |
227 | if ($email_usename) { | 293 | |
228 | $email_address = format_email($1, $2); | 294 | $email_address = format_email($1, $2); |
229 | } else { | ||
230 | $email_address = $2; | ||
231 | } | ||
232 | if ($email_git_penguin_chiefs) { | 295 | if ($email_git_penguin_chiefs) { |
233 | push(@email_to, $email_address); | 296 | push(@email_to, $email_address); |
234 | } else { | 297 | } else { |
@@ -250,22 +313,22 @@ if ($email || $email_list) { | |||
250 | } | 313 | } |
251 | 314 | ||
252 | if ($scm) { | 315 | if ($scm) { |
253 | @scm = sort_and_uniq(@scm); | 316 | @scm = uniq(@scm); |
254 | output(@scm); | 317 | output(@scm); |
255 | } | 318 | } |
256 | 319 | ||
257 | if ($status) { | 320 | if ($status) { |
258 | @status = sort_and_uniq(@status); | 321 | @status = uniq(@status); |
259 | output(@status); | 322 | output(@status); |
260 | } | 323 | } |
261 | 324 | ||
262 | if ($subsystem) { | 325 | if ($subsystem) { |
263 | @subsystem = sort_and_uniq(@subsystem); | 326 | @subsystem = uniq(@subsystem); |
264 | output(@subsystem); | 327 | output(@subsystem); |
265 | } | 328 | } |
266 | 329 | ||
267 | if ($web) { | 330 | if ($web) { |
268 | @web = sort_and_uniq(@web); | 331 | @web = uniq(@web); |
269 | output(@web); | 332 | output(@web); |
270 | } | 333 | } |
271 | 334 | ||
@@ -292,7 +355,7 @@ sub file_match_pattern { | |||
292 | sub usage { | 355 | sub usage { |
293 | print <<EOT; | 356 | print <<EOT; |
294 | usage: $P [options] patchfile | 357 | usage: $P [options] patchfile |
295 | $P [options] -f file | 358 | $P [options] -f file|directory |
296 | version: $V | 359 | version: $V |
297 | 360 | ||
298 | MAINTAINER field selection options: | 361 | MAINTAINER field selection options: |
@@ -301,11 +364,14 @@ MAINTAINER field selection options: | |||
301 | --git-chief-penguins => include ${penguin_chiefs} | 364 | --git-chief-penguins => include ${penguin_chiefs} |
302 | --git-min-signatures => number of signatures required (default: 1) | 365 | --git-min-signatures => number of signatures required (default: 1) |
303 | --git-max-maintainers => maximum maintainers to add (default: 5) | 366 | --git-max-maintainers => maximum maintainers to add (default: 5) |
367 | --git-min-percent => minimum percentage of commits required (default: 5) | ||
304 | --git-since => git history to use (default: 1-year-ago) | 368 | --git-since => git history to use (default: 1-year-ago) |
369 | --git-blame => use git blame to find modified commits for patch or file | ||
305 | --m => include maintainer(s) if any | 370 | --m => include maintainer(s) if any |
306 | --n => include name 'Full Name <addr\@domain.tld>' | 371 | --n => include name 'Full Name <addr\@domain.tld>' |
307 | --l => include list(s) if any | 372 | --l => include list(s) if any |
308 | --s => include subscriber only list(s) if any | 373 | --s => include subscriber only list(s) if any |
374 | --remove-duplicates => minimize duplicate email names/addresses | ||
309 | --scm => print SCM tree(s) if any | 375 | --scm => print SCM tree(s) if any |
310 | --status => print status if any | 376 | --status => print status if any |
311 | --subsystem => print subsystem name if any | 377 | --subsystem => print subsystem name if any |
@@ -313,15 +379,28 @@ MAINTAINER field selection options: | |||
313 | 379 | ||
314 | Output type options: | 380 | Output type options: |
315 | --separator [, ] => separator for multiple entries on 1 line | 381 | --separator [, ] => separator for multiple entries on 1 line |
382 | using --separator also sets --nomultiline if --separator is not [, ] | ||
316 | --multiline => print 1 entry per line | 383 | --multiline => print 1 entry per line |
317 | 384 | ||
318 | Default options: | ||
319 | [--email --git --m --n --l --multiline] | ||
320 | |||
321 | Other options: | 385 | Other options: |
386 | --pattern-depth => Number of pattern directory traversals (default: 0 (all)) | ||
322 | --version => show version | 387 | --version => show version |
323 | --help => show this help information | 388 | --help => show this help information |
324 | 389 | ||
390 | Default options: | ||
391 | [--email --git --m --n --l --multiline --pattern-depth=0 --remove-duplicates] | ||
392 | |||
393 | Notes: | ||
394 | Using "-f directory" may give unexpected results: | ||
395 | Used with "--git", git signators for _all_ files in and below | ||
396 | directory are examined as git recurses directories. | ||
397 | Any specified X: (exclude) pattern matches are _not_ ignored. | ||
398 | Used with "--nogit", directory is used as a pattern match, | ||
399 | no individual file within the directory or subdirectory | ||
400 | is matched. | ||
401 | Used with "--git-blame", does not iterate all files in directory | ||
402 | Using "--git-blame" is slow and may add old committers and authors | ||
403 | that are no longer active maintainers to the output. | ||
325 | EOT | 404 | EOT |
326 | } | 405 | } |
327 | 406 | ||
@@ -352,30 +431,100 @@ sub top_of_kernel_tree { | |||
352 | return 0; | 431 | return 0; |
353 | } | 432 | } |
354 | 433 | ||
355 | sub format_email { | 434 | sub parse_email { |
356 | my ($name, $email) = @_; | 435 | my ($formatted_email) = @_; |
436 | |||
437 | my $name = ""; | ||
438 | my $address = ""; | ||
439 | |||
440 | if ($formatted_email =~ /^([^<]+)<(.+\@.*)>.*$/) { | ||
441 | $name = $1; | ||
442 | $address = $2; | ||
443 | } elsif ($formatted_email =~ /^\s*<(.+\@\S*)>.*$/) { | ||
444 | $address = $1; | ||
445 | } elsif ($formatted_email =~ /^(.+\@\S*).*$/) { | ||
446 | $address = $1; | ||
447 | } | ||
357 | 448 | ||
358 | $name =~ s/^\s+|\s+$//g; | 449 | $name =~ s/^\s+|\s+$//g; |
359 | $name =~ s/^\"|\"$//g; | 450 | $name =~ s/^\"|\"$//g; |
360 | $email =~ s/^\s+|\s+$//g; | 451 | $address =~ s/^\s+|\s+$//g; |
452 | |||
453 | if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars | ||
454 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes | ||
455 | $name = "\"$name\""; | ||
456 | } | ||
361 | 457 | ||
362 | my $formatted_email = ""; | 458 | return ($name, $address); |
459 | } | ||
460 | |||
461 | sub format_email { | ||
462 | my ($name, $address) = @_; | ||
463 | |||
464 | my $formatted_email; | ||
465 | |||
466 | $name =~ s/^\s+|\s+$//g; | ||
467 | $name =~ s/^\"|\"$//g; | ||
468 | $address =~ s/^\s+|\s+$//g; | ||
363 | 469 | ||
364 | if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars | 470 | if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars |
365 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes | 471 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes |
366 | $formatted_email = "\"${name}\"\ \<${email}\>"; | 472 | $name = "\"$name\""; |
473 | } | ||
474 | |||
475 | if ($email_usename) { | ||
476 | if ("$name" eq "") { | ||
477 | $formatted_email = "$address"; | ||
478 | } else { | ||
479 | $formatted_email = "$name <${address}>"; | ||
480 | } | ||
367 | } else { | 481 | } else { |
368 | $formatted_email = "${name} \<${email}\>"; | 482 | $formatted_email = $address; |
369 | } | 483 | } |
484 | |||
370 | return $formatted_email; | 485 | return $formatted_email; |
371 | } | 486 | } |
372 | 487 | ||
373 | sub add_categories { | 488 | sub find_starting_index { |
489 | |||
490 | my ($index) = @_; | ||
491 | |||
492 | while ($index > 0) { | ||
493 | my $tv = $typevalue[$index]; | ||
494 | if (!($tv =~ m/^(\C):\s*(.*)/)) { | ||
495 | last; | ||
496 | } | ||
497 | $index--; | ||
498 | } | ||
499 | |||
500 | return $index; | ||
501 | } | ||
502 | |||
503 | sub find_ending_index { | ||
374 | my ($index) = @_; | 504 | my ($index) = @_; |
375 | 505 | ||
376 | $index = $index - 1; | 506 | while ($index < @typevalue) { |
377 | while ($index >= 0) { | ||
378 | my $tv = $typevalue[$index]; | 507 | my $tv = $typevalue[$index]; |
508 | if (!($tv =~ m/^(\C):\s*(.*)/)) { | ||
509 | last; | ||
510 | } | ||
511 | $index++; | ||
512 | } | ||
513 | |||
514 | return $index; | ||
515 | } | ||
516 | |||
517 | sub add_categories { | ||
518 | my ($index) = @_; | ||
519 | |||
520 | my $i; | ||
521 | my $start = find_starting_index($index); | ||
522 | my $end = find_ending_index($index); | ||
523 | |||
524 | push(@subsystem, $typevalue[$start]); | ||
525 | |||
526 | for ($i = $start + 1; $i < $end; $i++) { | ||
527 | my $tv = $typevalue[$i]; | ||
379 | if ($tv =~ m/^(\C):\s*(.*)/) { | 528 | if ($tv =~ m/^(\C):\s*(.*)/) { |
380 | my $ptype = $1; | 529 | my $ptype = $1; |
381 | my $pvalue = $2; | 530 | my $pvalue = $2; |
@@ -396,19 +545,19 @@ sub add_categories { | |||
396 | } | 545 | } |
397 | } | 546 | } |
398 | } elsif ($ptype eq "M") { | 547 | } elsif ($ptype eq "M") { |
399 | my $p_used = 0; | 548 | my ($name, $address) = parse_email($pvalue); |
400 | if ($index >= 0) { | 549 | if ($name eq "") { |
401 | my $tv = $typevalue[$index - 1]; | 550 | if ($i > 0) { |
402 | if ($tv =~ m/^(\C):\s*(.*)/) { | 551 | my $tv = $typevalue[$i - 1]; |
403 | if ($1 eq "P") { | 552 | if ($tv =~ m/^(\C):\s*(.*)/) { |
404 | if ($email_usename) { | 553 | if ($1 eq "P") { |
405 | push_email_address(format_email($2, $pvalue)); | 554 | $name = $2; |
406 | $p_used = 1; | 555 | $pvalue = format_email($name, $address); |
407 | } | 556 | } |
408 | } | 557 | } |
409 | } | 558 | } |
410 | } | 559 | } |
411 | if (!$p_used) { | 560 | if ($email_maintainer) { |
412 | push_email_addresses($pvalue); | 561 | push_email_addresses($pvalue); |
413 | } | 562 | } |
414 | } elsif ($ptype eq "T") { | 563 | } elsif ($ptype eq "T") { |
@@ -418,31 +567,41 @@ sub add_categories { | |||
418 | } elsif ($ptype eq "S") { | 567 | } elsif ($ptype eq "S") { |
419 | push(@status, $pvalue); | 568 | push(@status, $pvalue); |
420 | } | 569 | } |
421 | |||
422 | $index--; | ||
423 | } else { | ||
424 | push(@subsystem,$tv); | ||
425 | $index = -1; | ||
426 | } | 570 | } |
427 | } | 571 | } |
428 | } | 572 | } |
429 | 573 | ||
574 | my %email_hash_name; | ||
575 | my %email_hash_address; | ||
576 | |||
577 | sub email_inuse { | ||
578 | my ($name, $address) = @_; | ||
579 | |||
580 | return 1 if (($name eq "") && ($address eq "")); | ||
581 | return 1 if (($name ne "") && exists($email_hash_name{$name})); | ||
582 | return 1 if (($address ne "") && exists($email_hash_address{$address})); | ||
583 | |||
584 | return 0; | ||
585 | } | ||
586 | |||
430 | sub push_email_address { | 587 | sub push_email_address { |
431 | my ($email_address) = @_; | 588 | my ($line) = @_; |
432 | 589 | ||
433 | my $email_name = ""; | 590 | my ($name, $address) = parse_email($line); |
434 | if ($email_address =~ m/([^<]+)<(.*\@.*)>$/) { | 591 | |
435 | $email_name = $1; | 592 | if ($address eq "") { |
436 | $email_address = $2; | 593 | return 0; |
437 | } | 594 | } |
438 | 595 | ||
439 | if ($email_maintainer) { | 596 | if (!$email_remove_duplicates) { |
440 | if ($email_usename && $email_name) { | 597 | push(@email_to, format_email($name, $address)); |
441 | push(@email_to, format_email($email_name, $email_address)); | 598 | } elsif (!email_inuse($name, $address)) { |
442 | } else { | 599 | push(@email_to, format_email($name, $address)); |
443 | push(@email_to, $email_address); | 600 | $email_hash_name{$name}++; |
444 | } | 601 | $email_hash_address{$address}++; |
445 | } | 602 | } |
603 | |||
604 | return 1; | ||
446 | } | 605 | } |
447 | 606 | ||
448 | sub push_email_addresses { | 607 | sub push_email_addresses { |
@@ -458,7 +617,9 @@ sub push_email_addresses { | |||
458 | push_email_address($entry); | 617 | push_email_address($entry); |
459 | } | 618 | } |
460 | } else { | 619 | } else { |
461 | warn("Invalid MAINTAINERS address: '" . $address . "'\n"); | 620 | if (!push_email_address($address)) { |
621 | warn("Invalid MAINTAINERS address: '" . $address . "'\n"); | ||
622 | } | ||
462 | } | 623 | } |
463 | } | 624 | } |
464 | 625 | ||
@@ -474,6 +635,32 @@ sub which { | |||
474 | return ""; | 635 | return ""; |
475 | } | 636 | } |
476 | 637 | ||
638 | sub mailmap { | ||
639 | my @lines = @_; | ||
640 | my %hash; | ||
641 | |||
642 | foreach my $line (@lines) { | ||
643 | my ($name, $address) = parse_email($line); | ||
644 | if (!exists($hash{$name})) { | ||
645 | $hash{$name} = $address; | ||
646 | } elsif ($address ne $hash{$name}) { | ||
647 | $address = $hash{$name}; | ||
648 | $line = format_email($name, $address); | ||
649 | } | ||
650 | if (exists($mailmap{$name})) { | ||
651 | my $obj = $mailmap{$name}; | ||
652 | foreach my $map_address (@$obj) { | ||
653 | if (($map_address eq $address) && | ||
654 | ($map_address ne $hash{$name})) { | ||
655 | $line = format_email($name, $hash{$name}); | ||
656 | } | ||
657 | } | ||
658 | } | ||
659 | } | ||
660 | |||
661 | return @lines; | ||
662 | } | ||
663 | |||
477 | sub recent_git_signoffs { | 664 | sub recent_git_signoffs { |
478 | my ($file) = @_; | 665 | my ($file) = @_; |
479 | 666 | ||
@@ -482,6 +669,8 @@ sub recent_git_signoffs { | |||
482 | my $output = ""; | 669 | my $output = ""; |
483 | my $count = 0; | 670 | my $count = 0; |
484 | my @lines = (); | 671 | my @lines = (); |
672 | my %hash; | ||
673 | my $total_sign_offs; | ||
485 | 674 | ||
486 | if (which("git") eq "") { | 675 | if (which("git") eq "") { |
487 | warn("$P: git not found. Add --nogit to options?\n"); | 676 | warn("$P: git not found. Add --nogit to options?\n"); |
@@ -494,43 +683,119 @@ sub recent_git_signoffs { | |||
494 | } | 683 | } |
495 | 684 | ||
496 | $cmd = "git log --since=${email_git_since} -- ${file}"; | 685 | $cmd = "git log --since=${email_git_since} -- ${file}"; |
497 | $cmd .= " | grep -Ei \"^[-_ a-z]+by:.*\\\@.*\$\""; | 686 | |
687 | $output = `${cmd}`; | ||
688 | $output =~ s/^\s*//gm; | ||
689 | |||
690 | @lines = split("\n", $output); | ||
691 | |||
692 | @lines = grep(/^[-_ a-z]+by:.*\@.*$/i, @lines); | ||
498 | if (!$email_git_penguin_chiefs) { | 693 | if (!$email_git_penguin_chiefs) { |
499 | $cmd .= " | grep -Ev \"${penguin_chiefs}\""; | 694 | @lines = grep(!/${penguin_chiefs}/i, @lines); |
695 | } | ||
696 | # cut -f2- -d":" | ||
697 | s/.*:\s*(.+)\s*/$1/ for (@lines); | ||
698 | |||
699 | $total_sign_offs = @lines; | ||
700 | |||
701 | if ($email_remove_duplicates) { | ||
702 | @lines = mailmap(@lines); | ||
703 | } | ||
704 | |||
705 | @lines = sort(@lines); | ||
706 | |||
707 | # uniq -c | ||
708 | $hash{$_}++ for @lines; | ||
709 | |||
710 | # sort -rn | ||
711 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | ||
712 | my $sign_offs = $hash{$line}; | ||
713 | $count++; | ||
714 | last if ($sign_offs < $email_git_min_signatures || | ||
715 | $count > $email_git_max_maintainers || | ||
716 | $sign_offs * 100 / $total_sign_offs < $email_git_min_percent); | ||
717 | push_email_address($line); | ||
500 | } | 718 | } |
501 | $cmd .= " | cut -f2- -d\":\""; | 719 | } |
502 | $cmd .= " | sort | uniq -c | sort -rn"; | 720 | |
721 | sub save_commits { | ||
722 | my ($cmd, @commits) = @_; | ||
723 | my $output; | ||
724 | my @lines = (); | ||
503 | 725 | ||
504 | $output = `${cmd}`; | 726 | $output = `${cmd}`; |
505 | $output =~ s/^\s*//gm; | ||
506 | 727 | ||
507 | @lines = split("\n", $output); | 728 | @lines = split("\n", $output); |
508 | foreach my $line (@lines) { | 729 | foreach my $line (@lines) { |
509 | if ($line =~ m/([0-9]+)\s+(.*)/) { | 730 | if ($line =~ m/^(\w+) /) { |
510 | my $sign_offs = $1; | 731 | push (@commits, $1); |
511 | $line = $2; | ||
512 | $count++; | ||
513 | if ($sign_offs < $email_git_min_signatures || | ||
514 | $count > $email_git_max_maintainers) { | ||
515 | last; | ||
516 | } | ||
517 | } else { | ||
518 | die("$P: Unexpected git output: ${line}\n"); | ||
519 | } | 732 | } |
520 | if ($line =~ m/(.+)<(.+)>/) { | 733 | } |
521 | my $git_name = $1; | 734 | return @commits; |
522 | my $git_addr = $2; | 735 | } |
523 | if ($email_usename) { | 736 | |
524 | push(@email_to, format_email($git_name, $git_addr)); | 737 | sub git_assign_blame { |
525 | } else { | 738 | my ($file) = @_; |
526 | push(@email_to, $git_addr); | 739 | |
527 | } | 740 | my @lines = (); |
528 | } elsif ($line =~ m/<(.+)>/) { | 741 | my @commits = (); |
529 | my $git_addr = $1; | 742 | my $cmd; |
530 | push(@email_to, $git_addr); | 743 | my $output; |
531 | } else { | 744 | my %hash; |
532 | push(@email_to, $line); | 745 | my $total_sign_offs; |
746 | my $count; | ||
747 | |||
748 | if (@range) { | ||
749 | foreach my $file_range_diff (@range) { | ||
750 | next if (!($file_range_diff =~ m/(.+):(.+):(.+)/)); | ||
751 | my $diff_file = $1; | ||
752 | my $diff_start = $2; | ||
753 | my $diff_length = $3; | ||
754 | next if (!("$file" eq "$diff_file")); | ||
755 | $cmd = "git blame -l -L $diff_start,+$diff_length $file"; | ||
756 | @commits = save_commits($cmd, @commits); | ||
757 | } | ||
758 | } else { | ||
759 | if (-f $file) { | ||
760 | $cmd = "git blame -l $file"; | ||
761 | @commits = save_commits($cmd, @commits); | ||
762 | } | ||
763 | } | ||
764 | |||
765 | $total_sign_offs = 0; | ||
766 | @commits = uniq(@commits); | ||
767 | foreach my $commit (@commits) { | ||
768 | $cmd = "git log -1 ${commit}"; | ||
769 | |||
770 | $output = `${cmd}`; | ||
771 | $output =~ s/^\s*//gm; | ||
772 | @lines = split("\n", $output); | ||
773 | |||
774 | @lines = grep(/^[-_ a-z]+by:.*\@.*$/i, @lines); | ||
775 | if (!$email_git_penguin_chiefs) { | ||
776 | @lines = grep(!/${penguin_chiefs}/i, @lines); | ||
777 | } | ||
778 | |||
779 | # cut -f2- -d":" | ||
780 | s/.*:\s*(.+)\s*/$1/ for (@lines); | ||
781 | |||
782 | $total_sign_offs += @lines; | ||
783 | |||
784 | if ($email_remove_duplicates) { | ||
785 | @lines = mailmap(@lines); | ||
533 | } | 786 | } |
787 | |||
788 | $hash{$_}++ for @lines; | ||
789 | } | ||
790 | |||
791 | $count = 0; | ||
792 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | ||
793 | my $sign_offs = $hash{$line}; | ||
794 | $count++; | ||
795 | last if ($sign_offs < $email_git_min_signatures || | ||
796 | $count > $email_git_max_maintainers || | ||
797 | $sign_offs * 100 / $total_sign_offs < $email_git_min_percent); | ||
798 | push_email_address($line); | ||
534 | } | 799 | } |
535 | } | 800 | } |
536 | 801 | ||
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 5ddf8becd7a2..6d69c7ccdcc7 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -2,7 +2,8 @@ | |||
2 | # Kernel configuration targets | 2 | # Kernel configuration targets |
3 | # These targets are used from top-level makefile | 3 | # These targets are used from top-level makefile |
4 | 4 | ||
5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config | 5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \ |
6 | localmodconfig localyesconfig | ||
6 | 7 | ||
7 | ifdef KBUILD_KCONFIG | 8 | ifdef KBUILD_KCONFIG |
8 | Kconfig := $(KBUILD_KCONFIG) | 9 | Kconfig := $(KBUILD_KCONFIG) |
@@ -28,6 +29,35 @@ oldconfig: $(obj)/conf | |||
28 | silentoldconfig: $(obj)/conf | 29 | silentoldconfig: $(obj)/conf |
29 | $< -s $(Kconfig) | 30 | $< -s $(Kconfig) |
30 | 31 | ||
32 | localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | ||
33 | $(Q)perl $< $(Kconfig) > .tmp.config | ||
34 | $(Q)if [ -f .config ]; then \ | ||
35 | cmp -s .tmp.config .config || \ | ||
36 | (mv -f .config .config.old.1; \ | ||
37 | mv -f .tmp.config .config; \ | ||
38 | $(obj)/conf -s $(Kconfig); \ | ||
39 | mv -f .config.old.1 .config.old) \ | ||
40 | else \ | ||
41 | mv -f .tmp.config .config; \ | ||
42 | $(obj)/conf -s $(Kconfig); \ | ||
43 | fi | ||
44 | $(Q)rm -f .tmp.config | ||
45 | |||
46 | localyesconfig: $(obj)/streamline_config.pl $(obj)/conf | ||
47 | $(Q)perl $< $(Kconfig) > .tmp.config | ||
48 | $(Q)sed -i s/=m/=y/ .tmp.config | ||
49 | $(Q)if [ -f .config ]; then \ | ||
50 | cmp -s .tmp.config .config || \ | ||
51 | (mv -f .config .config.old.1; \ | ||
52 | mv -f .tmp.config .config; \ | ||
53 | $(obj)/conf -s $(Kconfig); \ | ||
54 | mv -f .config.old.1 .config.old) \ | ||
55 | else \ | ||
56 | mv -f .tmp.config .config; \ | ||
57 | $(obj)/conf -s $(Kconfig); \ | ||
58 | fi | ||
59 | $(Q)rm -f .tmp.config | ||
60 | |||
31 | # Create new linux.pot file | 61 | # Create new linux.pot file |
32 | # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files | 62 | # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files |
33 | # The symlink is used to repair a deficiency in arch/um | 63 | # The symlink is used to repair a deficiency in arch/um |
@@ -83,6 +113,8 @@ help: | |||
83 | @echo ' xconfig - Update current config utilising a QT based front-end' | 113 | @echo ' xconfig - Update current config utilising a QT based front-end' |
84 | @echo ' gconfig - Update current config utilising a GTK based front-end' | 114 | @echo ' gconfig - Update current config utilising a GTK based front-end' |
85 | @echo ' oldconfig - Update current config utilising a provided .config as base' | 115 | @echo ' oldconfig - Update current config utilising a provided .config as base' |
116 | @echo ' localmodconfig - Update current config disabling modules not loaded' | ||
117 | @echo ' localyesconfig - Update current config converting local mods to core' | ||
86 | @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' | 118 | @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' |
87 | @echo ' randconfig - New config with random answer to all options' | 119 | @echo ' randconfig - New config with random answer to all options' |
88 | @echo ' defconfig - New config with default answer to all options' | 120 | @echo ' defconfig - New config with default answer to all options' |
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c index 86d95cca46a7..f2375ad7ebc9 100644 --- a/scripts/kconfig/lxdialog/util.c +++ b/scripts/kconfig/lxdialog/util.c | |||
@@ -19,6 +19,8 @@ | |||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <stdarg.h> | ||
23 | |||
22 | #include "dialog.h" | 24 | #include "dialog.h" |
23 | 25 | ||
24 | struct dialog_info dlg; | 26 | struct dialog_info dlg; |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 3bcacb4bfd3a..25b60bc117f7 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -888,6 +888,8 @@ int main(int ac, char **av) | |||
888 | single_menu_mode = 1; | 888 | single_menu_mode = 1; |
889 | } | 889 | } |
890 | 890 | ||
891 | initscr(); | ||
892 | |||
891 | getyx(stdscr, saved_y, saved_x); | 893 | getyx(stdscr, saved_y, saved_x); |
892 | if (init_dialog(NULL)) { | 894 | if (init_dialog(NULL)) { |
893 | fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); | 895 | fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); |
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl new file mode 100644 index 000000000000..95984db8e1e0 --- /dev/null +++ b/scripts/kconfig/streamline_config.pl | |||
@@ -0,0 +1,366 @@ | |||
1 | #!/usr/bin/perl -w | ||
2 | # | ||
3 | # Copywrite 2005-2009 - Steven Rostedt | ||
4 | # Licensed under the terms of the GNU GPL License version 2 | ||
5 | # | ||
6 | # It's simple enough to figure out how this works. | ||
7 | # If not, then you can ask me at stripconfig@goodmis.org | ||
8 | # | ||
9 | # What it does? | ||
10 | # | ||
11 | # If you have installed a Linux kernel from a distribution | ||
12 | # that turns on way too many modules than you need, and | ||
13 | # you only want the modules you use, then this program | ||
14 | # is perfect for you. | ||
15 | # | ||
16 | # It gives you the ability to turn off all the modules that are | ||
17 | # not loaded on your system. | ||
18 | # | ||
19 | # Howto: | ||
20 | # | ||
21 | # 1. Boot up the kernel that you want to stream line the config on. | ||
22 | # 2. Change directory to the directory holding the source of the | ||
23 | # kernel that you just booted. | ||
24 | # 3. Copy the configuraton file to this directory as .config | ||
25 | # 4. Have all your devices that you need modules for connected and | ||
26 | # operational (make sure that their corresponding modules are loaded) | ||
27 | # 5. Run this script redirecting the output to some other file | ||
28 | # like config_strip. | ||
29 | # 6. Back up your old config (if you want too). | ||
30 | # 7. copy the config_strip file to .config | ||
31 | # 8. Run "make oldconfig" | ||
32 | # | ||
33 | # Now your kernel is ready to be built with only the modules that | ||
34 | # are loaded. | ||
35 | # | ||
36 | # Here's what I did with my Debian distribution. | ||
37 | # | ||
38 | # cd /usr/src/linux-2.6.10 | ||
39 | # cp /boot/config-2.6.10-1-686-smp .config | ||
40 | # ~/bin/streamline_config > config_strip | ||
41 | # mv .config config_sav | ||
42 | # mv config_strip .config | ||
43 | # make oldconfig | ||
44 | # | ||
45 | my $config = ".config"; | ||
46 | my $linuxpath = "."; | ||
47 | |||
48 | my $uname = `uname -r`; | ||
49 | chomp $uname; | ||
50 | |||
51 | my @searchconfigs = ( | ||
52 | { | ||
53 | "file" => ".config", | ||
54 | "exec" => "cat", | ||
55 | }, | ||
56 | { | ||
57 | "file" => "/proc/config.gz", | ||
58 | "exec" => "zcat", | ||
59 | }, | ||
60 | { | ||
61 | "file" => "/boot/config-$uname", | ||
62 | "exec" => "cat", | ||
63 | }, | ||
64 | { | ||
65 | "file" => "/boot/vmlinuz-$uname", | ||
66 | "exec" => "scripts/extract-ikconfig", | ||
67 | "test" => "scripts/extract-ikconfig", | ||
68 | }, | ||
69 | { | ||
70 | "file" => "vmlinux", | ||
71 | "exec" => "scripts/extract-ikconfig", | ||
72 | "test" => "scripts/extract-ikconfig", | ||
73 | }, | ||
74 | { | ||
75 | "file" => "/lib/modules/$uname/kernel/kernel/configs.ko", | ||
76 | "exec" => "scripts/extract-ikconfig", | ||
77 | "test" => "scripts/extract-ikconfig", | ||
78 | }, | ||
79 | { | ||
80 | "file" => "kernel/configs.ko", | ||
81 | "exec" => "scripts/extract-ikconfig", | ||
82 | "test" => "scripts/extract-ikconfig", | ||
83 | }, | ||
84 | { | ||
85 | "file" => "kernel/configs.o", | ||
86 | "exec" => "scripts/extract-ikconfig", | ||
87 | "test" => "scripts/extract-ikconfig", | ||
88 | }, | ||
89 | ); | ||
90 | |||
91 | sub find_config { | ||
92 | foreach my $conf (@searchconfigs) { | ||
93 | my $file = $conf->{"file"}; | ||
94 | |||
95 | next if ( ! -f "$file"); | ||
96 | |||
97 | if (defined($conf->{"test"})) { | ||
98 | `$conf->{"test"} $conf->{"file"} 2>/dev/null`; | ||
99 | next if ($?); | ||
100 | } | ||
101 | |||
102 | my $exec = $conf->{"exec"}; | ||
103 | |||
104 | print STDERR "using config: '$file'\n"; | ||
105 | |||
106 | open(CIN, "$exec $file |") || die "Failed to run $exec $file"; | ||
107 | return; | ||
108 | } | ||
109 | die "No config file found"; | ||
110 | } | ||
111 | |||
112 | find_config; | ||
113 | |||
114 | my @makefiles = `find $linuxpath -name Makefile`; | ||
115 | my %depends; | ||
116 | my %selects; | ||
117 | my %prompts; | ||
118 | my %objects; | ||
119 | my $var; | ||
120 | my $cont = 0; | ||
121 | |||
122 | # Get the top level Kconfig file (passed in) | ||
123 | my $kconfig = $ARGV[0]; | ||
124 | |||
125 | # prevent recursion | ||
126 | my %read_kconfigs; | ||
127 | |||
128 | sub read_kconfig { | ||
129 | my ($kconfig) = @_; | ||
130 | |||
131 | my $state = "NONE"; | ||
132 | my $config; | ||
133 | my @kconfigs; | ||
134 | |||
135 | open(KIN, $kconfig) || die "Can't open $kconfig"; | ||
136 | while (<KIN>) { | ||
137 | chomp; | ||
138 | |||
139 | # collect any Kconfig sources | ||
140 | if (/^source\s*"(.*)"/) { | ||
141 | $kconfigs[$#kconfigs+1] = $1; | ||
142 | } | ||
143 | |||
144 | # configs found | ||
145 | if (/^\s*config\s+(\S+)\s*$/) { | ||
146 | $state = "NEW"; | ||
147 | $config = $1; | ||
148 | |||
149 | # collect the depends for the config | ||
150 | } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) { | ||
151 | $state = "DEP"; | ||
152 | $depends{$config} = $1; | ||
153 | } elsif ($state eq "DEP" && /^\s*depends\s+on\s+(.*)$/) { | ||
154 | $depends{$config} .= " " . $1; | ||
155 | |||
156 | # Get the configs that select this config | ||
157 | } elsif ($state ne "NONE" && /^\s*select\s+(\S+)/) { | ||
158 | if (defined($selects{$1})) { | ||
159 | $selects{$1} .= " " . $config; | ||
160 | } else { | ||
161 | $selects{$1} = $config; | ||
162 | } | ||
163 | |||
164 | # configs without prompts must be selected | ||
165 | } elsif ($state ne "NONE" && /^\s*tristate\s\S/) { | ||
166 | # note if the config has a prompt | ||
167 | $prompt{$config} = 1; | ||
168 | |||
169 | # stop on "help" | ||
170 | } elsif (/^\s*help\s*$/) { | ||
171 | $state = "NONE"; | ||
172 | } | ||
173 | } | ||
174 | close(KIN); | ||
175 | |||
176 | # read in any configs that were found. | ||
177 | foreach $kconfig (@kconfigs) { | ||
178 | if (!defined($read_kconfigs{$kconfig})) { | ||
179 | $read_kconfigs{$kconfig} = 1; | ||
180 | read_kconfig($kconfig); | ||
181 | } | ||
182 | } | ||
183 | } | ||
184 | |||
185 | if ($kconfig) { | ||
186 | read_kconfig($kconfig); | ||
187 | } | ||
188 | |||
189 | # Read all Makefiles to map the configs to the objects | ||
190 | foreach my $makefile (@makefiles) { | ||
191 | chomp $makefile; | ||
192 | |||
193 | open(MIN,$makefile) || die "Can't open $makefile"; | ||
194 | while (<MIN>) { | ||
195 | my $objs; | ||
196 | |||
197 | # is this a line after a line with a backslash? | ||
198 | if ($cont && /(\S.*)$/) { | ||
199 | $objs = $1; | ||
200 | } | ||
201 | $cont = 0; | ||
202 | |||
203 | # collect objects after obj-$(CONFIG_FOO_BAR) | ||
204 | if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) { | ||
205 | $var = $1; | ||
206 | $objs = $2; | ||
207 | } | ||
208 | if (defined($objs)) { | ||
209 | # test if the line ends with a backslash | ||
210 | if ($objs =~ m,(.*)\\$,) { | ||
211 | $objs = $1; | ||
212 | $cont = 1; | ||
213 | } | ||
214 | |||
215 | foreach my $obj (split /\s+/,$objs) { | ||
216 | $obj =~ s/-/_/g; | ||
217 | if ($obj =~ /(.*)\.o$/) { | ||
218 | # Objects may bes enabled by more than one config. | ||
219 | # Store configs in an array. | ||
220 | my @arr; | ||
221 | |||
222 | if (defined($objects{$1})) { | ||
223 | @arr = @{$objects{$1}}; | ||
224 | } | ||
225 | |||
226 | $arr[$#arr+1] = $var; | ||
227 | |||
228 | # The objects have a hash mapping to a reference | ||
229 | # of an array of configs. | ||
230 | $objects{$1} = \@arr; | ||
231 | } | ||
232 | } | ||
233 | } | ||
234 | } | ||
235 | close(MIN); | ||
236 | } | ||
237 | |||
238 | my %modules; | ||
239 | |||
240 | # see what modules are loaded on this system | ||
241 | open(LIN,"/sbin/lsmod|") || die "Cant lsmod"; | ||
242 | while (<LIN>) { | ||
243 | next if (/^Module/); # Skip the first line. | ||
244 | if (/^(\S+)/) { | ||
245 | $modules{$1} = 1; | ||
246 | } | ||
247 | } | ||
248 | close (LIN); | ||
249 | |||
250 | # add to the configs hash all configs that are needed to enable | ||
251 | # a loaded module. | ||
252 | my %configs; | ||
253 | foreach my $module (keys(%modules)) { | ||
254 | if (defined($objects{$module})) { | ||
255 | @arr = @{$objects{$module}}; | ||
256 | foreach my $conf (@arr) { | ||
257 | $configs{$conf} = $module; | ||
258 | } | ||
259 | } else { | ||
260 | # Most likely, someone has a custom (binary?) module loaded. | ||
261 | print STDERR "$module config not found!!\n"; | ||
262 | } | ||
263 | } | ||
264 | |||
265 | my $valid = "A-Za-z_0-9"; | ||
266 | my $repeat = 1; | ||
267 | |||
268 | # | ||
269 | # Note, we do not care about operands (like: &&, ||, !) we want to add any | ||
270 | # config that is in the depend list of another config. This script does | ||
271 | # not enable configs that are not already enabled. If we come across a | ||
272 | # config A that depends on !B, we can still add B to the list of depends | ||
273 | # to keep on. If A was on in the original config, B would not have been | ||
274 | # and B would not be turned on by this script. | ||
275 | # | ||
276 | sub parse_config_dep_select | ||
277 | { | ||
278 | my ($p) = @_; | ||
279 | |||
280 | while ($p =~ /[$valid]/) { | ||
281 | |||
282 | if ($p =~ /^[^$valid]*([$valid]+)/) { | ||
283 | my $conf = "CONFIG_" . $1; | ||
284 | |||
285 | $p =~ s/^[^$valid]*[$valid]+//; | ||
286 | |||
287 | if (!defined($configs{$conf})) { | ||
288 | # We must make sure that this config has its | ||
289 | # dependencies met. | ||
290 | $repeat = 1; # do again | ||
291 | $configs{$conf} = 1; | ||
292 | } | ||
293 | } else { | ||
294 | die "this should never happen"; | ||
295 | } | ||
296 | } | ||
297 | } | ||
298 | |||
299 | while ($repeat) { | ||
300 | $repeat = 0; | ||
301 | |||
302 | foreach my $config (keys %configs) { | ||
303 | $config =~ s/^CONFIG_//; | ||
304 | |||
305 | if (defined($depends{$config})) { | ||
306 | # This config has dependencies. Make sure they are also included | ||
307 | parse_config_dep_select $depends{$config}; | ||
308 | } | ||
309 | |||
310 | if (defined($prompt{$config}) || !defined($selects{$config})) { | ||
311 | next; | ||
312 | } | ||
313 | |||
314 | # config has no prompt and must be selected. | ||
315 | parse_config_dep_select $selects{$config}; | ||
316 | } | ||
317 | } | ||
318 | |||
319 | my %setconfigs; | ||
320 | |||
321 | # Finally, read the .config file and turn off any module enabled that | ||
322 | # we could not find a reason to keep enabled. | ||
323 | while(<CIN>) { | ||
324 | |||
325 | if (/CONFIG_IKCONFIG/) { | ||
326 | if (/# CONFIG_IKCONFIG is not set/) { | ||
327 | # enable IKCONFIG at least as a module | ||
328 | print "CONFIG_IKCONFIG=m\n"; | ||
329 | # don't ask about PROC | ||
330 | print "# CONFIG_IKCONFIG_PROC is not set\n"; | ||
331 | } else { | ||
332 | print; | ||
333 | } | ||
334 | next; | ||
335 | } | ||
336 | |||
337 | if (/^(CONFIG.*)=(m|y)/) { | ||
338 | if (defined($configs{$1})) { | ||
339 | $setconfigs{$1} = $2; | ||
340 | } elsif ($2 eq "m") { | ||
341 | print "# $1 is not set\n"; | ||
342 | next; | ||
343 | } | ||
344 | } | ||
345 | print; | ||
346 | } | ||
347 | close(CIN); | ||
348 | |||
349 | # Integrity check, make sure all modules that we want enabled do | ||
350 | # indeed have their configs set. | ||
351 | loop: | ||
352 | foreach my $module (keys(%modules)) { | ||
353 | if (defined($objects{$module})) { | ||
354 | my @arr = @{$objects{$module}}; | ||
355 | foreach my $conf (@arr) { | ||
356 | if (defined($setconfigs{$conf})) { | ||
357 | next loop; | ||
358 | } | ||
359 | } | ||
360 | print STDERR "module $module did not have configs"; | ||
361 | foreach my $conf (@arr) { | ||
362 | print STDERR " " , $conf; | ||
363 | } | ||
364 | print STDERR "\n"; | ||
365 | } | ||
366 | } | ||
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index ed591e9b7d1d..ea9f8a58678f 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -1426,6 +1426,8 @@ sub dump_struct($$) { | |||
1426 | # strip comments: | 1426 | # strip comments: |
1427 | $members =~ s/\/\*.*?\*\///gos; | 1427 | $members =~ s/\/\*.*?\*\///gos; |
1428 | $nested =~ s/\/\*.*?\*\///gos; | 1428 | $nested =~ s/\/\*.*?\*\///gos; |
1429 | # strip kmemcheck_bitfield_{begin,end}.*; | ||
1430 | $members =~ s/kmemcheck_bitfield_.*?;//gos; | ||
1429 | 1431 | ||
1430 | create_parameterlist($members, ';', $file); | 1432 | create_parameterlist($members, ';', $file); |
1431 | check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested); | 1433 | check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested); |
@@ -1468,8 +1470,6 @@ sub dump_enum($$) { | |||
1468 | } | 1470 | } |
1469 | 1471 | ||
1470 | } | 1472 | } |
1471 | # strip kmemcheck_bitfield_{begin,end}.*; | ||
1472 | $members =~ s/kmemcheck_bitfield_.*?;//gos; | ||
1473 | 1473 | ||
1474 | output_declaration($declaration_name, | 1474 | output_declaration($declaration_name, |
1475 | 'enum', | 1475 | 'enum', |
@@ -1995,6 +1995,7 @@ sub process_file($) { | |||
1995 | my $identifier; | 1995 | my $identifier; |
1996 | my $func; | 1996 | my $func; |
1997 | my $descr; | 1997 | my $descr; |
1998 | my $in_purpose = 0; | ||
1998 | my $initial_section_counter = $section_counter; | 1999 | my $initial_section_counter = $section_counter; |
1999 | 2000 | ||
2000 | if (defined($ENV{'SRCTREE'})) { | 2001 | if (defined($ENV{'SRCTREE'})) { |
@@ -2044,6 +2045,7 @@ sub process_file($) { | |||
2044 | $descr =~ s/\s*$//; | 2045 | $descr =~ s/\s*$//; |
2045 | $descr =~ s/\s+/ /; | 2046 | $descr =~ s/\s+/ /; |
2046 | $declaration_purpose = xml_escape($descr); | 2047 | $declaration_purpose = xml_escape($descr); |
2048 | $in_purpose = 1; | ||
2047 | } else { | 2049 | } else { |
2048 | $declaration_purpose = ""; | 2050 | $declaration_purpose = ""; |
2049 | } | 2051 | } |
@@ -2090,6 +2092,7 @@ sub process_file($) { | |||
2090 | } | 2092 | } |
2091 | 2093 | ||
2092 | $in_doc_sect = 1; | 2094 | $in_doc_sect = 1; |
2095 | $in_purpose = 0; | ||
2093 | $contents = $newcontents; | 2096 | $contents = $newcontents; |
2094 | if ($contents ne "") { | 2097 | if ($contents ne "") { |
2095 | while ((substr($contents, 0, 1) eq " ") || | 2098 | while ((substr($contents, 0, 1) eq " ") || |
@@ -2119,11 +2122,19 @@ sub process_file($) { | |||
2119 | } elsif (/$doc_content/) { | 2122 | } elsif (/$doc_content/) { |
2120 | # miguel-style comment kludge, look for blank lines after | 2123 | # miguel-style comment kludge, look for blank lines after |
2121 | # @parameter line to signify start of description | 2124 | # @parameter line to signify start of description |
2122 | if ($1 eq "" && | 2125 | if ($1 eq "") { |
2123 | ($section =~ m/^@/ || $section eq $section_context)) { | 2126 | if ($section =~ m/^@/ || $section eq $section_context) { |
2124 | dump_section($file, $section, xml_escape($contents)); | 2127 | dump_section($file, $section, xml_escape($contents)); |
2125 | $section = $section_default; | 2128 | $section = $section_default; |
2126 | $contents = ""; | 2129 | $contents = ""; |
2130 | } else { | ||
2131 | $contents .= "\n"; | ||
2132 | } | ||
2133 | $in_purpose = 0; | ||
2134 | } elsif ($in_purpose == 1) { | ||
2135 | # Continued declaration purpose | ||
2136 | chomp($declaration_purpose); | ||
2137 | $declaration_purpose .= " " . xml_escape($1); | ||
2127 | } else { | 2138 | } else { |
2128 | $contents .= $1 . "\n"; | 2139 | $contents .= $1 . "\n"; |
2129 | } | 2140 | } |
diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl index 528492bcba5b..89774011965d 100644 --- a/scripts/markup_oops.pl +++ b/scripts/markup_oops.pl | |||
@@ -1,6 +1,7 @@ | |||
1 | #!/usr/bin/perl | 1 | #!/usr/bin/perl |
2 | 2 | ||
3 | use File::Basename; | 3 | use File::Basename; |
4 | use Math::BigInt; | ||
4 | 5 | ||
5 | # Copyright 2008, Intel Corporation | 6 | # Copyright 2008, Intel Corporation |
6 | # | 7 | # |
@@ -172,8 +173,8 @@ while (<STDIN>) { | |||
172 | parse_x86_regs($line); | 173 | parse_x86_regs($line); |
173 | } | 174 | } |
174 | 175 | ||
175 | my $decodestart = hex($target) - hex($func_offset); | 176 | my $decodestart = Math::BigInt->from_hex("0x$target") - Math::BigInt->from_hex("0x$func_offset"); |
176 | my $decodestop = hex($target) + 8192; | 177 | my $decodestop = Math::BigInt->from_hex("0x$target") + 8192; |
177 | if ($target eq "0") { | 178 | if ($target eq "0") { |
178 | print "No oops found!\n"; | 179 | print "No oops found!\n"; |
179 | print "Usage: \n"; | 180 | print "Usage: \n"; |
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index aadc5223dcdb..ecf9c7dc1825 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c | |||
@@ -334,8 +334,6 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md) | |||
334 | deps_drivers/net/dummy.o := \ | 334 | deps_drivers/net/dummy.o := \ |
335 | drivers/net/dummy.c \ | 335 | drivers/net/dummy.c \ |
336 | $(wildcard include/config/net/fastroute.h) \ | 336 | $(wildcard include/config/net/fastroute.h) \ |
337 | include/linux/config.h \ | ||
338 | $(wildcard include/config/h.h) \ | ||
339 | include/linux/module.h \ | 337 | include/linux/module.h \ |
340 | 338 | ||
341 | Sum all files in the same dir or subdirs. | 339 | Sum all files in the same dir or subdirs. |
diff --git a/scripts/module-common.lds b/scripts/module-common.lds new file mode 100644 index 000000000000..47a1f9ae0ede --- /dev/null +++ b/scripts/module-common.lds | |||
@@ -0,0 +1,8 @@ | |||
1 | /* | ||
2 | * Common module linker script, always used when linking a module. | ||
3 | * Archs are free to supply their own linker scripts. ld will | ||
4 | * combine them automatically. | ||
5 | */ | ||
6 | SECTIONS { | ||
7 | /DISCARD/ : { *(.discard) } | ||
8 | } | ||
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 01c2d13dd020..8b357b0bd250 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb | |||
@@ -16,6 +16,8 @@ create_package() { | |||
16 | local pname="$1" pdir="$2" | 16 | local pname="$1" pdir="$2" |
17 | 17 | ||
18 | cp debian/copyright "$pdir/usr/share/doc/$pname/" | 18 | cp debian/copyright "$pdir/usr/share/doc/$pname/" |
19 | cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian" | ||
20 | gzip -9 "$pdir/usr/share/doc/$pname/changelog.Debian" | ||
19 | 21 | ||
20 | # Fix ownership and permissions | 22 | # Fix ownership and permissions |
21 | chown -R root:root "$pdir" | 23 | chown -R root:root "$pdir" |
@@ -87,7 +89,7 @@ for script in postinst postrm preinst prerm ; do | |||
87 | set -e | 89 | set -e |
88 | 90 | ||
89 | # Pass maintainer script parameters to hook scripts | 91 | # Pass maintainer script parameters to hook scripts |
90 | export DEB_MAINT_PARAMS="\$@" | 92 | export DEB_MAINT_PARAMS="\$*" |
91 | 93 | ||
92 | test -d $debhookdir/$script.d && run-parts --arg="$version" $debhookdir/$script.d | 94 | test -d $debhookdir/$script.d && run-parts --arg="$version" $debhookdir/$script.d |
93 | exit 0 | 95 | exit 0 |
diff --git a/scripts/pnmtologo.c b/scripts/pnmtologo.c index 64f5ddb09ea6..5c113123ed9f 100644 --- a/scripts/pnmtologo.c +++ b/scripts/pnmtologo.c | |||
@@ -237,7 +237,7 @@ static void write_header(void) | |||
237 | fprintf(out, " * Linux logo %s\n", logoname); | 237 | fprintf(out, " * Linux logo %s\n", logoname); |
238 | fputs(" */\n\n", out); | 238 | fputs(" */\n\n", out); |
239 | fputs("#include <linux/linux_logo.h>\n\n", out); | 239 | fputs("#include <linux/linux_logo.h>\n\n", out); |
240 | fprintf(out, "static const unsigned char %s_data[] __initconst = {\n", | 240 | fprintf(out, "static unsigned char %s_data[] __initdata = {\n", |
241 | logoname); | 241 | logoname); |
242 | } | 242 | } |
243 | 243 | ||
@@ -374,7 +374,7 @@ static void write_logo_clut224(void) | |||
374 | fputs("\n};\n\n", out); | 374 | fputs("\n};\n\n", out); |
375 | 375 | ||
376 | /* write logo clut */ | 376 | /* write logo clut */ |
377 | fprintf(out, "static const unsigned char %s_clut[] __initconst = {\n", | 377 | fprintf(out, "static unsigned char %s_clut[] __initdata = {\n", |
378 | logoname); | 378 | logoname); |
379 | write_hex_cnt = 0; | 379 | write_hex_cnt = 0; |
380 | for (i = 0; i < logo_clutsize; i++) { | 380 | for (i = 0; i < logo_clutsize; i++) { |
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 7109e2b5bc0a..090d300d7394 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
@@ -57,7 +57,6 @@ | |||
57 | # call mcount (offset: 0x5) | 57 | # call mcount (offset: 0x5) |
58 | # [...] | 58 | # [...] |
59 | # ret | 59 | # ret |
60 | # .globl my_func | ||
61 | # other_func: | 60 | # other_func: |
62 | # [...] | 61 | # [...] |
63 | # call mcount (offset: 0x1b) | 62 | # call mcount (offset: 0x1b) |
@@ -393,7 +392,7 @@ while (<IN>) { | |||
393 | $read_function = 0; | 392 | $read_function = 0; |
394 | } | 393 | } |
395 | # print out any recorded offsets | 394 | # print out any recorded offsets |
396 | update_funcs() if ($text_found); | 395 | update_funcs() if (defined($ref_func)); |
397 | 396 | ||
398 | # reset all markers and arrays | 397 | # reset all markers and arrays |
399 | $text_found = 0; | 398 | $text_found = 0; |
@@ -403,7 +402,6 @@ while (<IN>) { | |||
403 | # section found, now is this a start of a function? | 402 | # section found, now is this a start of a function? |
404 | } elsif ($read_function && /$function_regex/) { | 403 | } elsif ($read_function && /$function_regex/) { |
405 | $text_found = 1; | 404 | $text_found = 1; |
406 | $offset = hex $1; | ||
407 | $text = $2; | 405 | $text = $2; |
408 | 406 | ||
409 | # if this is either a local function or a weak function | 407 | # if this is either a local function or a weak function |
@@ -412,10 +410,15 @@ while (<IN>) { | |||
412 | if (!defined($locals{$text}) && !defined($weak{$text})) { | 410 | if (!defined($locals{$text}) && !defined($weak{$text})) { |
413 | $ref_func = $text; | 411 | $ref_func = $text; |
414 | $read_function = 0; | 412 | $read_function = 0; |
413 | $offset = hex $1; | ||
415 | } else { | 414 | } else { |
416 | # if we already have a function, and this is weak, skip it | 415 | # if we already have a function, and this is weak, skip it |
417 | if (!defined($ref_func) || !defined($weak{$text})) { | 416 | if (!defined($ref_func) && !defined($weak{$text}) && |
417 | # PPC64 can have symbols that start with .L and | ||
418 | # gcc considers these special. Don't use them! | ||
419 | $text !~ /^\.L/) { | ||
418 | $ref_func = $text; | 420 | $ref_func = $text; |
421 | $offset = hex $1; | ||
419 | } | 422 | } |
420 | } | 423 | } |
421 | } elsif ($read_headers && /$mcount_section/) { | 424 | } elsif ($read_headers && /$mcount_section/) { |
@@ -440,7 +443,7 @@ while (<IN>) { | |||
440 | } | 443 | } |
441 | 444 | ||
442 | # dump out anymore offsets that may have been found | 445 | # dump out anymore offsets that may have been found |
443 | update_funcs() if ($text_found); | 446 | update_funcs() if (defined($ref_func)); |
444 | 447 | ||
445 | # If we did not find any mcount callers, we are done (do nothing). | 448 | # If we did not find any mcount callers, we are done (do nothing). |
446 | if (!$opened) { | 449 | if (!$opened) { |
diff --git a/scripts/tracing/power.pl b/scripts/tracing/power.pl deleted file mode 100644 index 4f729b3501e0..000000000000 --- a/scripts/tracing/power.pl +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | # Copyright 2008, Intel Corporation | ||
4 | # | ||
5 | # This file is part of the Linux kernel | ||
6 | # | ||
7 | # This program file is free software; you can redistribute it and/or modify it | ||
8 | # under the terms of the GNU General Public License as published by the | ||
9 | # Free Software Foundation; version 2 of the License. | ||
10 | # | ||
11 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
14 | # for more details. | ||
15 | # | ||
16 | # You should have received a copy of the GNU General Public License | ||
17 | # along with this program in a file named COPYING; if not, write to the | ||
18 | # Free Software Foundation, Inc., | ||
19 | # 51 Franklin Street, Fifth Floor, | ||
20 | # Boston, MA 02110-1301 USA | ||
21 | # | ||
22 | # Authors: | ||
23 | # Arjan van de Ven <arjan@linux.intel.com> | ||
24 | |||
25 | |||
26 | # | ||
27 | # This script turns a cstate ftrace output into a SVG graphic that shows | ||
28 | # historic C-state information | ||
29 | # | ||
30 | # | ||
31 | # cat /sys/kernel/debug/tracing/trace | perl power.pl > out.svg | ||
32 | # | ||
33 | |||
34 | my @styles; | ||
35 | my $base = 0; | ||
36 | |||
37 | my @pstate_last; | ||
38 | my @pstate_level; | ||
39 | |||
40 | $styles[0] = "fill:rgb(0,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
41 | $styles[1] = "fill:rgb(0,255,0);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
42 | $styles[2] = "fill:rgb(255,0,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
43 | $styles[3] = "fill:rgb(255,255,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
44 | $styles[4] = "fill:rgb(255,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
45 | $styles[5] = "fill:rgb(0,255,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
46 | $styles[6] = "fill:rgb(0,128,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
47 | $styles[7] = "fill:rgb(0,255,128);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
48 | $styles[8] = "fill:rgb(0,25,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; | ||
49 | |||
50 | |||
51 | print "<?xml version=\"1.0\" standalone=\"no\"?> \n"; | ||
52 | print "<svg width=\"10000\" height=\"100%\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n"; | ||
53 | |||
54 | my $scale = 30000.0; | ||
55 | while (<>) { | ||
56 | my $line = $_; | ||
57 | if ($line =~ /([0-9\.]+)\] CSTATE: Going to C([0-9]) on cpu ([0-9]+) for ([0-9\.]+)/) { | ||
58 | if ($base == 0) { | ||
59 | $base = $1; | ||
60 | } | ||
61 | my $time = $1 - $base; | ||
62 | $time = $time * $scale; | ||
63 | my $C = $2; | ||
64 | my $cpu = $3; | ||
65 | my $y = 400 * $cpu; | ||
66 | my $duration = $4 * $scale; | ||
67 | my $msec = int($4 * 100000)/100.0; | ||
68 | my $height = $C * 20; | ||
69 | $style = $styles[$C]; | ||
70 | |||
71 | $y = $y + 140 - $height; | ||
72 | |||
73 | $x2 = $time + 4; | ||
74 | $y2 = $y + 4; | ||
75 | |||
76 | |||
77 | print "<rect x=\"$time\" width=\"$duration\" y=\"$y\" height=\"$height\" style=\"$style\"/>\n"; | ||
78 | print "<text transform=\"translate($x2,$y2) rotate(90)\">C$C $msec</text>\n"; | ||
79 | } | ||
80 | if ($line =~ /([0-9\.]+)\] PSTATE: Going to P([0-9]) on cpu ([0-9]+)/) { | ||
81 | my $time = $1 - $base; | ||
82 | my $state = $2; | ||
83 | my $cpu = $3; | ||
84 | |||
85 | if (defined($pstate_last[$cpu])) { | ||
86 | my $from = $pstate_last[$cpu]; | ||
87 | my $oldstate = $pstate_state[$cpu]; | ||
88 | my $duration = ($time-$from) * $scale; | ||
89 | |||
90 | $from = $from * $scale; | ||
91 | my $to = $from + $duration; | ||
92 | my $height = 140 - ($oldstate * (140/8)); | ||
93 | |||
94 | my $y = 400 * $cpu + 200 + $height; | ||
95 | my $y2 = $y+4; | ||
96 | my $style = $styles[8]; | ||
97 | |||
98 | print "<rect x=\"$from\" y=\"$y\" width=\"$duration\" height=\"5\" style=\"$style\"/>\n"; | ||
99 | print "<text transform=\"translate($from,$y2)\">P$oldstate (cpu $cpu)</text>\n"; | ||
100 | }; | ||
101 | |||
102 | $pstate_last[$cpu] = $time; | ||
103 | $pstate_state[$cpu] = $state; | ||
104 | } | ||
105 | } | ||
106 | |||
107 | |||
108 | print "</svg>\n"; | ||