aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2010-08-04 08:05:07 -0400
committerMichal Marek <mmarek@suse.cz>2010-08-04 08:05:07 -0400
commit7a996d3ab150bb0e1b71fa182f70199a703efdd1 (patch)
tree96a36947d90c9b96580899abd38cb3b70cd9d40b /scripts
parent7cf3d73b4360e91b14326632ab1aeda4cb26308d (diff)
parent9fe6206f400646a2322096b56c59891d530e8d51 (diff)
Merge commit 'v2.6.35' into kbuild/kconfig
Conflicts: scripts/kconfig/Makefile
Diffstat (limited to 'scripts')
-rw-r--r--scripts/.gitignore1
-rw-r--r--scripts/Makefile.lib4
-rw-r--r--scripts/Makefile.modbuiltin5
-rw-r--r--scripts/binoffset.c163
-rwxr-xr-xscripts/checkpatch.pl109
-rwxr-xr-xscripts/extract-ikconfig127
-rw-r--r--scripts/gen_initramfs_list.sh1
-rwxr-xr-xscripts/get_maintainer.pl255
-rw-r--r--scripts/gfp-translate2
-rw-r--r--scripts/kconfig/Makefile18
-rw-r--r--scripts/kconfig/nconf.gui.c2
-rw-r--r--scripts/kconfig/streamline_config.pl68
-rw-r--r--scripts/kconfig/util.c2
-rwxr-xr-xscripts/kernel-doc21
-rw-r--r--scripts/markup_oops.pl2
-rw-r--r--scripts/mod/file2alias.c57
-rw-r--r--scripts/mod/modpost.c7
-rw-r--r--scripts/package/Makefile2
-rwxr-xr-xscripts/package/mkspec2
-rwxr-xr-xscripts/recordmcount.pl39
-rw-r--r--scripts/selinux/genheaders/genheaders.c2
-rwxr-xr-xscripts/setlocalversion183
22 files changed, 670 insertions, 402 deletions
diff --git a/scripts/.gitignore b/scripts/.gitignore
index 52cab46ae35a..c5d5db54c009 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -6,5 +6,4 @@ kallsyms
6pnmtologo 6pnmtologo
7bin2c 7bin2c
8unifdef 8unifdef
9binoffset
10ihex2fw 9ihex2fw
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index f3ccdb1b302b..54fd1b700131 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -245,3 +245,7 @@ quiet_cmd_lzo = LZO $@
245cmd_lzo = (cat $(filter-out FORCE,$^) | \ 245cmd_lzo = (cat $(filter-out FORCE,$^) | \
246 lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ 246 lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
247 (rm -f $@ ; false) 247 (rm -f $@ ; false)
248
249# misc stuff
250# ---------------------------------------------------------------------------
251quote:="
diff --git a/scripts/Makefile.modbuiltin b/scripts/Makefile.modbuiltin
index 102a276f6eea..1adb974e6950 100644
--- a/scripts/Makefile.modbuiltin
+++ b/scripts/Makefile.modbuiltin
@@ -14,6 +14,11 @@ __modbuiltin:
14 14
15include scripts/Kbuild.include 15include scripts/Kbuild.include
16 16
17ifneq ($(KBUILD_SRC),)
18# Create output directory if not already present
19_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
20endif
21
17# The filename Kbuild has precedence over Makefile 22# The filename Kbuild has precedence over Makefile
18kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) 23kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
19kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile) 24kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
diff --git a/scripts/binoffset.c b/scripts/binoffset.c
deleted file mode 100644
index 1a2e39b8e3e5..000000000000
--- a/scripts/binoffset.c
+++ /dev/null
@@ -1,163 +0,0 @@
1/***************************************************************************
2 * binoffset.c
3 * (C) 2002 Randy Dunlap <rdunlap@xenotime.net>
4
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19# binoffset.c:
20# - searches a (binary) file for a specified (binary) pattern
21# - returns the offset of the located pattern or ~0 if not found
22# - exits with exit status 0 normally or non-0 if pattern is not found
23# or any other error occurs.
24
25****************************************************************/
26
27#include <stdio.h>
28#include <stdlib.h>
29#include <string.h>
30#include <errno.h>
31#include <unistd.h>
32#include <fcntl.h>
33#include <sys/types.h>
34#include <sys/stat.h>
35#include <sys/mman.h>
36
37#define VERSION "0.1"
38#define BUF_SIZE (16 * 1024)
39#define PAT_SIZE 100
40
41char *progname;
42char *inputname;
43int inputfd;
44unsigned int bix; /* buf index */
45unsigned char patterns [PAT_SIZE] = {0}; /* byte-sized pattern array */
46int pat_len; /* actual number of pattern bytes */
47unsigned char *madr; /* mmap address */
48size_t filesize;
49int num_matches = 0;
50off_t firstloc = 0;
51
52void usage (void)
53{
54 fprintf (stderr, "%s ver. %s\n", progname, VERSION);
55 fprintf (stderr, "usage: %s filename pattern_bytes\n",
56 progname);
57 fprintf (stderr, " [prints location of pattern_bytes in file]\n");
58 exit (1);
59}
60
61void get_pattern (int pat_count, char *pats [])
62{
63 int ix, err, tmp;
64
65#ifdef DEBUG
66 fprintf (stderr,"get_pattern: count = %d\n", pat_count);
67 for (ix = 0; ix < pat_count; ix++)
68 fprintf (stderr, " pat # %d: [%s]\n", ix, pats[ix]);
69#endif
70
71 for (ix = 0; ix < pat_count; ix++) {
72 tmp = 0;
73 err = sscanf (pats[ix], "%5i", &tmp);
74 if (err != 1 || tmp > 0xff) {
75 fprintf (stderr, "pattern or value error in pattern # %d [%s]\n",
76 ix, pats[ix]);
77 usage ();
78 }
79 patterns [ix] = tmp;
80 }
81 pat_len = pat_count;
82}
83
84void search_pattern (void)
85{
86 for (bix = 0; bix < filesize; bix++) {
87 if (madr[bix] == patterns[0]) {
88 if (memcmp (&madr[bix], patterns, pat_len) == 0) {
89 if (num_matches == 0)
90 firstloc = bix;
91 num_matches++;
92 }
93 }
94 }
95}
96
97#ifdef NOTDEF
98size_t get_filesize (int fd)
99{
100 off_t end_off = lseek (fd, 0, SEEK_END);
101 lseek (fd, 0, SEEK_SET);
102 return (size_t) end_off;
103}
104#endif
105
106size_t get_filesize (int fd)
107{
108 int err;
109 struct stat stat;
110
111 err = fstat (fd, &stat);
112 fprintf (stderr, "filesize: %ld\n", err < 0 ? (long)err : stat.st_size);
113 if (err < 0)
114 return err;
115 return (size_t) stat.st_size;
116}
117
118int main (int argc, char *argv [])
119{
120 progname = argv[0];
121
122 if (argc < 3)
123 usage ();
124
125 get_pattern (argc - 2, argv + 2);
126
127 inputname = argv[1];
128
129 inputfd = open (inputname, O_RDONLY);
130 if (inputfd == -1) {
131 fprintf (stderr, "%s: cannot open '%s'\n",
132 progname, inputname);
133 exit (3);
134 }
135
136 filesize = get_filesize (inputfd);
137
138 madr = mmap (0, filesize, PROT_READ, MAP_PRIVATE, inputfd, 0);
139 if (madr == MAP_FAILED) {
140 fprintf (stderr, "mmap error = %d\n", errno);
141 close (inputfd);
142 exit (4);
143 }
144
145 search_pattern ();
146
147 if (munmap (madr, filesize))
148 fprintf (stderr, "munmap error = %d\n", errno);
149
150 if (close (inputfd))
151 fprintf (stderr, "%s: error %d closing '%s'\n",
152 progname, errno, inputname);
153
154 fprintf (stderr, "number of pattern matches = %d\n", num_matches);
155 if (num_matches == 0)
156 firstloc = ~0;
157 printf ("%ld\n", firstloc);
158 fprintf (stderr, "%ld\n", firstloc);
159
160 exit (num_matches ? 0 : 2);
161}
162
163/* end binoffset.c */
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 3257d3d96767..bd88f11b0953 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -145,11 +145,14 @@ our $Sparse = qr{
145 __kprobes| 145 __kprobes|
146 __ref 146 __ref
147 }x; 147 }x;
148
149# Notes to $Attribute:
150# We need \b after 'init' otherwise 'initconst' will cause a false positive in a check
148our $Attribute = qr{ 151our $Attribute = qr{
149 const| 152 const|
150 __read_mostly| 153 __read_mostly|
151 __kprobes| 154 __kprobes|
152 __(?:mem|cpu|dev|)(?:initdata|init)| 155 __(?:mem|cpu|dev|)(?:initdata|initconst|init\b)|
153 ____cacheline_aligned| 156 ____cacheline_aligned|
154 ____cacheline_aligned_in_smp| 157 ____cacheline_aligned_in_smp|
155 ____cacheline_internodealigned_in_smp| 158 ____cacheline_internodealigned_in_smp|
@@ -189,6 +192,14 @@ our $typeTypedefs = qr{(?x:
189 atomic_t 192 atomic_t
190)}; 193)};
191 194
195our $logFunctions = qr{(?x:
196 printk|
197 pr_(debug|dbg|vdbg|devel|info|warning|err|notice|alert|crit|emerg|cont)|
198 dev_(printk|dbg|vdbg|info|warn|err|notice|alert|crit|emerg|WARN)|
199 WARN|
200 panic
201)};
202
192our @typeList = ( 203our @typeList = (
193 qr{void}, 204 qr{void},
194 qr{(?:unsigned\s+)?char}, 205 qr{(?:unsigned\s+)?char},
@@ -1371,18 +1382,38 @@ sub process {
1371 ERROR("trailing whitespace\n" . $herevet); 1382 ERROR("trailing whitespace\n" . $herevet);
1372 } 1383 }
1373 1384
1385# check for Kconfig help text having a real description
1386 if ($realfile =~ /Kconfig/ &&
1387 $line =~ /\+?\s*(---)?help(---)?$/) {
1388 my $length = 0;
1389 for (my $l = $linenr; defined($lines[$l]); $l++) {
1390 my $f = $lines[$l];
1391 $f =~ s/#.*//;
1392 $f =~ s/^\s+//;
1393 next if ($f =~ /^$/);
1394 last if ($f =~ /^\s*config\s/);
1395 $length++;
1396 }
1397 WARN("please write a paragraph that describes the config symbol fully\n" . $herecurr) if ($length < 4);
1398 }
1399
1374# check we are in a valid source file if not then ignore this hunk 1400# check we are in a valid source file if not then ignore this hunk
1375 next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/); 1401 next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);
1376 1402
1377#80 column limit 1403#80 column limit
1378 if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ && 1404 if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ &&
1379 $rawline !~ /^.\s*\*\s*\@$Ident\s/ && 1405 $rawline !~ /^.\s*\*\s*\@$Ident\s/ &&
1380 $line !~ /^\+\s*printk\s*\(\s*(?:KERN_\S+\s*)?"[X\t]*"\s*(?:,|\)\s*;)\s*$/ && 1406 $line !~ /^\+\s*$logFunctions\s*\(\s*(?:KERN_\S+\s*)?"[X\t]*"\s*(?:,|\)\s*;)\s*$/ &&
1381 $length > 80) 1407 $length > 80)
1382 { 1408 {
1383 WARN("line over 80 characters\n" . $herecurr); 1409 WARN("line over 80 characters\n" . $herecurr);
1384 } 1410 }
1385 1411
1412# check for spaces before a quoted newline
1413 if ($rawline =~ /^.*\".*\s\\n/) {
1414 WARN("unnecessary whitespace before a quoted newline\n" . $herecurr);
1415 }
1416
1386# check for adding lines without a newline. 1417# check for adding lines without a newline.
1387 if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) { 1418 if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) {
1388 WARN("adding a line without newline at end of file\n" . $herecurr); 1419 WARN("adding a line without newline at end of file\n" . $herecurr);
@@ -1411,6 +1442,12 @@ sub process {
1411 ERROR("code indent should use tabs where possible\n" . $herevet); 1442 ERROR("code indent should use tabs where possible\n" . $herevet);
1412 } 1443 }
1413 1444
1445# check for space before tabs.
1446 if ($rawline =~ /^\+/ && $rawline =~ / \t/) {
1447 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
1448 WARN("please, no space before tabs\n" . $herevet);
1449 }
1450
1414# check we are in a valid C source file if not then ignore this hunk 1451# check we are in a valid C source file if not then ignore this hunk
1415 next if ($realfile !~ /\.(h|c)$/); 1452 next if ($realfile !~ /\.(h|c)$/);
1416 1453
@@ -2182,8 +2219,10 @@ sub process {
2182 # Find out how long the conditional actually is. 2219 # Find out how long the conditional actually is.
2183 my @newlines = ($c =~ /\n/gs); 2220 my @newlines = ($c =~ /\n/gs);
2184 my $cond_lines = 1 + $#newlines; 2221 my $cond_lines = 1 + $#newlines;
2222 my $stat_real = '';
2185 2223
2186 my $stat_real = raw_line($linenr, $cond_lines); 2224 $stat_real = raw_line($linenr, $cond_lines)
2225 . "\n" if ($cond_lines);
2187 if (defined($stat_real) && $cond_lines > 1) { 2226 if (defined($stat_real) && $cond_lines > 1) {
2188 $stat_real = "[...]\n$stat_real"; 2227 $stat_real = "[...]\n$stat_real";
2189 } 2228 }
@@ -2348,6 +2387,8 @@ sub process {
2348 DECLARE_PER_CPU| 2387 DECLARE_PER_CPU|
2349 DEFINE_PER_CPU| 2388 DEFINE_PER_CPU|
2350 __typeof__\(| 2389 __typeof__\(|
2390 union|
2391 struct|
2351 \.$Ident\s*=\s*| 2392 \.$Ident\s*=\s*|
2352 ^\"|\"$ 2393 ^\"|\"$
2353 }x; 2394 }x;
@@ -2560,6 +2601,11 @@ sub process {
2560 CHK("architecture specific defines should be avoided\n" . $herecurr); 2601 CHK("architecture specific defines should be avoided\n" . $herecurr);
2561 } 2602 }
2562 2603
2604# Check that the storage class is at the beginning of a declaration
2605 if ($line =~ /\b$Storage\b/ && $line !~ /^.\s*$Storage\b/) {
2606 WARN("storage class should be at the beginning of the declaration\n" . $herecurr)
2607 }
2608
2563# check the location of the inline attribute, that it is between 2609# check the location of the inline attribute, that it is between
2564# storage class and type. 2610# storage class and type.
2565 if ($line =~ /\b$Type\s+$Inline\b/ || 2611 if ($line =~ /\b$Type\s+$Inline\b/ ||
@@ -2572,6 +2618,11 @@ sub process {
2572 WARN("plain inline is preferred over $1\n" . $herecurr); 2618 WARN("plain inline is preferred over $1\n" . $herecurr);
2573 } 2619 }
2574 2620
2621# check for sizeof(&)
2622 if ($line =~ /\bsizeof\s*\(\s*\&/) {
2623 WARN("sizeof(& should be avoided\n" . $herecurr);
2624 }
2625
2575# check for new externs in .c files. 2626# check for new externs in .c files.
2576 if ($realfile =~ /\.c$/ && defined $stat && 2627 if ($realfile =~ /\.c$/ && defined $stat &&
2577 $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s) 2628 $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)
@@ -2625,6 +2676,7 @@ sub process {
2625# check for semaphores used as mutexes 2676# check for semaphores used as mutexes
2626 if ($line =~ /^.\s*init_MUTEX_LOCKED\s*\(/) { 2677 if ($line =~ /^.\s*init_MUTEX_LOCKED\s*\(/) {
2627 WARN("consider using a completion\n" . $herecurr); 2678 WARN("consider using a completion\n" . $herecurr);
2679
2628 } 2680 }
2629# recommend strict_strto* over simple_strto* 2681# recommend strict_strto* over simple_strto*
2630 if ($line =~ /\bsimple_(strto.*?)\s*\(/) { 2682 if ($line =~ /\bsimple_(strto.*?)\s*\(/) {
@@ -2634,9 +2686,46 @@ sub process {
2634 if ($line =~ /^.\s*__initcall\s*\(/) { 2686 if ($line =~ /^.\s*__initcall\s*\(/) {
2635 WARN("please use device_initcall() instead of __initcall()\n" . $herecurr); 2687 WARN("please use device_initcall() instead of __initcall()\n" . $herecurr);
2636 } 2688 }
2637# check for struct file_operations, ensure they are const. 2689# check for various ops structs, ensure they are const.
2690 my $struct_ops = qr{acpi_dock_ops|
2691 address_space_operations|
2692 backlight_ops|
2693 block_device_operations|
2694 dentry_operations|
2695 dev_pm_ops|
2696 dma_map_ops|
2697 extent_io_ops|
2698 file_lock_operations|
2699 file_operations|
2700 hv_ops|
2701 ide_dma_ops|
2702 intel_dvo_dev_ops|
2703 item_operations|
2704 iwl_ops|
2705 kgdb_arch|
2706 kgdb_io|
2707 kset_uevent_ops|
2708 lock_manager_operations|
2709 microcode_ops|
2710 mtrr_ops|
2711 neigh_ops|
2712 nlmsvc_binding|
2713 pci_raw_ops|
2714 pipe_buf_operations|
2715 platform_hibernation_ops|
2716 platform_suspend_ops|
2717 proto_ops|
2718 rpc_pipe_ops|
2719 seq_operations|
2720 snd_ac97_build_ops|
2721 soc_pcmcia_socket_ops|
2722 stacktrace_ops|
2723 sysfs_ops|
2724 tty_operations|
2725 usb_mon_operations|
2726 wd_ops}x;
2638 if ($line !~ /\bconst\b/ && 2727 if ($line !~ /\bconst\b/ &&
2639 $line =~ /\bstruct\s+(file_operations|seq_operations)\b/) { 2728 $line =~ /\bstruct\s+($struct_ops)\b/) {
2640 WARN("struct $1 should normally be const\n" . 2729 WARN("struct $1 should normally be const\n" .
2641 $herecurr); 2730 $herecurr);
2642 } 2731 }
@@ -2672,6 +2761,16 @@ sub process {
2672 WARN("use of in_atomic() is incorrect outside core kernel code\n" . $herecurr); 2761 WARN("use of in_atomic() is incorrect outside core kernel code\n" . $herecurr);
2673 } 2762 }
2674 } 2763 }
2764
2765# check for lockdep_set_novalidate_class
2766 if ($line =~ /^.\s*lockdep_set_novalidate_class\s*\(/ ||
2767 $line =~ /__lockdep_no_validate__\s*\)/ ) {
2768 if ($realfile !~ m@^kernel/lockdep@ &&
2769 $realfile !~ m@^include/linux/lockdep@ &&
2770 $realfile !~ m@^drivers/base/core@) {
2771 ERROR("lockdep_no_validate class is reserved for device->mutex.\n" . $herecurr);
2772 }
2773 }
2675 } 2774 }
2676 2775
2677 # If we have no input at all, then there is nothing to report on 2776 # If we have no input at all, then there is nothing to report on
diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig
index de233ff43c1c..37f30d36c944 100755
--- a/scripts/extract-ikconfig
+++ b/scripts/extract-ikconfig
@@ -1,92 +1,53 @@
1#!/bin/sh 1#!/bin/sh
2# extracts .config info from a [b]zImage file 2# ----------------------------------------------------------------------
3# uses: binoffset (new), dd, zcat, strings, grep 3# extract-ikconfig - Extract the .config file from a kernel image
4# $arg1 is [b]zImage filename 4#
5 5# This will only work when the kernel was compiled with CONFIG_IKCONFIG.
6binoffset="./scripts/binoffset" 6#
7test -e $binoffset || cc -o $binoffset ./scripts/binoffset.c || exit 1 7# The obscure use of the "tr" filter is to work around older versions of
8 8# "grep" that report the byte offset of the line instead of the pattern.
9IKCFG_ST="0x49 0x4b 0x43 0x46 0x47 0x5f 0x53 0x54" 9#
10IKCFG_ED="0x49 0x4b 0x43 0x46 0x47 0x5f 0x45 0x44" 10# (c) 2009, Dick Streefland <dick@streefland.net>
11dump_config() { 11# Licensed under the terms of the GNU General Public License.
12 file="$1" 12# ----------------------------------------------------------------------
13 13
14 start=`$binoffset $file $IKCFG_ST 2>/dev/null` 14gz1='\037\213\010'
15 [ "$?" != "0" ] && start="-1" 15gz2='01'
16 if [ "$start" -eq "-1" ]; then 16cf1='IKCFG_ST\037\213\010'
17 return 17cf2='0123456789'
18 fi 18
19 end=`$binoffset $file $IKCFG_ED 2>/dev/null` 19dump_config()
20 [ "$?" != "0" ] && end="-1"
21 if [ "$end" -eq "-1" ]; then
22 return
23 fi
24
25 start=`expr $start + 8`
26 size=`expr $end - $start`
27
28 dd if="$file" ibs=1 skip="$start" count="$size" 2>/dev/null | zcat
29
30 clean_up
31 exit 0
32}
33
34
35usage()
36{
37 echo " usage: extract-ikconfig [b]zImage_filename"
38}
39
40clean_up()
41{ 20{
42 if [ "$TMPFILE" != "" ]; then 21 if pos=`tr "$cf1\n$cf2" "\n$cf2=" < "$1" | grep -abo "^$cf2"`
43 rm -f $TMPFILE 22 then
23 pos=${pos%%:*}
24 tail -c+$(($pos+8)) "$1" | zcat -q
25 exit 0
44 fi 26 fi
45} 27}
46 28
47if [ $# -lt 1 ] 29# Check invocation:
30me=${0##*/}
31img=$1
32if [ $# -ne 1 -o ! -s "$img" ]
48then 33then
49 usage 34 echo "Usage: $me <kernel-image>" >&2
50 exit 1 35 exit 2
51fi 36fi
52 37
53TMPFILE=`mktemp -t ikconfig-XXXXXX` || exit 1 38# Initial attempt for uncompressed images or objects:
54image="$1" 39dump_config "$img"
55 40
56# vmlinux: Attempt to dump the configuration from the file directly 41# That didn't work, so decompress and try again:
57dump_config "$image" 42tmp=/tmp/ikconfig$$
58 43trap "rm -f $tmp" 0
59GZHDR1="0x1f 0x8b 0x08 0x00" 44for pos in `tr "$gz1\n$gz2" "\n$gz2=" < "$img" | grep -abo "^$gz2"`
60GZHDR2="0x1f 0x8b 0x08 0x08" 45do
61 46 pos=${pos%%:*}
62ELFHDR="0x7f 0x45 0x4c 0x46" 47 tail -c+$pos "$img" | zcat 2> /dev/null > $tmp
63 48 dump_config $tmp
64# vmlinux.gz: Check for a compressed images 49done
65off=`$binoffset "$image" $GZHDR1 2>/dev/null` 50
66[ "$?" != "0" ] && off="-1" 51# Bail out:
67if [ "$off" -eq "-1" ]; then 52echo "$me: Cannot find kernel config." >&2
68 off=`$binoffset "$image" $GZHDR2 2>/dev/null`
69 [ "$?" != "0" ] && off="-1"
70fi
71if [ "$off" -eq "0" ]; then
72 zcat <"$image" >"$TMPFILE"
73 dump_config "$TMPFILE"
74elif [ "$off" -ne "-1" ]; then
75 (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \
76 zcat >"$TMPFILE"
77 dump_config "$TMPFILE"
78
79# check if this is simply an ELF file
80else
81 off=`$binoffset "$image" $ELFHDR 2>/dev/null`
82 [ "$?" != "0" ] && off="-1"
83 if [ "$off" -eq "0" ]; then
84 dump_config "$image"
85 fi
86fi
87
88echo "ERROR: Unable to extract kernel configuration information."
89echo " This kernel image may not have the config info."
90
91clean_up
92exit 1 53exit 1
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index f3b5c05ced40..5958fffb2114 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -243,6 +243,7 @@ case "$arg" in
243 echo "$output_file" | grep -q "\.gz$" && compr="gzip -9 -f" 243 echo "$output_file" | grep -q "\.gz$" && compr="gzip -9 -f"
244 echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f" 244 echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f"
245 echo "$output_file" | grep -q "\.lzma$" && compr="lzma -9 -f" 245 echo "$output_file" | grep -q "\.lzma$" && compr="lzma -9 -f"
246 echo "$output_file" | grep -q "\.lzo$" && compr="lzop -9 -f"
246 echo "$output_file" | grep -q "\.cpio$" && compr="cat" 247 echo "$output_file" | grep -q "\.cpio$" && compr="cat"
247 shift 248 shift
248 ;; 249 ;;
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 090f24839700..b2281982f52f 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -13,7 +13,7 @@
13use strict; 13use strict;
14 14
15my $P = $0; 15my $P = $0;
16my $V = '0.23'; 16my $V = '0.24';
17 17
18use Getopt::Long qw(:config no_auto_abbrev); 18use Getopt::Long qw(:config no_auto_abbrev);
19 19
@@ -25,6 +25,7 @@ my $email_list = 1;
25my $email_subscriber_list = 0; 25my $email_subscriber_list = 0;
26my $email_git_penguin_chiefs = 0; 26my $email_git_penguin_chiefs = 0;
27my $email_git = 1; 27my $email_git = 1;
28my $email_git_all_signature_types = 0;
28my $email_git_blame = 0; 29my $email_git_blame = 0;
29my $email_git_min_signatures = 1; 30my $email_git_min_signatures = 1;
30my $email_git_max_maintainers = 5; 31my $email_git_max_maintainers = 5;
@@ -41,6 +42,8 @@ my $web = 0;
41my $subsystem = 0; 42my $subsystem = 0;
42my $status = 0; 43my $status = 0;
43my $keywords = 1; 44my $keywords = 1;
45my $sections = 0;
46my $file_emails = 0;
44my $from_filename = 0; 47my $from_filename = 0;
45my $pattern_depth = 0; 48my $pattern_depth = 0;
46my $version = 0; 49my $version = 0;
@@ -49,9 +52,9 @@ my $help = 0;
49my $exit = 0; 52my $exit = 0;
50 53
51my @penguin_chief = (); 54my @penguin_chief = ();
52push(@penguin_chief,"Linus Torvalds:torvalds\@linux-foundation.org"); 55push(@penguin_chief, "Linus Torvalds:torvalds\@linux-foundation.org");
53#Andrew wants in on most everything - 2009/01/14 56#Andrew wants in on most everything - 2009/01/14
54#push(@penguin_chief,"Andrew Morton:akpm\@linux-foundation.org"); 57#push(@penguin_chief, "Andrew Morton:akpm\@linux-foundation.org");
55 58
56my @penguin_chief_names = (); 59my @penguin_chief_names = ();
57foreach my $chief (@penguin_chief) { 60foreach my $chief (@penguin_chief) {
@@ -61,7 +64,16 @@ foreach my $chief (@penguin_chief) {
61 push(@penguin_chief_names, $chief_name); 64 push(@penguin_chief_names, $chief_name);
62 } 65 }
63} 66}
64my $penguin_chiefs = "\(" . join("|",@penguin_chief_names) . "\)"; 67my $penguin_chiefs = "\(" . join("|", @penguin_chief_names) . "\)";
68
69# Signature types of people who are either
70# a) responsible for the code in question, or
71# b) familiar enough with it to give relevant feedback
72my @signature_tags = ();
73push(@signature_tags, "Signed-off-by:");
74push(@signature_tags, "Reviewed-by:");
75push(@signature_tags, "Acked-by:");
76my $signaturePattern = "\(" . join("|", @signature_tags) . "\)";
65 77
66# rfc822 email address - preloaded methods go here. 78# rfc822 email address - preloaded methods go here.
67my $rfc822_lwsp = "(?:(?:\\r\\n)?[ \\t])"; 79my $rfc822_lwsp = "(?:(?:\\r\\n)?[ \\t])";
@@ -74,8 +86,8 @@ my %VCS_cmds;
74my %VCS_cmds_git = ( 86my %VCS_cmds_git = (
75 "execute_cmd" => \&git_execute_cmd, 87 "execute_cmd" => \&git_execute_cmd,
76 "available" => '(which("git") ne "") && (-d ".git")', 88 "available" => '(which("git") ne "") && (-d ".git")',
77 "find_signers_cmd" => "git log --since=\$email_git_since -- \$file", 89 "find_signers_cmd" => "git log --no-color --since=\$email_git_since -- \$file",
78 "find_commit_signers_cmd" => "git log -1 \$commit", 90 "find_commit_signers_cmd" => "git log --no-color -1 \$commit",
79 "blame_range_cmd" => "git blame -l -L \$diff_start,+\$diff_length \$file", 91 "blame_range_cmd" => "git blame -l -L \$diff_start,+\$diff_length \$file",
80 "blame_file_cmd" => "git blame -l \$file", 92 "blame_file_cmd" => "git blame -l \$file",
81 "commit_pattern" => "^commit [0-9a-f]{40,40}", 93 "commit_pattern" => "^commit [0-9a-f]{40,40}",
@@ -95,9 +107,34 @@ my %VCS_cmds_hg = (
95 "blame_commit_pattern" => "^([0-9a-f]+):" 107 "blame_commit_pattern" => "^([0-9a-f]+):"
96); 108);
97 109
110if (-f "${lk_path}.get_maintainer.conf") {
111 my @conf_args;
112 open(my $conffile, '<', "${lk_path}.get_maintainer.conf")
113 or warn "$P: Can't open .get_maintainer.conf: $!\n";
114 while (<$conffile>) {
115 my $line = $_;
116
117 $line =~ s/\s*\n?$//g;
118 $line =~ s/^\s*//g;
119 $line =~ s/\s+/ /g;
120
121 next if ($line =~ m/^\s*#/);
122 next if ($line =~ m/^\s*$/);
123
124 my @words = split(" ", $line);
125 foreach my $word (@words) {
126 last if ($word =~ m/^#/);
127 push (@conf_args, $word);
128 }
129 }
130 close($conffile);
131 unshift(@ARGV, @conf_args) if @conf_args;
132}
133
98if (!GetOptions( 134if (!GetOptions(
99 'email!' => \$email, 135 'email!' => \$email,
100 'git!' => \$email_git, 136 'git!' => \$email_git,
137 'git-all-signature-types!' => \$email_git_all_signature_types,
101 'git-blame!' => \$email_git_blame, 138 'git-blame!' => \$email_git_blame,
102 'git-chief-penguins!' => \$email_git_penguin_chiefs, 139 'git-chief-penguins!' => \$email_git_penguin_chiefs,
103 'git-min-signatures=i' => \$email_git_min_signatures, 140 'git-min-signatures=i' => \$email_git_min_signatures,
@@ -120,9 +157,11 @@ if (!GetOptions(
120 'web!' => \$web, 157 'web!' => \$web,
121 'pattern-depth=i' => \$pattern_depth, 158 'pattern-depth=i' => \$pattern_depth,
122 'k|keywords!' => \$keywords, 159 'k|keywords!' => \$keywords,
160 'sections!' => \$sections,
161 'fe|file-emails!' => \$file_emails,
123 'f|file' => \$from_filename, 162 'f|file' => \$from_filename,
124 'v|version' => \$version, 163 'v|version' => \$version,
125 'h|help' => \$help, 164 'h|help|usage' => \$help,
126 )) { 165 )) {
127 die "$P: invalid argument - use --help if necessary\n"; 166 die "$P: invalid argument - use --help if necessary\n";
128} 167}
@@ -137,9 +176,9 @@ if ($version != 0) {
137 exit 0; 176 exit 0;
138} 177}
139 178
140if ($#ARGV < 0) { 179if (-t STDIN && !@ARGV) {
141 usage(); 180 # We're talking to a terminal, but have no command line arguments.
142 die "$P: argument missing: patchfile or -f file please\n"; 181 die "$P: missing patchfile or -f file - use --help if necessary\n";
143} 182}
144 183
145if ($output_separator ne ", ") { 184if ($output_separator ne ", ") {
@@ -150,16 +189,24 @@ if ($output_rolestats) {
150 $output_roles = 1; 189 $output_roles = 1;
151} 190}
152 191
153my $selections = $email + $scm + $status + $subsystem + $web; 192if ($sections) {
154if ($selections == 0) { 193 $email = 0;
155 usage(); 194 $email_list = 0;
156 die "$P: Missing required option: email, scm, status, subsystem or web\n"; 195 $scm = 0;
196 $status = 0;
197 $subsystem = 0;
198 $web = 0;
199 $keywords = 0;
200} else {
201 my $selections = $email + $scm + $status + $subsystem + $web;
202 if ($selections == 0) {
203 die "$P: Missing required option: email, scm, status, subsystem or web\n";
204 }
157} 205}
158 206
159if ($email && 207if ($email &&
160 ($email_maintainer + $email_list + $email_subscriber_list + 208 ($email_maintainer + $email_list + $email_subscriber_list +
161 $email_git + $email_git_penguin_chiefs + $email_git_blame) == 0) { 209 $email_git + $email_git_penguin_chiefs + $email_git_blame) == 0) {
162 usage();
163 die "$P: Please select at least 1 email option\n"; 210 die "$P: Please select at least 1 email option\n";
164} 211}
165 212
@@ -168,13 +215,18 @@ if (!top_of_kernel_tree($lk_path)) {
168 . "a linux kernel source tree.\n"; 215 . "a linux kernel source tree.\n";
169} 216}
170 217
218if ($email_git_all_signature_types) {
219 $signaturePattern = "(.+?)[Bb][Yy]:";
220}
221
171## Read MAINTAINERS for type/value pairs 222## Read MAINTAINERS for type/value pairs
172 223
173my @typevalue = (); 224my @typevalue = ();
174my %keyword_hash; 225my %keyword_hash;
175 226
176open(MAINT, "<${lk_path}MAINTAINERS") || die "$P: Can't open MAINTAINERS\n"; 227open (my $maint, '<', "${lk_path}MAINTAINERS")
177while (<MAINT>) { 228 or die "$P: Can't open MAINTAINERS: $!\n";
229while (<$maint>) {
178 my $line = $_; 230 my $line = $_;
179 231
180 if ($line =~ m/^(\C):\s*(.*)/) { 232 if ($line =~ m/^(\C):\s*(.*)/) {
@@ -199,13 +251,14 @@ while (<MAINT>) {
199 push(@typevalue, $line); 251 push(@typevalue, $line);
200 } 252 }
201} 253}
202close(MAINT); 254close($maint);
203 255
204my %mailmap; 256my %mailmap;
205 257
206if ($email_remove_duplicates) { 258if ($email_remove_duplicates) {
207 open(MAILMAP, "<${lk_path}.mailmap") || warn "$P: Can't open .mailmap\n"; 259 open(my $mailmap, '<', "${lk_path}.mailmap")
208 while (<MAILMAP>) { 260 or warn "$P: Can't open .mailmap: $!\n";
261 while (<$mailmap>) {
209 my $line = $_; 262 my $line = $_;
210 263
211 next if ($line =~ m/^\s*#/); 264 next if ($line =~ m/^\s*#/);
@@ -224,7 +277,7 @@ if ($email_remove_duplicates) {
224 $mailmap{$name} = \@arr; 277 $mailmap{$name} = \@arr;
225 } 278 }
226 } 279 }
227 close(MAILMAP); 280 close($mailmap);
228} 281}
229 282
230## use the filenames on the command line or find the filenames in the patchfiles 283## use the filenames on the command line or find the filenames in the patchfiles
@@ -232,31 +285,47 @@ if ($email_remove_duplicates) {
232my @files = (); 285my @files = ();
233my @range = (); 286my @range = ();
234my @keyword_tvi = (); 287my @keyword_tvi = ();
288my @file_emails = ();
289
290if (!@ARGV) {
291 push(@ARGV, "&STDIN");
292}
235 293
236foreach my $file (@ARGV) { 294foreach my $file (@ARGV) {
237 ##if $file is a directory and it lacks a trailing slash, add one 295 if ($file ne "&STDIN") {
238 if ((-d $file)) { 296 ##if $file is a directory and it lacks a trailing slash, add one
239 $file =~ s@([^/])$@$1/@; 297 if ((-d $file)) {
240 } elsif (!(-f $file)) { 298 $file =~ s@([^/])$@$1/@;
241 die "$P: file '${file}' not found\n"; 299 } elsif (!(-f $file)) {
300 die "$P: file '${file}' not found\n";
301 }
242 } 302 }
243 if ($from_filename) { 303 if ($from_filename) {
244 push(@files, $file); 304 push(@files, $file);
245 if (-f $file && $keywords) { 305 if (-f $file && ($keywords || $file_emails)) {
246 open(FILE, "<$file") or die "$P: Can't open ${file}\n"; 306 open(my $f, '<', $file)
247 my $text = do { local($/) ; <FILE> }; 307 or die "$P: Can't open $file: $!\n";
248 foreach my $line (keys %keyword_hash) { 308 my $text = do { local($/) ; <$f> };
249 if ($text =~ m/$keyword_hash{$line}/x) { 309 close($f);
250 push(@keyword_tvi, $line); 310 if ($keywords) {
311 foreach my $line (keys %keyword_hash) {
312 if ($text =~ m/$keyword_hash{$line}/x) {
313 push(@keyword_tvi, $line);
314 }
251 } 315 }
252 } 316 }
253 close(FILE); 317 if ($file_emails) {
318 my @poss_addr = $text =~ m$[A-Za-zÀ-ÿ\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0,1}$g;
319 push(@file_emails, clean_file_emails(@poss_addr));
320 }
254 } 321 }
255 } else { 322 } else {
256 my $file_cnt = @files; 323 my $file_cnt = @files;
257 my $lastfile; 324 my $lastfile;
258 open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; 325
259 while (<PATCH>) { 326 open(my $patch, "< $file")
327 or die "$P: Can't open $file: $!\n";
328 while (<$patch>) {
260 my $patch_line = $_; 329 my $patch_line = $_;
261 if (m/^\+\+\+\s+(\S+)/) { 330 if (m/^\+\+\+\s+(\S+)/) {
262 my $filename = $1; 331 my $filename = $1;
@@ -276,7 +345,8 @@ foreach my $file (@ARGV) {
276 } 345 }
277 } 346 }
278 } 347 }
279 close(PATCH); 348 close($patch);
349
280 if ($file_cnt == @files) { 350 if ($file_cnt == @files) {
281 warn "$P: file '${file}' doesn't appear to be a patch. " 351 warn "$P: file '${file}' doesn't appear to be a patch. "
282 . "Add -f to options?\n"; 352 . "Add -f to options?\n";
@@ -285,6 +355,8 @@ foreach my $file (@ARGV) {
285 } 355 }
286} 356}
287 357
358@file_emails = uniq(@file_emails);
359
288my @email_to = (); 360my @email_to = ();
289my @list_to = (); 361my @list_to = ();
290my @scm = (); 362my @scm = ();
@@ -314,6 +386,7 @@ foreach my $file (@files) {
314 if ($type eq 'X') { 386 if ($type eq 'X') {
315 if (file_match_pattern($file, $value)) { 387 if (file_match_pattern($file, $value)) {
316 $exclude = 1; 388 $exclude = 1;
389 last;
317 } 390 }
318 } 391 }
319 } 392 }
@@ -340,12 +413,28 @@ foreach my $file (@files) {
340 } 413 }
341 } 414 }
342 415
343 $tvi += ($end - $start); 416 $tvi = $end + 1;
344
345 } 417 }
346 418
347 foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { 419 foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) {
348 add_categories($line); 420 add_categories($line);
421 if ($sections) {
422 my $i;
423 my $start = find_starting_index($line);
424 my $end = find_ending_index($line);
425 for ($i = $start; $i < $end; $i++) {
426 my $line = $typevalue[$i];
427 if ($line =~ /^[FX]:/) { ##Restore file patterns
428 $line =~ s/([^\\])\.([^\*])/$1\?$2/g;
429 $line =~ s/([^\\])\.$/$1\?/g; ##Convert . back to ?
430 $line =~ s/\\\./\./g; ##Convert \. to .
431 $line =~ s/\.\*/\*/g; ##Convert .* to *
432 }
433 $line =~ s/^([A-Z]):/$1:\t/g;
434 print("$line\n");
435 }
436 print("\n");
437 }
349 } 438 }
350 439
351 if ($email && $email_git) { 440 if ($email && $email_git) {
@@ -377,6 +466,14 @@ if ($email) {
377 } 466 }
378 } 467 }
379 } 468 }
469
470 foreach my $email (@file_emails) {
471 my ($name, $address) = parse_email($email);
472
473 my $tmp_email = format_email($name, $address, $email_usename);
474 push_email_address($tmp_email, '');
475 add_role($tmp_email, 'in file');
476 }
380} 477}
381 478
382if ($email || $email_list) { 479if ($email || $email_list) {
@@ -439,13 +536,15 @@ version: $V
439MAINTAINER field selection options: 536MAINTAINER field selection options:
440 --email => print email address(es) if any 537 --email => print email address(es) if any
441 --git => include recent git \*-by: signers 538 --git => include recent git \*-by: signers
539 --git-all-signature-types => include signers regardless of signature type
540 or use only ${signaturePattern} signers (default: $email_git_all_signature_types)
442 --git-chief-penguins => include ${penguin_chiefs} 541 --git-chief-penguins => include ${penguin_chiefs}
443 --git-min-signatures => number of signatures required (default: 1) 542 --git-min-signatures => number of signatures required (default: $email_git_min_signatures)
444 --git-max-maintainers => maximum maintainers to add (default: 5) 543 --git-max-maintainers => maximum maintainers to add (default: $email_git_max_maintainers)
445 --git-min-percent => minimum percentage of commits required (default: 5) 544 --git-min-percent => minimum percentage of commits required (default: $email_git_min_percent)
446 --git-blame => use git blame to find modified commits for patch or file 545 --git-blame => use git blame to find modified commits for patch or file
447 --git-since => git history to use (default: 1-year-ago) 546 --git-since => git history to use (default: $email_git_since)
448 --hg-since => hg history to use (default: -365) 547 --hg-since => hg history to use (default: $email_hg_since)
449 --m => include maintainer(s) if any 548 --m => include maintainer(s) if any
450 --n => include name 'Full Name <addr\@domain.tld>' 549 --n => include name 'Full Name <addr\@domain.tld>'
451 --l => include list(s) if any 550 --l => include list(s) if any
@@ -453,6 +552,7 @@ MAINTAINER field selection options:
453 --remove-duplicates => minimize duplicate email names/addresses 552 --remove-duplicates => minimize duplicate email names/addresses
454 --roles => show roles (status:subsystem, git-signer, list, etc...) 553 --roles => show roles (status:subsystem, git-signer, list, etc...)
455 --rolestats => show roles and statistics (commits/total_commits, %) 554 --rolestats => show roles and statistics (commits/total_commits, %)
555 --file-emails => add email addresses found in -f file (default: 0 (off))
456 --scm => print SCM tree(s) if any 556 --scm => print SCM tree(s) if any
457 --status => print status if any 557 --status => print status if any
458 --subsystem => print subsystem name if any 558 --subsystem => print subsystem name if any
@@ -466,6 +566,7 @@ Output type options:
466Other options: 566Other options:
467 --pattern-depth => Number of pattern directory traversals (default: 0 (all)) 567 --pattern-depth => Number of pattern directory traversals (default: 0 (all))
468 --keywords => scan patch for keywords (default: 1 (on)) 568 --keywords => scan patch for keywords (default: 1 (on))
569 --sections => print the entire subsystem sections with pattern matches
469 --version => show version 570 --version => show version
470 --help => show this help information 571 --help => show this help information
471 572
@@ -496,6 +597,11 @@ Notes:
496 --git-min-signatures, --git-max-maintainers, --git-min-percent, and 597 --git-min-signatures, --git-max-maintainers, --git-min-percent, and
497 --git-blame 598 --git-blame
498 Use --hg-since not --git-since to control date selection 599 Use --hg-since not --git-since to control date selection
600 File ".get_maintainer.conf", if it exists in the linux kernel source root
601 directory, can change whatever get_maintainer defaults are desired.
602 Entries in this file can be any command line argument.
603 This file is prepended to any additional command line arguments.
604 Multiple lines and # comments are allowed.
499EOT 605EOT
500} 606}
501 607
@@ -545,7 +651,7 @@ sub parse_email {
545 $name =~ s/^\"|\"$//g; 651 $name =~ s/^\"|\"$//g;
546 $address =~ s/^\s+|\s+$//g; 652 $address =~ s/^\s+|\s+$//g;
547 653
548 if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars 654 if ($name =~ /[^\w \-]/i) { ##has "must quote" chars
549 $name =~ s/(?<!\\)"/\\"/g; ##escape quotes 655 $name =~ s/(?<!\\)"/\\"/g; ##escape quotes
550 $name = "\"$name\""; 656 $name = "\"$name\"";
551 } 657 }
@@ -562,7 +668,7 @@ sub format_email {
562 $name =~ s/^\"|\"$//g; 668 $name =~ s/^\"|\"$//g;
563 $address =~ s/^\s+|\s+$//g; 669 $address =~ s/^\s+|\s+$//g;
564 670
565 if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars 671 if ($name =~ /[^\w \-]/i) { ##has "must quote" chars
566 $name =~ s/(?<!\\)"/\\"/g; ##escape quotes 672 $name =~ s/(?<!\\)"/\\"/g; ##escape quotes
567 $name = "\"$name\""; 673 $name = "\"$name\"";
568 } 674 }
@@ -811,7 +917,9 @@ sub add_role {
811 foreach my $entry (@email_to) { 917 foreach my $entry (@email_to) {
812 if ($email_remove_duplicates) { 918 if ($email_remove_duplicates) {
813 my ($entry_name, $entry_address) = parse_email($entry->[0]); 919 my ($entry_name, $entry_address) = parse_email($entry->[0]);
814 if ($name eq $entry_name || $address eq $entry_address) { 920 if (($name eq $entry_name || $address eq $entry_address)
921 && ($role eq "" || !($entry->[1] =~ m/$role/))
922 ) {
815 if ($entry->[1] eq "") { 923 if ($entry->[1] eq "") {
816 $entry->[1] = "$role"; 924 $entry->[1] = "$role";
817 } else { 925 } else {
@@ -819,7 +927,9 @@ sub add_role {
819 } 927 }
820 } 928 }
821 } else { 929 } else {
822 if ($email eq $entry->[0]) { 930 if ($email eq $entry->[0]
931 && ($role eq "" || !($entry->[1] =~ m/$role/))
932 ) {
823 if ($entry->[1] eq "") { 933 if ($entry->[1] eq "") {
824 $entry->[1] = "$role"; 934 $entry->[1] = "$role";
825 } else { 935 } else {
@@ -900,7 +1010,7 @@ sub vcs_find_signers {
900 1010
901 $commits = grep(/$pattern/, @lines); # of commits 1011 $commits = grep(/$pattern/, @lines); # of commits
902 1012
903 @lines = grep(/^[-_ a-z]+by:.*\@.*$/i, @lines); 1013 @lines = grep(/^[ \t]*${signaturePattern}.*\@.*$/, @lines);
904 if (!$email_git_penguin_chiefs) { 1014 if (!$email_git_penguin_chiefs) {
905 @lines = grep(!/${penguin_chiefs}/i, @lines); 1015 @lines = grep(!/${penguin_chiefs}/i, @lines);
906 } 1016 }
@@ -1099,6 +1209,51 @@ sub sort_and_uniq {
1099 return @parms; 1209 return @parms;
1100} 1210}
1101 1211
1212sub clean_file_emails {
1213 my (@file_emails) = @_;
1214 my @fmt_emails = ();
1215
1216 foreach my $email (@file_emails) {
1217 $email =~ s/[\(\<\{]{0,1}([A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+)[\)\>\}]{0,1}/\<$1\>/g;
1218 my ($name, $address) = parse_email($email);
1219 if ($name eq '"[,\.]"') {
1220 $name = "";
1221 }
1222
1223 my @nw = split(/[^A-Za-zÀ-ÿ\'\,\.\+-]/, $name);
1224 if (@nw > 2) {
1225 my $first = $nw[@nw - 3];
1226 my $middle = $nw[@nw - 2];
1227 my $last = $nw[@nw - 1];
1228
1229 if (((length($first) == 1 && $first =~ m/[A-Za-z]/) ||
1230 (length($first) == 2 && substr($first, -1) eq ".")) ||
1231 (length($middle) == 1 ||
1232 (length($middle) == 2 && substr($middle, -1) eq "."))) {
1233 $name = "$first $middle $last";
1234 } else {
1235 $name = "$middle $last";
1236 }
1237 }
1238
1239 if (substr($name, -1) =~ /[,\.]/) {
1240 $name = substr($name, 0, length($name) - 1);
1241 } elsif (substr($name, -2) =~ /[,\.]"/) {
1242 $name = substr($name, 0, length($name) - 2) . '"';
1243 }
1244
1245 if (substr($name, 0, 1) =~ /[,\.]/) {
1246 $name = substr($name, 1, length($name) - 1);
1247 } elsif (substr($name, 0, 2) =~ /"[,\.]/) {
1248 $name = '"' . substr($name, 2, length($name) - 2);
1249 }
1250
1251 my $fmt_email = format_email($name, $address, $email_usename);
1252 push(@fmt_emails, $fmt_email);
1253 }
1254 return @fmt_emails;
1255}
1256
1102sub merge_email { 1257sub merge_email {
1103 my @lines; 1258 my @lines;
1104 my %saw; 1259 my %saw;
@@ -1183,7 +1338,7 @@ sub rfc822_strip_comments {
1183 1338
1184# valid: returns true if the parameter is an RFC822 valid address 1339# valid: returns true if the parameter is an RFC822 valid address
1185# 1340#
1186sub rfc822_valid ($) { 1341sub rfc822_valid {
1187 my $s = rfc822_strip_comments(shift); 1342 my $s = rfc822_strip_comments(shift);
1188 1343
1189 if (!$rfc822re) { 1344 if (!$rfc822re) {
@@ -1203,7 +1358,7 @@ sub rfc822_valid ($) {
1203# from success with no addresses found, because an empty string is 1358# from success with no addresses found, because an empty string is
1204# a valid list. 1359# a valid list.
1205 1360
1206sub rfc822_validlist ($) { 1361sub rfc822_validlist {
1207 my $s = rfc822_strip_comments(shift); 1362 my $s = rfc822_strip_comments(shift);
1208 1363
1209 if (!$rfc822re) { 1364 if (!$rfc822re) {
diff --git a/scripts/gfp-translate b/scripts/gfp-translate
index 073cb6d152a0..d81b968d864e 100644
--- a/scripts/gfp-translate
+++ b/scripts/gfp-translate
@@ -19,7 +19,7 @@ usage() {
19 exit 0 19 exit 0
20} 20}
21 21
22# Parse command-line arguements 22# Parse command-line arguments
23while [ $# -gt 0 ]; do 23while [ $# -gt 0 ]; do
24 case $1 in 24 case $1 in
25 --source) 25 --source)
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index c0e459e2b014..de934def410f 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -33,9 +33,18 @@ silentoldconfig: $(obj)/conf
33 $(Q)mkdir -p include/generated 33 $(Q)mkdir -p include/generated
34 $< --$@ $(Kconfig) 34 $< --$@ $(Kconfig)
35 35
36# if no path is given, then use src directory to find file
37ifdef LSMOD
38LSMOD_F := $(LSMOD)
39ifeq ($(findstring /,$(LSMOD)),)
40 LSMOD_F := $(objtree)/$(LSMOD)
41endif
42endif
43
36localmodconfig: $(obj)/streamline_config.pl $(obj)/conf 44localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
37 $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config 45 $(Q)mkdir -p include/generated
38 $(Q)if [ -f .config ]; then \ 46 $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
47 $(Q)if [ -f .config ]; then \
39 cmp -s .tmp.config .config || \ 48 cmp -s .tmp.config .config || \
40 (mv -f .config .config.old.1; \ 49 (mv -f .config .config.old.1; \
41 mv -f .tmp.config .config; \ 50 mv -f .tmp.config .config; \
@@ -48,7 +57,8 @@ localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
48 $(Q)rm -f .tmp.config 57 $(Q)rm -f .tmp.config
49 58
50localyesconfig: $(obj)/streamline_config.pl $(obj)/conf 59localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
51 $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config 60 $(Q)mkdir -p include/generated
61 $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
52 $(Q)sed -i s/=m/=y/ .tmp.config 62 $(Q)sed -i s/=m/=y/ .tmp.config
53 $(Q)if [ -f .config ]; then \ 63 $(Q)if [ -f .config ]; then \
54 cmp -s .tmp.config .config || \ 64 cmp -s .tmp.config .config || \
@@ -212,7 +222,7 @@ HOSTCFLAGS_zconf.tab.o := -I$(src)
212HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl 222HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl
213HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK 223HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
214 224
215HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` 225HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl
216HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ 226HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
217 -D LKC_DIRECT_LINK 227 -D LKC_DIRECT_LINK
218 228
diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c
index 115edb437fb1..a9d9344e1365 100644
--- a/scripts/kconfig/nconf.gui.c
+++ b/scripts/kconfig/nconf.gui.c
@@ -226,7 +226,7 @@ void fill_window(WINDOW *win, const char *text)
226 int len = get_line_length(line); 226 int len = get_line_length(line);
227 strncpy(tmp, line, min(len, x)); 227 strncpy(tmp, line, min(len, x));
228 tmp[len] = '\0'; 228 tmp[len] = '\0';
229 mvwprintw(win, i, 0, tmp); 229 mvwprintw(win, i, 0, "%s", tmp);
230 } 230 }
231} 231}
232 232
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 0d800820c3cd..c70a27d924f0 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -113,14 +113,19 @@ find_config;
113# Get the build source and top level Kconfig file (passed in) 113# Get the build source and top level Kconfig file (passed in)
114my $ksource = $ARGV[0]; 114my $ksource = $ARGV[0];
115my $kconfig = $ARGV[1]; 115my $kconfig = $ARGV[1];
116my $lsmod_file = $ARGV[2];
117
118my @makefiles = `find $ksource -name Makefile 2>/dev/null`;
119chomp @makefiles;
116 120
117my @makefiles = `find $ksource -name Makefile`;
118my %depends; 121my %depends;
119my %selects; 122my %selects;
120my %prompts; 123my %prompts;
121my %objects; 124my %objects;
122my $var; 125my $var;
123my $cont = 0; 126my $cont = 0;
127my $iflevel = 0;
128my @ifdeps;
124 129
125# prevent recursion 130# prevent recursion
126my %read_kconfigs; 131my %read_kconfigs;
@@ -146,6 +151,15 @@ sub read_kconfig {
146 $state = "NEW"; 151 $state = "NEW";
147 $config = $1; 152 $config = $1;
148 153
154 for (my $i = 0; $i < $iflevel; $i++) {
155 if ($i) {
156 $depends{$config} .= " " . $ifdeps[$i];
157 } else {
158 $depends{$config} = $ifdeps[$i];
159 }
160 $state = "DEP";
161 }
162
149 # collect the depends for the config 163 # collect the depends for the config
150 } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) { 164 } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) {
151 $state = "DEP"; 165 $state = "DEP";
@@ -166,6 +180,21 @@ sub read_kconfig {
166 # note if the config has a prompt 180 # note if the config has a prompt
167 $prompt{$config} = 1; 181 $prompt{$config} = 1;
168 182
183 # Check for if statements
184 } elsif (/^if\s+(.*\S)\s*$/) {
185 my $deps = $1;
186 # remove beginning and ending non text
187 $deps =~ s/^[^a-zA-Z0-9_]*//;
188 $deps =~ s/[^a-zA-Z0-9_]*$//;
189
190 my @deps = split /[^a-zA-Z0-9_]+/, $deps;
191
192 $ifdeps[$iflevel++] = join ':', @deps;
193
194 } elsif (/^endif/) {
195
196 $iflevel-- if ($iflevel);
197
169 # stop on "help" 198 # stop on "help"
170 } elsif (/^\s*help\s*$/) { 199 } elsif (/^\s*help\s*$/) {
171 $state = "NONE"; 200 $state = "NONE";
@@ -188,7 +217,6 @@ if ($kconfig) {
188 217
189# Read all Makefiles to map the configs to the objects 218# Read all Makefiles to map the configs to the objects
190foreach my $makefile (@makefiles) { 219foreach my $makefile (@makefiles) {
191 chomp $makefile;
192 220
193 open(MIN,$makefile) || die "Can't open $makefile"; 221 open(MIN,$makefile) || die "Can't open $makefile";
194 while (<MIN>) { 222 while (<MIN>) {
@@ -215,7 +243,7 @@ foreach my $makefile (@makefiles) {
215 foreach my $obj (split /\s+/,$objs) { 243 foreach my $obj (split /\s+/,$objs) {
216 $obj =~ s/-/_/g; 244 $obj =~ s/-/_/g;
217 if ($obj =~ /(.*)\.o$/) { 245 if ($obj =~ /(.*)\.o$/) {
218 # Objects may bes enabled by more than one config. 246 # Objects may be enabled by more than one config.
219 # Store configs in an array. 247 # Store configs in an array.
220 my @arr; 248 my @arr;
221 249
@@ -237,8 +265,36 @@ foreach my $makefile (@makefiles) {
237 265
238my %modules; 266my %modules;
239 267
240# see what modules are loaded on this system 268if (defined($lsmod_file)) {
241open(LIN,"/sbin/lsmod|") || die "Cant lsmod"; 269 if ( ! -f $lsmod_file) {
270 die "$lsmod_file not found";
271 }
272 if ( -x $lsmod_file) {
273 # the file is executable, run it
274 open(LIN, "$lsmod_file|");
275 } else {
276 # Just read the contents
277 open(LIN, "$lsmod_file");
278 }
279} else {
280
281 # see what modules are loaded on this system
282 my $lsmod;
283
284 foreach $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) {
285 if ( -x "$dir/lsmod" ) {
286 $lsmod = "$dir/lsmod";
287 last;
288 }
289}
290 if (!defined($lsmod)) {
291 # try just the path
292 $lsmod = "lsmod";
293 }
294
295 open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod";
296}
297
242while (<LIN>) { 298while (<LIN>) {
243 next if (/^Module/); # Skip the first line. 299 next if (/^Module/); # Skip the first line.
244 if (/^(\S+)/) { 300 if (/^(\S+)/) {
@@ -252,7 +308,7 @@ close (LIN);
252my %configs; 308my %configs;
253foreach my $module (keys(%modules)) { 309foreach my $module (keys(%modules)) {
254 if (defined($objects{$module})) { 310 if (defined($objects{$module})) {
255 @arr = @{$objects{$module}}; 311 my @arr = @{$objects{$module}};
256 foreach my $conf (@arr) { 312 foreach my $conf (@arr) {
257 $configs{$conf} = $module; 313 $configs{$conf} = $module;
258 } 314 }
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index 81c100d953ef..78b5c04e736b 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -72,7 +72,7 @@ int file_write_dep(const char *name)
72} 72}
73 73
74 74
75/* Allocate initial growable sting */ 75/* Allocate initial growable string */
76struct gstr str_new(void) 76struct gstr str_new(void)
77{ 77{
78 struct gstr gs; 78 struct gstr gs;
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 241310e59cd6..fcdfb245a575 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -13,8 +13,6 @@ use strict;
13## This software falls under the GNU General Public License. ## 13## This software falls under the GNU General Public License. ##
14## Please read the COPYING file for more information ## 14## Please read the COPYING file for more information ##
15 15
16# w.o. 03-11-2000: added the '-filelist' option.
17
18# 18/01/2001 - Cleanups 16# 18/01/2001 - Cleanups
19# Functions prototyped as foo(void) same as foo() 17# Functions prototyped as foo(void) same as foo()
20# Stop eval'ing where we don't need to. 18# Stop eval'ing where we don't need to.
@@ -245,7 +243,7 @@ my $man_date = ('January', 'February', 'March', 'April', 'May', 'June',
245# could cause "use of undefined value" or other bugs. 243# could cause "use of undefined value" or other bugs.
246my ($function, %function_table, %parametertypes, $declaration_purpose); 244my ($function, %function_table, %parametertypes, $declaration_purpose);
247my ($type, $declaration_name, $return_type); 245my ($type, $declaration_name, $return_type);
248my ($newsection, $newcontents, $prototype, $filelist, $brcount, %source_map); 246my ($newsection, $newcontents, $prototype, $brcount, %source_map);
249 247
250if (defined($ENV{'KBUILD_VERBOSE'})) { 248if (defined($ENV{'KBUILD_VERBOSE'})) {
251 $verbose = "$ENV{'KBUILD_VERBOSE'}"; 249 $verbose = "$ENV{'KBUILD_VERBOSE'}";
@@ -338,8 +336,6 @@ while ($ARGV[0] =~ m/^-(.*)/) {
338 $verbose = 1; 336 $verbose = 1;
339 } elsif (($cmd eq "-h") || ($cmd eq "--help")) { 337 } elsif (($cmd eq "-h") || ($cmd eq "--help")) {
340 usage(); 338 usage();
341 } elsif ($cmd eq '-filelist') {
342 $filelist = shift @ARGV;
343 } elsif ($cmd eq '-no-doc-sections') { 339 } elsif ($cmd eq '-no-doc-sections') {
344 $no_doc_sections = 1; 340 $no_doc_sections = 1;
345 } 341 }
@@ -1428,6 +1424,8 @@ sub dump_struct($$) {
1428 $nested =~ s/\/\*.*?\*\///gos; 1424 $nested =~ s/\/\*.*?\*\///gos;
1429 # strip kmemcheck_bitfield_{begin,end}.*; 1425 # strip kmemcheck_bitfield_{begin,end}.*;
1430 $members =~ s/kmemcheck_bitfield_.*?;//gos; 1426 $members =~ s/kmemcheck_bitfield_.*?;//gos;
1427 # strip attributes
1428 $members =~ s/__aligned\s*\(\d+\)//gos;
1431 1429
1432 create_parameterlist($members, ';', $file); 1430 create_parameterlist($members, ';', $file);
1433 check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested); 1431 check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested);
@@ -1732,6 +1730,7 @@ sub dump_function($$) {
1732 $prototype =~ s/^noinline +//; 1730 $prototype =~ s/^noinline +//;
1733 $prototype =~ s/__devinit +//; 1731 $prototype =~ s/__devinit +//;
1734 $prototype =~ s/__init +//; 1732 $prototype =~ s/__init +//;
1733 $prototype =~ s/__init_or_module +//;
1735 $prototype =~ s/^#\s*define\s+//; #ak added 1734 $prototype =~ s/^#\s*define\s+//; #ak added
1736 $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; 1735 $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//;
1737 1736
@@ -1811,14 +1810,6 @@ if (open(SOURCE_MAP, "<.tmp_filelist.txt")) {
1811 close(SOURCE_MAP); 1810 close(SOURCE_MAP);
1812} 1811}
1813 1812
1814if ($filelist) {
1815 open(FLIST,"<$filelist") or die "Can't open file list $filelist";
1816 while(<FLIST>) {
1817 chop;
1818 process_file($_);
1819 }
1820}
1821
1822foreach (@ARGV) { 1813foreach (@ARGV) {
1823 chomp; 1814 chomp;
1824 process_file($_); 1815 process_file($_);
@@ -2023,6 +2014,8 @@ sub process_file($) {
2023 return; 2014 return;
2024 } 2015 }
2025 2016
2017 $. = 1;
2018
2026 $section_counter = 0; 2019 $section_counter = 0;
2027 while (<IN>) { 2020 while (<IN>) {
2028 if ($state == 0) { 2021 if ($state == 0) {
@@ -2113,7 +2106,7 @@ sub process_file($) {
2113 $section = $newsection; 2106 $section = $newsection;
2114 } elsif (/$doc_end/) { 2107 } elsif (/$doc_end/) {
2115 2108
2116 if ($contents ne "") { 2109 if (($contents ne "") && ($contents ne "\n")) {
2117 dump_section($file, $section, xml_escape($contents)); 2110 dump_section($file, $section, xml_escape($contents));
2118 $section = $section_default; 2111 $section = $section_default;
2119 $contents = ""; 2112 $contents = "";
diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl
index 90e1d9aa35b5..827896f56501 100644
--- a/scripts/markup_oops.pl
+++ b/scripts/markup_oops.pl
@@ -168,7 +168,7 @@ while (<STDIN>) {
168 $function = $1; 168 $function = $1;
169 $func_offset = $2; 169 $func_offset = $2;
170 } 170 }
171 if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { 171 if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+0x([0-9a-f]+)\/0x[a-f0-9]/) {
172 $function = $1; 172 $function = $1;
173 $func_offset = $2; 173 $func_offset = $2;
174 } 174 }
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 220213e603db..5758aab0d8bb 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -796,6 +796,51 @@ static int do_platform_entry(const char *filename,
796 return 1; 796 return 1;
797} 797}
798 798
799static int do_mdio_entry(const char *filename,
800 struct mdio_device_id *id, char *alias)
801{
802 int i;
803
804 alias += sprintf(alias, MDIO_MODULE_PREFIX);
805
806 for (i = 0; i < 32; i++) {
807 if (!((id->phy_id_mask >> (31-i)) & 1))
808 *(alias++) = '?';
809 else if ((id->phy_id >> (31-i)) & 1)
810 *(alias++) = '1';
811 else
812 *(alias++) = '0';
813 }
814
815 /* Terminate the string */
816 *alias = 0;
817
818 return 1;
819}
820
821/* Looks like: zorro:iN. */
822static int do_zorro_entry(const char *filename, struct zorro_device_id *id,
823 char *alias)
824{
825 id->id = TO_NATIVE(id->id);
826 strcpy(alias, "zorro:");
827 ADD(alias, "i", id->id != ZORRO_WILDCARD, id->id);
828 return 1;
829}
830
831/* looks like: "pnp:dD" */
832static int do_isapnp_entry(const char *filename,
833 struct isapnp_device_id *id, char *alias)
834{
835 sprintf(alias, "pnp:d%c%c%c%x%x%x%x*",
836 'A' + ((id->vendor >> 2) & 0x3f) - 1,
837 'A' + (((id->vendor & 3) << 3) | ((id->vendor >> 13) & 7)) - 1,
838 'A' + ((id->vendor >> 8) & 0x1f) - 1,
839 (id->function >> 4) & 0x0f, id->function & 0x0f,
840 (id->function >> 12) & 0x0f, (id->function >> 8) & 0x0f);
841 return 1;
842}
843
799/* Ignore any prefix, eg. some architectures prepend _ */ 844/* Ignore any prefix, eg. some architectures prepend _ */
800static inline int sym_is(const char *symbol, const char *name) 845static inline int sym_is(const char *symbol, const char *name)
801{ 846{
@@ -943,6 +988,18 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
943 do_table(symval, sym->st_size, 988 do_table(symval, sym->st_size,
944 sizeof(struct platform_device_id), "platform", 989 sizeof(struct platform_device_id), "platform",
945 do_platform_entry, mod); 990 do_platform_entry, mod);
991 else if (sym_is(symname, "__mod_mdio_device_table"))
992 do_table(symval, sym->st_size,
993 sizeof(struct mdio_device_id), "mdio",
994 do_mdio_entry, mod);
995 else if (sym_is(symname, "__mod_zorro_device_table"))
996 do_table(symval, sym->st_size,
997 sizeof(struct zorro_device_id), "zorro",
998 do_zorro_entry, mod);
999 else if (sym_is(symname, "__mod_isapnp_device_table"))
1000 do_table(symval, sym->st_size,
1001 sizeof(struct isapnp_device_id), "isa",
1002 do_isapnp_entry, mod);
946 free(zeros); 1003 free(zeros);
947} 1004}
948 1005
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 3318692e4e76..f6127b9f5aca 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -503,6 +503,11 @@ static int ignore_undef_symbol(struct elf_info *info, const char *symname)
503 strncmp(symname, "_rest32gpr_", sizeof("_rest32gpr_") - 1) == 0 || 503 strncmp(symname, "_rest32gpr_", sizeof("_rest32gpr_") - 1) == 0 ||
504 strncmp(symname, "_save32gpr_", sizeof("_save32gpr_") - 1) == 0) 504 strncmp(symname, "_save32gpr_", sizeof("_save32gpr_") - 1) == 0)
505 return 1; 505 return 1;
506 if (info->hdr->e_machine == EM_PPC64)
507 /* Special register function linked on all modules during final link of .ko */
508 if (strncmp(symname, "_restgpr0_", sizeof("_restgpr0_") - 1) == 0 ||
509 strncmp(symname, "_savegpr0_", sizeof("_savegpr0_") - 1) == 0)
510 return 1;
506 /* Do not ignore this symbol */ 511 /* Do not ignore this symbol */
507 return 0; 512 return 0;
508} 513}
@@ -1342,7 +1347,7 @@ static unsigned int *reloc_location(struct elf_info *elf,
1342 int section = sechdr->sh_info; 1347 int section = sechdr->sh_info;
1343 1348
1344 return (void *)elf->hdr + sechdrs[section].sh_offset + 1349 return (void *)elf->hdr + sechdrs[section].sh_offset +
1345 (r->r_offset - sechdrs[section].sh_addr); 1350 r->r_offset - sechdrs[section].sh_addr;
1346} 1351}
1347 1352
1348static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) 1353static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 62fcc3a7f4d3..d2c29b63adda 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -44,7 +44,7 @@ rpm-pkg rpm: $(objtree)/kernel.spec FORCE
44 fi 44 fi
45 $(MAKE) clean 45 $(MAKE) clean
46 $(PREV) ln -sf $(srctree) $(KERNELPATH) 46 $(PREV) ln -sf $(srctree) $(KERNELPATH)
47 $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion 47 $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion
48 $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. 48 $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/.
49 $(PREV) rm $(KERNELPATH) 49 $(PREV) rm $(KERNELPATH)
50 rm -f $(objtree)/.scmversion 50 rm -f $(objtree)/.scmversion
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index 16ae0dd746e1..15440f55aef6 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# Output a simple RPM spec file that uses no fancy features requring 3# Output a simple RPM spec file that uses no fancy features requiring
4# RPM v4. This is intended to work with any RPM distro. 4# RPM v4. This is intended to work with any RPM distro.
5# 5#
6# The only gothic bit here is redefining install_post to avoid 6# The only gothic bit here is redefining install_post to avoid
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index ea6f6e3adaea..f3c9c0a90b98 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -136,13 +136,14 @@ my %text_sections = (
136 ".text.unlikely" => 1, 136 ".text.unlikely" => 1,
137); 137);
138 138
139$objdump = "objdump" if ((length $objdump) == 0); 139# Note: we are nice to C-programmers here, thus we skip the '||='-idiom.
140$objcopy = "objcopy" if ((length $objcopy) == 0); 140$objdump = 'objdump' if (!$objdump);
141$cc = "gcc" if ((length $cc) == 0); 141$objcopy = 'objcopy' if (!$objcopy);
142$ld = "ld" if ((length $ld) == 0); 142$cc = 'gcc' if (!$cc);
143$nm = "nm" if ((length $nm) == 0); 143$ld = 'ld' if (!$ld);
144$rm = "rm" if ((length $rm) == 0); 144$nm = 'nm' if (!$nm);
145$mv = "mv" if ((length $mv) == 0); 145$rm = 'rm' if (!$rm);
146$mv = 'mv' if (!$mv);
146 147
147#print STDERR "running: $P '$arch' '$objdump' '$objcopy' '$cc' '$ld' " . 148#print STDERR "running: $P '$arch' '$objdump' '$objcopy' '$cc' '$ld' " .
148# "'$nm' '$rm' '$mv' '$inputfile'\n"; 149# "'$nm' '$rm' '$mv' '$inputfile'\n";
@@ -432,14 +433,14 @@ sub update_funcs
432 433
433 # Loop through all the mcount caller offsets and print a reference 434 # Loop through all the mcount caller offsets and print a reference
434 # to the caller based from the ref_func. 435 # to the caller based from the ref_func.
435 for (my $i=0; $i <= $#offsets; $i++) { 436 if (!$opened) {
436 if (!$opened) { 437 open(FILE, ">$mcount_s") || die "can't create $mcount_s\n";
437 open(FILE, ">$mcount_s") || die "can't create $mcount_s\n"; 438 $opened = 1;
438 $opened = 1; 439 print FILE "\t.section $mcount_section,\"a\",$section_type\n";
439 print FILE "\t.section $mcount_section,\"a\",$section_type\n"; 440 print FILE "\t.align $alignment\n" if (defined($alignment));
440 print FILE "\t.align $alignment\n" if (defined($alignment)); 441 }
441 } 442 foreach my $cur_offset (@offsets) {
442 printf FILE "\t%s %s + %d\n", $type, $ref_func, $offsets[$i] - $offset; 443 printf FILE "\t%s %s + %d\n", $type, $ref_func, $cur_offset - $offset;
443 } 444 }
444} 445}
445 446
@@ -476,11 +477,7 @@ while (<IN>) {
476 $read_headers = 0; 477 $read_headers = 0;
477 478
478 # Only record text sections that we know are safe 479 # Only record text sections that we know are safe
479 if (defined($text_sections{$1})) { 480 $read_function = defined($text_sections{$1});
480 $read_function = 1;
481 } else {
482 $read_function = 0;
483 }
484 # print out any recorded offsets 481 # print out any recorded offsets
485 update_funcs(); 482 update_funcs();
486 483
@@ -514,7 +511,7 @@ while (<IN>) {
514 } 511 }
515 # is this a call site to mcount? If so, record it to print later 512 # is this a call site to mcount? If so, record it to print later
516 if ($text_found && /$mcount_regex/) { 513 if ($text_found && /$mcount_regex/) {
517 $offsets[$#offsets + 1] = hex $1; 514 push(@offsets, hex $1);
518 } 515 }
519} 516}
520 517
diff --git a/scripts/selinux/genheaders/genheaders.c b/scripts/selinux/genheaders/genheaders.c
index 24626968055d..58a12c278706 100644
--- a/scripts/selinux/genheaders/genheaders.c
+++ b/scripts/selinux/genheaders/genheaders.c
@@ -81,7 +81,7 @@ int main(int argc, char *argv[])
81 fprintf(fout, "\n"); 81 fprintf(fout, "\n");
82 82
83 for (i = 1; i < isids_len; i++) { 83 for (i = 1; i < isids_len; i++) {
84 char *s = initial_sid_to_string[i]; 84 const char *s = initial_sid_to_string[i];
85 fprintf(fout, "#define SECINITSID_%s", s); 85 fprintf(fout, "#define SECINITSID_%s", s);
86 for (j = 0; j < max(1, 40 - strlen(s)); j++) 86 for (j = 0; j < max(1, 40 - strlen(s)); j++)
87 fprintf(fout, " "); 87 fprintf(fout, " ");
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 46989b88d734..64a9cb5556cd 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -10,73 +10,162 @@
10# 10#
11 11
12usage() { 12usage() {
13 echo "Usage: $0 [srctree]" >&2 13 echo "Usage: $0 [--save-scmversion] [srctree]" >&2
14 exit 1 14 exit 1
15} 15}
16 16
17cd "${1:-.}" || usage 17scm_only=false
18srctree=.
19if test "$1" = "--save-scmversion"; then
20 scm_only=true
21 shift
22fi
23if test $# -gt 0; then
24 srctree=$1
25 shift
26fi
27if test $# -gt 0 -o ! -d "$srctree"; then
28 usage
29fi
18 30
19# Check for git and a git repo. 31scm_version()
20if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then 32{
33 local short
34 short=false
21 35
22 # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore it, 36 cd "$srctree"
23 # because this version is defined in the top level Makefile. 37 if test -e .scmversion; then
24 if [ -z "`git describe --exact-match 2>/dev/null`" ]; then 38 cat .scmversion
39 return
40 fi
41 if test "$1" = "--short"; then
42 short=true
43 fi
25 44
26 # If we are past a tagged commit (like "v2.6.30-rc5-302-g72357d5"), 45 # Check for git and a git repo.
27 # we pretty print it. 46 if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
28 if atag="`git describe 2>/dev/null`"; then 47
29 echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' 48 # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
49 # it, because this version is defined in the top level Makefile.
50 if [ -z "`git describe --exact-match 2>/dev/null`" ]; then
51
52 # If only the short version is requested, don't bother
53 # running further git commands
54 if $short; then
55 echo "+"
56 return
57 fi
58 # If we are past a tagged commit (like
59 # "v2.6.30-rc5-302-g72357d5"), we pretty print it.
60 if atag="`git describe 2>/dev/null`"; then
61 echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
62
63 # If we don't have a tag at all we print -g{commitish}.
64 else
65 printf '%s%s' -g $head
66 fi
67 fi
30 68
31 # If we don't have a tag at all we print -g{commitish}. 69 # Is this git on svn?
32 else 70 if git config --get svn-remote.svn.url >/dev/null; then
33 printf '%s%s' -g $head 71 printf -- '-svn%s' "`git svn find-rev $head`"
34 fi 72 fi
35 fi
36 73
37 # Is this git on svn? 74 # Update index only on r/w media
38 if git config --get svn-remote.svn.url >/dev/null; then 75 [ -w . ] && git update-index --refresh --unmerged > /dev/null
39 printf -- '-svn%s' "`git svn find-rev $head`"
40 fi
41 76
42 # Update index only on r/w media 77 # Check for uncommitted changes
43 [ -w . ] && git update-index --refresh --unmerged > /dev/null 78 if git diff-index --name-only HEAD | grep -v "^scripts/package" \
79 | read dummy; then
80 printf '%s' -dirty
81 fi
44 82
45 # Check for uncommitted changes 83 # All done with git
46 if git diff-index --name-only HEAD | grep -v "^scripts/package" \ 84 return
47 | read dummy; then
48 printf '%s' -dirty
49 fi 85 fi
50 86
51 # All done with git 87 # Check for mercurial and a mercurial repo.
52 exit 88 if hgid=`hg id 2>/dev/null`; then
53fi 89 tag=`printf '%s' "$hgid" | cut -d' ' -f2`
54 90
55# Check for mercurial and a mercurial repo. 91 # Do we have an untagged version?
56if hgid=`hg id 2>/dev/null`; then 92 if [ -z "$tag" -o "$tag" = tip ]; then
57 tag=`printf '%s' "$hgid" | cut -d' ' -f2` 93 id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
94 printf '%s%s' -hg "$id"
95 fi
96
97 # Are there uncommitted changes?
98 # These are represented by + after the changeset id.
99 case "$hgid" in
100 *+|*+\ *) printf '%s' -dirty ;;
101 esac
58 102
59 # Do we have an untagged version? 103 # All done with mercurial
60 if [ -z "$tag" -o "$tag" = tip ]; then 104 return
61 id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
62 printf '%s%s' -hg "$id"
63 fi 105 fi
64 106
65 # Are there uncommitted changes? 107 # Check for svn and a svn repo.
66 # These are represented by + after the changeset id. 108 if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then
67 case "$hgid" in 109 rev=`echo $rev | awk '{print $NF}'`
68 *+|*+\ *) printf '%s' -dirty ;; 110 printf -- '-svn%s' "$rev"
69 esac
70 111
71 # All done with mercurial 112 # All done with svn
113 return
114 fi
115}
116
117collect_files()
118{
119 local file res
120
121 for file; do
122 case "$file" in
123 *\~*)
124 continue
125 ;;
126 esac
127 if test -e "$file"; then
128 res="$res$(cat "$file")"
129 fi
130 done
131 echo "$res"
132}
133
134if $scm_only; then
135 if test ! -e .scmversion; then
136 res=$(scm_version)
137 echo "$res" >.scmversion
138 fi
72 exit 139 exit
73fi 140fi
74 141
75# Check for svn and a svn repo. 142if test -e include/config/auto.conf; then
76if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then 143 . include/config/auto.conf
77 rev=`echo $rev | awk '{print $NF}'` 144else
78 printf -- '-svn%s' "$rev" 145 echo "Error: kernelrelease not valid - run 'make prepare' to update it"
146 exit 1
147fi
79 148
80 # All done with svn 149# localversion* files in the build and source directory
81 exit 150res="$(collect_files localversion*)"
151if test ! "$srctree" -ef .; then
152 res="$res$(collect_files "$srctree"/localversion*)"
153fi
154
155# CONFIG_LOCALVERSION and LOCALVERSION (if set)
156res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}"
157
158# scm version string if not at a tagged commit
159if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
160 # full scm version string
161 res="$res$(scm_version)"
162else
163 # apped a plus sign if the repository is not in a clean tagged
164 # state and LOCALVERSION= is not specified
165 if test "${LOCALVERSION+set}" != "set"; then
166 scm=$(scm_version --short)
167 res="$res${scm:++}"
168 fi
82fi 169fi
170
171echo "$res"