diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/.gitignore | 1 | ||||
| -rw-r--r-- | scripts/binoffset.c | 163 | ||||
| -rwxr-xr-x | scripts/checkpatch.pl | 78 | ||||
| -rwxr-xr-x | scripts/extract-ikconfig | 127 | ||||
| -rwxr-xr-x | scripts/get_maintainer.pl | 185 | ||||
| -rw-r--r-- | scripts/kconfig/Makefile | 14 | ||||
| -rw-r--r-- | scripts/kconfig/streamline_config.pl | 59 | ||||
| -rwxr-xr-x | scripts/kernel-doc | 16 | ||||
| -rwxr-xr-x | scripts/recordmcount.pl | 39 |
9 files changed, 354 insertions, 328 deletions
diff --git a/scripts/.gitignore b/scripts/.gitignore index 52cab46ae35a..c5d5db54c009 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore | |||
| @@ -6,5 +6,4 @@ kallsyms | |||
| 6 | pnmtologo | 6 | pnmtologo |
| 7 | bin2c | 7 | bin2c |
| 8 | unifdef | 8 | unifdef |
| 9 | binoffset | ||
| 10 | ihex2fw | 9 | ihex2fw |
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 | |||
| 41 | char *progname; | ||
| 42 | char *inputname; | ||
| 43 | int inputfd; | ||
| 44 | unsigned int bix; /* buf index */ | ||
| 45 | unsigned char patterns [PAT_SIZE] = {0}; /* byte-sized pattern array */ | ||
| 46 | int pat_len; /* actual number of pattern bytes */ | ||
| 47 | unsigned char *madr; /* mmap address */ | ||
| 48 | size_t filesize; | ||
| 49 | int num_matches = 0; | ||
| 50 | off_t firstloc = 0; | ||
| 51 | |||
| 52 | void 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 | |||
| 61 | void 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 | |||
| 84 | void 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 | ||
| 98 | size_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 | |||
| 106 | size_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 | |||
| 118 | int 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..a4d74344d805 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 | ||
| 148 | our $Attribute = qr{ | 151 | our $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 | ||
| 195 | our $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 | |||
| 192 | our @typeList = ( | 203 | our @typeList = ( |
| 193 | qr{void}, | 204 | qr{void}, |
| 194 | qr{(?:unsigned\s+)?char}, | 205 | qr{(?:unsigned\s+)?char}, |
| @@ -1377,12 +1388,17 @@ sub process { | |||
| 1377 | #80 column limit | 1388 | #80 column limit |
| 1378 | if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ && | 1389 | if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ && |
| 1379 | $rawline !~ /^.\s*\*\s*\@$Ident\s/ && | 1390 | $rawline !~ /^.\s*\*\s*\@$Ident\s/ && |
| 1380 | $line !~ /^\+\s*printk\s*\(\s*(?:KERN_\S+\s*)?"[X\t]*"\s*(?:,|\)\s*;)\s*$/ && | 1391 | $line !~ /^\+\s*$logFunctions\s*\(\s*(?:KERN_\S+\s*)?"[X\t]*"\s*(?:,|\)\s*;)\s*$/ && |
| 1381 | $length > 80) | 1392 | $length > 80) |
| 1382 | { | 1393 | { |
| 1383 | WARN("line over 80 characters\n" . $herecurr); | 1394 | WARN("line over 80 characters\n" . $herecurr); |
| 1384 | } | 1395 | } |
| 1385 | 1396 | ||
| 1397 | # check for spaces before a quoted newline | ||
| 1398 | if ($rawline =~ /^.*\".*\s\\n/) { | ||
| 1399 | WARN("unnecessary whitespace before a quoted newline\n" . $herecurr); | ||
| 1400 | } | ||
| 1401 | |||
| 1386 | # check for adding lines without a newline. | 1402 | # check for adding lines without a newline. |
| 1387 | if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) { | 1403 | 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); | 1404 | WARN("adding a line without newline at end of file\n" . $herecurr); |
| @@ -1411,6 +1427,12 @@ sub process { | |||
| 1411 | ERROR("code indent should use tabs where possible\n" . $herevet); | 1427 | ERROR("code indent should use tabs where possible\n" . $herevet); |
| 1412 | } | 1428 | } |
| 1413 | 1429 | ||
| 1430 | # check for space before tabs. | ||
| 1431 | if ($rawline =~ /^\+/ && $rawline =~ / \t/) { | ||
| 1432 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; | ||
| 1433 | WARN("please, no space before tabs\n" . $herevet); | ||
| 1434 | } | ||
| 1435 | |||
| 1414 | # check we are in a valid C source file if not then ignore this hunk | 1436 | # check we are in a valid C source file if not then ignore this hunk |
| 1415 | next if ($realfile !~ /\.(h|c)$/); | 1437 | next if ($realfile !~ /\.(h|c)$/); |
| 1416 | 1438 | ||
| @@ -2182,8 +2204,10 @@ sub process { | |||
| 2182 | # Find out how long the conditional actually is. | 2204 | # Find out how long the conditional actually is. |
| 2183 | my @newlines = ($c =~ /\n/gs); | 2205 | my @newlines = ($c =~ /\n/gs); |
| 2184 | my $cond_lines = 1 + $#newlines; | 2206 | my $cond_lines = 1 + $#newlines; |
| 2207 | my $stat_real = ''; | ||
| 2185 | 2208 | ||
| 2186 | my $stat_real = raw_line($linenr, $cond_lines); | 2209 | $stat_real = raw_line($linenr, $cond_lines) |
| 2210 | . "\n" if ($cond_lines); | ||
| 2187 | if (defined($stat_real) && $cond_lines > 1) { | 2211 | if (defined($stat_real) && $cond_lines > 1) { |
| 2188 | $stat_real = "[...]\n$stat_real"; | 2212 | $stat_real = "[...]\n$stat_real"; |
| 2189 | } | 2213 | } |
| @@ -2348,6 +2372,8 @@ sub process { | |||
| 2348 | DECLARE_PER_CPU| | 2372 | DECLARE_PER_CPU| |
| 2349 | DEFINE_PER_CPU| | 2373 | DEFINE_PER_CPU| |
| 2350 | __typeof__\(| | 2374 | __typeof__\(| |
| 2375 | union| | ||
| 2376 | struct| | ||
| 2351 | \.$Ident\s*=\s*| | 2377 | \.$Ident\s*=\s*| |
| 2352 | ^\"|\"$ | 2378 | ^\"|\"$ |
| 2353 | }x; | 2379 | }x; |
| @@ -2572,6 +2598,11 @@ sub process { | |||
| 2572 | WARN("plain inline is preferred over $1\n" . $herecurr); | 2598 | WARN("plain inline is preferred over $1\n" . $herecurr); |
| 2573 | } | 2599 | } |
| 2574 | 2600 | ||
| 2601 | # check for sizeof(&) | ||
| 2602 | if ($line =~ /\bsizeof\s*\(\s*\&/) { | ||
| 2603 | WARN("sizeof(& should be avoided\n" . $herecurr); | ||
| 2604 | } | ||
| 2605 | |||
| 2575 | # check for new externs in .c files. | 2606 | # check for new externs in .c files. |
| 2576 | if ($realfile =~ /\.c$/ && defined $stat && | 2607 | if ($realfile =~ /\.c$/ && defined $stat && |
| 2577 | $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s) | 2608 | $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s) |
| @@ -2634,9 +2665,46 @@ sub process { | |||
| 2634 | if ($line =~ /^.\s*__initcall\s*\(/) { | 2665 | if ($line =~ /^.\s*__initcall\s*\(/) { |
| 2635 | WARN("please use device_initcall() instead of __initcall()\n" . $herecurr); | 2666 | WARN("please use device_initcall() instead of __initcall()\n" . $herecurr); |
| 2636 | } | 2667 | } |
| 2637 | # check for struct file_operations, ensure they are const. | 2668 | # check for various ops structs, ensure they are const. |
| 2669 | my $struct_ops = qr{acpi_dock_ops| | ||
| 2670 | address_space_operations| | ||
| 2671 | backlight_ops| | ||
| 2672 | block_device_operations| | ||
| 2673 | dentry_operations| | ||
| 2674 | dev_pm_ops| | ||
| 2675 | dma_map_ops| | ||
| 2676 | extent_io_ops| | ||
| 2677 | file_lock_operations| | ||
| 2678 | file_operations| | ||
| 2679 | hv_ops| | ||
| 2680 | ide_dma_ops| | ||
| 2681 | intel_dvo_dev_ops| | ||
| 2682 | item_operations| | ||
| 2683 | iwl_ops| | ||
| 2684 | kgdb_arch| | ||
| 2685 | kgdb_io| | ||
| 2686 | kset_uevent_ops| | ||
| 2687 | lock_manager_operations| | ||
| 2688 | microcode_ops| | ||
| 2689 | mtrr_ops| | ||
| 2690 | neigh_ops| | ||
| 2691 | nlmsvc_binding| | ||
| 2692 | pci_raw_ops| | ||
| 2693 | pipe_buf_operations| | ||
| 2694 | platform_hibernation_ops| | ||
| 2695 | platform_suspend_ops| | ||
| 2696 | proto_ops| | ||
| 2697 | rpc_pipe_ops| | ||
| 2698 | seq_operations| | ||
| 2699 | snd_ac97_build_ops| | ||
| 2700 | soc_pcmcia_socket_ops| | ||
| 2701 | stacktrace_ops| | ||
| 2702 | sysfs_ops| | ||
| 2703 | tty_operations| | ||
| 2704 | usb_mon_operations| | ||
| 2705 | wd_ops}x; | ||
| 2638 | if ($line !~ /\bconst\b/ && | 2706 | if ($line !~ /\bconst\b/ && |
| 2639 | $line =~ /\bstruct\s+(file_operations|seq_operations)\b/) { | 2707 | $line =~ /\bstruct\s+($struct_ops)\b/) { |
| 2640 | WARN("struct $1 should normally be const\n" . | 2708 | WARN("struct $1 should normally be const\n" . |
| 2641 | $herecurr); | 2709 | $herecurr); |
| 2642 | } | 2710 | } |
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. | |
| 6 | binoffset="./scripts/binoffset" | 6 | # |
| 7 | test -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. | |
| 9 | IKCFG_ST="0x49 0x4b 0x43 0x46 0x47 0x5f 0x53 0x54" | 9 | # |
| 10 | IKCFG_ED="0x49 0x4b 0x43 0x46 0x47 0x5f 0x45 0x44" | 10 | # (c) 2009, Dick Streefland <dick@streefland.net> |
| 11 | dump_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` | 14 | gz1='\037\213\010' |
| 15 | [ "$?" != "0" ] && start="-1" | 15 | gz2='01' |
| 16 | if [ "$start" -eq "-1" ]; then | 16 | cf1='IKCFG_ST\037\213\010' |
| 17 | return | 17 | cf2='0123456789' |
| 18 | fi | 18 | |
| 19 | end=`$binoffset $file $IKCFG_ED 2>/dev/null` | 19 | dump_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 | |||
| 35 | usage() | ||
| 36 | { | ||
| 37 | echo " usage: extract-ikconfig [b]zImage_filename" | ||
| 38 | } | ||
| 39 | |||
| 40 | clean_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 | ||
| 47 | if [ $# -lt 1 ] | 29 | # Check invocation: |
| 30 | me=${0##*/} | ||
| 31 | img=$1 | ||
| 32 | if [ $# -ne 1 -o ! -s "$img" ] | ||
| 48 | then | 33 | then |
| 49 | usage | 34 | echo "Usage: $me <kernel-image>" >&2 |
| 50 | exit 1 | 35 | exit 2 |
| 51 | fi | 36 | fi |
| 52 | 37 | ||
| 53 | TMPFILE=`mktemp -t ikconfig-XXXXXX` || exit 1 | 38 | # Initial attempt for uncompressed images or objects: |
| 54 | image="$1" | 39 | dump_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: |
| 57 | dump_config "$image" | 42 | tmp=/tmp/ikconfig$$ |
| 58 | 43 | trap "rm -f $tmp" 0 | |
| 59 | GZHDR1="0x1f 0x8b 0x08 0x00" | 44 | for pos in `tr "$gz1\n$gz2" "\n$gz2=" < "$img" | grep -abo "^$gz2"` |
| 60 | GZHDR2="0x1f 0x8b 0x08 0x08" | 45 | do |
| 61 | 46 | pos=${pos%%:*} | |
| 62 | ELFHDR="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 | 49 | done |
| 65 | off=`$binoffset "$image" $GZHDR1 2>/dev/null` | 50 | |
| 66 | [ "$?" != "0" ] && off="-1" | 51 | # Bail out: |
| 67 | if [ "$off" -eq "-1" ]; then | 52 | echo "$me: Cannot find kernel config." >&2 |
| 68 | off=`$binoffset "$image" $GZHDR2 2>/dev/null` | ||
| 69 | [ "$?" != "0" ] && off="-1" | ||
| 70 | fi | ||
| 71 | if [ "$off" -eq "0" ]; then | ||
| 72 | zcat <"$image" >"$TMPFILE" | ||
| 73 | dump_config "$TMPFILE" | ||
| 74 | elif [ "$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 | ||
| 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 | ||
| 86 | fi | ||
| 87 | |||
| 88 | echo "ERROR: Unable to extract kernel configuration information." | ||
| 89 | echo " This kernel image may not have the config info." | ||
| 90 | |||
| 91 | clean_up | ||
| 92 | exit 1 | 53 | exit 1 |
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 2f3230db7ffb..f76f3d13276d 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
| @@ -41,6 +41,8 @@ my $web = 0; | |||
| 41 | my $subsystem = 0; | 41 | my $subsystem = 0; |
| 42 | my $status = 0; | 42 | my $status = 0; |
| 43 | my $keywords = 1; | 43 | my $keywords = 1; |
| 44 | my $sections = 0; | ||
| 45 | my $file_emails = 0; | ||
| 44 | my $from_filename = 0; | 46 | my $from_filename = 0; |
| 45 | my $pattern_depth = 0; | 47 | my $pattern_depth = 0; |
| 46 | my $version = 0; | 48 | my $version = 0; |
| @@ -120,9 +122,11 @@ if (!GetOptions( | |||
| 120 | 'web!' => \$web, | 122 | 'web!' => \$web, |
| 121 | 'pattern-depth=i' => \$pattern_depth, | 123 | 'pattern-depth=i' => \$pattern_depth, |
| 122 | 'k|keywords!' => \$keywords, | 124 | 'k|keywords!' => \$keywords, |
| 125 | 'sections!' => \$sections, | ||
| 126 | 'fe|file-emails!' => \$file_emails, | ||
| 123 | 'f|file' => \$from_filename, | 127 | 'f|file' => \$from_filename, |
| 124 | 'v|version' => \$version, | 128 | 'v|version' => \$version, |
| 125 | 'h|help' => \$help, | 129 | 'h|help|usage' => \$help, |
| 126 | )) { | 130 | )) { |
| 127 | die "$P: invalid argument - use --help if necessary\n"; | 131 | die "$P: invalid argument - use --help if necessary\n"; |
| 128 | } | 132 | } |
| @@ -137,9 +141,9 @@ if ($version != 0) { | |||
| 137 | exit 0; | 141 | exit 0; |
| 138 | } | 142 | } |
| 139 | 143 | ||
| 140 | if ($#ARGV < 0) { | 144 | if (-t STDIN && !@ARGV) { |
| 141 | usage(); | 145 | # We're talking to a terminal, but have no command line arguments. |
| 142 | die "$P: argument missing: patchfile or -f file please\n"; | 146 | die "$P: missing patchfile or -f file - use --help if necessary\n"; |
| 143 | } | 147 | } |
| 144 | 148 | ||
| 145 | if ($output_separator ne ", ") { | 149 | if ($output_separator ne ", ") { |
| @@ -150,16 +154,24 @@ if ($output_rolestats) { | |||
| 150 | $output_roles = 1; | 154 | $output_roles = 1; |
| 151 | } | 155 | } |
| 152 | 156 | ||
| 153 | my $selections = $email + $scm + $status + $subsystem + $web; | 157 | if ($sections) { |
| 154 | if ($selections == 0) { | 158 | $email = 0; |
| 155 | usage(); | 159 | $email_list = 0; |
| 156 | die "$P: Missing required option: email, scm, status, subsystem or web\n"; | 160 | $scm = 0; |
| 161 | $status = 0; | ||
| 162 | $subsystem = 0; | ||
| 163 | $web = 0; | ||
| 164 | $keywords = 0; | ||
| 165 | } else { | ||
| 166 | my $selections = $email + $scm + $status + $subsystem + $web; | ||
| 167 | if ($selections == 0) { | ||
| 168 | die "$P: Missing required option: email, scm, status, subsystem or web\n"; | ||
| 169 | } | ||
| 157 | } | 170 | } |
| 158 | 171 | ||
| 159 | if ($email && | 172 | if ($email && |
| 160 | ($email_maintainer + $email_list + $email_subscriber_list + | 173 | ($email_maintainer + $email_list + $email_subscriber_list + |
| 161 | $email_git + $email_git_penguin_chiefs + $email_git_blame) == 0) { | 174 | $email_git + $email_git_penguin_chiefs + $email_git_blame) == 0) { |
| 162 | usage(); | ||
| 163 | die "$P: Please select at least 1 email option\n"; | 175 | die "$P: Please select at least 1 email option\n"; |
| 164 | } | 176 | } |
| 165 | 177 | ||
| @@ -173,8 +185,9 @@ if (!top_of_kernel_tree($lk_path)) { | |||
| 173 | my @typevalue = (); | 185 | my @typevalue = (); |
| 174 | my %keyword_hash; | 186 | my %keyword_hash; |
| 175 | 187 | ||
| 176 | open(MAINT, "<${lk_path}MAINTAINERS") || die "$P: Can't open MAINTAINERS\n"; | 188 | open (my $maint, '<', "${lk_path}MAINTAINERS") |
| 177 | while (<MAINT>) { | 189 | or die "$P: Can't open MAINTAINERS: $!\n"; |
| 190 | while (<$maint>) { | ||
| 178 | my $line = $_; | 191 | my $line = $_; |
| 179 | 192 | ||
| 180 | if ($line =~ m/^(\C):\s*(.*)/) { | 193 | if ($line =~ m/^(\C):\s*(.*)/) { |
| @@ -199,13 +212,14 @@ while (<MAINT>) { | |||
| 199 | push(@typevalue, $line); | 212 | push(@typevalue, $line); |
| 200 | } | 213 | } |
| 201 | } | 214 | } |
| 202 | close(MAINT); | 215 | close($maint); |
| 203 | 216 | ||
| 204 | my %mailmap; | 217 | my %mailmap; |
| 205 | 218 | ||
| 206 | if ($email_remove_duplicates) { | 219 | if ($email_remove_duplicates) { |
| 207 | open(MAILMAP, "<${lk_path}.mailmap") || warn "$P: Can't open .mailmap\n"; | 220 | open(my $mailmap, '<', "${lk_path}.mailmap") |
| 208 | while (<MAILMAP>) { | 221 | or warn "$P: Can't open .mailmap: $!\n"; |
| 222 | while (<$mailmap>) { | ||
| 209 | my $line = $_; | 223 | my $line = $_; |
| 210 | 224 | ||
| 211 | next if ($line =~ m/^\s*#/); | 225 | next if ($line =~ m/^\s*#/); |
| @@ -224,7 +238,7 @@ if ($email_remove_duplicates) { | |||
| 224 | $mailmap{$name} = \@arr; | 238 | $mailmap{$name} = \@arr; |
| 225 | } | 239 | } |
| 226 | } | 240 | } |
| 227 | close(MAILMAP); | 241 | close($mailmap); |
| 228 | } | 242 | } |
| 229 | 243 | ||
| 230 | ## use the filenames on the command line or find the filenames in the patchfiles | 244 | ## use the filenames on the command line or find the filenames in the patchfiles |
| @@ -232,31 +246,47 @@ if ($email_remove_duplicates) { | |||
| 232 | my @files = (); | 246 | my @files = (); |
| 233 | my @range = (); | 247 | my @range = (); |
| 234 | my @keyword_tvi = (); | 248 | my @keyword_tvi = (); |
| 249 | my @file_emails = (); | ||
| 250 | |||
| 251 | if (!@ARGV) { | ||
| 252 | push(@ARGV, "&STDIN"); | ||
| 253 | } | ||
| 235 | 254 | ||
| 236 | foreach my $file (@ARGV) { | 255 | foreach my $file (@ARGV) { |
| 237 | ##if $file is a directory and it lacks a trailing slash, add one | 256 | if ($file ne "&STDIN") { |
| 238 | if ((-d $file)) { | 257 | ##if $file is a directory and it lacks a trailing slash, add one |
| 239 | $file =~ s@([^/])$@$1/@; | 258 | if ((-d $file)) { |
| 240 | } elsif (!(-f $file)) { | 259 | $file =~ s@([^/])$@$1/@; |
| 241 | die "$P: file '${file}' not found\n"; | 260 | } elsif (!(-f $file)) { |
| 261 | die "$P: file '${file}' not found\n"; | ||
| 262 | } | ||
| 242 | } | 263 | } |
| 243 | if ($from_filename) { | 264 | if ($from_filename) { |
| 244 | push(@files, $file); | 265 | push(@files, $file); |
| 245 | if (-f $file && $keywords) { | 266 | if (-f $file && ($keywords || $file_emails)) { |
| 246 | open(FILE, "<$file") or die "$P: Can't open ${file}\n"; | 267 | open(my $f, '<', $file) |
| 247 | my $text = do { local($/) ; <FILE> }; | 268 | or die "$P: Can't open $file: $!\n"; |
| 248 | foreach my $line (keys %keyword_hash) { | 269 | my $text = do { local($/) ; <$f> }; |
| 249 | if ($text =~ m/$keyword_hash{$line}/x) { | 270 | close($f); |
| 250 | push(@keyword_tvi, $line); | 271 | if ($keywords) { |
| 272 | foreach my $line (keys %keyword_hash) { | ||
| 273 | if ($text =~ m/$keyword_hash{$line}/x) { | ||
| 274 | push(@keyword_tvi, $line); | ||
| 275 | } | ||
| 251 | } | 276 | } |
| 252 | } | 277 | } |
| 253 | close(FILE); | 278 | if ($file_emails) { |
| 279 | 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; | ||
| 280 | push(@file_emails, clean_file_emails(@poss_addr)); | ||
| 281 | } | ||
| 254 | } | 282 | } |
| 255 | } else { | 283 | } else { |
| 256 | my $file_cnt = @files; | 284 | my $file_cnt = @files; |
| 257 | my $lastfile; | 285 | my $lastfile; |
| 258 | open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; | 286 | |
| 259 | while (<PATCH>) { | 287 | open(my $patch, '<', $file) |
| 288 | or die "$P: Can't open $file: $!\n"; | ||
| 289 | while (<$patch>) { | ||
| 260 | my $patch_line = $_; | 290 | my $patch_line = $_; |
| 261 | if (m/^\+\+\+\s+(\S+)/) { | 291 | if (m/^\+\+\+\s+(\S+)/) { |
| 262 | my $filename = $1; | 292 | my $filename = $1; |
| @@ -276,7 +306,8 @@ foreach my $file (@ARGV) { | |||
| 276 | } | 306 | } |
| 277 | } | 307 | } |
| 278 | } | 308 | } |
| 279 | close(PATCH); | 309 | close($patch); |
| 310 | |||
| 280 | if ($file_cnt == @files) { | 311 | if ($file_cnt == @files) { |
| 281 | warn "$P: file '${file}' doesn't appear to be a patch. " | 312 | warn "$P: file '${file}' doesn't appear to be a patch. " |
| 282 | . "Add -f to options?\n"; | 313 | . "Add -f to options?\n"; |
| @@ -285,6 +316,8 @@ foreach my $file (@ARGV) { | |||
| 285 | } | 316 | } |
| 286 | } | 317 | } |
| 287 | 318 | ||
| 319 | @file_emails = uniq(@file_emails); | ||
| 320 | |||
| 288 | my @email_to = (); | 321 | my @email_to = (); |
| 289 | my @list_to = (); | 322 | my @list_to = (); |
| 290 | my @scm = (); | 323 | my @scm = (); |
| @@ -314,6 +347,7 @@ foreach my $file (@files) { | |||
| 314 | if ($type eq 'X') { | 347 | if ($type eq 'X') { |
| 315 | if (file_match_pattern($file, $value)) { | 348 | if (file_match_pattern($file, $value)) { |
| 316 | $exclude = 1; | 349 | $exclude = 1; |
| 350 | last; | ||
| 317 | } | 351 | } |
| 318 | } | 352 | } |
| 319 | } | 353 | } |
| @@ -340,12 +374,28 @@ foreach my $file (@files) { | |||
| 340 | } | 374 | } |
| 341 | } | 375 | } |
| 342 | 376 | ||
| 343 | $tvi += ($end - $start); | 377 | $tvi = $end + 1; |
| 344 | |||
| 345 | } | 378 | } |
| 346 | 379 | ||
| 347 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | 380 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { |
| 348 | add_categories($line); | 381 | add_categories($line); |
| 382 | if ($sections) { | ||
| 383 | my $i; | ||
| 384 | my $start = find_starting_index($line); | ||
| 385 | my $end = find_ending_index($line); | ||
| 386 | for ($i = $start; $i < $end; $i++) { | ||
| 387 | my $line = $typevalue[$i]; | ||
| 388 | if ($line =~ /^[FX]:/) { ##Restore file patterns | ||
| 389 | $line =~ s/([^\\])\.([^\*])/$1\?$2/g; | ||
| 390 | $line =~ s/([^\\])\.$/$1\?/g; ##Convert . back to ? | ||
| 391 | $line =~ s/\\\./\./g; ##Convert \. to . | ||
| 392 | $line =~ s/\.\*/\*/g; ##Convert .* to * | ||
| 393 | } | ||
| 394 | $line =~ s/^([A-Z]):/$1:\t/g; | ||
| 395 | print("$line\n"); | ||
| 396 | } | ||
| 397 | print("\n"); | ||
| 398 | } | ||
| 349 | } | 399 | } |
| 350 | 400 | ||
| 351 | if ($email && $email_git) { | 401 | if ($email && $email_git) { |
| @@ -377,6 +427,14 @@ if ($email) { | |||
| 377 | } | 427 | } |
| 378 | } | 428 | } |
| 379 | } | 429 | } |
| 430 | |||
| 431 | foreach my $email (@file_emails) { | ||
| 432 | my ($name, $address) = parse_email($email); | ||
| 433 | |||
| 434 | my $tmp_email = format_email($name, $address, $email_usename); | ||
| 435 | push_email_address($tmp_email, ''); | ||
| 436 | add_role($tmp_email, 'in file'); | ||
| 437 | } | ||
| 380 | } | 438 | } |
| 381 | 439 | ||
| 382 | if ($email || $email_list) { | 440 | if ($email || $email_list) { |
| @@ -453,6 +511,7 @@ MAINTAINER field selection options: | |||
| 453 | --remove-duplicates => minimize duplicate email names/addresses | 511 | --remove-duplicates => minimize duplicate email names/addresses |
| 454 | --roles => show roles (status:subsystem, git-signer, list, etc...) | 512 | --roles => show roles (status:subsystem, git-signer, list, etc...) |
| 455 | --rolestats => show roles and statistics (commits/total_commits, %) | 513 | --rolestats => show roles and statistics (commits/total_commits, %) |
| 514 | --file-emails => add email addresses found in -f file (default: 0 (off)) | ||
| 456 | --scm => print SCM tree(s) if any | 515 | --scm => print SCM tree(s) if any |
| 457 | --status => print status if any | 516 | --status => print status if any |
| 458 | --subsystem => print subsystem name if any | 517 | --subsystem => print subsystem name if any |
| @@ -466,6 +525,7 @@ Output type options: | |||
| 466 | Other options: | 525 | Other options: |
| 467 | --pattern-depth => Number of pattern directory traversals (default: 0 (all)) | 526 | --pattern-depth => Number of pattern directory traversals (default: 0 (all)) |
| 468 | --keywords => scan patch for keywords (default: 1 (on)) | 527 | --keywords => scan patch for keywords (default: 1 (on)) |
| 528 | --sections => print the entire subsystem sections with pattern matches | ||
| 469 | --version => show version | 529 | --version => show version |
| 470 | --help => show this help information | 530 | --help => show this help information |
| 471 | 531 | ||
| @@ -545,7 +605,7 @@ sub parse_email { | |||
| 545 | $name =~ s/^\"|\"$//g; | 605 | $name =~ s/^\"|\"$//g; |
| 546 | $address =~ s/^\s+|\s+$//g; | 606 | $address =~ s/^\s+|\s+$//g; |
| 547 | 607 | ||
| 548 | if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars | 608 | if ($name =~ /[^\w \-]/i) { ##has "must quote" chars |
| 549 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes | 609 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes |
| 550 | $name = "\"$name\""; | 610 | $name = "\"$name\""; |
| 551 | } | 611 | } |
| @@ -562,7 +622,7 @@ sub format_email { | |||
| 562 | $name =~ s/^\"|\"$//g; | 622 | $name =~ s/^\"|\"$//g; |
| 563 | $address =~ s/^\s+|\s+$//g; | 623 | $address =~ s/^\s+|\s+$//g; |
| 564 | 624 | ||
| 565 | if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars | 625 | if ($name =~ /[^\w \-]/i) { ##has "must quote" chars |
| 566 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes | 626 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes |
| 567 | $name = "\"$name\""; | 627 | $name = "\"$name\""; |
| 568 | } | 628 | } |
| @@ -811,7 +871,9 @@ sub add_role { | |||
| 811 | foreach my $entry (@email_to) { | 871 | foreach my $entry (@email_to) { |
| 812 | if ($email_remove_duplicates) { | 872 | if ($email_remove_duplicates) { |
| 813 | my ($entry_name, $entry_address) = parse_email($entry->[0]); | 873 | my ($entry_name, $entry_address) = parse_email($entry->[0]); |
| 814 | if ($name eq $entry_name || $address eq $entry_address) { | 874 | if (($name eq $entry_name || $address eq $entry_address) |
| 875 | && ($role eq "" || !($entry->[1] =~ m/$role/)) | ||
| 876 | ) { | ||
| 815 | if ($entry->[1] eq "") { | 877 | if ($entry->[1] eq "") { |
| 816 | $entry->[1] = "$role"; | 878 | $entry->[1] = "$role"; |
| 817 | } else { | 879 | } else { |
| @@ -819,7 +881,9 @@ sub add_role { | |||
| 819 | } | 881 | } |
| 820 | } | 882 | } |
| 821 | } else { | 883 | } else { |
| 822 | if ($email eq $entry->[0]) { | 884 | if ($email eq $entry->[0] |
| 885 | && ($role eq "" || !($entry->[1] =~ m/$role/)) | ||
| 886 | ) { | ||
| 823 | if ($entry->[1] eq "") { | 887 | if ($entry->[1] eq "") { |
| 824 | $entry->[1] = "$role"; | 888 | $entry->[1] = "$role"; |
| 825 | } else { | 889 | } else { |
| @@ -1099,6 +1163,51 @@ sub sort_and_uniq { | |||
| 1099 | return @parms; | 1163 | return @parms; |
| 1100 | } | 1164 | } |
| 1101 | 1165 | ||
| 1166 | sub clean_file_emails { | ||
| 1167 | my (@file_emails) = @_; | ||
| 1168 | my @fmt_emails = (); | ||
| 1169 | |||
| 1170 | foreach my $email (@file_emails) { | ||
| 1171 | $email =~ s/[\(\<\{]{0,1}([A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+)[\)\>\}]{0,1}/\<$1\>/g; | ||
| 1172 | my ($name, $address) = parse_email($email); | ||
| 1173 | if ($name eq '"[,\.]"') { | ||
| 1174 | $name = ""; | ||
| 1175 | } | ||
| 1176 | |||
| 1177 | my @nw = split(/[^A-Za-zÀ-ÿ\'\,\.\+-]/, $name); | ||
| 1178 | if (@nw > 2) { | ||
| 1179 | my $first = $nw[@nw - 3]; | ||
| 1180 | my $middle = $nw[@nw - 2]; | ||
| 1181 | my $last = $nw[@nw - 1]; | ||
| 1182 | |||
| 1183 | if (((length($first) == 1 && $first =~ m/[A-Za-z]/) || | ||
| 1184 | (length($first) == 2 && substr($first, -1) eq ".")) || | ||
| 1185 | (length($middle) == 1 || | ||
| 1186 | (length($middle) == 2 && substr($middle, -1) eq "."))) { | ||
| 1187 | $name = "$first $middle $last"; | ||
| 1188 | } else { | ||
| 1189 | $name = "$middle $last"; | ||
| 1190 | } | ||
| 1191 | } | ||
| 1192 | |||
| 1193 | if (substr($name, -1) =~ /[,\.]/) { | ||
| 1194 | $name = substr($name, 0, length($name) - 1); | ||
| 1195 | } elsif (substr($name, -2) =~ /[,\.]"/) { | ||
| 1196 | $name = substr($name, 0, length($name) - 2) . '"'; | ||
| 1197 | } | ||
| 1198 | |||
| 1199 | if (substr($name, 0, 1) =~ /[,\.]/) { | ||
| 1200 | $name = substr($name, 1, length($name) - 1); | ||
| 1201 | } elsif (substr($name, 0, 2) =~ /"[,\.]/) { | ||
| 1202 | $name = '"' . substr($name, 2, length($name) - 2); | ||
| 1203 | } | ||
| 1204 | |||
| 1205 | my $fmt_email = format_email($name, $address, $email_usename); | ||
| 1206 | push(@fmt_emails, $fmt_email); | ||
| 1207 | } | ||
| 1208 | return @fmt_emails; | ||
| 1209 | } | ||
| 1210 | |||
| 1102 | sub merge_email { | 1211 | sub merge_email { |
| 1103 | my @lines; | 1212 | my @lines; |
| 1104 | my %saw; | 1213 | my %saw; |
| @@ -1183,7 +1292,7 @@ sub rfc822_strip_comments { | |||
| 1183 | 1292 | ||
| 1184 | # valid: returns true if the parameter is an RFC822 valid address | 1293 | # valid: returns true if the parameter is an RFC822 valid address |
| 1185 | # | 1294 | # |
| 1186 | sub rfc822_valid ($) { | 1295 | sub rfc822_valid { |
| 1187 | my $s = rfc822_strip_comments(shift); | 1296 | my $s = rfc822_strip_comments(shift); |
| 1188 | 1297 | ||
| 1189 | if (!$rfc822re) { | 1298 | if (!$rfc822re) { |
| @@ -1203,7 +1312,7 @@ sub rfc822_valid ($) { | |||
| 1203 | # from success with no addresses found, because an empty string is | 1312 | # from success with no addresses found, because an empty string is |
| 1204 | # a valid list. | 1313 | # a valid list. |
| 1205 | 1314 | ||
| 1206 | sub rfc822_validlist ($) { | 1315 | sub rfc822_validlist { |
| 1207 | my $s = rfc822_strip_comments(shift); | 1316 | my $s = rfc822_strip_comments(shift); |
| 1208 | 1317 | ||
| 1209 | if (!$rfc822re) { | 1318 | if (!$rfc822re) { |
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 999e8a7d5bf7..186c46604d06 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
| @@ -30,8 +30,17 @@ silentoldconfig: $(obj)/conf | |||
| 30 | $(Q)mkdir -p include/generated | 30 | $(Q)mkdir -p include/generated |
| 31 | $< -s $(Kconfig) | 31 | $< -s $(Kconfig) |
| 32 | 32 | ||
| 33 | # if no path is given, then use src directory to find file | ||
| 34 | ifdef LSMOD | ||
| 35 | LSMOD_F := $(LSMOD) | ||
| 36 | ifeq ($(findstring /,$(LSMOD)),) | ||
| 37 | LSMOD_F := $(objtree)/$(LSMOD) | ||
| 38 | endif | ||
| 39 | endif | ||
| 40 | |||
| 33 | localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | 41 | localmodconfig: $(obj)/streamline_config.pl $(obj)/conf |
| 34 | $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config | 42 | $(Q)mkdir -p include/generated |
| 43 | $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config | ||
| 35 | $(Q)if [ -f .config ]; then \ | 44 | $(Q)if [ -f .config ]; then \ |
| 36 | cmp -s .tmp.config .config || \ | 45 | cmp -s .tmp.config .config || \ |
| 37 | (mv -f .config .config.old.1; \ | 46 | (mv -f .config .config.old.1; \ |
| @@ -45,7 +54,8 @@ localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | |||
| 45 | $(Q)rm -f .tmp.config | 54 | $(Q)rm -f .tmp.config |
| 46 | 55 | ||
| 47 | localyesconfig: $(obj)/streamline_config.pl $(obj)/conf | 56 | localyesconfig: $(obj)/streamline_config.pl $(obj)/conf |
| 48 | $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config | 57 | $(Q)mkdir -p include/generated |
| 58 | $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config | ||
| 49 | $(Q)sed -i s/=m/=y/ .tmp.config | 59 | $(Q)sed -i s/=m/=y/ .tmp.config |
| 50 | $(Q)if [ -f .config ]; then \ | 60 | $(Q)if [ -f .config ]; then \ |
| 51 | cmp -s .tmp.config .config || \ | 61 | cmp -s .tmp.config .config || \ |
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 0d800820c3cd..afbd54ac1d83 100644 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl | |||
| @@ -113,6 +113,7 @@ 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) |
| 114 | my $ksource = $ARGV[0]; | 114 | my $ksource = $ARGV[0]; |
| 115 | my $kconfig = $ARGV[1]; | 115 | my $kconfig = $ARGV[1]; |
| 116 | my $lsmod_file = $ARGV[2]; | ||
| 116 | 117 | ||
| 117 | my @makefiles = `find $ksource -name Makefile`; | 118 | my @makefiles = `find $ksource -name Makefile`; |
| 118 | my %depends; | 119 | my %depends; |
| @@ -121,6 +122,8 @@ my %prompts; | |||
| 121 | my %objects; | 122 | my %objects; |
| 122 | my $var; | 123 | my $var; |
| 123 | my $cont = 0; | 124 | my $cont = 0; |
| 125 | my $iflevel = 0; | ||
| 126 | my @ifdeps; | ||
| 124 | 127 | ||
| 125 | # prevent recursion | 128 | # prevent recursion |
| 126 | my %read_kconfigs; | 129 | my %read_kconfigs; |
| @@ -146,6 +149,15 @@ sub read_kconfig { | |||
| 146 | $state = "NEW"; | 149 | $state = "NEW"; |
| 147 | $config = $1; | 150 | $config = $1; |
| 148 | 151 | ||
| 152 | for (my $i = 0; $i < $iflevel; $i++) { | ||
| 153 | if ($i) { | ||
| 154 | $depends{$config} .= " " . $ifdeps[$i]; | ||
| 155 | } else { | ||
| 156 | $depends{$config} = $ifdeps[$i]; | ||
| 157 | } | ||
| 158 | $state = "DEP"; | ||
| 159 | } | ||
| 160 | |||
| 149 | # collect the depends for the config | 161 | # collect the depends for the config |
| 150 | } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) { | 162 | } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) { |
| 151 | $state = "DEP"; | 163 | $state = "DEP"; |
| @@ -166,6 +178,21 @@ sub read_kconfig { | |||
| 166 | # note if the config has a prompt | 178 | # note if the config has a prompt |
| 167 | $prompt{$config} = 1; | 179 | $prompt{$config} = 1; |
| 168 | 180 | ||
| 181 | # Check for if statements | ||
| 182 | } elsif (/^if\s+(.*\S)\s*$/) { | ||
| 183 | my $deps = $1; | ||
| 184 | # remove beginning and ending non text | ||
| 185 | $deps =~ s/^[^a-zA-Z0-9_]*//; | ||
| 186 | $deps =~ s/[^a-zA-Z0-9_]*$//; | ||
| 187 | |||
| 188 | my @deps = split /[^a-zA-Z0-9_]+/, $deps; | ||
| 189 | |||
| 190 | $ifdeps[$iflevel++] = join ':', @deps; | ||
| 191 | |||
| 192 | } elsif (/^endif/) { | ||
| 193 | |||
| 194 | $iflevel-- if ($iflevel); | ||
| 195 | |||
| 169 | # stop on "help" | 196 | # stop on "help" |
| 170 | } elsif (/^\s*help\s*$/) { | 197 | } elsif (/^\s*help\s*$/) { |
| 171 | $state = "NONE"; | 198 | $state = "NONE"; |
| @@ -237,8 +264,36 @@ foreach my $makefile (@makefiles) { | |||
| 237 | 264 | ||
| 238 | my %modules; | 265 | my %modules; |
| 239 | 266 | ||
| 240 | # see what modules are loaded on this system | 267 | if (defined($lsmod_file)) { |
| 241 | open(LIN,"/sbin/lsmod|") || die "Cant lsmod"; | 268 | if ( ! -f $lsmod_file) { |
| 269 | die "$lsmod_file not found"; | ||
| 270 | } | ||
| 271 | if ( -x $lsmod_file) { | ||
| 272 | # the file is executable, run it | ||
| 273 | open(LIN, "$lsmod_file|"); | ||
| 274 | } else { | ||
| 275 | # Just read the contents | ||
| 276 | open(LIN, "$lsmod_file"); | ||
| 277 | } | ||
| 278 | } else { | ||
| 279 | |||
| 280 | # see what modules are loaded on this system | ||
| 281 | my $lsmod; | ||
| 282 | |||
| 283 | foreach $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) { | ||
| 284 | if ( -x "$dir/lsmod" ) { | ||
| 285 | $lsmod = "$dir/lsmod"; | ||
| 286 | last; | ||
| 287 | } | ||
| 288 | } | ||
| 289 | if (!defined($lsmod)) { | ||
| 290 | # try just the path | ||
| 291 | $lsmod = "lsmod"; | ||
| 292 | } | ||
| 293 | |||
| 294 | open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod"; | ||
| 295 | } | ||
| 296 | |||
| 242 | while (<LIN>) { | 297 | while (<LIN>) { |
| 243 | next if (/^Module/); # Skip the first line. | 298 | next if (/^Module/); # Skip the first line. |
| 244 | if (/^(\S+)/) { | 299 | if (/^(\S+)/) { |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 241310e59cd6..208ad3b0ca51 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. |
| 246 | my ($function, %function_table, %parametertypes, $declaration_purpose); | 244 | my ($function, %function_table, %parametertypes, $declaration_purpose); |
| 247 | my ($type, $declaration_name, $return_type); | 245 | my ($type, $declaration_name, $return_type); |
| 248 | my ($newsection, $newcontents, $prototype, $filelist, $brcount, %source_map); | 246 | my ($newsection, $newcontents, $prototype, $brcount, %source_map); |
| 249 | 247 | ||
| 250 | if (defined($ENV{'KBUILD_VERBOSE'})) { | 248 | if (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 | } |
| @@ -1811,14 +1807,6 @@ if (open(SOURCE_MAP, "<.tmp_filelist.txt")) { | |||
| 1811 | close(SOURCE_MAP); | 1807 | close(SOURCE_MAP); |
| 1812 | } | 1808 | } |
| 1813 | 1809 | ||
| 1814 | if ($filelist) { | ||
| 1815 | open(FLIST,"<$filelist") or die "Can't open file list $filelist"; | ||
| 1816 | while(<FLIST>) { | ||
| 1817 | chop; | ||
| 1818 | process_file($_); | ||
| 1819 | } | ||
| 1820 | } | ||
| 1821 | |||
| 1822 | foreach (@ARGV) { | 1810 | foreach (@ARGV) { |
| 1823 | chomp; | 1811 | chomp; |
| 1824 | process_file($_); | 1812 | process_file($_); |
| @@ -2023,6 +2011,8 @@ sub process_file($) { | |||
| 2023 | return; | 2011 | return; |
| 2024 | } | 2012 | } |
| 2025 | 2013 | ||
| 2014 | $. = 1; | ||
| 2015 | |||
| 2026 | $section_counter = 0; | 2016 | $section_counter = 0; |
| 2027 | while (<IN>) { | 2017 | while (<IN>) { |
| 2028 | if ($state == 0) { | 2018 | if ($state == 0) { |
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 | ||
