aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Kbuild.include2
-rw-r--r--scripts/Makefile.build3
-rw-r--r--scripts/Makefile.headersinst4
-rw-r--r--scripts/Makefile.lib24
-rw-r--r--scripts/Makefile.modpost8
-rw-r--r--scripts/basic/fixdep.c93
-rwxr-xr-xscripts/checkpatch.pl34
-rwxr-xr-xscripts/coccicheck31
-rwxr-xr-xscripts/decodecode8
-rw-r--r--scripts/genksyms/genksyms.c18
-rwxr-xr-xscripts/get_maintainer.pl2
-rw-r--r--scripts/headers_install.pl63
-rw-r--r--scripts/headers_install.sh43
-rw-r--r--scripts/kconfig/Makefile4
-rw-r--r--scripts/kconfig/conf.c12
-rw-r--r--scripts/kconfig/confdata.c59
-rw-r--r--scripts/kconfig/list.h40
-rw-r--r--scripts/kconfig/lxdialog/check-lxdialog.sh6
-rw-r--r--scripts/kconfig/lxdialog/dialog.h7
-rw-r--r--scripts/kconfig/lxdialog/util.c45
-rw-r--r--scripts/kconfig/mconf.c74
-rw-r--r--scripts/kconfig/menu.c31
-rwxr-xr-xscripts/kconfig/merge_config.sh10
-rw-r--r--scripts/kconfig/streamline_config.pl26
-rw-r--r--scripts/link-vmlinux.sh5
-rw-r--r--scripts/mod/Makefile2
-rw-r--r--scripts/mod/devicetable-offsets.c3
-rw-r--r--scripts/mod/file2alias.c12
-rw-r--r--scripts/mod/modpost.c94
-rw-r--r--scripts/package/Makefile41
-rw-r--r--scripts/package/buildtar2
-rwxr-xr-xscripts/tags.sh4
32 files changed, 570 insertions, 240 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 978416dd31ca..547e15daf03d 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -148,7 +148,7 @@ cc-ldoption = $(call try-run,\
148# ld-option 148# ld-option
149# Usage: LDFLAGS += $(call ld-option, -X) 149# Usage: LDFLAGS += $(call ld-option, -X)
150ld-option = $(call try-run,\ 150ld-option = $(call try-run,\
151 $(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2)) 151 $(CC) -x c /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
152 152
153# ar-option 153# ar-option
154# Usage: KBUILD_ARFLAGS := $(call ar-option,D) 154# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 0e801c3cdaf8..d5d859c80729 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -211,7 +211,8 @@ $(obj)/%.i: $(src)/%.c FORCE
211 211
212cmd_gensymtypes = \ 212cmd_gensymtypes = \
213 $(CPP) -D__GENKSYMS__ $(c_flags) $< | \ 213 $(CPP) -D__GENKSYMS__ $(c_flags) $< | \
214 $(GENKSYMS) $(if $(1), -T $(2)) -a $(ARCH) \ 214 $(GENKSYMS) $(if $(1), -T $(2)) \
215 $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX)) \
215 $(if $(KBUILD_PRESERVE),-p) \ 216 $(if $(KBUILD_PRESERVE),-p) \
216 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null)) 217 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
217 218
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 477d137c0557..182084d728c8 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -72,7 +72,7 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
72quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ 72quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
73 file$(if $(word 2, $(all-files)),s)) 73 file$(if $(word 2, $(all-files)),s))
74 cmd_install = \ 74 cmd_install = \
75 $(PERL) $< $(installdir) $(SRCARCH) $(input-files); \ 75 $(CONFIG_SHELL) $< $(installdir) $(input-files); \
76 for F in $(wrapper-files); do \ 76 for F in $(wrapper-files); do \
77 echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \ 77 echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \
78 done; \ 78 done; \
@@ -98,7 +98,7 @@ __headersinst: $(subdirs) $(install-file)
98 @: 98 @:
99 99
100targets += $(install-file) 100targets += $(install-file)
101$(install-file): scripts/headers_install.pl $(input-files) FORCE 101$(install-file): scripts/headers_install.sh $(input-files) FORCE
102 $(if $(unwanted),$(call cmd,remove),) 102 $(if $(unwanted),$(call cmd,remove),)
103 $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@))) 103 $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
104 $(call if_changed,install) 104 $(call if_changed,install)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 07125e697d7a..51bb3de680b6 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -119,13 +119,6 @@ _c_flags += $(if $(patsubst n%,, \
119 $(CFLAGS_GCOV)) 119 $(CFLAGS_GCOV))
120endif 120endif
121 121
122ifdef CONFIG_SYMBOL_PREFIX
123_sym_flags = -DSYMBOL_PREFIX=$(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX))
124_cpp_flags += $(_sym_flags)
125_a_flags += $(_sym_flags)
126endif
127
128
129# If building the kernel in a separate objtree expand all occurrences 122# If building the kernel in a separate objtree expand all occurrences
130# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). 123# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
131 124
@@ -156,9 +149,9 @@ cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
156 149
157ld_flags = $(LDFLAGS) $(ldflags-y) 150ld_flags = $(LDFLAGS) $(ldflags-y)
158 151
159dtc_cpp_flags = -Wp,-MD,$(depfile) -nostdinc \ 152dtc_cpp_flags = -Wp,-MD,$(depfile).pre -nostdinc \
160 -I$(srctree)/arch/$(SRCARCH)/boot/dts \ 153 -I$(srctree)/arch/$(SRCARCH)/boot/dts \
161 -I$(srctree)/arch/$(SRCARCH)/include/dts \ 154 -I$(srctree)/arch/$(SRCARCH)/boot/dts/include \
162 -undef -D__DTS__ 155 -undef -D__DTS__
163 156
164# Finds the multi-part object the current object will be linked into 157# Finds the multi-part object the current object will be linked into
@@ -269,20 +262,17 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
269 $(call cmd,dt_S_dtb) 262 $(call cmd,dt_S_dtb)
270 263
271quiet_cmd_dtc = DTC $@ 264quiet_cmd_dtc = DTC $@
272cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $< 265cmd_dtc = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
266 $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \
267 -i $(srctree)/arch/$(SRCARCH)/boot/dts $(DTC_FLAGS) \
268 -d $(depfile).dtc $(dtc-tmp) ; \
269 cat $(depfile).pre $(depfile).dtc > $(depfile)
273 270
274$(obj)/%.dtb: $(src)/%.dts FORCE 271$(obj)/%.dtb: $(src)/%.dts FORCE
275 $(call if_changed_dep,dtc) 272 $(call if_changed_dep,dtc)
276 273
277dtc-tmp = $(subst $(comma),_,$(dot-target).dts) 274dtc-tmp = $(subst $(comma),_,$(dot-target).dts)
278 275
279quiet_cmd_dtc_cpp = DTC+CPP $@
280cmd_dtc_cpp = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
281 $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $(dtc-tmp)
282
283$(obj)/%.dtb: $(src)/%.dtsp FORCE
284 $(call if_changed_dep,dtc_cpp)
285
286# Bzip2 276# Bzip2
287# --------------------------------------------------------------------------- 277# ---------------------------------------------------------------------------
288 278
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index cf82c832458f..8dcdca27d836 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -60,7 +60,8 @@ kernelsymfile := $(objtree)/Module.symvers
60modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers 60modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers
61 61
62# Step 1), find all modules listed in $(MODVERDIR)/ 62# Step 1), find all modules listed in $(MODVERDIR)/
63__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod))) 63MODLISTCMD := find $(MODVERDIR) -name '*.mod' | xargs -r grep -h '\.ko$$' | sort -u
64__modules := $(shell $(MODLISTCMD))
64modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o))) 65modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o)))
65 66
66# Stop after building .o files if NOFINAL is set. Makes compile tests quicker 67# Stop after building .o files if NOFINAL is set. Makes compile tests quicker
@@ -78,12 +79,13 @@ modpost = scripts/mod/modpost \
78 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ 79 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
79 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) 80 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
80 81
82# We can go over command line length here, so be careful.
81quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules 83quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
82 cmd_modpost = $(modpost) -s 84 cmd_modpost = $(MODLISTCMD) | sed 's/\.ko$$/.o/' | $(modpost) -s -T -
83 85
84PHONY += __modpost 86PHONY += __modpost
85__modpost: $(modules:.ko=.o) FORCE 87__modpost: $(modules:.ko=.o) FORCE
86 $(call cmd,modpost) $(wildcard vmlinux) $(filter-out FORCE,$^) 88 $(call cmd,modpost) $(wildcard vmlinux)
87 89
88quiet_cmd_kernel-mod = MODPOST $@ 90quiet_cmd_kernel-mod = MODPOST $@
89 cmd_kernel-mod = $(modpost) $@ 91 cmd_kernel-mod = $(modpost) $@
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 7f6425e24ce3..078fe1d64e7d 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -320,49 +320,78 @@ static void parse_dep_file(void *map, size_t len)
320 char *end = m + len; 320 char *end = m + len;
321 char *p; 321 char *p;
322 char s[PATH_MAX]; 322 char s[PATH_MAX];
323 int first; 323 int is_target;
324 324 int saw_any_target = 0;
325 p = strchr(m, ':'); 325 int is_first_dep = 0;
326 if (!p) {
327 fprintf(stderr, "fixdep: parse error\n");
328 exit(1);
329 }
330 memcpy(s, m, p-m); s[p-m] = 0;
331 m = p+1;
332 326
333 clear_config(); 327 clear_config();
334 328
335 first = 1;
336 while (m < end) { 329 while (m < end) {
330 /* Skip any "white space" */
337 while (m < end && (*m == ' ' || *m == '\\' || *m == '\n')) 331 while (m < end && (*m == ' ' || *m == '\\' || *m == '\n'))
338 m++; 332 m++;
333 /* Find next "white space" */
339 p = m; 334 p = m;
340 while (p < end && *p != ' ') p++; 335 while (p < end && *p != ' ' && *p != '\\' && *p != '\n')
341 if (p == end) {
342 do p--; while (!isalnum(*p));
343 p++; 336 p++;
337 /* Is the token we found a target name? */
338 is_target = (*(p-1) == ':');
339 /* Don't write any target names into the dependency file */
340 if (is_target) {
341 /* The /next/ file is the first dependency */
342 is_first_dep = 1;
343 } else {
344 /* Save this token/filename */
345 memcpy(s, m, p-m);
346 s[p - m] = 0;
347
348 /* Ignore certain dependencies */
349 if (strrcmp(s, "include/generated/autoconf.h") &&
350 strrcmp(s, "arch/um/include/uml-config.h") &&
351 strrcmp(s, "include/linux/kconfig.h") &&
352 strrcmp(s, ".ver")) {
353 /*
354 * Do not list the source file as dependency,
355 * so that kbuild is not confused if a .c file
356 * is rewritten into .S or vice versa. Storing
357 * it in source_* is needed for modpost to
358 * compute srcversions.
359 */
360 if (is_first_dep) {
361 /*
362 * If processing the concatenation of
363 * multiple dependency files, only
364 * process the first target name, which
365 * will be the original source name,
366 * and ignore any other target names,
367 * which will be intermediate temporary
368 * files.
369 */
370 if (!saw_any_target) {
371 saw_any_target = 1;
372 printf("source_%s := %s\n\n",
373 target, s);
374 printf("deps_%s := \\\n",
375 target);
376 }
377 is_first_dep = 0;
378 } else
379 printf(" %s \\\n", s);
380 do_config_file(s);
381 }
344 } 382 }
345 memcpy(s, m, p-m); s[p-m] = 0; 383 /*
346 if (strrcmp(s, "include/generated/autoconf.h") && 384 * Start searching for next token immediately after the first
347 strrcmp(s, "arch/um/include/uml-config.h") && 385 * "whitespace" character that follows this token.
348 strrcmp(s, "include/linux/kconfig.h") && 386 */
349 strrcmp(s, ".ver")) {
350 /*
351 * Do not list the source file as dependency, so that
352 * kbuild is not confused if a .c file is rewritten
353 * into .S or vice versa. Storing it in source_* is
354 * needed for modpost to compute srcversions.
355 */
356 if (first) {
357 printf("source_%s := %s\n\n", target, s);
358 printf("deps_%s := \\\n", target);
359 } else
360 printf(" %s \\\n", s);
361 do_config_file(s);
362 }
363 first = 0;
364 m = p + 1; 387 m = p + 1;
365 } 388 }
389
390 if (!saw_any_target) {
391 fprintf(stderr, "fixdep: parse error; no targets found\n");
392 exit(1);
393 }
394
366 printf("\n%s: $(deps_%s)\n\n", target, target); 395 printf("\n%s: $(deps_%s)\n\n", target, target);
367 printf("$(deps_%s):\n", target); 396 printf("$(deps_%s):\n", target);
368} 397}
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b28cc384a5bc..b954de58304f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -281,6 +281,7 @@ our $signature_tags = qr{(?xi:
281 Tested-by:| 281 Tested-by:|
282 Reviewed-by:| 282 Reviewed-by:|
283 Reported-by:| 283 Reported-by:|
284 Suggested-by:|
284 To:| 285 To:|
285 Cc: 286 Cc:
286)}; 287)};
@@ -628,6 +629,13 @@ sub sanitise_line {
628 return $res; 629 return $res;
629} 630}
630 631
632sub get_quoted_string {
633 my ($line, $rawline) = @_;
634
635 return "" if ($line !~ m/(\"[X]+\")/g);
636 return substr($rawline, $-[0], $+[0] - $-[0]);
637}
638
631sub ctx_statement_block { 639sub ctx_statement_block {
632 my ($linenr, $remain, $off) = @_; 640 my ($linenr, $remain, $off) = @_;
633 my $line = $linenr - 1; 641 my $line = $linenr - 1;
@@ -1576,7 +1584,8 @@ sub process {
1576# Check for incorrect file permissions 1584# Check for incorrect file permissions
1577 if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) { 1585 if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) {
1578 my $permhere = $here . "FILE: $realfile\n"; 1586 my $permhere = $here . "FILE: $realfile\n";
1579 if ($realfile =~ /(Makefile|Kconfig|\.c|\.h|\.S|\.tmpl)$/) { 1587 if ($realfile !~ m@scripts/@ &&
1588 $realfile !~ /\.(py|pl|awk|sh)$/) {
1580 ERROR("EXECUTE_PERMISSIONS", 1589 ERROR("EXECUTE_PERMISSIONS",
1581 "do not set execute permissions for source files\n" . $permhere); 1590 "do not set execute permissions for source files\n" . $permhere);
1582 } 1591 }
@@ -2514,8 +2523,8 @@ sub process {
2514 2523
2515# check for whitespace before a non-naked semicolon 2524# check for whitespace before a non-naked semicolon
2516 if ($line =~ /^\+.*\S\s+;/) { 2525 if ($line =~ /^\+.*\S\s+;/) {
2517 CHK("SPACING", 2526 WARN("SPACING",
2518 "space prohibited before semicolon\n" . $herecurr); 2527 "space prohibited before semicolon\n" . $herecurr);
2519 } 2528 }
2520 2529
2521# Check operator spacing. 2530# Check operator spacing.
@@ -3016,6 +3025,7 @@ sub process {
3016 $dstat !~ /^'X'$/ && # character constants 3025 $dstat !~ /^'X'$/ && # character constants
3017 $dstat !~ /$exceptions/ && 3026 $dstat !~ /$exceptions/ &&
3018 $dstat !~ /^\.$Ident\s*=/ && # .foo = 3027 $dstat !~ /^\.$Ident\s*=/ && # .foo =
3028 $dstat !~ /^(?:\#\s*$Ident|\#\s*$Constant)\s*$/ && # stringification #foo
3019 $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...) 3029 $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...)
3020 $dstat !~ /^for\s*$Constant$/ && # for (...) 3030 $dstat !~ /^for\s*$Constant$/ && # for (...)
3021 $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar() 3031 $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar()
@@ -3220,7 +3230,7 @@ sub process {
3220 } 3230 }
3221 3231
3222# check for unnecessary blank lines around braces 3232# check for unnecessary blank lines around braces
3223 if (($line =~ /^..*}\s*$/ && $prevline =~ /^.\s*$/)) { 3233 if (($line =~ /^.\s*}\s*$/ && $prevline =~ /^.\s*$/)) {
3224 CHK("BRACES", 3234 CHK("BRACES",
3225 "Blank lines aren't necessary before a close brace '}'\n" . $hereprev); 3235 "Blank lines aren't necessary before a close brace '}'\n" . $hereprev);
3226 } 3236 }
@@ -3372,6 +3382,15 @@ sub process {
3372 "struct spinlock should be spinlock_t\n" . $herecurr); 3382 "struct spinlock should be spinlock_t\n" . $herecurr);
3373 } 3383 }
3374 3384
3385# check for seq_printf uses that could be seq_puts
3386 if ($line =~ /\bseq_printf\s*\(/) {
3387 my $fmt = get_quoted_string($line, $rawline);
3388 if ($fmt !~ /[^\\]\%/) {
3389 WARN("PREFER_SEQ_PUTS",
3390 "Prefer seq_puts to seq_printf\n" . $herecurr);
3391 }
3392 }
3393
3375# Check for misused memsets 3394# Check for misused memsets
3376 if ($^V && $^V ge 5.10.0 && 3395 if ($^V && $^V ge 5.10.0 &&
3377 defined $stat && 3396 defined $stat &&
@@ -3476,6 +3495,13 @@ sub process {
3476 "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr); 3495 "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr);
3477 } 3496 }
3478 3497
3498# check for krealloc arg reuse
3499 if ($^V && $^V ge 5.10.0 &&
3500 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*\1\s*,/) {
3501 WARN("KREALLOC_ARG_REUSE",
3502 "Reusing the krealloc arg is almost always a bug\n" . $herecurr);
3503 }
3504
3479# check for alloc argument mismatch 3505# check for alloc argument mismatch
3480 if ($line =~ /\b(kcalloc|kmalloc_array)\s*\(\s*sizeof\b/) { 3506 if ($line =~ /\b(kcalloc|kmalloc_array)\s*\(\s*sizeof\b/) {
3481 WARN("ALLOC_ARRAY_ARGS", 3507 WARN("ALLOC_ARRAY_ARGS",
diff --git a/scripts/coccicheck b/scripts/coccicheck
index 85d31899ad98..06fcb3333247 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -1,4 +1,4 @@
1#!/bin/sh 1#!/bin/bash
2 2
3SPATCH="`which ${SPATCH:=spatch}`" 3SPATCH="`which ${SPATCH:=spatch}`"
4 4
@@ -11,27 +11,32 @@ else
11 VERBOSE=0 11 VERBOSE=0
12fi 12fi
13 13
14FLAGS="$SPFLAGS -very_quiet"
15
16# spatch only allows include directories with the syntax "-I include"
17# while gcc also allows "-Iinclude" and "-include include"
18COCCIINCLUDE=${LINUXINCLUDE//-I/-I }
19COCCIINCLUDE=${COCCIINCLUDE//-include/-I}
20
14if [ "$C" = "1" -o "$C" = "2" ]; then 21if [ "$C" = "1" -o "$C" = "2" ]; then
15 ONLINE=1 22 ONLINE=1
16 23
17# This requires Coccinelle >= 0.2.3 24 # Take only the last argument, which is the C file to test
18# FLAGS="-ignore_unknown_options -very_quiet" 25 shift $(( $# - 1 ))
19# OPTIONS=$* 26 OPTIONS="$COCCIINCLUDE $1"
20
21# Workaround for Coccinelle < 0.2.3
22 FLAGS="-I $srctree/include -very_quiet"
23 shift $(( $# - 1 ))
24 OPTIONS=$1
25else 27else
26 ONLINE=0 28 ONLINE=0
27 FLAGS="-very_quiet"
28 if [ "$KBUILD_EXTMOD" = "" ] ; then 29 if [ "$KBUILD_EXTMOD" = "" ] ; then
29 OPTIONS="-dir $srctree" 30 OPTIONS="-dir $srctree $COCCIINCLUDE"
30 else 31 else
31 OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree -I $srctree/include -I $KBUILD_EXTMOD/include" 32 OPTIONS="-dir $KBUILD_EXTMOD $COCCIINCLUDE"
32 fi 33 fi
33fi 34fi
34 35
36if [ "$KBUILD_EXTMOD" != "" ] ; then
37 OPTIONS="-patch $srctree $OPTIONS"
38fi
39
35if [ ! -x "$SPATCH" ]; then 40if [ ! -x "$SPATCH" ]; then
36 echo 'spatch is part of the Coccinelle project and is available at http://coccinelle.lip6.fr/' 41 echo 'spatch is part of the Coccinelle project and is available at http://coccinelle.lip6.fr/'
37 exit 1 42 exit 1
@@ -72,7 +77,7 @@ coccinelle () {
72# 77#
73# $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null 78# $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null
74 79
75 if [ $VERBOSE -ne 0 ] ; then 80 if [ $VERBOSE -ne 0 -a $ONLINE -eq 0 ] ; then
76 81
77 FILE=`echo $COCCI | sed "s|$srctree/||"` 82 FILE=`echo $COCCI | sed "s|$srctree/||"`
78 83
diff --git a/scripts/decodecode b/scripts/decodecode
index 4f8248d5a11f..d8824f37acce 100755
--- a/scripts/decodecode
+++ b/scripts/decodecode
@@ -89,10 +89,16 @@ echo $code >> $T.s
89disas $T 89disas $T
90cat $T.dis >> $T.aa 90cat $T.dis >> $T.aa
91 91
92# (lines of whole $T.oo) - (lines of $T.aa, i.e. "Code starting") + 3,
93# i.e. the title + the "===..=" line (sed is counting from 1, 0 address is
94# special)
95faultlinenum=$(( $(wc -l $T.oo | cut -d" " -f1) - \
96 $(wc -l $T.aa | cut -d" " -f1) + 3))
97
92faultline=`cat $T.dis | head -1 | cut -d":" -f2-` 98faultline=`cat $T.dis | head -1 | cut -d":" -f2-`
93faultline=`echo "$faultline" | sed -e 's/\[/\\\[/g; s/\]/\\\]/g'` 99faultline=`echo "$faultline" | sed -e 's/\[/\\\[/g; s/\]/\\\]/g'`
94 100
95cat $T.oo | sed -e "s/\($faultline\)/\*\1 <-- trapping instruction/g" 101cat $T.oo | sed -e "${faultlinenum}s/^\(.*:\)\(.*\)/\1\*\2\t\t<-- trapping instruction/"
96echo 102echo
97cat $T.aa 103cat $T.aa
98cleanup 104cleanup
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c
index d25e4a118d37..88632df4381b 100644
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -45,7 +45,6 @@ int in_source_file;
45 45
46static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types, 46static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types,
47 flag_preserve, flag_warnings; 47 flag_preserve, flag_warnings;
48static const char *arch = "";
49static const char *mod_prefix = ""; 48static const char *mod_prefix = "";
50 49
51static int errors; 50static int errors;
@@ -731,7 +730,7 @@ static void genksyms_usage(void)
731{ 730{
732 fputs("Usage:\n" "genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver\n" "\n" 731 fputs("Usage:\n" "genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver\n" "\n"
733#ifdef __GNU_LIBRARY__ 732#ifdef __GNU_LIBRARY__
734 " -a, --arch Select architecture\n" 733 " -s, --symbol-prefix Select symbol prefix\n"
735 " -d, --debug Increment the debug level (repeatable)\n" 734 " -d, --debug Increment the debug level (repeatable)\n"
736 " -D, --dump Dump expanded symbol defs (for debugging only)\n" 735 " -D, --dump Dump expanded symbol defs (for debugging only)\n"
737 " -r, --reference file Read reference symbols from a file\n" 736 " -r, --reference file Read reference symbols from a file\n"
@@ -742,7 +741,7 @@ static void genksyms_usage(void)
742 " -h, --help Print this message\n" 741 " -h, --help Print this message\n"
743 " -V, --version Print the release version\n" 742 " -V, --version Print the release version\n"
744#else /* __GNU_LIBRARY__ */ 743#else /* __GNU_LIBRARY__ */
745 " -a Select architecture\n" 744 " -s Select symbol prefix\n"
746 " -d Increment the debug level (repeatable)\n" 745 " -d Increment the debug level (repeatable)\n"
747 " -D Dump expanded symbol defs (for debugging only)\n" 746 " -D Dump expanded symbol defs (for debugging only)\n"
748 " -r file Read reference symbols from a file\n" 747 " -r file Read reference symbols from a file\n"
@@ -763,7 +762,7 @@ int main(int argc, char **argv)
763 762
764#ifdef __GNU_LIBRARY__ 763#ifdef __GNU_LIBRARY__
765 struct option long_opts[] = { 764 struct option long_opts[] = {
766 {"arch", 1, 0, 'a'}, 765 {"symbol-prefix", 1, 0, 's'},
767 {"debug", 0, 0, 'd'}, 766 {"debug", 0, 0, 'd'},
768 {"warnings", 0, 0, 'w'}, 767 {"warnings", 0, 0, 'w'},
769 {"quiet", 0, 0, 'q'}, 768 {"quiet", 0, 0, 'q'},
@@ -776,14 +775,14 @@ int main(int argc, char **argv)
776 {0, 0, 0, 0} 775 {0, 0, 0, 0}
777 }; 776 };
778 777
779 while ((o = getopt_long(argc, argv, "a:dwqVDr:T:ph", 778 while ((o = getopt_long(argc, argv, "s:dwqVDr:T:ph",
780 &long_opts[0], NULL)) != EOF) 779 &long_opts[0], NULL)) != EOF)
781#else /* __GNU_LIBRARY__ */ 780#else /* __GNU_LIBRARY__ */
782 while ((o = getopt(argc, argv, "a:dwqVDr:T:ph")) != EOF) 781 while ((o = getopt(argc, argv, "s:dwqVDr:T:ph")) != EOF)
783#endif /* __GNU_LIBRARY__ */ 782#endif /* __GNU_LIBRARY__ */
784 switch (o) { 783 switch (o) {
785 case 'a': 784 case 's':
786 arch = optarg; 785 mod_prefix = optarg;
787 break; 786 break;
788 case 'd': 787 case 'd':
789 flag_debug++; 788 flag_debug++;
@@ -826,9 +825,6 @@ int main(int argc, char **argv)
826 genksyms_usage(); 825 genksyms_usage();
827 return 1; 826 return 1;
828 } 827 }
829 if ((strcmp(arch, "h8300") == 0) || (strcmp(arch, "blackfin") == 0) ||
830 (strcmp(arch, "metag") == 0))
831 mod_prefix = "_";
832 { 828 {
833 extern int yydebug; 829 extern int yydebug;
834 extern int yy_flex_debug; 830 extern int yy_flex_debug;
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index ce4cc837b748..5e4fb144a04f 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -611,7 +611,7 @@ sub get_maintainers {
611 $hash{$tvi} = $value_pd; 611 $hash{$tvi} = $value_pd;
612 } 612 }
613 } 613 }
614 } elsif ($type eq 'K') { 614 } elsif ($type eq 'N') {
615 if ($file =~ m/$value/x) { 615 if ($file =~ m/$value/x) {
616 $hash{$tvi} = 0; 616 $hash{$tvi} = 0;
617 } 617 }
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
deleted file mode 100644
index 581ca99c96f2..000000000000
--- a/scripts/headers_install.pl
+++ /dev/null
@@ -1,63 +0,0 @@
1#!/usr/bin/perl -w
2#
3# headers_install prepare the listed header files for use in
4# user space and copy the files to their destination.
5#
6# Usage: headers_install.pl readdir installdir arch [files...]
7# installdir: dir to install the files to
8# arch: current architecture
9# arch is used to force a reinstallation when the arch
10# changes because kbuild then detect a command line change.
11# files: list of files to check
12#
13# Step in preparation for users space:
14# 1) Drop all use of compiler.h definitions
15# 2) Drop include of compiler.h
16# 3) Drop all sections defined out by __KERNEL__ (using unifdef)
17
18use strict;
19
20my ($installdir, $arch, @files) = @ARGV;
21
22my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__";
23
24foreach my $filename (@files) {
25 my $file = $filename;
26 $file =~ s!^.*/!!;
27
28 my $tmpfile = "$installdir/$file.tmp";
29
30 open(my $in, '<', $filename)
31 or die "$filename: $!\n";
32 open(my $out, '>', $tmpfile)
33 or die "$tmpfile: $!\n";
34 while (my $line = <$in>) {
35 $line =~ s/([\s(])__user\s/$1/g;
36 $line =~ s/([\s(])__force\s/$1/g;
37 $line =~ s/([\s(])__iomem\s/$1/g;
38 $line =~ s/\s__attribute_const__\s/ /g;
39 $line =~ s/\s__attribute_const__$//g;
40 $line =~ s/\b__packed\b/__attribute__((packed))/g;
41 $line =~ s/^#include <linux\/compiler.h>//;
42 $line =~ s/(^|\s)(inline)\b/$1__$2__/g;
43 $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;
44 $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g;
45 $line =~ s/#ifndef\s+_UAPI/#ifndef /;
46 $line =~ s/#define\s+_UAPI/#define /;
47 $line =~ s!#endif\s+/[*]\s*_UAPI!#endif /* !;
48 printf {$out} "%s", $line;
49 }
50 close $out;
51 close $in;
52
53 system $unifdef . " $tmpfile > $installdir/$file";
54 # unifdef will exit 0 on success, and will exit 1 when the
55 # file was processed successfully but no changes were made,
56 # so abort only when it's higher than that.
57 my $e = $? >> 8;
58 if ($e > 1) {
59 die "$tmpfile: $!\n";
60 }
61 unlink $tmpfile;
62}
63exit 0;
diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
new file mode 100644
index 000000000000..643764f53ea7
--- /dev/null
+++ b/scripts/headers_install.sh
@@ -0,0 +1,43 @@
1#!/bin/sh
2
3if [ $# -lt 1 ]
4then
5 echo "Usage: headers_install.sh OUTDIR [FILES...]
6 echo
7 echo "Prepares kernel header files for use by user space, by removing"
8 echo "all compiler.h definitions and #includes, removing any"
9 echo "#ifdef __KERNEL__ sections, and putting __underscores__ around"
10 echo "asm/inline/volatile keywords."
11 echo
12 echo "OUTDIR: directory to write each userspace header FILE to."
13 echo "FILES: list of header files to operate on."
14
15 exit 1
16fi
17
18# Grab arguments
19
20OUTDIR="$1"
21shift
22
23# Iterate through files listed on command line
24
25FILE=
26trap 'rm -f "$OUTDIR/$FILE" "$OUTDIR/$FILE.sed"' EXIT
27for i in "$@"
28do
29 FILE="$(basename "$i")"
30 sed -r \
31 -e 's/([ \t(])(__user|__force|__iomem)[ \t]/\1/g' \
32 -e 's/__attribute_const__([ \t]|$)/\1/g' \
33 -e 's@^#include <linux/compiler.h>@@' \
34 -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
35 -e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \
36 -e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \
37 "$i" > "$OUTDIR/$FILE.sed" || exit 1
38 scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \
39 > "$OUTDIR/$FILE"
40 [ $? -gt 1 ] && exit 1
41 rm -f "$OUTDIR/$FILE.sed"
42done
43trap - EXIT
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 231b4759c714..844bc9da08da 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -219,7 +219,9 @@ HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
219 219
220HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) 220HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
221 221
222HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses 222HOSTLOADLIBES_nconf = $(shell \
223 pkg-config --libs menu panel ncurses 2>/dev/null \
224 || echo "-lmenu -lpanel -lncurses" )
223$(obj)/qconf.o: $(obj)/.tmp_qtcheck 225$(obj)/qconf.o: $(obj)/.tmp_qtcheck
224 226
225ifeq ($(qconf-target),1) 227ifeq ($(qconf-target),1)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index e39fcd8143ea..bde5b95c8c19 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -13,6 +13,7 @@
13#include <getopt.h> 13#include <getopt.h>
14#include <sys/stat.h> 14#include <sys/stat.h>
15#include <sys/time.h> 15#include <sys/time.h>
16#include <errno.h>
16 17
17#include "lkc.h" 18#include "lkc.h"
18 19
@@ -514,14 +515,23 @@ int main(int ac, char **av)
514 { 515 {
515 struct timeval now; 516 struct timeval now;
516 unsigned int seed; 517 unsigned int seed;
518 char *seed_env;
517 519
518 /* 520 /*
519 * Use microseconds derived seed, 521 * Use microseconds derived seed,
520 * compensate for systems where it may be zero 522 * compensate for systems where it may be zero
521 */ 523 */
522 gettimeofday(&now, NULL); 524 gettimeofday(&now, NULL);
523
524 seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1)); 525 seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1));
526
527 seed_env = getenv("KCONFIG_SEED");
528 if( seed_env && *seed_env ) {
529 char *endp;
530 int tmp = (int)strtol(seed_env, &endp, 10);
531 if (*endp == '\0') {
532 seed = tmp;
533 }
534 }
525 srand(seed); 535 srand(seed);
526 break; 536 break;
527 } 537 }
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 13ddf1126c2a..43eda40c3838 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -1106,10 +1106,54 @@ static void set_all_choice_values(struct symbol *csym)
1106void conf_set_all_new_symbols(enum conf_def_mode mode) 1106void conf_set_all_new_symbols(enum conf_def_mode mode)
1107{ 1107{
1108 struct symbol *sym, *csym; 1108 struct symbol *sym, *csym;
1109 int i, cnt; 1109 int i, cnt, pby, pty, ptm; /* pby: probability of boolean = y
1110 * pty: probability of tristate = y
1111 * ptm: probability of tristate = m
1112 */
1113
1114 pby = 50; pty = ptm = 33; /* can't go as the default in switch-case
1115 * below, otherwise gcc whines about
1116 * -Wmaybe-uninitialized */
1117 if (mode == def_random) {
1118 int n, p[3];
1119 char *env = getenv("KCONFIG_PROBABILITY");
1120 n = 0;
1121 while( env && *env ) {
1122 char *endp;
1123 int tmp = strtol( env, &endp, 10 );
1124 if( tmp >= 0 && tmp <= 100 ) {
1125 p[n++] = tmp;
1126 } else {
1127 errno = ERANGE;
1128 perror( "KCONFIG_PROBABILITY" );
1129 exit( 1 );
1130 }
1131 env = (*endp == ':') ? endp+1 : endp;
1132 if( n >=3 ) {
1133 break;
1134 }
1135 }
1136 switch( n ) {
1137 case 1:
1138 pby = p[0]; ptm = pby/2; pty = pby-ptm;
1139 break;
1140 case 2:
1141 pty = p[0]; ptm = p[1]; pby = pty + ptm;
1142 break;
1143 case 3:
1144 pby = p[0]; pty = p[1]; ptm = p[2];
1145 break;
1146 }
1147
1148 if( pty+ptm > 100 ) {
1149 errno = ERANGE;
1150 perror( "KCONFIG_PROBABILITY" );
1151 exit( 1 );
1152 }
1153 }
1110 1154
1111 for_all_symbols(i, sym) { 1155 for_all_symbols(i, sym) {
1112 if (sym_has_value(sym)) 1156 if (sym_has_value(sym) || (sym->flags & SYMBOL_VALID))
1113 continue; 1157 continue;
1114 switch (sym_get_type(sym)) { 1158 switch (sym_get_type(sym)) {
1115 case S_BOOLEAN: 1159 case S_BOOLEAN:
@@ -1125,8 +1169,15 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
1125 sym->def[S_DEF_USER].tri = no; 1169 sym->def[S_DEF_USER].tri = no;
1126 break; 1170 break;
1127 case def_random: 1171 case def_random:
1128 cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2; 1172 sym->def[S_DEF_USER].tri = no;
1129 sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt); 1173 cnt = rand() % 100;
1174 if (sym->type == S_TRISTATE) {
1175 if (cnt < pty)
1176 sym->def[S_DEF_USER].tri = yes;
1177 else if (cnt < (pty+ptm))
1178 sym->def[S_DEF_USER].tri = mod;
1179 } else if (cnt < pby)
1180 sym->def[S_DEF_USER].tri = yes;
1130 break; 1181 break;
1131 default: 1182 default:
1132 continue; 1183 continue;
diff --git a/scripts/kconfig/list.h b/scripts/kconfig/list.h
index 0ae730be5f49..685d80e1bb0e 100644
--- a/scripts/kconfig/list.h
+++ b/scripts/kconfig/list.h
@@ -51,6 +51,19 @@ struct list_head {
51 pos = list_entry(pos->member.next, typeof(*pos), member)) 51 pos = list_entry(pos->member.next, typeof(*pos), member))
52 52
53/** 53/**
54 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
55 * @pos: the type * to use as a loop cursor.
56 * @n: another type * to use as temporary storage
57 * @head: the head for your list.
58 * @member: the name of the list_struct within the struct.
59 */
60#define list_for_each_entry_safe(pos, n, head, member) \
61 for (pos = list_entry((head)->next, typeof(*pos), member), \
62 n = list_entry(pos->member.next, typeof(*pos), member); \
63 &pos->member != (head); \
64 pos = n, n = list_entry(n->member.next, typeof(*n), member))
65
66/**
54 * list_empty - tests whether a list is empty 67 * list_empty - tests whether a list is empty
55 * @head: the list to test. 68 * @head: the list to test.
56 */ 69 */
@@ -88,4 +101,31 @@ static inline void list_add_tail(struct list_head *_new, struct list_head *head)
88 __list_add(_new, head->prev, head); 101 __list_add(_new, head->prev, head);
89} 102}
90 103
104/*
105 * Delete a list entry by making the prev/next entries
106 * point to each other.
107 *
108 * This is only for internal list manipulation where we know
109 * the prev/next entries already!
110 */
111static inline void __list_del(struct list_head *prev, struct list_head *next)
112{
113 next->prev = prev;
114 prev->next = next;
115}
116
117#define LIST_POISON1 ((void *) 0x00100100)
118#define LIST_POISON2 ((void *) 0x00200200)
119/**
120 * list_del - deletes entry from list.
121 * @entry: the element to delete from the list.
122 * Note: list_empty() on entry does not return true after this, the entry is
123 * in an undefined state.
124 */
125static inline void list_del(struct list_head *entry)
126{
127 __list_del(entry->prev, entry->next);
128 entry->next = (struct list_head*)LIST_POISON1;
129 entry->prev = (struct list_head*)LIST_POISON2;
130}
91#endif 131#endif
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
index 80788137c670..9d2a4c585ee1 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -4,6 +4,8 @@
4# What library to link 4# What library to link
5ldflags() 5ldflags()
6{ 6{
7 pkg-config --libs ncursesw 2>/dev/null && exit
8 pkg-config --libs ncurses 2>/dev/null && exit
7 for ext in so a dll.a dylib ; do 9 for ext in so a dll.a dylib ; do
8 for lib in ncursesw ncurses curses ; do 10 for lib in ncursesw ncurses curses ; do
9 $cc -print-file-name=lib${lib}.${ext} | grep -q / 11 $cc -print-file-name=lib${lib}.${ext} | grep -q /
@@ -20,12 +22,12 @@ ldflags()
20ccflags() 22ccflags()
21{ 23{
22 if [ -f /usr/include/ncursesw/curses.h ]; then 24 if [ -f /usr/include/ncursesw/curses.h ]; then
23 echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"' 25 echo '-I/usr/include/ncursesw -DCURSES_LOC="<curses.h>"'
24 echo ' -DNCURSES_WIDECHAR=1' 26 echo ' -DNCURSES_WIDECHAR=1'
25 elif [ -f /usr/include/ncurses/ncurses.h ]; then 27 elif [ -f /usr/include/ncurses/ncurses.h ]; then
26 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"' 28 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
27 elif [ -f /usr/include/ncurses/curses.h ]; then 29 elif [ -f /usr/include/ncurses/curses.h ]; then
28 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"' 30 echo '-I/usr/include/ncurses -DCURSES_LOC="<curses.h>"'
29 elif [ -f /usr/include/ncurses.h ]; then 31 elif [ -f /usr/include/ncurses.h ]; then
30 echo '-DCURSES_LOC="<ncurses.h>"' 32 echo '-DCURSES_LOC="<ncurses.h>"'
31 else 33 else
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h
index 307022a8beef..1099337079b6 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -106,8 +106,14 @@ struct dialog_color {
106 int hl; /* highlight this item */ 106 int hl; /* highlight this item */
107}; 107};
108 108
109struct subtitle_list {
110 struct subtitle_list *next;
111 const char *text;
112};
113
109struct dialog_info { 114struct dialog_info {
110 const char *backtitle; 115 const char *backtitle;
116 struct subtitle_list *subtitles;
111 struct dialog_color screen; 117 struct dialog_color screen;
112 struct dialog_color shadow; 118 struct dialog_color shadow;
113 struct dialog_color dialog; 119 struct dialog_color dialog;
@@ -196,6 +202,7 @@ int on_key_resize(void);
196 202
197int init_dialog(const char *backtitle); 203int init_dialog(const char *backtitle);
198void set_dialog_backtitle(const char *backtitle); 204void set_dialog_backtitle(const char *backtitle);
205void set_dialog_subtitles(struct subtitle_list *subtitles);
199void end_dialog(int x, int y); 206void end_dialog(int x, int y);
200void attr_clear(WINDOW * win, int height, int width, chtype attr); 207void attr_clear(WINDOW * win, int height, int width, chtype attr);
201void dialog_clear(void); 208void dialog_clear(void);
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c
index 109d53117d22..a0e97c299410 100644
--- a/scripts/kconfig/lxdialog/util.c
+++ b/scripts/kconfig/lxdialog/util.c
@@ -257,12 +257,48 @@ void dialog_clear(void)
257 attr_clear(stdscr, LINES, COLS, dlg.screen.atr); 257 attr_clear(stdscr, LINES, COLS, dlg.screen.atr);
258 /* Display background title if it exists ... - SLH */ 258 /* Display background title if it exists ... - SLH */
259 if (dlg.backtitle != NULL) { 259 if (dlg.backtitle != NULL) {
260 int i; 260 int i, len = 0, skip = 0;
261 struct subtitle_list *pos;
261 262
262 wattrset(stdscr, dlg.screen.atr); 263 wattrset(stdscr, dlg.screen.atr);
263 mvwaddstr(stdscr, 0, 1, (char *)dlg.backtitle); 264 mvwaddstr(stdscr, 0, 1, (char *)dlg.backtitle);
265
266 for (pos = dlg.subtitles; pos != NULL; pos = pos->next) {
267 /* 3 is for the arrow and spaces */
268 len += strlen(pos->text) + 3;
269 }
270
264 wmove(stdscr, 1, 1); 271 wmove(stdscr, 1, 1);
265 for (i = 1; i < COLS - 1; i++) 272 if (len > COLS - 2) {
273 const char *ellipsis = "[...] ";
274 waddstr(stdscr, ellipsis);
275 skip = len - (COLS - 2 - strlen(ellipsis));
276 }
277
278 for (pos = dlg.subtitles; pos != NULL; pos = pos->next) {
279 if (skip == 0)
280 waddch(stdscr, ACS_RARROW);
281 else
282 skip--;
283
284 if (skip == 0)
285 waddch(stdscr, ' ');
286 else
287 skip--;
288
289 if (skip < strlen(pos->text)) {
290 waddstr(stdscr, pos->text + skip);
291 skip = 0;
292 } else
293 skip -= strlen(pos->text);
294
295 if (skip == 0)
296 waddch(stdscr, ' ');
297 else
298 skip--;
299 }
300
301 for (i = len + 1; i < COLS - 1; i++)
266 waddch(stdscr, ACS_HLINE); 302 waddch(stdscr, ACS_HLINE);
267 } 303 }
268 wnoutrefresh(stdscr); 304 wnoutrefresh(stdscr);
@@ -302,6 +338,11 @@ void set_dialog_backtitle(const char *backtitle)
302 dlg.backtitle = backtitle; 338 dlg.backtitle = backtitle;
303} 339}
304 340
341void set_dialog_subtitles(struct subtitle_list *subtitles)
342{
343 dlg.subtitles = subtitles;
344}
345
305/* 346/*
306 * End using dialog functions. 347 * End using dialog functions.
307 */ 348 */
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 566288a76370..387dc8daf7b2 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -311,6 +311,50 @@ static void set_config_filename(const char *config_filename)
311 filename[sizeof(filename)-1] = '\0'; 311 filename[sizeof(filename)-1] = '\0';
312} 312}
313 313
314struct subtitle_part {
315 struct list_head entries;
316 const char *text;
317};
318static LIST_HEAD(trail);
319
320static struct subtitle_list *subtitles;
321static void set_subtitle(void)
322{
323 struct subtitle_part *sp;
324 struct subtitle_list *pos, *tmp;
325
326 for (pos = subtitles; pos != NULL; pos = tmp) {
327 tmp = pos->next;
328 free(pos);
329 }
330
331 subtitles = NULL;
332 list_for_each_entry(sp, &trail, entries) {
333 if (sp->text) {
334 if (pos) {
335 pos->next = xcalloc(sizeof(*pos), 1);
336 pos = pos->next;
337 } else {
338 subtitles = pos = xcalloc(sizeof(*pos), 1);
339 }
340 pos->text = sp->text;
341 }
342 }
343
344 set_dialog_subtitles(subtitles);
345}
346
347static void reset_subtitle(void)
348{
349 struct subtitle_list *pos, *tmp;
350
351 for (pos = subtitles; pos != NULL; pos = tmp) {
352 tmp = pos->next;
353 free(pos);
354 }
355 subtitles = NULL;
356 set_dialog_subtitles(subtitles);
357}
314 358
315struct search_data { 359struct search_data {
316 struct list_head *head; 360 struct list_head *head;
@@ -353,6 +397,8 @@ static void search_conf(void)
353 char *dialog_input; 397 char *dialog_input;
354 int dres, vscroll = 0, hscroll = 0; 398 int dres, vscroll = 0, hscroll = 0;
355 bool again; 399 bool again;
400 struct gstr sttext;
401 struct subtitle_part stpart;
356 402
357 title = str_new(); 403 title = str_new();
358 str_printf( &title, _("Enter %s (sub)string to search for " 404 str_printf( &title, _("Enter %s (sub)string to search for "
@@ -379,6 +425,11 @@ again:
379 if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0) 425 if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
380 dialog_input += strlen(CONFIG_); 426 dialog_input += strlen(CONFIG_);
381 427
428 sttext = str_new();
429 str_printf(&sttext, "Search (%s)", dialog_input_result);
430 stpart.text = str_get(&sttext);
431 list_add_tail(&stpart.entries, &trail);
432
382 sym_arr = sym_re_search(dialog_input); 433 sym_arr = sym_re_search(dialog_input);
383 do { 434 do {
384 LIST_HEAD(head); 435 LIST_HEAD(head);
@@ -389,8 +440,10 @@ again:
389 .targets = targets, 440 .targets = targets,
390 .keys = keys, 441 .keys = keys,
391 }; 442 };
443 struct jump_key *pos, *tmp;
392 444
393 res = get_relations_str(sym_arr, &head); 445 res = get_relations_str(sym_arr, &head);
446 set_subtitle();
394 dres = show_textbox_ext(_("Search Results"), (char *) 447 dres = show_textbox_ext(_("Search Results"), (char *)
395 str_get(&res), 0, 0, keys, &vscroll, 448 str_get(&res), 0, 0, keys, &vscroll,
396 &hscroll, &update_text, (void *) 449 &hscroll, &update_text, (void *)
@@ -402,9 +455,13 @@ again:
402 again = true; 455 again = true;
403 } 456 }
404 str_free(&res); 457 str_free(&res);
458 list_for_each_entry_safe(pos, tmp, &head, entries)
459 free(pos);
405 } while (again); 460 } while (again);
406 free(sym_arr); 461 free(sym_arr);
407 str_free(&title); 462 str_free(&title);
463 list_del(trail.prev);
464 str_free(&sttext);
408} 465}
409 466
410static void build_conf(struct menu *menu) 467static void build_conf(struct menu *menu)
@@ -589,16 +646,24 @@ static void conf(struct menu *menu, struct menu *active_menu)
589{ 646{
590 struct menu *submenu; 647 struct menu *submenu;
591 const char *prompt = menu_get_prompt(menu); 648 const char *prompt = menu_get_prompt(menu);
649 struct subtitle_part stpart;
592 struct symbol *sym; 650 struct symbol *sym;
593 int res; 651 int res;
594 int s_scroll = 0; 652 int s_scroll = 0;
595 653
654 if (menu != &rootmenu)
655 stpart.text = menu_get_prompt(menu);
656 else
657 stpart.text = NULL;
658 list_add_tail(&stpart.entries, &trail);
659
596 while (1) { 660 while (1) {
597 item_reset(); 661 item_reset();
598 current_menu = menu; 662 current_menu = menu;
599 build_conf(menu); 663 build_conf(menu);
600 if (!child_count) 664 if (!child_count)
601 break; 665 break;
666 set_subtitle();
602 dialog_clear(); 667 dialog_clear();
603 res = dialog_menu(prompt ? _(prompt) : _("Main Menu"), 668 res = dialog_menu(prompt ? _(prompt) : _("Main Menu"),
604 _(menu_instructions), 669 _(menu_instructions),
@@ -640,13 +705,17 @@ static void conf(struct menu *menu, struct menu *active_menu)
640 case 2: 705 case 2:
641 if (sym) 706 if (sym)
642 show_help(submenu); 707 show_help(submenu);
643 else 708 else {
709 reset_subtitle();
644 show_helptext(_("README"), _(mconf_readme)); 710 show_helptext(_("README"), _(mconf_readme));
711 }
645 break; 712 break;
646 case 3: 713 case 3:
714 reset_subtitle();
647 conf_save(); 715 conf_save();
648 break; 716 break;
649 case 4: 717 case 4:
718 reset_subtitle();
650 conf_load(); 719 conf_load();
651 break; 720 break;
652 case 5: 721 case 5:
@@ -679,6 +748,8 @@ static void conf(struct menu *menu, struct menu *active_menu)
679 break; 748 break;
680 } 749 }
681 } 750 }
751
752 list_del(trail.prev);
682} 753}
683 754
684static int show_textbox_ext(const char *title, char *text, int r, int c, int 755static int show_textbox_ext(const char *title, char *text, int r, int c, int
@@ -881,6 +952,7 @@ static int handle_exit(void)
881 int res; 952 int res;
882 953
883 save_and_exit = 1; 954 save_and_exit = 1;
955 reset_subtitle();
884 dialog_clear(); 956 dialog_clear();
885 if (conf_get_changed()) 957 if (conf_get_changed())
886 res = dialog_yesno(NULL, 958 res = dialog_yesno(NULL,
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index f3bffa309333..b5c7d90df9df 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -515,13 +515,6 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
515 struct jump_key *jump; 515 struct jump_key *jump;
516 516
517 str_printf(r, _("Prompt: %s\n"), _(prop->text)); 517 str_printf(r, _("Prompt: %s\n"), _(prop->text));
518 str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
519 prop->menu->lineno);
520 if (!expr_is_yes(prop->visible.expr)) {
521 str_append(r, _(" Depends on: "));
522 expr_gstr_print(prop->visible.expr, r);
523 str_append(r, "\n");
524 }
525 menu = prop->menu->parent; 518 menu = prop->menu->parent;
526 for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) { 519 for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
527 bool accessible = menu_is_visible(menu); 520 bool accessible = menu_is_visible(menu);
@@ -572,6 +565,18 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
572} 565}
573 566
574/* 567/*
568 * get peoperty of type P_SYMBOL
569 */
570static struct property *get_symbol_prop(struct symbol *sym)
571{
572 struct property *prop = NULL;
573
574 for_all_properties(sym, prop, P_SYMBOL)
575 break;
576 return prop;
577}
578
579/*
575 * head is optional and may be NULL 580 * head is optional and may be NULL
576 */ 581 */
577void get_symbol_str(struct gstr *r, struct symbol *sym, 582void get_symbol_str(struct gstr *r, struct symbol *sym,
@@ -595,6 +600,18 @@ void get_symbol_str(struct gstr *r, struct symbol *sym,
595 } 600 }
596 for_all_prompts(sym, prop) 601 for_all_prompts(sym, prop)
597 get_prompt_str(r, prop, head); 602 get_prompt_str(r, prop, head);
603
604 prop = get_symbol_prop(sym);
605 if (prop) {
606 str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
607 prop->menu->lineno);
608 if (!expr_is_yes(prop->visible.expr)) {
609 str_append(r, _(" Depends on: "));
610 expr_gstr_print(prop->visible.expr, r);
611 str_append(r, "\n");
612 }
613 }
614
598 hit = false; 615 hit = false;
599 for_all_properties(sym, prop, P_SELECT) { 616 for_all_properties(sym, prop, P_SELECT) {
600 if (!hit) { 617 if (!hit) {
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index 05274fccb88e..81b0c61bb9e2 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -120,10 +120,18 @@ if [ "$MAKE" = "false" ]; then
120 exit 120 exit
121fi 121fi
122 122
123# If we have an output dir, setup the O= argument, otherwise leave
124# it blank, since O=. will create an unnecessary ./source softlink
125OUTPUT_ARG=""
126if [ "$OUTPUT" != "." ] ; then
127 OUTPUT_ARG="O=$OUTPUT"
128fi
129
130
123# Use the merged file as the starting point for: 131# Use the merged file as the starting point for:
124# alldefconfig: Fills in any missing symbols with Kconfig default 132# alldefconfig: Fills in any missing symbols with Kconfig default
125# allnoconfig: Fills in any missing symbols with # CONFIG_* is not set 133# allnoconfig: Fills in any missing symbols with # CONFIG_* is not set
126make KCONFIG_ALLCONFIG=$TMP_FILE O=$OUTPUT $ALLTARGET 134make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET
127 135
128 136
129# Check all specified config values took (might have missed-dependency issues) 137# Check all specified config values took (might have missed-dependency issues)
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 33689396953a..4606cdfb859d 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -156,7 +156,6 @@ sub read_kconfig {
156 156
157 my $state = "NONE"; 157 my $state = "NONE";
158 my $config; 158 my $config;
159 my @kconfigs;
160 159
161 my $cont = 0; 160 my $cont = 0;
162 my $line; 161 my $line;
@@ -190,7 +189,13 @@ sub read_kconfig {
190 189
191 # collect any Kconfig sources 190 # collect any Kconfig sources
192 if (/^source\s*"(.*)"/) { 191 if (/^source\s*"(.*)"/) {
193 $kconfigs[$#kconfigs+1] = $1; 192 my $kconfig = $1;
193 # prevent reading twice.
194 if (!defined($read_kconfigs{$kconfig})) {
195 $read_kconfigs{$kconfig} = 1;
196 read_kconfig($kconfig);
197 }
198 next;
194 } 199 }
195 200
196 # configs found 201 # configs found
@@ -250,14 +255,6 @@ sub read_kconfig {
250 } 255 }
251 } 256 }
252 close($kinfile); 257 close($kinfile);
253
254 # read in any configs that were found.
255 foreach my $kconfig (@kconfigs) {
256 if (!defined($read_kconfigs{$kconfig})) {
257 $read_kconfigs{$kconfig} = 1;
258 read_kconfig($kconfig);
259 }
260 }
261} 258}
262 259
263if ($kconfig) { 260if ($kconfig) {
@@ -396,6 +393,15 @@ foreach my $module (keys(%modules)) {
396 foreach my $conf (@arr) { 393 foreach my $conf (@arr) {
397 $configs{$conf} = $module; 394 $configs{$conf} = $module;
398 dprint "$conf added by direct ($module)\n"; 395 dprint "$conf added by direct ($module)\n";
396 if ($debugprint) {
397 my $c=$conf;
398 $c =~ s/^CONFIG_//;
399 if (defined($depends{$c})) {
400 dprint " deps = $depends{$c}\n";
401 } else {
402 dprint " no deps\n";
403 }
404 }
399 } 405 }
400 } else { 406 } else {
401 # Most likely, someone has a custom (binary?) module loaded. 407 # Most likely, someone has a custom (binary?) module loaded.
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 3d569d6022c2..014994936b1c 100644
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -74,9 +74,8 @@ kallsyms()
74 info KSYM ${2} 74 info KSYM ${2}
75 local kallsymopt; 75 local kallsymopt;
76 76
77 if [ -n "${CONFIG_SYMBOL_PREFIX}" ]; then 77 if [ -n "${CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX}" ]; then
78 kallsymopt="${kallsymopt} \ 78 kallsymopt="${kallsymopt} --symbol-prefix=_"
79 --symbol-prefix=${CONFIG_SYMBOL_PREFIX}"
80 fi 79 fi
81 80
82 if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then 81 if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then
diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile
index 9415b5663364..75d59fcd48b8 100644
--- a/scripts/mod/Makefile
+++ b/scripts/mod/Makefile
@@ -37,6 +37,8 @@ scripts/mod/devicetable-offsets.s: scripts/mod/devicetable-offsets.c FORCE
37$(obj)/$(devicetable-offsets-file): scripts/mod/devicetable-offsets.s 37$(obj)/$(devicetable-offsets-file): scripts/mod/devicetable-offsets.s
38 $(call cmd,offsets) 38 $(call cmd,offsets)
39 39
40targets += $(devicetable-offsets-file)
41
40# dependencies on generated files need to be listed explicitly 42# dependencies on generated files need to be listed explicitly
41 43
42$(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h 44$(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c
index b45260bfeaa0..e66d4d258e1a 100644
--- a/scripts/mod/devicetable-offsets.c
+++ b/scripts/mod/devicetable-offsets.c
@@ -174,5 +174,8 @@ int main(void)
174 DEVID_FIELD(x86_cpu_id, model); 174 DEVID_FIELD(x86_cpu_id, model);
175 DEVID_FIELD(x86_cpu_id, vendor); 175 DEVID_FIELD(x86_cpu_id, vendor);
176 176
177 DEVID(mei_cl_device_id);
178 DEVID_FIELD(mei_cl_device_id, name);
179
177 return 0; 180 return 0;
178} 181}
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 771ac17f635d..45f9a3377dcd 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -1133,6 +1133,18 @@ static int do_x86cpu_entry(const char *filename, void *symval,
1133} 1133}
1134ADD_TO_DEVTABLE("x86cpu", x86_cpu_id, do_x86cpu_entry); 1134ADD_TO_DEVTABLE("x86cpu", x86_cpu_id, do_x86cpu_entry);
1135 1135
1136/* Looks like: mei:S */
1137static int do_mei_entry(const char *filename, void *symval,
1138 char *alias)
1139{
1140 DEF_FIELD_ADDR(symval, mei_cl_device_id, name);
1141
1142 sprintf(alias, MEI_CL_MODULE_PREFIX "%s", *name);
1143
1144 return 1;
1145}
1146ADD_TO_DEVTABLE("mei", mei_cl_device_id, do_mei_entry);
1147
1136/* Does namelen bytes of name exactly match the symbol? */ 1148/* Does namelen bytes of name exactly match the symbol? */
1137static bool sym_is(const char *name, unsigned namelen, const char *symbol) 1149static bool sym_is(const char *name, unsigned namelen, const char *symbol)
1138{ 1150{
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 78b30c1548e9..a4be8e112bb6 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -15,17 +15,12 @@
15#include <stdio.h> 15#include <stdio.h>
16#include <ctype.h> 16#include <ctype.h>
17#include <string.h> 17#include <string.h>
18#include <limits.h>
19#include <stdbool.h>
18#include "modpost.h" 20#include "modpost.h"
19#include "../../include/generated/autoconf.h" 21#include "../../include/generated/autoconf.h"
20#include "../../include/linux/license.h" 22#include "../../include/linux/license.h"
21 23#include "../../include/linux/export.h"
22/* Some toolchains use a `_' prefix for all user symbols. */
23#ifdef CONFIG_SYMBOL_PREFIX
24#define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
25#else
26#define MODULE_SYMBOL_PREFIX ""
27#endif
28
29 24
30/* Are we using CONFIG_MODVERSIONS? */ 25/* Are we using CONFIG_MODVERSIONS? */
31int modversions = 0; 26int modversions = 0;
@@ -85,6 +80,14 @@ PRINTF void merror(const char *fmt, ...)
85 va_end(arglist); 80 va_end(arglist);
86} 81}
87 82
83static inline bool strends(const char *str, const char *postfix)
84{
85 if (strlen(str) < strlen(postfix))
86 return false;
87
88 return strcmp(str + strlen(str) - strlen(postfix), postfix) == 0;
89}
90
88static int is_vmlinux(const char *modname) 91static int is_vmlinux(const char *modname)
89{ 92{
90 const char *myname; 93 const char *myname;
@@ -120,22 +123,20 @@ static struct module *find_module(char *modname)
120 return mod; 123 return mod;
121} 124}
122 125
123static struct module *new_module(char *modname) 126static struct module *new_module(const char *modname)
124{ 127{
125 struct module *mod; 128 struct module *mod;
126 char *p, *s; 129 char *p;
127 130
128 mod = NOFAIL(malloc(sizeof(*mod))); 131 mod = NOFAIL(malloc(sizeof(*mod)));
129 memset(mod, 0, sizeof(*mod)); 132 memset(mod, 0, sizeof(*mod));
130 p = NOFAIL(strdup(modname)); 133 p = NOFAIL(strdup(modname));
131 134
132 /* strip trailing .o */ 135 /* strip trailing .o */
133 s = strrchr(p, '.'); 136 if (strends(p, ".o")) {
134 if (s != NULL) 137 p[strlen(p) - 2] = '\0';
135 if (strcmp(s, ".o") == 0) { 138 mod->is_dot_o = 1;
136 *s = '\0'; 139 }
137 mod->is_dot_o = 1;
138 }
139 140
140 /* add to list */ 141 /* add to list */
141 mod->name = p; 142 mod->name = p;
@@ -562,7 +563,7 @@ static void parse_elf_finish(struct elf_info *info)
562static int ignore_undef_symbol(struct elf_info *info, const char *symname) 563static int ignore_undef_symbol(struct elf_info *info, const char *symname)
563{ 564{
564 /* ignore __this_module, it will be resolved shortly */ 565 /* ignore __this_module, it will be resolved shortly */
565 if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0) 566 if (strcmp(symname, VMLINUX_SYMBOL_STR(__this_module)) == 0)
566 return 1; 567 return 1;
567 /* ignore global offset table */ 568 /* ignore global offset table */
568 if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0) 569 if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
@@ -583,8 +584,8 @@ static int ignore_undef_symbol(struct elf_info *info, const char *symname)
583 return 0; 584 return 0;
584} 585}
585 586
586#define CRC_PFX MODULE_SYMBOL_PREFIX "__crc_" 587#define CRC_PFX VMLINUX_SYMBOL_STR(__crc_)
587#define KSYMTAB_PFX MODULE_SYMBOL_PREFIX "__ksymtab_" 588#define KSYMTAB_PFX VMLINUX_SYMBOL_STR(__ksymtab_)
588 589
589static void handle_modversions(struct module *mod, struct elf_info *info, 590static void handle_modversions(struct module *mod, struct elf_info *info,
590 Elf_Sym *sym, const char *symname) 591 Elf_Sym *sym, const char *symname)
@@ -637,14 +638,15 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
637 } 638 }
638#endif 639#endif
639 640
640 if (memcmp(symname, MODULE_SYMBOL_PREFIX, 641#ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX
641 strlen(MODULE_SYMBOL_PREFIX)) == 0) { 642 if (symname[0] != '_')
642 mod->unres = 643 break;
643 alloc_symbol(symname + 644 else
644 strlen(MODULE_SYMBOL_PREFIX), 645 symname++;
645 ELF_ST_BIND(sym->st_info) == STB_WEAK, 646#endif
646 mod->unres); 647 mod->unres = alloc_symbol(symname,
647 } 648 ELF_ST_BIND(sym->st_info) == STB_WEAK,
649 mod->unres);
648 break; 650 break;
649 default: 651 default:
650 /* All exported symbols */ 652 /* All exported symbols */
@@ -652,9 +654,9 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
652 sym_add_exported(symname + strlen(KSYMTAB_PFX), mod, 654 sym_add_exported(symname + strlen(KSYMTAB_PFX), mod,
653 export); 655 export);
654 } 656 }
655 if (strcmp(symname, MODULE_SYMBOL_PREFIX "init_module") == 0) 657 if (strcmp(symname, VMLINUX_SYMBOL_STR(init_module)) == 0)
656 mod->has_init = 1; 658 mod->has_init = 1;
657 if (strcmp(symname, MODULE_SYMBOL_PREFIX "cleanup_module") == 0) 659 if (strcmp(symname, VMLINUX_SYMBOL_STR(cleanup_module)) == 0)
658 mod->has_cleanup = 1; 660 mod->has_cleanup = 1;
659 break; 661 break;
660 } 662 }
@@ -1762,6 +1764,27 @@ static void read_symbols(char *modname)
1762 mod->unres = alloc_symbol("module_layout", 0, mod->unres); 1764 mod->unres = alloc_symbol("module_layout", 0, mod->unres);
1763} 1765}
1764 1766
1767static void read_symbols_from_files(const char *filename)
1768{
1769 FILE *in = stdin;
1770 char fname[PATH_MAX];
1771
1772 if (strcmp(filename, "-") != 0) {
1773 in = fopen(filename, "r");
1774 if (!in)
1775 fatal("Can't open filenames file %s: %m", filename);
1776 }
1777
1778 while (fgets(fname, PATH_MAX, in) != NULL) {
1779 if (strends(fname, "\n"))
1780 fname[strlen(fname)-1] = '\0';
1781 read_symbols(fname);
1782 }
1783
1784 if (in != stdin)
1785 fclose(in);
1786}
1787
1765#define SZ 500 1788#define SZ 500
1766 1789
1767/* We first write the generated file into memory using the 1790/* We first write the generated file into memory using the
@@ -1934,7 +1957,8 @@ static int add_versions(struct buffer *b, struct module *mod)
1934 s->name, mod->name); 1957 s->name, mod->name);
1935 continue; 1958 continue;
1936 } 1959 }
1937 buf_printf(b, "\t{ %#8x, \"%s\" },\n", s->crc, s->name); 1960 buf_printf(b, "\t{ %#8x, __VMLINUX_SYMBOL_STR(%s) },\n",
1961 s->crc, s->name);
1938 } 1962 }
1939 1963
1940 buf_printf(b, "};\n"); 1964 buf_printf(b, "};\n");
@@ -2122,13 +2146,13 @@ int main(int argc, char **argv)
2122 struct module *mod; 2146 struct module *mod;
2123 struct buffer buf = { }; 2147 struct buffer buf = { };
2124 char *kernel_read = NULL, *module_read = NULL; 2148 char *kernel_read = NULL, *module_read = NULL;
2125 char *dump_write = NULL; 2149 char *dump_write = NULL, *files_source = NULL;
2126 int opt; 2150 int opt;
2127 int err; 2151 int err;
2128 struct ext_sym_list *extsym_iter; 2152 struct ext_sym_list *extsym_iter;
2129 struct ext_sym_list *extsym_start = NULL; 2153 struct ext_sym_list *extsym_start = NULL;
2130 2154
2131 while ((opt = getopt(argc, argv, "i:I:e:msSo:awM:K:")) != -1) { 2155 while ((opt = getopt(argc, argv, "i:I:e:msST:o:awM:K:")) != -1) {
2132 switch (opt) { 2156 switch (opt) {
2133 case 'i': 2157 case 'i':
2134 kernel_read = optarg; 2158 kernel_read = optarg;
@@ -2160,6 +2184,9 @@ int main(int argc, char **argv)
2160 case 'S': 2184 case 'S':
2161 sec_mismatch_verbose = 0; 2185 sec_mismatch_verbose = 0;
2162 break; 2186 break;
2187 case 'T':
2188 files_source = optarg;
2189 break;
2163 case 'w': 2190 case 'w':
2164 warn_unresolved = 1; 2191 warn_unresolved = 1;
2165 break; 2192 break;
@@ -2182,6 +2209,9 @@ int main(int argc, char **argv)
2182 while (optind < argc) 2209 while (optind < argc)
2183 read_symbols(argv[optind++]); 2210 read_symbols(argv[optind++]);
2184 2211
2212 if (files_source)
2213 read_symbols_from_files(files_source);
2214
2185 for (mod = modules; mod; mod = mod->next) { 2215 for (mod = modules; mod; mod = mod->next) {
2186 if (mod->skip) 2216 if (mod->skip)
2187 continue; 2217 continue;
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 87bf08076b11..a4f31c900fa6 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -27,53 +27,44 @@ RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
27 27
28# Remove hyphens since they have special meaning in RPM filenames 28# Remove hyphens since they have special meaning in RPM filenames
29KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE)) 29KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
30# Include only those top-level files that are needed by make, plus the GPL copy
31TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \
32 Kbuild Kconfig COPYING $(wildcard localversion*)
33TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT))
30MKSPEC := $(srctree)/scripts/package/mkspec 34MKSPEC := $(srctree)/scripts/package/mkspec
31PREV := set -e; cd -P ..;
32 35
33# rpm-pkg 36# rpm-pkg
34# --------------------------------------------------------------------------- 37# ---------------------------------------------------------------------------
35$(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile 38rpm-pkg rpm: FORCE
36 $(CONFIG_SHELL) $(MKSPEC) > $@ 39 @if test "$(objtree)" != "$(srctree)"; then \
37
38rpm-pkg rpm: $(objtree)/kernel.spec FORCE
39 @if test -n "$(KBUILD_OUTPUT)"; then \
40 echo "Building source + binary RPM is not possible outside the"; \ 40 echo "Building source + binary RPM is not possible outside the"; \
41 echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \ 41 echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
42 echo "binrpm-pkg target instead."; \ 42 echo "binrpm-pkg target instead."; \
43 false; \ 43 false; \
44 fi 44 fi
45 $(MAKE) clean 45 $(MAKE) clean
46 $(PREV) ln -sf $(srctree) $(KERNELPATH) 46 ln -sf $(srctree) $(KERNELPATH)
47 $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
47 $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion 48 $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion
48 $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. 49 tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(TAR_CONTENT)
49 $(PREV) rm $(KERNELPATH) 50 rm $(KERNELPATH)
50 rm -f $(objtree)/.scmversion 51 rm -f $(objtree)/.scmversion
51 set -e; \
52 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version 52 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
53 set -e; \
54 mv -f $(objtree)/.tmp_version $(objtree)/.version 53 mv -f $(objtree)/.tmp_version $(objtree)/.version
55 54 $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz
56 $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz 55 rm $(KERNELPATH).tar.gz kernel.spec
57 rm ../$(KERNELPATH).tar.gz
58
59clean-files := $(objtree)/kernel.spec
60 56
61# binrpm-pkg 57# binrpm-pkg
62# --------------------------------------------------------------------------- 58# ---------------------------------------------------------------------------
63$(objtree)/binkernel.spec: $(MKSPEC) $(srctree)/Makefile 59binrpm-pkg: FORCE
64 $(CONFIG_SHELL) $(MKSPEC) prebuilt > $@
65
66binrpm-pkg: $(objtree)/binkernel.spec FORCE
67 $(MAKE) KBUILD_SRC= 60 $(MAKE) KBUILD_SRC=
68 set -e; \ 61 $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec
69 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version 62 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
70 set -e; \
71 mv -f $(objtree)/.tmp_version $(objtree)/.version 63 mv -f $(objtree)/.tmp_version $(objtree)/.version
72 64
73 $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \ 65 $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \
74 $(UTS_MACHINE) -bb $< 66 $(UTS_MACHINE) -bb $(objtree)/binkernel.spec
75 67 rm binkernel.spec
76clean-files += $(objtree)/binkernel.spec
77 68
78# Deb target 69# Deb target
79# --------------------------------------------------------------------------- 70# ---------------------------------------------------------------------------
diff --git a/scripts/package/buildtar b/scripts/package/buildtar
index 62d8234f8787..cdd9bb909bcd 100644
--- a/scripts/package/buildtar
+++ b/scripts/package/buildtar
@@ -16,7 +16,7 @@ set -e
16# Some variables and settings used throughout the script 16# Some variables and settings used throughout the script
17# 17#
18tmpdir="${objtree}/tar-install" 18tmpdir="${objtree}/tar-install"
19tarball="${objtree}/linux-${KERNELRELEASE}.tar" 19tarball="${objtree}/linux-${KERNELRELEASE}-${ARCH}.tar"
20 20
21 21
22# 22#
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 26a87e68afed..74f02e4dddd2 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -199,7 +199,9 @@ exuberant()
199 --regex-c='/DEFINE_PER_CPU_SHARED_ALIGNED\(([^,]*,\s*)(\w*).*\)/\2/v/' \ 199 --regex-c='/DEFINE_PER_CPU_SHARED_ALIGNED\(([^,]*,\s*)(\w*).*\)/\2/v/' \
200 --regex-c='/DECLARE_WAIT_QUEUE_HEAD\((\w*)/\1/v/' \ 200 --regex-c='/DECLARE_WAIT_QUEUE_HEAD\((\w*)/\1/v/' \
201 --regex-c='/DECLARE_(TASKLET|WORK|DELAYED_WORK)\((\w*)/\2/v/' \ 201 --regex-c='/DECLARE_(TASKLET|WORK|DELAYED_WORK)\((\w*)/\2/v/' \
202 --regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/' 202 --regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/' \
203 --regex-c='/(^\s)OFFSET\((\w*)/\2/v/' \
204 --regex-c='/(^\s)DEFINE\((\w*)/\2/v/'
203 205
204 all_kconfigs | xargs $1 -a \ 206 all_kconfigs | xargs $1 -a \
205 --langdef=kconfig --language-force=kconfig \ 207 --langdef=kconfig --language-force=kconfig \