aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.build37
-rw-r--r--scripts/Makefile.headersinst3
-rw-r--r--scripts/Makefile.help3
-rw-r--r--scripts/Makefile.modpost9
-rwxr-xr-xscripts/checkkconfigsymbols.sh2
-rwxr-xr-xscripts/checkpatch.pl42
-rwxr-xr-xscripts/checksyscalls.sh1
-rwxr-xr-xscripts/coccicheck80
-rw-r--r--scripts/coccinelle/alloc/drop_kmalloc_cast.cocci67
-rw-r--r--scripts/coccinelle/alloc/kzalloc-simple.cocci82
-rw-r--r--scripts/coccinelle/deref_null.cocci293
-rw-r--r--scripts/coccinelle/err_cast.cocci56
-rw-r--r--scripts/coccinelle/resource_size.cocci93
-rwxr-xr-xscripts/decodecode10
-rw-r--r--scripts/dtc/fstree.c1
-rw-r--r--scripts/kconfig/.gitignore1
-rw-r--r--scripts/kconfig/Makefile87
-rw-r--r--scripts/kconfig/conf.c19
-rw-r--r--scripts/kconfig/confdata.c90
-rw-r--r--scripts/kconfig/expr.h3
-rw-r--r--scripts/kconfig/gconf.c20
-rw-r--r--scripts/kconfig/gconf.glade1
-rw-r--r--scripts/kconfig/kxgettext.c15
-rw-r--r--scripts/kconfig/lex.zconf.c_shipped7
-rw-r--r--scripts/kconfig/lkc.h8
-rw-r--r--scripts/kconfig/lkc_proto.h1
-rw-r--r--scripts/kconfig/lxdialog/check-lxdialog.sh2
-rw-r--r--scripts/kconfig/mconf.c64
-rw-r--r--scripts/kconfig/menu.c13
-rw-r--r--scripts/kconfig/nconf.c71
-rw-r--r--scripts/kconfig/nconf.gui.c2
-rw-r--r--scripts/kconfig/qconf.cc174
-rw-r--r--scripts/kconfig/qconf.h76
-rw-r--r--scripts/kconfig/symbol.c49
-rw-r--r--scripts/kconfig/util.c7
-rw-r--r--scripts/kconfig/zconf.l7
-rw-r--r--scripts/kconfig/zconf.tab.c_shipped547
-rw-r--r--scripts/kconfig/zconf.y18
-rwxr-xr-xscripts/kernel-doc2
-rw-r--r--scripts/mkmakefile4
-rw-r--r--scripts/mod/file2alias.c6
-rw-r--r--scripts/mod/modpost.c175
-rw-r--r--scripts/mod/modpost.h43
-rw-r--r--scripts/package/Makefile37
-rw-r--r--scripts/package/builddeb5
-rwxr-xr-xscripts/recordmcount.pl2
-rwxr-xr-xscripts/setlocalversion6
47 files changed, 1654 insertions, 687 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index e4deb73e9a84..a1a5cf95a68d 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -115,7 +115,10 @@ endif
115# --------------------------------------------------------------------------- 115# ---------------------------------------------------------------------------
116 116
117# Default is built-in, unless we know otherwise 117# Default is built-in, unless we know otherwise
118modkern_cflags = $(if $(part-of-module), $(CFLAGS_MODULE), $(CFLAGS_KERNEL)) 118modkern_cflags = \
119 $(if $(part-of-module), \
120 $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \
121 $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL))
119quiet_modtag := $(empty) $(empty) 122quiet_modtag := $(empty) $(empty)
120 123
121$(real-objs-m) : part-of-module := y 124$(real-objs-m) : part-of-module := y
@@ -156,14 +159,14 @@ $(obj)/%.i: $(src)/%.c FORCE
156 159
157cmd_gensymtypes = \ 160cmd_gensymtypes = \
158 $(CPP) -D__GENKSYMS__ $(c_flags) $< | \ 161 $(CPP) -D__GENKSYMS__ $(c_flags) $< | \
159 $(GENKSYMS) -T $@ -a $(ARCH) \ 162 $(GENKSYMS) $(if $(1), -T $(2)) -a $(ARCH) \
160 $(if $(KBUILD_PRESERVE),-p) \ 163 $(if $(KBUILD_PRESERVE),-p) \
161 $(if $(1),-r $(firstword $(wildcard $(@:.symtypes=.symref) /dev/null))) 164 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
162 165
163quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@ 166quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
164cmd_cc_symtypes_c = \ 167cmd_cc_symtypes_c = \
165 set -e; \ 168 set -e; \
166 $(call cmd_gensymtypes, true) >/dev/null; \ 169 $(call cmd_gensymtypes,true,$@) >/dev/null; \
167 test -s $@ || rm -f $@ 170 test -s $@ || rm -f $@
168 171
169$(obj)/%.symtypes : $(src)/%.c FORCE 172$(obj)/%.symtypes : $(src)/%.c FORCE
@@ -192,16 +195,16 @@ else
192# the actual value of the checksum generated by genksyms 195# the actual value of the checksum generated by genksyms
193 196
194cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $< 197cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $<
195cmd_modversions = \ 198cmd_modversions = \
196 if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ 199 if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \
197 $(call cmd_gensymtypes, $(KBUILD_SYMTYPES)) \ 200 $(call cmd_gensymtypes,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
198 > $(@D)/.tmp_$(@F:.o=.ver); \ 201 > $(@D)/.tmp_$(@F:.o=.ver); \
199 \ 202 \
200 $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ 203 $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
201 -T $(@D)/.tmp_$(@F:.o=.ver); \ 204 -T $(@D)/.tmp_$(@F:.o=.ver); \
202 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ 205 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
203 else \ 206 else \
204 mv -f $(@D)/.tmp_$(@F) $@; \ 207 mv -f $(@D)/.tmp_$(@F) $@; \
205 fi; 208 fi;
206endif 209endif
207 210
@@ -248,10 +251,10 @@ $(obj)/%.lst: $(src)/%.c FORCE
248# Compile assembler sources (.S) 251# Compile assembler sources (.S)
249# --------------------------------------------------------------------------- 252# ---------------------------------------------------------------------------
250 253
251modkern_aflags := $(AFLAGS_KERNEL) 254modkern_aflags := $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL)
252 255
253$(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE) 256$(real-objs-m) : modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE)
254$(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE) 257$(real-objs-m:.o=.s): modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE)
255 258
256quiet_cmd_as_s_S = CPP $(quiet_modtag) $@ 259quiet_cmd_as_s_S = CPP $(quiet_modtag) $@
257cmd_as_s_S = $(CPP) $(a_flags) -o $@ $< 260cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 0fcd83838771..f89cb87f5c01 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -3,7 +3,6 @@
3# 3#
4# header-y - list files to be installed. They are preprocessed 4# header-y - list files to be installed. They are preprocessed
5# to remove __KERNEL__ section of the file 5# to remove __KERNEL__ section of the file
6# unifdef-y - Same as header-y. Obsolete
7# objhdr-y - Same as header-y but for generated files 6# objhdr-y - Same as header-y but for generated files
8# 7#
9# ========================================================================== 8# ==========================================================================
@@ -20,7 +19,7 @@ include scripts/Kbuild.include
20 19
21install := $(INSTALL_HDR_PATH)/$(_dst) 20install := $(INSTALL_HDR_PATH)/$(_dst)
22 21
23header-y := $(sort $(header-y) $(unifdef-y)) 22header-y := $(sort $(header-y))
24subdirs := $(patsubst %/,%,$(filter %/, $(header-y))) 23subdirs := $(patsubst %/,%,$(filter %/, $(header-y)))
25header-y := $(filter-out %/, $(header-y)) 24header-y := $(filter-out %/, $(header-y))
26 25
diff --git a/scripts/Makefile.help b/scripts/Makefile.help
new file mode 100644
index 000000000000..d03608f5db04
--- /dev/null
+++ b/scripts/Makefile.help
@@ -0,0 +1,3 @@
1
2checker-help:
3 @echo ' coccicheck - Check with Coccinelle.'
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 8f14c81abbc7..7d22056582c1 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -30,7 +30,7 @@
30# - See include/linux/module.h for more details 30# - See include/linux/module.h for more details
31 31
32# Step 4 is solely used to allow module versioning in external modules, 32# Step 4 is solely used to allow module versioning in external modules,
33# where the CRC of each module is retrieved from the Module.symers file. 33# where the CRC of each module is retrieved from the Module.symvers file.
34 34
35# KBUILD_MODPOST_WARN can be set to avoid error out in case of undefined 35# KBUILD_MODPOST_WARN can be set to avoid error out in case of undefined
36# symbols in the final module linking stage 36# symbols in the final module linking stage
@@ -107,7 +107,7 @@ $(modules:.ko=.mod.c): __modpost ;
107modname = $(notdir $(@:.mod.o=)) 107modname = $(notdir $(@:.mod.o=))
108 108
109quiet_cmd_cc_o_c = CC $@ 109quiet_cmd_cc_o_c = CC $@
110 cmd_cc_o_c = $(CC) $(c_flags) $(CFLAGS_MODULE) \ 110 cmd_cc_o_c = $(CC) $(c_flags) $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE) \
111 -c -o $@ $< 111 -c -o $@ $<
112 112
113$(modules:.ko=.mod.o): %.mod.o: %.mod.c FORCE 113$(modules:.ko=.mod.o): %.mod.o: %.mod.c FORCE
@@ -117,8 +117,9 @@ targets += $(modules:.ko=.mod.o)
117 117
118# Step 6), final link of the modules 118# Step 6), final link of the modules
119quiet_cmd_ld_ko_o = LD [M] $@ 119quiet_cmd_ld_ko_o = LD [M] $@
120 cmd_ld_ko_o = $(LD) -r $(LDFLAGS) $(LDFLAGS_MODULE) -o $@ \ 120 cmd_ld_ko_o = $(LD) -r $(LDFLAGS) \
121 $(filter-out FORCE,$^) 121 $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \
122 -o $@ $(filter-out FORCE,$^)
122 123
123$(modules): %.ko :%.o %.mod.o FORCE 124$(modules): %.ko :%.o %.mod.o FORCE
124 $(call if_changed,ld_ko_o) 125 $(call if_changed,ld_ko_o)
diff --git a/scripts/checkkconfigsymbols.sh b/scripts/checkkconfigsymbols.sh
index 46be3c5a62b7..2ca49bb31efc 100755
--- a/scripts/checkkconfigsymbols.sh
+++ b/scripts/checkkconfigsymbols.sh
@@ -14,7 +14,7 @@ find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while
14do 14do
15 # Output the bare Kconfig variable and the filename; the _MODULE part at 15 # Output the bare Kconfig variable and the filename; the _MODULE part at
16 # the end is not removed here (would need perl an not-hungry regexp for that). 16 # the end is not removed here (would need perl an not-hungry regexp for that).
17 sed -ne 's!^.*\<\(UML_\)\?CONFIG_\([0-9A-Z_]\+\).*!\2 '$i'!p' < $i 17 sed -ne 's!^.*\<\(UML_\)\?CONFIG_\([0-9A-Za-z_]\+\).*!\2 '$i'!p' < $i
18done | \ 18done | \
19# Smart "sort|uniq" implemented in awk and tuned to collect the names of all 19# Smart "sort|uniq" implemented in awk and tuned to collect the names of all
20# files which use a given symbol 20# files which use a given symbol
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index bd88f11b0953..2039acdf5122 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -195,7 +195,7 @@ our $typeTypedefs = qr{(?x:
195our $logFunctions = qr{(?x: 195our $logFunctions = qr{(?x:
196 printk| 196 printk|
197 pr_(debug|dbg|vdbg|devel|info|warning|err|notice|alert|crit|emerg|cont)| 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)| 198 (dev|netdev|netif)_(printk|dbg|vdbg|info|warn|err|notice|alert|crit|emerg|WARN)|
199 WARN| 199 WARN|
200 panic 200 panic
201)}; 201)};
@@ -224,6 +224,12 @@ our @modifierList = (
224 qr{fastcall}, 224 qr{fastcall},
225); 225);
226 226
227our $allowed_asm_includes = qr{(?x:
228 irq|
229 memory
230)};
231# memory.h: ARM has a custom one
232
227sub build_types { 233sub build_types {
228 my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)"; 234 my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)";
229 my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)"; 235 my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)";
@@ -552,6 +558,9 @@ sub ctx_statement_block {
552 $type = ($level != 0)? '{' : ''; 558 $type = ($level != 0)? '{' : '';
553 559
554 if ($level == 0) { 560 if ($level == 0) {
561 if (substr($blk, $off + 1, 1) eq ';') {
562 $off++;
563 }
555 last; 564 last;
556 } 565 }
557 } 566 }
@@ -1403,7 +1412,8 @@ sub process {
1403#80 column limit 1412#80 column limit
1404 if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ && 1413 if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ &&
1405 $rawline !~ /^.\s*\*\s*\@$Ident\s/ && 1414 $rawline !~ /^.\s*\*\s*\@$Ident\s/ &&
1406 $line !~ /^\+\s*$logFunctions\s*\(\s*(?:KERN_\S+\s*)?"[X\t]*"\s*(?:,|\)\s*;)\s*$/ && 1415 !($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(KERN_\S+\s*|[^"]*))?"[X\t]*"\s*(?:,|\)\s*;)\s*$/ ||
1416 $line =~ /^\+\s*"[^"]*"\s*(?:\s*|,|\)\s*;)\s*$/) &&
1407 $length > 80) 1417 $length > 80)
1408 { 1418 {
1409 WARN("line over 80 characters\n" . $herecurr); 1419 WARN("line over 80 characters\n" . $herecurr);
@@ -1448,6 +1458,13 @@ sub process {
1448 WARN("please, no space before tabs\n" . $herevet); 1458 WARN("please, no space before tabs\n" . $herevet);
1449 } 1459 }
1450 1460
1461# check for spaces at the beginning of a line.
1462 if ($rawline =~ /^\+ / && $rawline !~ /\+ +\*/) {
1463 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
1464 WARN("please, no space for starting a line, \
1465 excluding comments\n" . $herevet);
1466 }
1467
1451# check we are in a valid C source file if not then ignore this hunk 1468# check we are in a valid C source file if not then ignore this hunk
1452 next if ($realfile !~ /\.(h|c)$/); 1469 next if ($realfile !~ /\.(h|c)$/);
1453 1470
@@ -1778,9 +1795,9 @@ sub process {
1778 WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr); 1795 WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr);
1779 } 1796 }
1780 1797
1781# check for external initialisers. 1798# check for global initialisers.
1782 if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) { 1799 if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) {
1783 ERROR("do not initialise externals to 0 or NULL\n" . 1800 ERROR("do not initialise globals to 0 or NULL\n" .
1784 $herecurr); 1801 $herecurr);
1785 } 1802 }
1786# check for static initialisers. 1803# check for static initialisers.
@@ -2308,7 +2325,7 @@ sub process {
2308 my $checkfile = "include/linux/$file"; 2325 my $checkfile = "include/linux/$file";
2309 if (-f "$root/$checkfile" && 2326 if (-f "$root/$checkfile" &&
2310 $realfile ne $checkfile && 2327 $realfile ne $checkfile &&
2311 $1 ne 'irq') 2328 $1 !~ /$allowed_asm_includes/)
2312 { 2329 {
2313 if ($realfile =~ m{^arch/}) { 2330 if ($realfile =~ m{^arch/}) {
2314 CHK("Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr); 2331 CHK("Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
@@ -2570,6 +2587,21 @@ sub process {
2570 } 2587 }
2571 } 2588 }
2572 2589
2590# prefer usleep_range over udelay
2591 if ($line =~ /\budelay\s*\(\s*(\w+)\s*\)/) {
2592 # ignore udelay's < 10, however
2593 if (! (($1 =~ /(\d+)/) && ($1 < 10)) ) {
2594 CHK("usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt\n" . $line);
2595 }
2596 }
2597
2598# warn about unexpectedly long msleep's
2599 if ($line =~ /\bmsleep\s*\((\d+)\);/) {
2600 if ($1 < 20) {
2601 WARN("msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt\n" . $line);
2602 }
2603 }
2604
2573# warn about #ifdefs in C files 2605# warn about #ifdefs in C files
2574# if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) { 2606# if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
2575# print "#ifdef in C files should be avoided\n"; 2607# print "#ifdef in C files should be avoided\n";
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index 66ad375612f2..6bb42e72e0e5 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -183,7 +183,6 @@ cat << EOF
183#define __IGNORE_ustat /* statfs */ 183#define __IGNORE_ustat /* statfs */
184#define __IGNORE_utime /* utimes */ 184#define __IGNORE_utime /* utimes */
185#define __IGNORE_vfork /* clone */ 185#define __IGNORE_vfork /* clone */
186#define __IGNORE_wait4 /* waitid */
187 186
188/* sync_file_range had a stupid ABI. Allow sync_file_range2 instead */ 187/* sync_file_range had a stupid ABI. Allow sync_file_range2 instead */
189#ifdef __NR_sync_file_range2 188#ifdef __NR_sync_file_range2
diff --git a/scripts/coccicheck b/scripts/coccicheck
new file mode 100755
index 000000000000..b8bcf1f7bed7
--- /dev/null
+++ b/scripts/coccicheck
@@ -0,0 +1,80 @@
1#!/bin/sh
2
3SPATCH="`which ${SPATCH:=spatch}`"
4
5if [ "$C" = "1" -o "$C" = "2" ]; then
6 ONLINE=1
7
8# This requires Coccinelle >= 0.2.3
9# FLAGS="-ignore_unknown_options -very_quiet"
10# OPTIONS=$*
11
12# Workaround for Coccinelle < 0.2.3
13 FLAGS="-I $srctree/include -very_quiet"
14 shift $(( $# - 1 ))
15 OPTIONS=$1
16else
17 ONLINE=0
18 FLAGS="-very_quiet"
19fi
20
21if [ ! -x "$SPATCH" ]; then
22 echo 'spatch is part of the Coccinelle project and is available at http://coccinelle.lip6.fr/'
23 exit 1
24fi
25
26if [ "$MODE" = "" ] ; then
27 if [ "$ONLINE" = "0" ] ; then
28 echo 'You have not explicitly specify the mode to use. Fallback to "report".'
29 echo 'You can specify the mode with "make coccicheck MODE=<mode>"'
30 echo 'Available modes are: report, patch, context, org'
31 fi
32 MODE="report"
33fi
34
35if [ "$ONLINE" = "0" ] ; then
36 echo ''
37 echo 'Please check for false positives in the output before submitting a patch.'
38 echo 'When using "patch" mode, carefully review the patch before submitting it.'
39 echo ''
40fi
41
42coccinelle () {
43 COCCI="$1"
44
45 OPT=`grep "Option" $COCCI | cut -d':' -f2`
46
47# The option '-parse_cocci' can be used to syntaxically check the SmPL files.
48#
49# $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null
50
51 if [ "$ONLINE" = "0" ] ; then
52
53 FILE=`echo $COCCI | sed "s|$srctree/||"`
54
55 echo "Processing `basename $COCCI` with option(s) \"$OPT\""
56 echo 'Message example to submit a patch:'
57
58 sed -e '/\/\/\//!d' -e 's|^///||' $COCCI
59
60 echo ' The semantic patch that makes this change is available'
61 echo " in $FILE."
62 echo ''
63 echo ' More information about semantic patching is available at'
64 echo ' http://coccinelle.lip6.fr/'
65 echo ''
66
67 $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $srctree || exit 1
68 else
69 $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1
70 fi
71
72}
73
74if [ "$COCCI" = "" ] ; then
75 for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do
76 coccinelle $f
77 done
78else
79 coccinelle $COCCI
80fi
diff --git a/scripts/coccinelle/alloc/drop_kmalloc_cast.cocci b/scripts/coccinelle/alloc/drop_kmalloc_cast.cocci
new file mode 100644
index 000000000000..7d4771d449c3
--- /dev/null
+++ b/scripts/coccinelle/alloc/drop_kmalloc_cast.cocci
@@ -0,0 +1,67 @@
1///
2/// Casting (void *) value returned by kmalloc is useless
3/// as mentioned in Documentation/CodingStyle, Chap 14.
4///
5// Confidence: High
6// Copyright: 2009,2010 Nicolas Palix, DIKU. GPLv2.
7// URL: http://coccinelle.lip6.fr/
8// Options: -no_includes -include_headers
9//
10// Keywords: kmalloc, kzalloc, kcalloc
11// Version min: < 2.6.12 kmalloc
12// Version min: < 2.6.12 kcalloc
13// Version min: 2.6.14 kzalloc
14//
15
16virtual context
17virtual patch
18virtual org
19virtual report
20
21//----------------------------------------------------------
22// For context mode
23//----------------------------------------------------------
24
25@depends on context@
26type T;
27@@
28
29* (T *)
30 \(kmalloc\|kzalloc\|kcalloc\)(...)
31
32//----------------------------------------------------------
33// For patch mode
34//----------------------------------------------------------
35
36@depends on patch@
37type T;
38@@
39
40- (T *)
41 \(kmalloc\|kzalloc\|kcalloc\)(...)
42
43//----------------------------------------------------------
44// For org and report mode
45//----------------------------------------------------------
46
47@r depends on org || report@
48type T;
49position p;
50@@
51
52 (T@p *)\(kmalloc\|kzalloc\|kcalloc\)(...)
53
54@script:python depends on org@
55p << r.p;
56t << r.T;
57@@
58
59coccilib.org.print_safe_todo(p[0], t)
60
61@script:python depends on report@
62p << r.p;
63t << r.T;
64@@
65
66msg="WARNING: casting value returned by k[cmz]alloc to (%s *) is useless." % (t)
67coccilib.report.print_report(p[0], msg)
diff --git a/scripts/coccinelle/alloc/kzalloc-simple.cocci b/scripts/coccinelle/alloc/kzalloc-simple.cocci
new file mode 100644
index 000000000000..2eae828fc657
--- /dev/null
+++ b/scripts/coccinelle/alloc/kzalloc-simple.cocci
@@ -0,0 +1,82 @@
1///
2/// kzalloc should be used rather than kmalloc followed by memset 0
3///
4// Confidence: High
5// Copyright: (C) 2009-2010 Julia Lawall, Nicolas Palix, DIKU. GPLv2.
6// Copyright: (C) 2009-2010 Gilles Muller, INRIA/LiP6. GPLv2.
7// URL: http://coccinelle.lip6.fr/rules/kzalloc.html
8// Options: -no_includes -include_headers
9//
10// Keywords: kmalloc, kzalloc
11// Version min: < 2.6.12 kmalloc
12// Version min: 2.6.14 kzalloc
13//
14
15virtual context
16virtual patch
17virtual org
18virtual report
19
20//----------------------------------------------------------
21// For context mode
22//----------------------------------------------------------
23
24@depends on context@
25type T, T2;
26expression x;
27expression E1,E2;
28statement S;
29@@
30
31* x = (T)kmalloc(E1,E2);
32 if ((x==NULL) || ...) S
33* memset((T2)x,0,E1);
34
35//----------------------------------------------------------
36// For patch mode
37//----------------------------------------------------------
38
39@depends on patch@
40type T, T2;
41expression x;
42expression E1,E2;
43statement S;
44@@
45
46- x = (T)kmalloc(E1,E2);
47+ x = kzalloc(E1,E2);
48 if ((x==NULL) || ...) S
49- memset((T2)x,0,E1);
50
51//----------------------------------------------------------
52// For org mode
53//----------------------------------------------------------
54
55@r depends on org || report@
56type T, T2;
57expression x;
58expression E1,E2;
59statement S;
60position p;
61@@
62
63 x = (T)kmalloc@p(E1,E2);
64 if ((x==NULL) || ...) S
65 memset((T2)x,0,E1);
66
67@script:python depends on org@
68p << r.p;
69x << r.x;
70@@
71
72msg="%s" % (x)
73msg_safe=msg.replace("[","@(").replace("]",")")
74coccilib.org.print_todo(p[0], msg_safe)
75
76@script:python depends on report@
77p << r.p;
78x << r.x;
79@@
80
81msg="WARNING: kzalloc should be used for %s, instead of kmalloc/memset" % (x)
82coccilib.report.print_report(p[0], msg)
diff --git a/scripts/coccinelle/deref_null.cocci b/scripts/coccinelle/deref_null.cocci
new file mode 100644
index 000000000000..9969d76d0f4b
--- /dev/null
+++ b/scripts/coccinelle/deref_null.cocci
@@ -0,0 +1,293 @@
1///
2/// A variable is dereference under a NULL test.
3/// Even though it is know to be NULL.
4///
5// Confidence: Moderate
6// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2.
7// Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2.
8// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2.
9// URL: http://coccinelle.lip6.fr/
10// Comments: -I ... -all_includes can give more complete results
11// Options:
12
13virtual context
14virtual patch
15virtual org
16virtual report
17
18@initialize:python depends on !context && patch && !org && !report@
19
20import sys
21print >> sys.stderr, "This semantic patch does not support the 'patch' mode."
22
23@depends on patch@
24@@
25
26this_rule_should_never_matches();
27
28@ifm depends on !patch@
29expression *E;
30statement S1,S2;
31position p1;
32@@
33
34if@p1 ((E == NULL && ...) || ...) S1 else S2
35
36// The following two rules are separate, because both can match a single
37// expression in different ways
38@pr1 depends on !patch expression@
39expression *ifm.E;
40identifier f;
41position p1;
42@@
43
44 (E != NULL && ...) ? <+...E->f@p1...+> : ...
45
46@pr2 depends on !patch expression@
47expression *ifm.E;
48identifier f;
49position p2;
50@@
51
52(
53 (E != NULL) && ... && <+...E->f@p2...+>
54|
55 (E == NULL) || ... || <+...E->f@p2...+>
56|
57 sizeof(<+...E->f@p2...+>)
58)
59
60// For org and report modes
61
62@r depends on !context && !patch && (org || report) exists@
63expression subE <= ifm.E;
64expression *ifm.E;
65expression E1,E2;
66identifier f;
67statement S1,S2,S3,S4;
68iterator iter;
69position p!={pr1.p1,pr2.p2};
70position ifm.p1;
71@@
72
73if@p1 ((E == NULL && ...) || ...)
74{
75 ... when != if (...) S1 else S2
76(
77 iter(subE,...) S4 // no use
78|
79 list_remove_head(E2,subE,...)
80|
81 subE = E1
82|
83 for(subE = E1;...;...) S4
84|
85 subE++
86|
87 ++subE
88|
89 --subE
90|
91 subE--
92|
93 &subE
94|
95 E->f@p // bad use
96)
97 ... when any
98 return ...;
99}
100else S3
101
102@script:python depends on !context && !patch && !org && report@
103p << r.p;
104p1 << ifm.p1;
105x << ifm.E;
106@@
107
108msg="ERROR: %s is NULL but dereferenced." % (x)
109coccilib.report.print_report(p[0], msg)
110cocci.include_match(False)
111
112@script:python depends on !context && !patch && org && !report@
113p << r.p;
114p1 << ifm.p1;
115x << ifm.E;
116@@
117
118msg="ERROR: %s is NULL but dereferenced." % (x)
119msg_safe=msg.replace("[","@(").replace("]",")")
120cocci.print_main(msg_safe,p)
121cocci.include_match(False)
122
123@s depends on !context && !patch && (org || report) exists@
124expression subE <= ifm.E;
125expression *ifm.E;
126expression E1,E2;
127identifier f;
128statement S1,S2,S3,S4;
129iterator iter;
130position p!={pr1.p1,pr2.p2};
131position ifm.p1;
132@@
133
134if@p1 ((E == NULL && ...) || ...)
135{
136 ... when != if (...) S1 else S2
137(
138 iter(subE,...) S4 // no use
139|
140 list_remove_head(E2,subE,...)
141|
142 subE = E1
143|
144 for(subE = E1;...;...) S4
145|
146 subE++
147|
148 ++subE
149|
150 --subE
151|
152 subE--
153|
154 &subE
155|
156 E->f@p // bad use
157)
158 ... when any
159}
160else S3
161
162@script:python depends on !context && !patch && !org && report@
163p << s.p;
164p1 << ifm.p1;
165x << ifm.E;
166@@
167
168msg="ERROR: %s is NULL but dereferenced." % (x)
169coccilib.report.print_report(p[0], msg)
170
171@script:python depends on !context && !patch && org && !report@
172p << s.p;
173p1 << ifm.p1;
174x << ifm.E;
175@@
176
177msg="ERROR: %s is NULL but dereferenced." % (x)
178msg_safe=msg.replace("[","@(").replace("]",")")
179cocci.print_main(msg_safe,p)
180
181// For context mode
182
183@depends on context && !patch && !org && !report exists@
184expression subE <= ifm.E;
185expression *ifm.E;
186expression E1,E2;
187identifier f;
188statement S1,S2,S3,S4;
189iterator iter;
190position p!={pr1.p1,pr2.p2};
191position ifm.p1;
192@@
193
194if@p1 ((E == NULL && ...) || ...)
195{
196 ... when != if (...) S1 else S2
197(
198 iter(subE,...) S4 // no use
199|
200 list_remove_head(E2,subE,...)
201|
202 subE = E1
203|
204 for(subE = E1;...;...) S4
205|
206 subE++
207|
208 ++subE
209|
210 --subE
211|
212 subE--
213|
214 &subE
215|
216* E->f@p // bad use
217)
218 ... when any
219 return ...;
220}
221else S3
222
223// The following three rules are duplicates of ifm, pr1 and pr2 respectively.
224// It is need because the previous rule as already made a "change".
225
226@ifm1 depends on !patch@
227expression *E;
228statement S1,S2;
229position p1;
230@@
231
232if@p1 ((E == NULL && ...) || ...) S1 else S2
233
234@pr11 depends on !patch expression@
235expression *ifm1.E;
236identifier f;
237position p1;
238@@
239
240 (E != NULL && ...) ? <+...E->f@p1...+> : ...
241
242@pr12 depends on !patch expression@
243expression *ifm1.E;
244identifier f;
245position p2;
246@@
247
248(
249 (E != NULL) && ... && <+...E->f@p2...+>
250|
251 (E == NULL) || ... || <+...E->f@p2...+>
252|
253 sizeof(<+...E->f@p2...+>)
254)
255
256@depends on context && !patch && !org && !report exists@
257expression subE <= ifm1.E;
258expression *ifm1.E;
259expression E1,E2;
260identifier f;
261statement S1,S2,S3,S4;
262iterator iter;
263position p!={pr11.p1,pr12.p2};
264position ifm1.p1;
265@@
266
267if@p1 ((E == NULL && ...) || ...)
268{
269 ... when != if (...) S1 else S2
270(
271 iter(subE,...) S4 // no use
272|
273 list_remove_head(E2,subE,...)
274|
275 subE = E1
276|
277 for(subE = E1;...;...) S4
278|
279 subE++
280|
281 ++subE
282|
283 --subE
284|
285 subE--
286|
287 &subE
288|
289* E->f@p // bad use
290)
291 ... when any
292}
293else S3
diff --git a/scripts/coccinelle/err_cast.cocci b/scripts/coccinelle/err_cast.cocci
new file mode 100644
index 000000000000..2ce115000af6
--- /dev/null
+++ b/scripts/coccinelle/err_cast.cocci
@@ -0,0 +1,56 @@
1///
2/// Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))
3///
4// Confidence: High
5// Copyright: (C) 2009, 2010 Nicolas Palix, DIKU. GPLv2.
6// Copyright: (C) 2009, 2010 Julia Lawall, DIKU. GPLv2.
7// Copyright: (C) 2009, 2010 Gilles Muller, INRIA/LiP6. GPLv2.
8// URL: http://coccinelle.lip6.fr/
9// Options:
10//
11// Keywords: ERR_PTR, PTR_ERR, ERR_CAST
12// Version min: 2.6.25
13//
14
15virtual context
16virtual patch
17virtual org
18virtual report
19
20
21@ depends on context && !patch && !org && !report@
22expression x;
23@@
24
25* ERR_PTR(PTR_ERR(x))
26
27@ depends on !context && patch && !org && !report @
28expression x;
29@@
30
31- ERR_PTR(PTR_ERR(x))
32+ ERR_CAST(x)
33
34@r depends on !context && !patch && (org || report)@
35expression x;
36position p;
37@@
38
39 ERR_PTR@p(PTR_ERR(x))
40
41@script:python depends on org@
42p << r.p;
43x << r.x;
44@@
45
46msg="WARNING ERR_CAST can be used with %s" % (x)
47msg_safe=msg.replace("[","@(").replace("]",")")
48coccilib.org.print_todo(p[0], msg_safe)
49
50@script:python depends on report@
51p << r.p;
52x << r.x;
53@@
54
55msg="WARNING: ERR_CAST can be used with %s" % (x)
56coccilib.report.print_report(p[0], msg)
diff --git a/scripts/coccinelle/resource_size.cocci b/scripts/coccinelle/resource_size.cocci
new file mode 100644
index 000000000000..1935a58b39d9
--- /dev/null
+++ b/scripts/coccinelle/resource_size.cocci
@@ -0,0 +1,93 @@
1///
2/// Use resource_size function on resource object
3/// instead of explicit computation.
4///
5// Confidence: High
6// Copyright: (C) 2009, 2010 Nicolas Palix, DIKU. GPLv2.
7// Copyright: (C) 2009, 2010 Julia Lawall, DIKU. GPLv2.
8// Copyright: (C) 2009, 2010 Gilles Muller, INRIA/LiP6. GPLv2.
9// URL: http://coccinelle.lip6.fr/
10// Options:
11//
12// Keywords: resource_size
13// Version min: 2.6.27 resource_size
14//
15
16virtual context
17virtual patch
18virtual org
19virtual report
20
21//----------------------------------------------------------
22// For context mode
23//----------------------------------------------------------
24
25@r_context depends on context && !patch && !org@
26struct resource *res;
27@@
28
29* (res->end - res->start) + 1
30
31//----------------------------------------------------------
32// For patch mode
33//----------------------------------------------------------
34
35@r_patch depends on !context && patch && !org@
36struct resource *res;
37@@
38
39- (res->end - res->start) + 1
40+ resource_size(res)
41
42//----------------------------------------------------------
43// For org mode
44//----------------------------------------------------------
45
46
47@r_org depends on !context && !patch && (org || report)@
48struct resource *res;
49position p;
50@@
51
52 (res->end@p - res->start) + 1
53
54@rbad_org depends on !context && !patch && (org || report)@
55struct resource *res;
56position p != r_org.p;
57@@
58
59 res->end@p - res->start
60
61@script:python depends on org@
62p << r_org.p;
63x << r_org.res;
64@@
65
66msg="ERROR with %s" % (x)
67msg_safe=msg.replace("[","@(").replace("]",")")
68coccilib.org.print_todo(p[0], msg_safe)
69
70@script:python depends on report@
71p << r_org.p;
72x << r_org.res;
73@@
74
75msg="ERROR: Missing resource_size with %s" % (x)
76coccilib.report.print_report(p[0], msg)
77
78@script:python depends on org@
79p << rbad_org.p;
80x << rbad_org.res;
81@@
82
83msg="WARNING with %s" % (x)
84msg_safe=msg.replace("[","@(").replace("]",")")
85coccilib.org.print_todo(p[0], msg_safe)
86
87@script:python depends on report@
88p << rbad_org.p;
89x << rbad_org.res;
90@@
91
92msg="WARNING: Suspicious code. resource_size is maybe missing with %s" % (x)
93coccilib.report.print_report(p[0], msg)
diff --git a/scripts/decodecode b/scripts/decodecode
index 8b30cc36744f..18ba881c3415 100755
--- a/scripts/decodecode
+++ b/scripts/decodecode
@@ -40,7 +40,7 @@ echo $code
40code=`echo $code | sed -e 's/.*Code: //'` 40code=`echo $code | sed -e 's/.*Code: //'`
41 41
42width=`expr index "$code" ' '` 42width=`expr index "$code" ' '`
43width=$[($width-1)/2] 43width=$((($width-1)/2))
44case $width in 44case $width in
451) type=byte ;; 451) type=byte ;;
462) type=2byte ;; 462) type=2byte ;;
@@ -48,10 +48,10 @@ case $width in
48esac 48esac
49 49
50disas() { 50disas() {
51 ${CROSS_COMPILE}as $AFLAGS -o $1.o $1.s &> /dev/null 51 ${CROSS_COMPILE}as $AFLAGS -o $1.o $1.s > /dev/null 2>&1
52 52
53 if [ "$ARCH" == "arm" ]; then 53 if [ "$ARCH" = "arm" ]; then
54 if [ $width == 2 ]; then 54 if [ $width -eq 2 ]; then
55 OBJDUMPFLAGS="-M force-thumb" 55 OBJDUMPFLAGS="-M force-thumb"
56 fi 56 fi
57 57
@@ -59,7 +59,7 @@ disas() {
59 fi 59 fi
60 60
61 ${CROSS_COMPILE}objdump $OBJDUMPFLAGS -S $1.o | \ 61 ${CROSS_COMPILE}objdump $OBJDUMPFLAGS -S $1.o | \
62 grep -v "/tmp\|Disassembly\|\.text\|^$" &> $1.dis 62 grep -v "/tmp\|Disassembly\|\.text\|^$" > $1.dis 2>&1
63} 63}
64 64
65marker=`expr index "$code" "\<"` 65marker=`expr index "$code" "\<"`
diff --git a/scripts/dtc/fstree.c b/scripts/dtc/fstree.c
index 766b2694d935..8fe1bdf239f0 100644
--- a/scripts/dtc/fstree.c
+++ b/scripts/dtc/fstree.c
@@ -77,6 +77,7 @@ static struct node *read_fstree(const char *dirname)
77 free(tmpnam); 77 free(tmpnam);
78 } 78 }
79 79
80 closedir(d);
80 return tree; 81 return tree;
81} 82}
82 83
diff --git a/scripts/kconfig/.gitignore b/scripts/kconfig/.gitignore
index 6a36a76e6606..624f6502e03e 100644
--- a/scripts/kconfig/.gitignore
+++ b/scripts/kconfig/.gitignore
@@ -17,6 +17,7 @@ gconf.glade.h
17# 17#
18conf 18conf
19mconf 19mconf
20nconf
20qconf 21qconf
21gconf 22gconf
22kxgettext 23kxgettext
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index de934def410f..368ae306aee4 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -8,7 +8,7 @@ PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-c
8ifdef KBUILD_KCONFIG 8ifdef KBUILD_KCONFIG
9Kconfig := $(KBUILD_KCONFIG) 9Kconfig := $(KBUILD_KCONFIG)
10else 10else
11Kconfig := arch/$(SRCARCH)/Kconfig 11Kconfig := Kconfig
12endif 12endif
13 13
14xconfig: $(obj)/qconf 14xconfig: $(obj)/qconf
@@ -145,11 +145,8 @@ check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
145 145
146# Use recursively expanded variables so we do not call gcc unless 146# Use recursively expanded variables so we do not call gcc unless
147# we really need to do so. (Do not call gcc as part of make mrproper) 147# we really need to do so. (Do not call gcc as part of make mrproper)
148HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) 148HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
149HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) 149 -DLOCALE
150
151HOST_EXTRACFLAGS += -DLOCALE
152
153 150
154# =========================================================================== 151# ===========================================================================
155# Shared Makefile for the various kconfig executables: 152# Shared Makefile for the various kconfig executables:
@@ -208,7 +205,7 @@ clean-files += config.pot linux.pot
208PHONY += $(obj)/dochecklxdialog 205PHONY += $(obj)/dochecklxdialog
209$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog 206$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog
210$(obj)/dochecklxdialog: 207$(obj)/dochecklxdialog:
211 $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES) 208 $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf)
212 209
213always := dochecklxdialog 210always := dochecklxdialog
214 211
@@ -226,6 +223,8 @@ HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl
226HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ 223HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
227 -D LKC_DIRECT_LINK 224 -D LKC_DIRECT_LINK
228 225
226HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
227
229HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses 228HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses
230$(obj)/qconf.o: $(obj)/.tmp_qtcheck 229$(obj)/qconf.o: $(obj)/.tmp_qtcheck
231 230
@@ -236,40 +235,48 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
236# QT needs some extra effort... 235# QT needs some extra effort...
237$(obj)/.tmp_qtcheck: 236$(obj)/.tmp_qtcheck:
238 @set -e; echo " CHECK qt"; dir=""; pkg=""; \ 237 @set -e; echo " CHECK qt"; dir=""; pkg=""; \
239 pkg-config --exists qt 2> /dev/null && pkg=qt; \ 238 if ! pkg-config --exists QtCore 2> /dev/null; then \
240 pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ 239 echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \
241 if [ -n "$$pkg" ]; then \ 240 pkg-config --exists qt 2> /dev/null && pkg=qt; \
242 cflags="\$$(shell pkg-config $$pkg --cflags)"; \ 241 pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
243 libs="\$$(shell pkg-config $$pkg --libs)"; \ 242 if [ -n "$$pkg" ]; then \
244 moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \ 243 cflags="\$$(shell pkg-config $$pkg --cflags)"; \
245 dir="$$(pkg-config $$pkg --variable=prefix)"; \ 244 libs="\$$(shell pkg-config $$pkg --libs)"; \
245 moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
246 dir="$$(pkg-config $$pkg --variable=prefix)"; \
247 else \
248 for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
249 if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
250 done; \
251 if [ -z "$$dir" ]; then \
252 echo "*"; \
253 echo "* Unable to find any QT installation. Please make sure that"; \
254 echo "* the QT4 or QT3 development package is correctly installed and"; \
255 echo "* either qmake can be found or install pkg-config or set"; \
256 echo "* the QTDIR environment variable to the correct location."; \
257 echo "*"; \
258 false; \
259 fi; \
260 libpath=$$dir/lib; lib=qt; osdir=""; \
261 $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
262 osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
263 test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
264 test -f $$libpath/libqt-mt.so && lib=qt-mt; \
265 cflags="-I$$dir/include"; \
266 libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
267 moc="$$dir/bin/moc"; \
268 fi; \
269 if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
270 echo "*"; \
271 echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
272 echo "*"; \
273 moc="/usr/bin/moc"; \
274 fi; \
246 else \ 275 else \
247 for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \ 276 cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \
248 if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \ 277 libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \
249 done; \ 278 binpath="\$$(shell pkg-config QtCore --variable=prefix)"; \
250 if [ -z "$$dir" ]; then \ 279 moc="$$binpath/bin/moc"; \
251 echo "*"; \
252 echo "* Unable to find the QT3 installation. Please make sure that"; \
253 echo "* the QT3 development package is correctly installed and"; \
254 echo "* either install pkg-config or set the QTDIR environment"; \
255 echo "* variable to the correct location."; \
256 echo "*"; \
257 false; \
258 fi; \
259 libpath=$$dir/lib; lib=qt; osdir=""; \
260 $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
261 osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
262 test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
263 test -f $$libpath/libqt-mt.so && lib=qt-mt; \
264 cflags="-I$$dir/include"; \
265 libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
266 moc="$$dir/bin/moc"; \
267 fi; \
268 if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
269 echo "*"; \
270 echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
271 echo "*"; \
272 moc="/usr/bin/moc"; \
273 fi; \ 280 fi; \
274 echo "KC_QT_CFLAGS=$$cflags" > $@; \ 281 echo "KC_QT_CFLAGS=$$cflags" > $@; \
275 echo "KC_QT_LIBS=$$libs" >> $@; \ 282 echo "KC_QT_LIBS=$$libs" >> $@; \
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 4f0ed5b3a75e..5459a38be866 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -425,9 +425,9 @@ static void check_conf(struct menu *menu)
425 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { 425 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
426 if (input_mode == listnewconfig) { 426 if (input_mode == listnewconfig) {
427 if (sym->name && !sym_is_choice_value(sym)) { 427 if (sym->name && !sym_is_choice_value(sym)) {
428 printf("CONFIG_%s\n", sym->name); 428 printf("%s%s\n", CONFIG_, sym->name);
429 } 429 }
430 } else { 430 } else if (input_mode != oldnoconfig) {
431 if (!conf_cnt++) 431 if (!conf_cnt++)
432 printf(_("*\n* Restart config...\n*\n")); 432 printf(_("*\n* Restart config...\n*\n"));
433 rootEntry = menu_get_parent_menu(menu); 433 rootEntry = menu_get_parent_menu(menu);
@@ -466,7 +466,7 @@ int main(int ac, char **av)
466 bindtextdomain(PACKAGE, LOCALEDIR); 466 bindtextdomain(PACKAGE, LOCALEDIR);
467 textdomain(PACKAGE); 467 textdomain(PACKAGE);
468 468
469 while ((opt = getopt_long_only(ac, av, "", long_opts, NULL)) != -1) { 469 while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) {
470 input_mode = (enum input_mode)opt; 470 input_mode = (enum input_mode)opt;
471 switch (opt) { 471 switch (opt) {
472 case silentoldconfig: 472 case silentoldconfig:
@@ -508,8 +508,7 @@ int main(int ac, char **av)
508 name = conf_get_configname(); 508 name = conf_get_configname();
509 if (stat(name, &tmpstat)) { 509 if (stat(name, &tmpstat)) {
510 fprintf(stderr, _("***\n" 510 fprintf(stderr, _("***\n"
511 "*** You have not yet configured your kernel!\n" 511 "*** Configuration file \"%s\" not found!\n"
512 "*** (missing kernel config file \"%s\")\n"
513 "***\n" 512 "***\n"
514 "*** Please run some configurator (e.g. \"make oldconfig\" or\n" 513 "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
515 "*** \"make menuconfig\" or \"make xconfig\").\n" 514 "*** \"make menuconfig\" or \"make xconfig\").\n"
@@ -571,7 +570,7 @@ int main(int ac, char **av)
571 name = getenv("KCONFIG_NOSILENTUPDATE"); 570 name = getenv("KCONFIG_NOSILENTUPDATE");
572 if (name && *name) { 571 if (name && *name) {
573 fprintf(stderr, 572 fprintf(stderr,
574 _("\n*** Kernel configuration requires explicit update.\n\n")); 573 _("\n*** The configuration requires explicit update.\n\n"));
575 return 1; 574 return 1;
576 } 575 }
577 } 576 }
@@ -599,12 +598,12 @@ int main(int ac, char **av)
599 break; 598 break;
600 case savedefconfig: 599 case savedefconfig:
601 break; 600 break;
602 case oldconfig:
603 case oldaskconfig: 601 case oldaskconfig:
604 rootEntry = &rootmenu; 602 rootEntry = &rootmenu;
605 conf(&rootmenu); 603 conf(&rootmenu);
606 input_mode = silentoldconfig; 604 input_mode = silentoldconfig;
607 /* fall through */ 605 /* fall through */
606 case oldconfig:
608 case listnewconfig: 607 case listnewconfig:
609 case oldnoconfig: 608 case oldnoconfig:
610 case silentoldconfig: 609 case silentoldconfig:
@@ -623,11 +622,11 @@ int main(int ac, char **av)
623 * All other commands are only used to generate a config. 622 * All other commands are only used to generate a config.
624 */ 623 */
625 if (conf_get_changed() && conf_write(NULL)) { 624 if (conf_get_changed() && conf_write(NULL)) {
626 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 625 fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n"));
627 exit(1); 626 exit(1);
628 } 627 }
629 if (conf_write_autoconf()) { 628 if (conf_write_autoconf()) {
630 fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n")); 629 fprintf(stderr, _("\n*** Error during update of the configuration.\n\n"));
631 return 1; 630 return 1;
632 } 631 }
633 } else if (input_mode == savedefconfig) { 632 } else if (input_mode == savedefconfig) {
@@ -638,7 +637,7 @@ int main(int ac, char **av)
638 } 637 }
639 } else if (input_mode != listnewconfig) { 638 } else if (input_mode != listnewconfig) {
640 if (conf_write(NULL)) { 639 if (conf_write(NULL)) {
641 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 640 fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n"));
642 exit(1); 641 exit(1);
643 } 642 }
644 } 643 }
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index c07060ab7820..9df80114b47b 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -246,24 +246,23 @@ load:
246 while (fgets(line, sizeof(line), in)) { 246 while (fgets(line, sizeof(line), in)) {
247 conf_lineno++; 247 conf_lineno++;
248 sym = NULL; 248 sym = NULL;
249 switch (line[0]) { 249 if (line[0] == '#') {
250 case '#': 250 if (memcmp(line + 2, CONFIG_, strlen(CONFIG_)))
251 if (memcmp(line + 2, "CONFIG_", 7))
252 continue; 251 continue;
253 p = strchr(line + 9, ' '); 252 p = strchr(line + 2 + strlen(CONFIG_), ' ');
254 if (!p) 253 if (!p)
255 continue; 254 continue;
256 *p++ = 0; 255 *p++ = 0;
257 if (strncmp(p, "is not set", 10)) 256 if (strncmp(p, "is not set", 10))
258 continue; 257 continue;
259 if (def == S_DEF_USER) { 258 if (def == S_DEF_USER) {
260 sym = sym_find(line + 9); 259 sym = sym_find(line + 2 + strlen(CONFIG_));
261 if (!sym) { 260 if (!sym) {
262 sym_add_change_count(1); 261 sym_add_change_count(1);
263 break; 262 goto setsym;
264 } 263 }
265 } else { 264 } else {
266 sym = sym_lookup(line + 9, 0); 265 sym = sym_lookup(line + 2 + strlen(CONFIG_), 0);
267 if (sym->type == S_UNKNOWN) 266 if (sym->type == S_UNKNOWN)
268 sym->type = S_BOOLEAN; 267 sym->type = S_BOOLEAN;
269 } 268 }
@@ -279,13 +278,8 @@ load:
279 default: 278 default:
280 ; 279 ;
281 } 280 }
282 break; 281 } else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) {
283 case 'C': 282 p = strchr(line + strlen(CONFIG_), '=');
284 if (memcmp(line, "CONFIG_", 7)) {
285 conf_warning("unexpected data");
286 continue;
287 }
288 p = strchr(line + 7, '=');
289 if (!p) 283 if (!p)
290 continue; 284 continue;
291 *p++ = 0; 285 *p++ = 0;
@@ -296,13 +290,13 @@ load:
296 *p2 = 0; 290 *p2 = 0;
297 } 291 }
298 if (def == S_DEF_USER) { 292 if (def == S_DEF_USER) {
299 sym = sym_find(line + 7); 293 sym = sym_find(line + strlen(CONFIG_));
300 if (!sym) { 294 if (!sym) {
301 sym_add_change_count(1); 295 sym_add_change_count(1);
302 break; 296 goto setsym;
303 } 297 }
304 } else { 298 } else {
305 sym = sym_lookup(line + 7, 0); 299 sym = sym_lookup(line + strlen(CONFIG_), 0);
306 if (sym->type == S_UNKNOWN) 300 if (sym->type == S_UNKNOWN)
307 sym->type = S_OTHER; 301 sym->type = S_OTHER;
308 } 302 }
@@ -311,14 +305,12 @@ load:
311 } 305 }
312 if (conf_set_sym_val(sym, def, def_flags, p)) 306 if (conf_set_sym_val(sym, def, def_flags, p))
313 continue; 307 continue;
314 break; 308 } else {
315 case '\r': 309 if (line[0] != '\r' && line[0] != '\n')
316 case '\n': 310 conf_warning("unexpected data");
317 break;
318 default:
319 conf_warning("unexpected data");
320 continue; 311 continue;
321 } 312 }
313setsym:
322 if (sym && sym_is_choice_value(sym)) { 314 if (sym && sym_is_choice_value(sym)) {
323 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); 315 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
324 switch (sym->def[def].tri) { 316 switch (sym->def[def].tri) {
@@ -431,9 +423,9 @@ static void conf_write_string(bool headerfile, const char *name,
431{ 423{
432 int l; 424 int l;
433 if (headerfile) 425 if (headerfile)
434 fprintf(out, "#define CONFIG_%s \"", name); 426 fprintf(out, "#define %s%s \"", CONFIG_, name);
435 else 427 else
436 fprintf(out, "CONFIG_%s=\"", name); 428 fprintf(out, "%s%s=\"", CONFIG_, name);
437 429
438 while (1) { 430 while (1) {
439 l = strcspn(str, "\"\\"); 431 l = strcspn(str, "\"\\");
@@ -459,13 +451,14 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
459 switch (sym_get_tristate_value(sym)) { 451 switch (sym_get_tristate_value(sym)) {
460 case no: 452 case no:
461 if (write_no) 453 if (write_no)
462 fprintf(out, "# CONFIG_%s is not set\n", sym->name); 454 fprintf(out, "# %s%s is not set\n",
455 CONFIG_, sym->name);
463 break; 456 break;
464 case mod: 457 case mod:
465 fprintf(out, "CONFIG_%s=m\n", sym->name); 458 fprintf(out, "%s%s=m\n", CONFIG_, sym->name);
466 break; 459 break;
467 case yes: 460 case yes:
468 fprintf(out, "CONFIG_%s=y\n", sym->name); 461 fprintf(out, "%s%s=y\n", CONFIG_, sym->name);
469 break; 462 break;
470 } 463 }
471 break; 464 break;
@@ -475,7 +468,7 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
475 case S_HEX: 468 case S_HEX:
476 case S_INT: 469 case S_INT:
477 str = sym_get_string_value(sym); 470 str = sym_get_string_value(sym);
478 fprintf(out, "CONFIG_%s=%s\n", sym->name, str); 471 fprintf(out, "%s%s=%s\n", CONFIG_, sym->name, str);
479 break; 472 break;
480 case S_OTHER: 473 case S_OTHER:
481 case S_UNKNOWN: 474 case S_UNKNOWN:
@@ -567,7 +560,7 @@ int conf_write(const char *name)
567 struct menu *menu; 560 struct menu *menu;
568 const char *basename; 561 const char *basename;
569 const char *str; 562 const char *str;
570 char dirname[128], tmpname[128], newname[128]; 563 char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
571 enum symbol_type type; 564 enum symbol_type type;
572 time_t now; 565 time_t now;
573 int use_timestamp = 1; 566 int use_timestamp = 1;
@@ -607,8 +600,6 @@ int conf_write(const char *name)
607 if (!out) 600 if (!out)
608 return 1; 601 return 1;
609 602
610 sym = sym_lookup("KERNELVERSION", 0);
611 sym_calc_value(sym);
612 time(&now); 603 time(&now);
613 env = getenv("KCONFIG_NOTIMESTAMP"); 604 env = getenv("KCONFIG_NOTIMESTAMP");
614 if (env && *env) 605 if (env && *env)
@@ -616,10 +607,10 @@ int conf_write(const char *name)
616 607
617 fprintf(out, _("#\n" 608 fprintf(out, _("#\n"
618 "# Automatically generated make config: don't edit\n" 609 "# Automatically generated make config: don't edit\n"
619 "# Linux kernel version: %s\n" 610 "# %s\n"
620 "%s%s" 611 "%s%s"
621 "#\n"), 612 "#\n"),
622 sym_get_string_value(sym), 613 rootmenu.prompt->text,
623 use_timestamp ? "# " : "", 614 use_timestamp ? "# " : "",
624 use_timestamp ? ctime(&now) : ""); 615 use_timestamp ? ctime(&now) : "");
625 616
@@ -686,7 +677,7 @@ next:
686static int conf_split_config(void) 677static int conf_split_config(void)
687{ 678{
688 const char *name; 679 const char *name;
689 char path[128]; 680 char path[PATH_MAX+1];
690 char *s, *d, c; 681 char *s, *d, c;
691 struct symbol *sym; 682 struct symbol *sym;
692 struct stat sb; 683 struct stat sb;
@@ -828,25 +819,23 @@ int conf_write_autoconf(void)
828 return 1; 819 return 1;
829 } 820 }
830 821
831 sym = sym_lookup("KERNELVERSION", 0);
832 sym_calc_value(sym);
833 time(&now); 822 time(&now);
834 fprintf(out, "#\n" 823 fprintf(out, "#\n"
835 "# Automatically generated make config: don't edit\n" 824 "# Automatically generated make config: don't edit\n"
836 "# Linux kernel version: %s\n" 825 "# %s\n"
837 "# %s" 826 "# %s"
838 "#\n", 827 "#\n",
839 sym_get_string_value(sym), ctime(&now)); 828 rootmenu.prompt->text, ctime(&now));
840 fprintf(tristate, "#\n" 829 fprintf(tristate, "#\n"
841 "# Automatically generated - do not edit\n" 830 "# Automatically generated - do not edit\n"
842 "\n"); 831 "\n");
843 fprintf(out_h, "/*\n" 832 fprintf(out_h, "/*\n"
844 " * Automatically generated C config: don't edit\n" 833 " * Automatically generated C config: don't edit\n"
845 " * Linux kernel version: %s\n" 834 " * %s\n"
846 " * %s" 835 " * %s"
847 " */\n" 836 " */\n"
848 "#define AUTOCONF_INCLUDED\n", 837 "#define AUTOCONF_INCLUDED\n",
849 sym_get_string_value(sym), ctime(&now)); 838 rootmenu.prompt->text, ctime(&now));
850 839
851 for_all_symbols(i, sym) { 840 for_all_symbols(i, sym) {
852 sym_calc_value(sym); 841 sym_calc_value(sym);
@@ -864,14 +853,17 @@ int conf_write_autoconf(void)
864 case no: 853 case no:
865 break; 854 break;
866 case mod: 855 case mod:
867 fprintf(tristate, "CONFIG_%s=M\n", sym->name); 856 fprintf(tristate, "%s%s=M\n",
868 fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name); 857 CONFIG_, sym->name);
858 fprintf(out_h, "#define %s%s_MODULE 1\n",
859 CONFIG_, sym->name);
869 break; 860 break;
870 case yes: 861 case yes:
871 if (sym->type == S_TRISTATE) 862 if (sym->type == S_TRISTATE)
872 fprintf(tristate, "CONFIG_%s=Y\n", 863 fprintf(tristate,"%s%s=Y\n",
873 sym->name); 864 CONFIG_, sym->name);
874 fprintf(out_h, "#define CONFIG_%s 1\n", sym->name); 865 fprintf(out_h, "#define %s%s 1\n",
866 CONFIG_, sym->name);
875 break; 867 break;
876 } 868 }
877 break; 869 break;
@@ -881,12 +873,14 @@ int conf_write_autoconf(void)
881 case S_HEX: 873 case S_HEX:
882 str = sym_get_string_value(sym); 874 str = sym_get_string_value(sym);
883 if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { 875 if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
884 fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str); 876 fprintf(out_h, "#define %s%s 0x%s\n",
877 CONFIG_, sym->name, str);
885 break; 878 break;
886 } 879 }
887 case S_INT: 880 case S_INT:
888 str = sym_get_string_value(sym); 881 str = sym_get_string_value(sym);
889 fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str); 882 fprintf(out_h, "#define %s%s %s\n",
883 CONFIG_, sym->name, str);
890 break; 884 break;
891 default: 885 default:
892 break; 886 break;
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 6ee2e4fb1481..184eb6a0b505 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -18,7 +18,7 @@ extern "C" {
18struct file { 18struct file {
19 struct file *next; 19 struct file *next;
20 struct file *parent; 20 struct file *parent;
21 char *name; 21 const char *name;
22 int lineno; 22 int lineno;
23 int flags; 23 int flags;
24}; 24};
@@ -165,7 +165,6 @@ struct menu {
165 struct symbol *sym; 165 struct symbol *sym;
166 struct property *prompt; 166 struct property *prompt;
167 struct expr *dep; 167 struct expr *dep;
168 struct expr *dir_dep;
169 unsigned int flags; 168 unsigned int flags;
170 char *help; 169 char *help;
171 struct file *file; 170 struct file *file;
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index d66988265f89..455896164d72 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -133,7 +133,6 @@ void init_main_window(const gchar * glade_file)
133 GladeXML *xml; 133 GladeXML *xml;
134 GtkWidget *widget; 134 GtkWidget *widget;
135 GtkTextBuffer *txtbuf; 135 GtkTextBuffer *txtbuf;
136 char title[256];
137 GtkStyle *style; 136 GtkStyle *style;
138 137
139 xml = glade_xml_new(glade_file, "window1", NULL); 138 xml = glade_xml_new(glade_file, "window1", NULL);
@@ -210,9 +209,7 @@ void init_main_window(const gchar * glade_file)
210 /*"style", PANGO_STYLE_OBLIQUE, */ 209 /*"style", PANGO_STYLE_OBLIQUE, */
211 NULL); 210 NULL);
212 211
213 sprintf(title, _("Linux Kernel v%s Configuration"), 212 gtk_window_set_title(GTK_WINDOW(main_wnd), rootmenu.prompt->text);
214 getenv("KERNELVERSION"));
215 gtk_window_set_title(GTK_WINDOW(main_wnd), title);
216 213
217 gtk_widget_show(main_wnd); 214 gtk_widget_show(main_wnd);
218} 215}
@@ -671,8 +668,7 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
671{ 668{
672 GtkWidget *dialog; 669 GtkWidget *dialog;
673 const gchar *intro_text = _( 670 const gchar *intro_text = _(
674 "Welcome to gkc, the GTK+ graphical kernel configuration tool\n" 671 "Welcome to gkc, the GTK+ graphical configuration tool\n"
675 "for Linux.\n"
676 "For each option, a blank box indicates the feature is disabled, a\n" 672 "For each option, a blank box indicates the feature is disabled, a\n"
677 "check indicates it is enabled, and a dot indicates that it is to\n" 673 "check indicates it is enabled, and a dot indicates that it is to\n"
678 "be compiled as a module. Clicking on the box will cycle through the three states.\n" 674 "be compiled as a module. Clicking on the box will cycle through the three states.\n"
@@ -1531,12 +1527,6 @@ int main(int ac, char *av[])
1531 else 1527 else
1532 glade_file = g_strconcat(g_get_current_dir(), "/", av[0], ".glade", NULL); 1528 glade_file = g_strconcat(g_get_current_dir(), "/", av[0], ".glade", NULL);
1533 1529
1534 /* Load the interface and connect signals */
1535 init_main_window(glade_file);
1536 init_tree_model();
1537 init_left_tree();
1538 init_right_tree();
1539
1540 /* Conf stuffs */ 1530 /* Conf stuffs */
1541 if (ac > 1 && av[1][0] == '-') { 1531 if (ac > 1 && av[1][0] == '-') {
1542 switch (av[1][1]) { 1532 switch (av[1][1]) {
@@ -1556,6 +1546,12 @@ int main(int ac, char *av[])
1556 fixup_rootmenu(&rootmenu); 1546 fixup_rootmenu(&rootmenu);
1557 conf_read(NULL); 1547 conf_read(NULL);
1558 1548
1549 /* Load the interface and connect signals */
1550 init_main_window(glade_file);
1551 init_tree_model();
1552 init_left_tree();
1553 init_right_tree();
1554
1559 switch (view_mode) { 1555 switch (view_mode) {
1560 case SINGLE_VIEW: 1556 case SINGLE_VIEW:
1561 display_tree_part(); 1557 display_tree_part();
diff --git a/scripts/kconfig/gconf.glade b/scripts/kconfig/gconf.glade
index d52b0a75d824..aa483cb32755 100644
--- a/scripts/kconfig/gconf.glade
+++ b/scripts/kconfig/gconf.glade
@@ -1,5 +1,4 @@
1<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> 1<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
2<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
3 2
4<glade-interface> 3<glade-interface>
5 4
diff --git a/scripts/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c
index dcc3fcc0cc9a..e9d8e791bf0d 100644
--- a/scripts/kconfig/kxgettext.c
+++ b/scripts/kconfig/kxgettext.c
@@ -63,11 +63,11 @@ next:
63 63
64struct file_line { 64struct file_line {
65 struct file_line *next; 65 struct file_line *next;
66 char* file; 66 const char *file;
67 int lineno; 67 int lineno;
68}; 68};
69 69
70static struct file_line *file_line__new(char *file, int lineno) 70static struct file_line *file_line__new(const char *file, int lineno)
71{ 71{
72 struct file_line *self = malloc(sizeof(*self)); 72 struct file_line *self = malloc(sizeof(*self));
73 73
@@ -90,7 +90,8 @@ struct message {
90 90
91static struct message *message__list; 91static struct message *message__list;
92 92
93static struct message *message__new(const char *msg, char *option, char *file, int lineno) 93static struct message *message__new(const char *msg, char *option,
94 const char *file, int lineno)
94{ 95{
95 struct message *self = malloc(sizeof(*self)); 96 struct message *self = malloc(sizeof(*self));
96 97
@@ -130,7 +131,8 @@ static struct message *mesage__find(const char *msg)
130 return m; 131 return m;
131} 132}
132 133
133static int message__add_file_line(struct message *self, char *file, int lineno) 134static int message__add_file_line(struct message *self, const char *file,
135 int lineno)
134{ 136{
135 int rc = -1; 137 int rc = -1;
136 struct file_line *fl = file_line__new(file, lineno); 138 struct file_line *fl = file_line__new(file, lineno);
@@ -145,7 +147,8 @@ out:
145 return rc; 147 return rc;
146} 148}
147 149
148static int message__add(const char *msg, char *option, char *file, int lineno) 150static int message__add(const char *msg, char *option, const char *file,
151 int lineno)
149{ 152{
150 int rc = 0; 153 int rc = 0;
151 char bf[16384]; 154 char bf[16384];
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped
index fdc7113b08d1..6eb039718259 100644
--- a/scripts/kconfig/lex.zconf.c_shipped
+++ b/scripts/kconfig/lex.zconf.c_shipped
@@ -2373,9 +2373,10 @@ void zconf_nextfile(const char *name)
2373 memset(buf, 0, sizeof(*buf)); 2373 memset(buf, 0, sizeof(*buf));
2374 2374
2375 current_buf->state = YY_CURRENT_BUFFER; 2375 current_buf->state = YY_CURRENT_BUFFER;
2376 zconfin = zconf_fopen(name); 2376 zconfin = zconf_fopen(file->name);
2377 if (!zconfin) { 2377 if (!zconfin) {
2378 printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name); 2378 printf("%s:%d: can't open file \"%s\"\n",
2379 zconf_curname(), zconf_lineno(), file->name);
2379 exit(1); 2380 exit(1);
2380 } 2381 }
2381 zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE)); 2382 zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
@@ -2422,7 +2423,7 @@ int zconf_lineno(void)
2422 return current_pos.lineno; 2423 return current_pos.lineno;
2423} 2424}
2424 2425
2425char *zconf_curname(void) 2426const char *zconf_curname(void)
2426{ 2427{
2427 return current_pos.file ? current_pos.file->name : "<none>"; 2428 return current_pos.file ? current_pos.file->name : "<none>";
2428} 2429}
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index bdf71bd31412..753cdbd7b805 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -31,12 +31,18 @@ extern "C" {
31 31
32#define SRCTREE "srctree" 32#define SRCTREE "srctree"
33 33
34#ifndef PACKAGE
34#define PACKAGE "linux" 35#define PACKAGE "linux"
36#endif
37
35#define LOCALEDIR "/usr/share/locale" 38#define LOCALEDIR "/usr/share/locale"
36 39
37#define _(text) gettext(text) 40#define _(text) gettext(text)
38#define N_(text) (text) 41#define N_(text) (text)
39 42
43#ifndef CONFIG_
44#define CONFIG_ "CONFIG_"
45#endif
40 46
41#define TF_COMMAND 0x0001 47#define TF_COMMAND 0x0001
42#define TF_PARAM 0x0002 48#define TF_PARAM 0x0002
@@ -70,7 +76,7 @@ FILE *zconf_fopen(const char *name);
70void zconf_initscan(const char *name); 76void zconf_initscan(const char *name);
71void zconf_nextfile(const char *name); 77void zconf_nextfile(const char *name);
72int zconf_lineno(void); 78int zconf_lineno(void);
73char *zconf_curname(void); 79const char *zconf_curname(void);
74 80
75/* conf.c */ 81/* conf.c */
76void xfgets(char *str, int size, FILE *in); 82void xfgets(char *str, int size, FILE *in);
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index 481d4849d0f0..17342fef38b9 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -30,6 +30,7 @@ P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
30 30
31P(sym_lookup,struct symbol *,(const char *name, int flags)); 31P(sym_lookup,struct symbol *,(const char *name, int flags));
32P(sym_find,struct symbol *,(const char *name)); 32P(sym_find,struct symbol *,(const char *name));
33P(sym_expand_string_value,const char *,(const char *in));
33P(sym_re_search,struct symbol **,(const char *pattern)); 34P(sym_re_search,struct symbol **,(const char *pattern));
34P(sym_type_name,const char *,(enum symbol_type type)); 35P(sym_type_name,const char *,(enum symbol_type type));
35P(sym_calc_value,void,(struct symbol *sym)); 36P(sym_calc_value,void,(struct symbol *sym));
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
index fcef0f59d553..82cc3a85e7f8 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -23,6 +23,8 @@ ccflags()
23 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"' 23 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
24 elif [ -f /usr/include/ncurses/curses.h ]; then 24 elif [ -f /usr/include/ncurses/curses.h ]; then
25 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"' 25 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
26 elif [ -f /usr/include/ncursesw/curses.h ]; then
27 echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
26 elif [ -f /usr/include/ncurses.h ]; then 28 elif [ -f /usr/include/ncurses.h ]; then
27 echo '-DCURSES_LOC="<ncurses.h>"' 29 echo '-DCURSES_LOC="<ncurses.h>"'
28 else 30 else
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index d2f6e056c058..d433c7a24745 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -25,11 +25,9 @@
25static const char mconf_readme[] = N_( 25static const char mconf_readme[] = N_(
26"Overview\n" 26"Overview\n"
27"--------\n" 27"--------\n"
28"Some kernel features may be built directly into the kernel.\n" 28"This interface let you select features and parameters for the build.\n"
29"Some may be made into loadable runtime modules. Some features\n" 29"Features can either be built-in, modularized, or ignored. Parameters\n"
30"may be completely removed altogether. There are also certain\n" 30"must be entered in as decimal or hexadecimal numbers or text.\n"
31"kernel parameters which are not really features, but must be\n"
32"entered in as decimal or hexadecimal numbers or possibly text.\n"
33"\n" 31"\n"
34"Menu items beginning with following braces represent features that\n" 32"Menu items beginning with following braces represent features that\n"
35" [ ] can be built in or removed\n" 33" [ ] can be built in or removed\n"
@@ -117,7 +115,7 @@ static const char mconf_readme[] = N_(
117"-----------------------------\n" 115"-----------------------------\n"
118"Menuconfig supports the use of alternate configuration files for\n" 116"Menuconfig supports the use of alternate configuration files for\n"
119"those who, for various reasons, find it necessary to switch\n" 117"those who, for various reasons, find it necessary to switch\n"
120"between different kernel configurations.\n" 118"between different configurations.\n"
121"\n" 119"\n"
122"At the end of the main menu you will find two options. One is\n" 120"At the end of the main menu you will find two options. One is\n"
123"for saving the current configuration to a file of your choosing.\n" 121"for saving the current configuration to a file of your choosing.\n"
@@ -150,9 +148,9 @@ static const char mconf_readme[] = N_(
150"\n" 148"\n"
151"Optional personality available\n" 149"Optional personality available\n"
152"------------------------------\n" 150"------------------------------\n"
153"If you prefer to have all of the kernel options listed in a single\n" 151"If you prefer to have all of the options listed in a single menu, rather\n"
154"menu, rather than the default multimenu hierarchy, run the menuconfig\n" 152"than the default multimenu hierarchy, run the menuconfig with\n"
155"with MENUCONFIG_MODE environment variable set to single_menu. Example:\n" 153"MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
156"\n" 154"\n"
157"make MENUCONFIG_MODE=single_menu menuconfig\n" 155"make MENUCONFIG_MODE=single_menu menuconfig\n"
158"\n" 156"\n"
@@ -207,12 +205,12 @@ load_config_text[] = N_(
207 "last retrieved. Leave blank to abort."), 205 "last retrieved. Leave blank to abort."),
208load_config_help[] = N_( 206load_config_help[] = N_(
209 "\n" 207 "\n"
210 "For various reasons, one may wish to keep several different kernel\n" 208 "For various reasons, one may wish to keep several different\n"
211 "configurations available on a single machine.\n" 209 "configurations available on a single machine.\n"
212 "\n" 210 "\n"
213 "If you have saved a previous configuration in a file other than the\n" 211 "If you have saved a previous configuration in a file other than the\n"
214 "kernel's default, entering the name of the file here will allow you\n" 212 "default one, entering its name here will allow you to modify that\n"
215 "to modify that configuration.\n" 213 "configuration.\n"
216 "\n" 214 "\n"
217 "If you are uncertain, then you have probably never used alternate\n" 215 "If you are uncertain, then you have probably never used alternate\n"
218 "configuration files. You should therefore leave this blank to abort.\n"), 216 "configuration files. You should therefore leave this blank to abort.\n"),
@@ -221,8 +219,8 @@ save_config_text[] = N_(
221 "as an alternate. Leave blank to abort."), 219 "as an alternate. Leave blank to abort."),
222save_config_help[] = N_( 220save_config_help[] = N_(
223 "\n" 221 "\n"
224 "For various reasons, one may wish to keep different kernel\n" 222 "For various reasons, one may wish to keep different configurations\n"
225 "configurations available on a single machine.\n" 223 "available on a single machine.\n"
226 "\n" 224 "\n"
227 "Entering a file name here will allow you to later retrieve, modify\n" 225 "Entering a file name here will allow you to later retrieve, modify\n"
228 "and use the current configuration as an alternate to whatever\n" 226 "and use the current configuration as an alternate to whatever\n"
@@ -232,7 +230,7 @@ save_config_help[] = N_(
232 "leave this blank.\n"), 230 "leave this blank.\n"),
233search_help[] = N_( 231search_help[] = N_(
234 "\n" 232 "\n"
235 "Search for CONFIG_ symbols and display their relations.\n" 233 "Search for symbols and display their relations.\n"
236 "Regular expressions are allowed.\n" 234 "Regular expressions are allowed.\n"
237 "Example: search for \"^FOO\"\n" 235 "Example: search for \"^FOO\"\n"
238 "Result:\n" 236 "Result:\n"
@@ -249,7 +247,7 @@ search_help[] = N_(
249 "Selected by: BAR\n" 247 "Selected by: BAR\n"
250 "-----------------------------------------------------------------\n" 248 "-----------------------------------------------------------------\n"
251 "o The line 'Prompt:' shows the text used in the menu structure for\n" 249 "o The line 'Prompt:' shows the text used in the menu structure for\n"
252 " this CONFIG_ symbol\n" 250 " this symbol\n"
253 "o The 'Defined at' line tell at what file / line number the symbol\n" 251 "o The 'Defined at' line tell at what file / line number the symbol\n"
254 " is defined\n" 252 " is defined\n"
255 "o The 'Depends on:' line tell what symbols needs to be defined for\n" 253 "o The 'Depends on:' line tell what symbols needs to be defined for\n"
@@ -265,9 +263,9 @@ search_help[] = N_(
265 "Only relevant lines are shown.\n" 263 "Only relevant lines are shown.\n"
266 "\n\n" 264 "\n\n"
267 "Search examples:\n" 265 "Search examples:\n"
268 "Examples: USB => find all CONFIG_ symbols containing USB\n" 266 "Examples: USB => find all symbols containing USB\n"
269 " ^USB => find all CONFIG_ symbols starting with USB\n" 267 " ^USB => find all symbols starting with USB\n"
270 " USB$ => find all CONFIG_ symbols ending with USB\n" 268 " USB$ => find all symbols ending with USB\n"
271 "\n"); 269 "\n");
272 270
273static int indent; 271static int indent;
@@ -290,13 +288,9 @@ static void set_config_filename(const char *config_filename)
290{ 288{
291 static char menu_backtitle[PATH_MAX+128]; 289 static char menu_backtitle[PATH_MAX+128];
292 int size; 290 int size;
293 struct symbol *sym;
294 291
295 sym = sym_lookup("KERNELVERSION", 0);
296 sym_calc_value(sym);
297 size = snprintf(menu_backtitle, sizeof(menu_backtitle), 292 size = snprintf(menu_backtitle, sizeof(menu_backtitle),
298 _("%s - Linux Kernel v%s Configuration"), 293 "%s - %s", config_filename, rootmenu.prompt->text);
299 config_filename, sym_get_string_value(sym));
300 if (size >= sizeof(menu_backtitle)) 294 if (size >= sizeof(menu_backtitle))
301 menu_backtitle[sizeof(menu_backtitle)-1] = '\0'; 295 menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
302 set_dialog_backtitle(menu_backtitle); 296 set_dialog_backtitle(menu_backtitle);
@@ -316,8 +310,8 @@ static void search_conf(void)
316again: 310again:
317 dialog_clear(); 311 dialog_clear();
318 dres = dialog_inputbox(_("Search Configuration Parameter"), 312 dres = dialog_inputbox(_("Search Configuration Parameter"),
319 _("Enter CONFIG_ (sub)string to search for " 313 _("Enter " CONFIG_ " (sub)string to search for "
320 "(with or without \"CONFIG\")"), 314 "(with or without \"" CONFIG_ "\")"),
321 10, 75, ""); 315 10, 75, "");
322 switch (dres) { 316 switch (dres) {
323 case 0: 317 case 0:
@@ -329,10 +323,10 @@ again:
329 return; 323 return;
330 } 324 }
331 325
332 /* strip CONFIG_ if necessary */ 326 /* strip the prefix if necessary */
333 dialog_input = dialog_input_result; 327 dialog_input = dialog_input_result;
334 if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0) 328 if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
335 dialog_input += 7; 329 dialog_input += strlen(CONFIG_);
336 330
337 sym_arr = sym_re_search(dialog_input); 331 sym_arr = sym_re_search(dialog_input);
338 res = get_relations_str(sym_arr); 332 res = get_relations_str(sym_arr);
@@ -834,7 +828,7 @@ int main(int ac, char **av)
834 if (conf_get_changed()) 828 if (conf_get_changed())
835 res = dialog_yesno(NULL, 829 res = dialog_yesno(NULL,
836 _("Do you wish to save your " 830 _("Do you wish to save your "
837 "new kernel configuration?\n" 831 "new configuration?\n"
838 "<ESC><ESC> to continue."), 832 "<ESC><ESC> to continue."),
839 6, 60); 833 6, 60);
840 else 834 else
@@ -846,20 +840,20 @@ int main(int ac, char **av)
846 case 0: 840 case 0:
847 if (conf_write(filename)) { 841 if (conf_write(filename)) {
848 fprintf(stderr, _("\n\n" 842 fprintf(stderr, _("\n\n"
849 "Error during writing of the kernel configuration.\n" 843 "Error while writing of the configuration.\n"
850 "Your kernel configuration changes were NOT saved." 844 "Your configuration changes were NOT saved."
851 "\n\n")); 845 "\n\n"));
852 return 1; 846 return 1;
853 } 847 }
854 case -1: 848 case -1:
855 printf(_("\n\n" 849 printf(_("\n\n"
856 "*** End of Linux kernel configuration.\n" 850 "*** End of the configuration.\n"
857 "*** Execute 'make' to build the kernel or try 'make help'." 851 "*** Execute 'make' to start the build or try 'make help'."
858 "\n\n")); 852 "\n\n"));
859 break; 853 break;
860 default: 854 default:
861 fprintf(stderr, _("\n\n" 855 fprintf(stderr, _("\n\n"
862 "Your kernel configuration changes were NOT saved." 856 "Your configuration changes were NOT saved."
863 "\n\n")); 857 "\n\n"));
864 } 858 }
865 859
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 4fb590247f33..7e83aef42c6d 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -10,7 +10,7 @@
10#include "lkc.h" 10#include "lkc.h"
11 11
12static const char nohelp_text[] = N_( 12static const char nohelp_text[] = N_(
13 "There is no help available for this kernel option.\n"); 13 "There is no help available for this option.\n");
14 14
15struct menu rootmenu; 15struct menu rootmenu;
16static struct menu **last_entry_ptr; 16static struct menu **last_entry_ptr;
@@ -107,7 +107,6 @@ static struct expr *menu_check_dep(struct expr *e)
107void menu_add_dep(struct expr *dep) 107void menu_add_dep(struct expr *dep)
108{ 108{
109 current_entry->dep = expr_alloc_and(current_entry->dep, menu_check_dep(dep)); 109 current_entry->dep = expr_alloc_and(current_entry->dep, menu_check_dep(dep));
110 current_entry->dir_dep = current_entry->dep;
111} 110}
112 111
113void menu_set_type(int type) 112void menu_set_type(int type)
@@ -139,7 +138,7 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e
139 while (isspace(*prompt)) 138 while (isspace(*prompt))
140 prompt++; 139 prompt++;
141 } 140 }
142 if (current_entry->prompt) 141 if (current_entry->prompt && current_entry != &rootmenu)
143 prop_warn(prop, "prompt redefined"); 142 prop_warn(prop, "prompt redefined");
144 current_entry->prompt = prop; 143 current_entry->prompt = prop;
145 } 144 }
@@ -291,10 +290,6 @@ void menu_finalize(struct menu *parent)
291 for (menu = parent->list; menu; menu = menu->next) 290 for (menu = parent->list; menu; menu = menu->next)
292 menu_finalize(menu); 291 menu_finalize(menu);
293 } else if (sym) { 292 } else if (sym) {
294 /* ignore inherited dependencies for dir_dep */
295 sym->dir_dep.expr = expr_transform(expr_copy(parent->dir_dep));
296 sym->dir_dep.expr = expr_eliminate_dups(sym->dir_dep.expr);
297
298 basedep = parent->prompt ? parent->prompt->visible.expr : NULL; 293 basedep = parent->prompt ? parent->prompt->visible.expr : NULL;
299 basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no); 294 basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no);
300 basedep = expr_eliminate_dups(expr_transform(basedep)); 295 basedep = expr_eliminate_dups(expr_transform(basedep));
@@ -325,6 +320,8 @@ void menu_finalize(struct menu *parent)
325 parent->next = last_menu->next; 320 parent->next = last_menu->next;
326 last_menu->next = NULL; 321 last_menu->next = NULL;
327 } 322 }
323
324 sym->dir_dep.expr = parent->dep;
328 } 325 }
329 for (menu = parent->list; menu; menu = menu->next) { 326 for (menu = parent->list; menu; menu = menu->next) {
330 if (sym && sym_is_choice(sym) && 327 if (sym && sym_is_choice(sym) &&
@@ -566,7 +563,7 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help)
566 563
567 if (menu_has_help(menu)) { 564 if (menu_has_help(menu)) {
568 if (sym->name) { 565 if (sym->name) {
569 str_printf(help, "CONFIG_%s:\n\n", sym->name); 566 str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
570 str_append(help, _(menu_get_help(menu))); 567 str_append(help, _(menu_get_help(menu)));
571 str_append(help, "\n"); 568 str_append(help, "\n");
572 } 569 }
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 16233a9382c8..272a987f23e0 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -15,11 +15,9 @@
15static const char nconf_readme[] = N_( 15static const char nconf_readme[] = N_(
16"Overview\n" 16"Overview\n"
17"--------\n" 17"--------\n"
18"Some kernel features may be built directly into the kernel.\n" 18"This interface let you select features and parameters for the build.\n"
19"Some may be made into loadable runtime modules. Some features\n" 19"Features can either be built-in, modularized, or ignored. Parameters\n"
20"may be completely removed altogether. There are also certain\n" 20"must be entered in as decimal or hexadecimal numbers or text.\n"
21"kernel parameters which are not really features, but must be\n"
22"entered in as decimal or hexadecimal numbers or possibly text.\n"
23"\n" 21"\n"
24"Menu items beginning with following braces represent features that\n" 22"Menu items beginning with following braces represent features that\n"
25" [ ] can be built in or removed\n" 23" [ ] can be built in or removed\n"
@@ -95,7 +93,7 @@ static const char nconf_readme[] = N_(
95"-----------------------------\n" 93"-----------------------------\n"
96"nconfig supports the use of alternate configuration files for\n" 94"nconfig supports the use of alternate configuration files for\n"
97"those who, for various reasons, find it necessary to switch\n" 95"those who, for various reasons, find it necessary to switch\n"
98"between different kernel configurations.\n" 96"between different configurations.\n"
99"\n" 97"\n"
100"At the end of the main menu you will find two options. One is\n" 98"At the end of the main menu you will find two options. One is\n"
101"for saving the current configuration to a file of your choosing.\n" 99"for saving the current configuration to a file of your choosing.\n"
@@ -128,9 +126,9 @@ static const char nconf_readme[] = N_(
128"\n" 126"\n"
129"Optional personality available\n" 127"Optional personality available\n"
130"------------------------------\n" 128"------------------------------\n"
131"If you prefer to have all of the kernel options listed in a single\n" 129"If you prefer to have all of the options listed in a single menu, rather\n"
132"menu, rather than the default multimenu hierarchy, run the nconfig\n" 130"than the default multimenu hierarchy, run the nconfig with NCONFIG_MODE\n"
133"with NCONFIG_MODE environment variable set to single_menu. Example:\n" 131"environment variable set to single_menu. Example:\n"
134"\n" 132"\n"
135"make NCONFIG_MODE=single_menu nconfig\n" 133"make NCONFIG_MODE=single_menu nconfig\n"
136"\n" 134"\n"
@@ -185,19 +183,19 @@ setmod_text[] = N_(
185"has been configured as a module.\n" 183"has been configured as a module.\n"
186"As a result, this feature will be built as a module."), 184"As a result, this feature will be built as a module."),
187nohelp_text[] = N_( 185nohelp_text[] = N_(
188"There is no help available for this kernel option.\n"), 186"There is no help available for this option.\n"),
189load_config_text[] = N_( 187load_config_text[] = N_(
190"Enter the name of the configuration file you wish to load.\n" 188"Enter the name of the configuration file you wish to load.\n"
191"Accept the name shown to restore the configuration you\n" 189"Accept the name shown to restore the configuration you\n"
192"last retrieved. Leave blank to abort."), 190"last retrieved. Leave blank to abort."),
193load_config_help[] = N_( 191load_config_help[] = N_(
194"\n" 192"\n"
195"For various reasons, one may wish to keep several different kernel\n" 193"For various reasons, one may wish to keep several different\n"
196"configurations available on a single machine.\n" 194"configurations available on a single machine.\n"
197"\n" 195"\n"
198"If you have saved a previous configuration in a file other than the\n" 196"If you have saved a previous configuration in a file other than the\n"
199"kernel's default, entering the name of the file here will allow you\n" 197"default one, entering its name here will allow you to modify that\n"
200"to modify that configuration.\n" 198"configuration.\n"
201"\n" 199"\n"
202"If you are uncertain, then you have probably never used alternate\n" 200"If you are uncertain, then you have probably never used alternate\n"
203"configuration files. You should therefor leave this blank to abort.\n"), 201"configuration files. You should therefor leave this blank to abort.\n"),
@@ -206,8 +204,8 @@ save_config_text[] = N_(
206"as an alternate. Leave blank to abort."), 204"as an alternate. Leave blank to abort."),
207save_config_help[] = N_( 205save_config_help[] = N_(
208"\n" 206"\n"
209"For various reasons, one may wish to keep different kernel\n" 207"For various reasons, one may wish to keep different configurations\n"
210"configurations available on a single machine.\n" 208"available on a single machine.\n"
211"\n" 209"\n"
212"Entering a file name here will allow you to later retrieve, modify\n" 210"Entering a file name here will allow you to later retrieve, modify\n"
213"and use the current configuration as an alternate to whatever\n" 211"and use the current configuration as an alternate to whatever\n"
@@ -217,8 +215,8 @@ save_config_help[] = N_(
217"leave this blank.\n"), 215"leave this blank.\n"),
218search_help[] = N_( 216search_help[] = N_(
219"\n" 217"\n"
220"Search for CONFIG_ symbols and display their relations.\n" 218"Search for symbols and display their relations. Regular expressions\n"
221"Regular expressions are allowed.\n" 219"are allowed.\n"
222"Example: search for \"^FOO\"\n" 220"Example: search for \"^FOO\"\n"
223"Result:\n" 221"Result:\n"
224"-----------------------------------------------------------------\n" 222"-----------------------------------------------------------------\n"
@@ -234,7 +232,7 @@ search_help[] = N_(
234"Selected by: BAR\n" 232"Selected by: BAR\n"
235"-----------------------------------------------------------------\n" 233"-----------------------------------------------------------------\n"
236"o The line 'Prompt:' shows the text used in the menu structure for\n" 234"o The line 'Prompt:' shows the text used in the menu structure for\n"
237" this CONFIG_ symbol\n" 235" this symbol\n"
238"o The 'Defined at' line tell at what file / line number the symbol\n" 236"o The 'Defined at' line tell at what file / line number the symbol\n"
239" is defined\n" 237" is defined\n"
240"o The 'Depends on:' line tell what symbols needs to be defined for\n" 238"o The 'Depends on:' line tell what symbols needs to be defined for\n"
@@ -250,9 +248,9 @@ search_help[] = N_(
250"Only relevant lines are shown.\n" 248"Only relevant lines are shown.\n"
251"\n\n" 249"\n\n"
252"Search examples:\n" 250"Search examples:\n"
253"Examples: USB = > find all CONFIG_ symbols containing USB\n" 251"Examples: USB = > find all symbols containing USB\n"
254" ^USB => find all CONFIG_ symbols starting with USB\n" 252" ^USB => find all symbols starting with USB\n"
255" USB$ => find all CONFIG_ symbols ending with USB\n" 253" USB$ => find all symbols ending with USB\n"
256"\n"); 254"\n");
257 255
258struct mitem { 256struct mitem {
@@ -635,13 +633,9 @@ static char menu_backtitle[PATH_MAX+128];
635static const char *set_config_filename(const char *config_filename) 633static const char *set_config_filename(const char *config_filename)
636{ 634{
637 int size; 635 int size;
638 struct symbol *sym;
639 636
640 sym = sym_lookup("KERNELVERSION", 0);
641 sym_calc_value(sym);
642 size = snprintf(menu_backtitle, sizeof(menu_backtitle), 637 size = snprintf(menu_backtitle, sizeof(menu_backtitle),
643 _("%s - Linux Kernel v%s Configuration"), 638 "%s - %s", config_filename, rootmenu.prompt->text);
644 config_filename, sym_get_string_value(sym));
645 if (size >= sizeof(menu_backtitle)) 639 if (size >= sizeof(menu_backtitle))
646 menu_backtitle[sizeof(menu_backtitle)-1] = '\0'; 640 menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
647 641
@@ -662,8 +656,7 @@ static int do_exit(void)
662 return 0; 656 return 0;
663 } 657 }
664 res = btn_dialog(main_window, 658 res = btn_dialog(main_window,
665 _("Do you wish to save your " 659 _("Do you wish to save your new configuration?\n"
666 "new kernel configuration?\n"
667 "<ESC> to cancel and resume nconfig."), 660 "<ESC> to cancel and resume nconfig."),
668 2, 661 2,
669 " <save> ", 662 " <save> ",
@@ -680,17 +673,15 @@ static int do_exit(void)
680 if (res) 673 if (res)
681 btn_dialog( 674 btn_dialog(
682 main_window, 675 main_window,
683 _("Error during writing of the kernel " 676 _("Error during writing of configuration.\n"
684 "configuration.\n" 677 "Your configuration changes were NOT saved."),
685 "Your kernel configuration "
686 "changes were NOT saved."),
687 1, 678 1,
688 "<OK>"); 679 "<OK>");
689 break; 680 break;
690 default: 681 default:
691 btn_dialog( 682 btn_dialog(
692 main_window, 683 main_window,
693 _("Your kernel configuration changes were NOT saved."), 684 _("Your configuration changes were NOT saved."),
694 1, 685 1,
695 "<OK>"); 686 "<OK>");
696 break; 687 break;
@@ -710,8 +701,8 @@ static void search_conf(void)
710again: 701again:
711 dres = dialog_inputbox(main_window, 702 dres = dialog_inputbox(main_window,
712 _("Search Configuration Parameter"), 703 _("Search Configuration Parameter"),
713 _("Enter CONFIG_ (sub)string to search for " 704 _("Enter " CONFIG_ " (sub)string to search for "
714 "(with or without \"CONFIG\")"), 705 "(with or without \"" CONFIG_ "\")"),
715 "", dialog_input_result, 99); 706 "", dialog_input_result, 99);
716 switch (dres) { 707 switch (dres) {
717 case 0: 708 case 0:
@@ -724,10 +715,10 @@ again:
724 return; 715 return;
725 } 716 }
726 717
727 /* strip CONFIG_ if necessary */ 718 /* strip the prefix if necessary */
728 dialog_input = dialog_input_result; 719 dialog_input = dialog_input_result;
729 if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0) 720 if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
730 dialog_input += 7; 721 dialog_input += strlen(CONFIG_);
731 722
732 sym_arr = sym_re_search(dialog_input); 723 sym_arr = sym_re_search(dialog_input);
733 res = get_relations_str(sym_arr); 724 res = get_relations_str(sym_arr);
@@ -1235,10 +1226,12 @@ static void show_help(struct menu *menu)
1235 1226
1236 if (menu && menu->sym && menu_has_help(menu)) { 1227 if (menu && menu->sym && menu_has_help(menu)) {
1237 if (menu->sym->name) { 1228 if (menu->sym->name) {
1238 str_printf(&help, "CONFIG_%s:\n\n", menu->sym->name); 1229 str_printf(&help, "%s%s:\n\n", CONFIG_, menu->sym->name);
1239 str_append(&help, _(menu_get_help(menu))); 1230 str_append(&help, _(menu_get_help(menu)));
1240 str_append(&help, "\n"); 1231 str_append(&help, "\n");
1241 get_symbol_str(&help, menu->sym); 1232 get_symbol_str(&help, menu->sym);
1233 } else {
1234 str_append(&help, _(menu_get_help(menu)));
1242 } 1235 }
1243 } else { 1236 } else {
1244 str_append(&help, nohelp_text); 1237 str_append(&help, nohelp_text);
diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c
index d963071e48df..f8137b3a5382 100644
--- a/scripts/kconfig/nconf.gui.c
+++ b/scripts/kconfig/nconf.gui.c
@@ -137,7 +137,7 @@ void set_colors()
137 if (has_colors()) { 137 if (has_colors()) {
138 normal_color_theme(); 138 normal_color_theme();
139 } else { 139 } else {
140 /* give deafults */ 140 /* give defaults */
141 no_colors_theme(); 141 no_colors_theme();
142 } 142 }
143} 143}
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 820df2d1217b..06dd2e33581d 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -3,25 +3,42 @@
3 * Released under the terms of the GNU GPL v2.0. 3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#include <qapplication.h> 6#include <qglobal.h>
7
8#if QT_VERSION < 0x040000
7#include <qmainwindow.h> 9#include <qmainwindow.h>
10#include <qvbox.h>
11#include <qvaluelist.h>
12#include <qtextbrowser.h>
13#include <qaction.h>
14#include <qheader.h>
15#include <qfiledialog.h>
16#include <qdragobject.h>
17#include <qpopupmenu.h>
18#else
19#include <q3mainwindow.h>
20#include <q3vbox.h>
21#include <q3valuelist.h>
22#include <q3textbrowser.h>
23#include <q3action.h>
24#include <q3header.h>
25#include <q3filedialog.h>
26#include <q3dragobject.h>
27#include <q3popupmenu.h>
28#endif
29
30#include <qapplication.h>
8#include <qdesktopwidget.h> 31#include <qdesktopwidget.h>
9#include <qtoolbar.h> 32#include <qtoolbar.h>
10#include <qlayout.h> 33#include <qlayout.h>
11#include <qvbox.h>
12#include <qsplitter.h> 34#include <qsplitter.h>
13#include <qlistview.h>
14#include <qtextbrowser.h>
15#include <qlineedit.h> 35#include <qlineedit.h>
16#include <qlabel.h> 36#include <qlabel.h>
17#include <qpushbutton.h> 37#include <qpushbutton.h>
18#include <qmenubar.h> 38#include <qmenubar.h>
19#include <qmessagebox.h> 39#include <qmessagebox.h>
20#include <qaction.h>
21#include <qheader.h>
22#include <qfiledialog.h>
23#include <qdragobject.h>
24#include <qregexp.h> 40#include <qregexp.h>
41#include <qevent.h>
25 42
26#include <stdlib.h> 43#include <stdlib.h>
27 44
@@ -39,7 +56,7 @@
39static QApplication *configApp; 56static QApplication *configApp;
40static ConfigSettings *configSettings; 57static ConfigSettings *configSettings;
41 58
42QAction *ConfigMainWindow::saveAction; 59Q3Action *ConfigMainWindow::saveAction;
43 60
44static inline QString qgettext(const char* str) 61static inline QString qgettext(const char* str)
45{ 62{
@@ -54,9 +71,9 @@ static inline QString qgettext(const QString& str)
54/** 71/**
55 * Reads a list of integer values from the application settings. 72 * Reads a list of integer values from the application settings.
56 */ 73 */
57QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) 74Q3ValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
58{ 75{
59 QValueList<int> result; 76 Q3ValueList<int> result;
60 QStringList entryList = readListEntry(key, ok); 77 QStringList entryList = readListEntry(key, ok);
61 QStringList::Iterator it; 78 QStringList::Iterator it;
62 79
@@ -69,10 +86,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
69/** 86/**
70 * Writes a list of integer values to the application settings. 87 * Writes a list of integer values to the application settings.
71 */ 88 */
72bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value) 89bool ConfigSettings::writeSizes(const QString& key, const Q3ValueList<int>& value)
73{ 90{
74 QStringList stringList; 91 QStringList stringList;
75 QValueList<int>::ConstIterator it; 92 Q3ValueList<int>::ConstIterator it;
76 93
77 for (it = value.begin(); it != value.end(); ++it) 94 for (it = value.begin(); it != value.end(); ++it)
78 stringList.push_back(QString::number(*it)); 95 stringList.push_back(QString::number(*it));
@@ -80,7 +97,6 @@ bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value
80} 97}
81 98
82 99
83#if QT_VERSION >= 300
84/* 100/*
85 * set the new data 101 * set the new data
86 * TODO check the value 102 * TODO check the value
@@ -91,7 +107,6 @@ void ConfigItem::okRename(int col)
91 sym_set_string_value(menu->sym, text(dataColIdx).latin1()); 107 sym_set_string_value(menu->sym, text(dataColIdx).latin1());
92 listView()->updateList(this); 108 listView()->updateList(this);
93} 109}
94#endif
95 110
96/* 111/*
97 * update the displayed of a menu entry 112 * update the displayed of a menu entry
@@ -195,11 +210,9 @@ void ConfigItem::updateMenu(void)
195 210
196 data = sym_get_string_value(sym); 211 data = sym_get_string_value(sym);
197 212
198#if QT_VERSION >= 300
199 int i = list->mapIdx(dataColIdx); 213 int i = list->mapIdx(dataColIdx);
200 if (i >= 0) 214 if (i >= 0)
201 setRenameEnabled(i, TRUE); 215 setRenameEnabled(i, TRUE);
202#endif
203 setText(dataColIdx, data); 216 setText(dataColIdx, data);
204 if (type == S_STRING) 217 if (type == S_STRING)
205 prompt = QString("%1: %2").arg(prompt).arg(data); 218 prompt = QString("%1: %2").arg(prompt).arg(data);
@@ -432,7 +445,7 @@ void ConfigList::updateList(ConfigItem* item)
432 if (!rootEntry) { 445 if (!rootEntry) {
433 if (mode != listMode) 446 if (mode != listMode)
434 goto update; 447 goto update;
435 QListViewItemIterator it(this); 448 Q3ListViewItemIterator it(this);
436 ConfigItem* item; 449 ConfigItem* item;
437 450
438 for (; it.current(); ++it) { 451 for (; it.current(); ++it) {
@@ -527,11 +540,9 @@ void ConfigList::changeValue(ConfigItem* item)
527 case S_INT: 540 case S_INT:
528 case S_HEX: 541 case S_HEX:
529 case S_STRING: 542 case S_STRING:
530#if QT_VERSION >= 300
531 if (colMap[dataColIdx] >= 0) 543 if (colMap[dataColIdx] >= 0)
532 item->startRename(colMap[dataColIdx]); 544 item->startRename(colMap[dataColIdx]);
533 else 545 else
534#endif
535 parent()->lineEdit->show(item); 546 parent()->lineEdit->show(item);
536 break; 547 break;
537 } 548 }
@@ -563,7 +574,7 @@ void ConfigList::setParentMenu(void)
563 return; 574 return;
564 setRootMenu(menu_get_parent_menu(rootEntry->parent)); 575 setRootMenu(menu_get_parent_menu(rootEntry->parent));
565 576
566 QListViewItemIterator it(this); 577 Q3ListViewItemIterator it(this);
567 for (; (item = (ConfigItem*)it.current()); it++) { 578 for (; (item = (ConfigItem*)it.current()); it++) {
568 if (item->menu == oldroot) { 579 if (item->menu == oldroot) {
569 setCurrentItem(item); 580 setCurrentItem(item);
@@ -645,7 +656,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
645 656
646void ConfigList::keyPressEvent(QKeyEvent* ev) 657void ConfigList::keyPressEvent(QKeyEvent* ev)
647{ 658{
648 QListViewItem* i = currentItem(); 659 Q3ListViewItem* i = currentItem();
649 ConfigItem* item; 660 ConfigItem* item;
650 struct menu *menu; 661 struct menu *menu;
651 enum prop_type type; 662 enum prop_type type;
@@ -811,10 +822,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
811{ 822{
812 if (e->y() <= header()->geometry().bottom()) { 823 if (e->y() <= header()->geometry().bottom()) {
813 if (!headerPopup) { 824 if (!headerPopup) {
814 QAction *action; 825 Q3Action *action;
815 826
816 headerPopup = new QPopupMenu(this); 827 headerPopup = new Q3PopupMenu(this);
817 action = new QAction(NULL, _("Show Name"), 0, this); 828 action = new Q3Action(NULL, _("Show Name"), 0, this);
818 action->setToggleAction(TRUE); 829 action->setToggleAction(TRUE);
819 connect(action, SIGNAL(toggled(bool)), 830 connect(action, SIGNAL(toggled(bool)),
820 parent(), SLOT(setShowName(bool))); 831 parent(), SLOT(setShowName(bool)));
@@ -822,7 +833,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
822 action, SLOT(setOn(bool))); 833 action, SLOT(setOn(bool)));
823 action->setOn(showName); 834 action->setOn(showName);
824 action->addTo(headerPopup); 835 action->addTo(headerPopup);
825 action = new QAction(NULL, _("Show Range"), 0, this); 836 action = new Q3Action(NULL, _("Show Range"), 0, this);
826 action->setToggleAction(TRUE); 837 action->setToggleAction(TRUE);
827 connect(action, SIGNAL(toggled(bool)), 838 connect(action, SIGNAL(toggled(bool)),
828 parent(), SLOT(setShowRange(bool))); 839 parent(), SLOT(setShowRange(bool)));
@@ -830,7 +841,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
830 action, SLOT(setOn(bool))); 841 action, SLOT(setOn(bool)));
831 action->setOn(showRange); 842 action->setOn(showRange);
832 action->addTo(headerPopup); 843 action->addTo(headerPopup);
833 action = new QAction(NULL, _("Show Data"), 0, this); 844 action = new Q3Action(NULL, _("Show Data"), 0, this);
834 action->setToggleAction(TRUE); 845 action->setToggleAction(TRUE);
835 connect(action, SIGNAL(toggled(bool)), 846 connect(action, SIGNAL(toggled(bool)),
836 parent(), SLOT(setShowData(bool))); 847 parent(), SLOT(setShowData(bool)));
@@ -914,7 +925,7 @@ void ConfigView::setShowData(bool b)
914 925
915void ConfigList::setAllOpen(bool open) 926void ConfigList::setAllOpen(bool open)
916{ 927{
917 QListViewItemIterator it(this); 928 Q3ListViewItemIterator it(this);
918 929
919 for (; it.current(); it++) 930 for (; it.current(); it++)
920 it.current()->setOpen(open); 931 it.current()->setOpen(open);
@@ -937,7 +948,7 @@ void ConfigView::updateListAll(void)
937} 948}
938 949
939ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) 950ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
940 : Parent(parent, name), sym(0), menu(0) 951 : Parent(parent, name), sym(0), _menu(0)
941{ 952{
942 if (name) { 953 if (name) {
943 configSettings->beginGroup(name); 954 configSettings->beginGroup(name);
@@ -960,7 +971,7 @@ void ConfigInfoView::setShowDebug(bool b)
960{ 971{
961 if (_showDebug != b) { 972 if (_showDebug != b) {
962 _showDebug = b; 973 _showDebug = b;
963 if (menu) 974 if (_menu)
964 menuInfo(); 975 menuInfo();
965 else if (sym) 976 else if (sym)
966 symbolInfo(); 977 symbolInfo();
@@ -970,11 +981,11 @@ void ConfigInfoView::setShowDebug(bool b)
970 981
971void ConfigInfoView::setInfo(struct menu *m) 982void ConfigInfoView::setInfo(struct menu *m)
972{ 983{
973 if (menu == m) 984 if (_menu == m)
974 return; 985 return;
975 menu = m; 986 _menu = m;
976 sym = NULL; 987 sym = NULL;
977 if (!menu) 988 if (!_menu)
978 clear(); 989 clear();
979 else 990 else
980 menuInfo(); 991 menuInfo();
@@ -1001,11 +1012,11 @@ void ConfigInfoView::menuInfo(void)
1001 struct symbol* sym; 1012 struct symbol* sym;
1002 QString head, debug, help; 1013 QString head, debug, help;
1003 1014
1004 sym = menu->sym; 1015 sym = _menu->sym;
1005 if (sym) { 1016 if (sym) {
1006 if (menu->prompt) { 1017 if (_menu->prompt) {
1007 head += "<big><b>"; 1018 head += "<big><b>";
1008 head += print_filter(_(menu->prompt->text)); 1019 head += print_filter(_(_menu->prompt->text));
1009 head += "</b></big>"; 1020 head += "</b></big>";
1010 if (sym->name) { 1021 if (sym->name) {
1011 head += " ("; 1022 head += " (";
@@ -1031,23 +1042,23 @@ void ConfigInfoView::menuInfo(void)
1031 debug = debug_info(sym); 1042 debug = debug_info(sym);
1032 1043
1033 struct gstr help_gstr = str_new(); 1044 struct gstr help_gstr = str_new();
1034 menu_get_ext_help(menu, &help_gstr); 1045 menu_get_ext_help(_menu, &help_gstr);
1035 help = print_filter(str_get(&help_gstr)); 1046 help = print_filter(str_get(&help_gstr));
1036 str_free(&help_gstr); 1047 str_free(&help_gstr);
1037 } else if (menu->prompt) { 1048 } else if (_menu->prompt) {
1038 head += "<big><b>"; 1049 head += "<big><b>";
1039 head += print_filter(_(menu->prompt->text)); 1050 head += print_filter(_(_menu->prompt->text));
1040 head += "</b></big><br><br>"; 1051 head += "</b></big><br><br>";
1041 if (showDebug()) { 1052 if (showDebug()) {
1042 if (menu->prompt->visible.expr) { 1053 if (_menu->prompt->visible.expr) {
1043 debug += "&nbsp;&nbsp;dep: "; 1054 debug += "&nbsp;&nbsp;dep: ";
1044 expr_print(menu->prompt->visible.expr, expr_print_help, &debug, E_NONE); 1055 expr_print(_menu->prompt->visible.expr, expr_print_help, &debug, E_NONE);
1045 debug += "<br><br>"; 1056 debug += "<br><br>";
1046 } 1057 }
1047 } 1058 }
1048 } 1059 }
1049 if (showDebug()) 1060 if (showDebug())
1050 debug += QString().sprintf("defined at %s:%d<br><br>", menu->file->name, menu->lineno); 1061 debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
1051 1062
1052 setText(head + debug + help); 1063 setText(head + debug + help);
1053} 1064}
@@ -1150,10 +1161,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
1150 *text += str2; 1161 *text += str2;
1151} 1162}
1152 1163
1153QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) 1164Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
1154{ 1165{
1155 QPopupMenu* popup = Parent::createPopupMenu(pos); 1166 Q3PopupMenu* popup = Parent::createPopupMenu(pos);
1156 QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup); 1167 Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup);
1157 action->setToggleAction(TRUE); 1168 action->setToggleAction(TRUE);
1158 connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); 1169 connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
1159 connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); 1170 connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
@@ -1210,7 +1221,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
1210 y = configSettings->readNumEntry("/window y", 0, &ok); 1221 y = configSettings->readNumEntry("/window y", 0, &ok);
1211 if (ok) 1222 if (ok)
1212 move(x, y); 1223 move(x, y);
1213 QValueList<int> sizes = configSettings->readSizes("/split", &ok); 1224 Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
1214 if (ok) 1225 if (ok)
1215 split->setSizes(sizes); 1226 split->setSizes(sizes);
1216 configSettings->endGroup(); 1227 configSettings->endGroup();
@@ -1263,8 +1274,14 @@ ConfigMainWindow::ConfigMainWindow(void)
1263 char title[256]; 1274 char title[256];
1264 1275
1265 QDesktopWidget *d = configApp->desktop(); 1276 QDesktopWidget *d = configApp->desktop();
1266 snprintf(title, sizeof(title), _("Linux Kernel v%s Configuration"), 1277 snprintf(title, sizeof(title), "%s%s",
1267 getenv("KERNELVERSION")); 1278 rootmenu.prompt->text,
1279#if QT_VERSION < 0x040000
1280 " (Qt3)"
1281#else
1282 ""
1283#endif
1284 );
1268 setCaption(title); 1285 setCaption(title);
1269 1286
1270 width = configSettings->readNumEntry("/window width", d->width() - 64); 1287 width = configSettings->readNumEntry("/window width", d->width() - 64);
@@ -1297,42 +1314,42 @@ ConfigMainWindow::ConfigMainWindow(void)
1297 configList->setFocus(); 1314 configList->setFocus();
1298 1315
1299 menu = menuBar(); 1316 menu = menuBar();
1300 toolBar = new QToolBar("Tools", this); 1317 toolBar = new Q3ToolBar("Tools", this);
1301 1318
1302 backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this); 1319 backAction = new Q3Action("Back", QPixmap(xpm_back), _("Back"), 0, this);
1303 connect(backAction, SIGNAL(activated()), SLOT(goBack())); 1320 connect(backAction, SIGNAL(activated()), SLOT(goBack()));
1304 backAction->setEnabled(FALSE); 1321 backAction->setEnabled(FALSE);
1305 QAction *quitAction = new QAction("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this); 1322 Q3Action *quitAction = new Q3Action("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this);
1306 connect(quitAction, SIGNAL(activated()), SLOT(close())); 1323 connect(quitAction, SIGNAL(activated()), SLOT(close()));
1307 QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this); 1324 Q3Action *loadAction = new Q3Action("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this);
1308 connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); 1325 connect(loadAction, SIGNAL(activated()), SLOT(loadConfig()));
1309 saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this); 1326 saveAction = new Q3Action("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this);
1310 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); 1327 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig()));
1311 conf_set_changed_callback(conf_changed); 1328 conf_set_changed_callback(conf_changed);
1312 // Set saveAction's initial state 1329 // Set saveAction's initial state
1313 conf_changed(); 1330 conf_changed();
1314 QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this); 1331 Q3Action *saveAsAction = new Q3Action("Save As...", _("Save &As..."), 0, this);
1315 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); 1332 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
1316 QAction *searchAction = new QAction("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this); 1333 Q3Action *searchAction = new Q3Action("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this);
1317 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); 1334 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig()));
1318 QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this); 1335 Q3Action *singleViewAction = new Q3Action("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this);
1319 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); 1336 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
1320 QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this); 1337 Q3Action *splitViewAction = new Q3Action("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this);
1321 connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); 1338 connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView()));
1322 QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this); 1339 Q3Action *fullViewAction = new Q3Action("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this);
1323 connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); 1340 connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView()));
1324 1341
1325 QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this); 1342 Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this);
1326 showNameAction->setToggleAction(TRUE); 1343 showNameAction->setToggleAction(TRUE);
1327 connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); 1344 connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
1328 connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); 1345 connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
1329 showNameAction->setOn(configView->showName()); 1346 showNameAction->setOn(configView->showName());
1330 QAction *showRangeAction = new QAction(NULL, _("Show Range"), 0, this); 1347 Q3Action *showRangeAction = new Q3Action(NULL, _("Show Range"), 0, this);
1331 showRangeAction->setToggleAction(TRUE); 1348 showRangeAction->setToggleAction(TRUE);
1332 connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); 1349 connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
1333 connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); 1350 connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
1334 showRangeAction->setOn(configList->showRange); 1351 showRangeAction->setOn(configList->showRange);
1335 QAction *showDataAction = new QAction(NULL, _("Show Data"), 0, this); 1352 Q3Action *showDataAction = new Q3Action(NULL, _("Show Data"), 0, this);
1336 showDataAction->setToggleAction(TRUE); 1353 showDataAction->setToggleAction(TRUE);
1337 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); 1354 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
1338 connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); 1355 connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
@@ -1345,9 +1362,15 @@ ConfigMainWindow::ConfigMainWindow(void)
1345 connect(optGroup, SIGNAL(selected(QAction *)), menuView, 1362 connect(optGroup, SIGNAL(selected(QAction *)), menuView,
1346 SLOT(setOptionMode(QAction *))); 1363 SLOT(setOptionMode(QAction *)));
1347 1364
1348 configView->showNormalAction = new QAction(NULL, _("Show Normal Options"), 0, optGroup); 1365#if QT_VERSION >= 0x040000
1349 configView->showAllAction = new QAction(NULL, _("Show All Options"), 0, optGroup); 1366 configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup);
1350 configView->showPromptAction = new QAction(NULL, _("Show Prompt Options"), 0, optGroup); 1367 configView->showAllAction = new QAction(_("Show All Options"), optGroup);
1368 configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup);
1369#else
1370 configView->showNormalAction = new QAction(_("Show Normal Options"), 0, optGroup);
1371 configView->showAllAction = new QAction(_("Show All Options"), 0, optGroup);
1372 configView->showPromptAction = new QAction(_("Show Prompt Options"), 0, optGroup);
1373#endif
1351 configView->showNormalAction->setToggleAction(TRUE); 1374 configView->showNormalAction->setToggleAction(TRUE);
1352 configView->showNormalAction->setOn(configList->optMode == normalOpt); 1375 configView->showNormalAction->setOn(configList->optMode == normalOpt);
1353 configView->showAllAction->setToggleAction(TRUE); 1376 configView->showAllAction->setToggleAction(TRUE);
@@ -1355,15 +1378,15 @@ ConfigMainWindow::ConfigMainWindow(void)
1355 configView->showPromptAction->setToggleAction(TRUE); 1378 configView->showPromptAction->setToggleAction(TRUE);
1356 configView->showPromptAction->setOn(configList->optMode == promptOpt); 1379 configView->showPromptAction->setOn(configList->optMode == promptOpt);
1357 1380
1358 QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this); 1381 Q3Action *showDebugAction = new Q3Action(NULL, _("Show Debug Info"), 0, this);
1359 showDebugAction->setToggleAction(TRUE); 1382 showDebugAction->setToggleAction(TRUE);
1360 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); 1383 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
1361 connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); 1384 connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
1362 showDebugAction->setOn(helpText->showDebug()); 1385 showDebugAction->setOn(helpText->showDebug());
1363 1386
1364 QAction *showIntroAction = new QAction(NULL, _("Introduction"), 0, this); 1387 Q3Action *showIntroAction = new Q3Action(NULL, _("Introduction"), 0, this);
1365 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); 1388 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro()));
1366 QAction *showAboutAction = new QAction(NULL, _("About"), 0, this); 1389 Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this);
1367 connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); 1390 connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
1368 1391
1369 // init tool bar 1392 // init tool bar
@@ -1377,7 +1400,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1377 fullViewAction->addTo(toolBar); 1400 fullViewAction->addTo(toolBar);
1378 1401
1379 // create config menu 1402 // create config menu
1380 QPopupMenu* config = new QPopupMenu(this); 1403 Q3PopupMenu* config = new Q3PopupMenu(this);
1381 menu->insertItem(_("&File"), config); 1404 menu->insertItem(_("&File"), config);
1382 loadAction->addTo(config); 1405 loadAction->addTo(config);
1383 saveAction->addTo(config); 1406 saveAction->addTo(config);
@@ -1386,12 +1409,12 @@ ConfigMainWindow::ConfigMainWindow(void)
1386 quitAction->addTo(config); 1409 quitAction->addTo(config);
1387 1410
1388 // create edit menu 1411 // create edit menu
1389 QPopupMenu* editMenu = new QPopupMenu(this); 1412 Q3PopupMenu* editMenu = new Q3PopupMenu(this);
1390 menu->insertItem(_("&Edit"), editMenu); 1413 menu->insertItem(_("&Edit"), editMenu);
1391 searchAction->addTo(editMenu); 1414 searchAction->addTo(editMenu);
1392 1415
1393 // create options menu 1416 // create options menu
1394 QPopupMenu* optionMenu = new QPopupMenu(this); 1417 Q3PopupMenu* optionMenu = new Q3PopupMenu(this);
1395 menu->insertItem(_("&Option"), optionMenu); 1418 menu->insertItem(_("&Option"), optionMenu);
1396 showNameAction->addTo(optionMenu); 1419 showNameAction->addTo(optionMenu);
1397 showRangeAction->addTo(optionMenu); 1420 showRangeAction->addTo(optionMenu);
@@ -1399,10 +1422,9 @@ ConfigMainWindow::ConfigMainWindow(void)
1399 optionMenu->insertSeparator(); 1422 optionMenu->insertSeparator();
1400 optGroup->addTo(optionMenu); 1423 optGroup->addTo(optionMenu);
1401 optionMenu->insertSeparator(); 1424 optionMenu->insertSeparator();
1402 showDebugAction->addTo(optionMenu);
1403 1425
1404 // create help menu 1426 // create help menu
1405 QPopupMenu* helpMenu = new QPopupMenu(this); 1427 Q3PopupMenu* helpMenu = new Q3PopupMenu(this);
1406 menu->insertSeparator(); 1428 menu->insertSeparator();
1407 menu->insertItem(_("&Help"), helpMenu); 1429 menu->insertItem(_("&Help"), helpMenu);
1408 showIntroAction->addTo(helpMenu); 1430 showIntroAction->addTo(helpMenu);
@@ -1437,7 +1459,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1437 showSplitView(); 1459 showSplitView();
1438 1460
1439 // UI setup done, restore splitter positions 1461 // UI setup done, restore splitter positions
1440 QValueList<int> sizes = configSettings->readSizes("/split1", &ok); 1462 Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok);
1441 if (ok) 1463 if (ok)
1442 split1->setSizes(sizes); 1464 split1->setSizes(sizes);
1443 1465
@@ -1448,7 +1470,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1448 1470
1449void ConfigMainWindow::loadConfig(void) 1471void ConfigMainWindow::loadConfig(void)
1450{ 1472{
1451 QString s = QFileDialog::getOpenFileName(conf_get_configname(), NULL, this); 1473 QString s = Q3FileDialog::getOpenFileName(conf_get_configname(), NULL, this);
1452 if (s.isNull()) 1474 if (s.isNull())
1453 return; 1475 return;
1454 if (conf_read(QFile::encodeName(s))) 1476 if (conf_read(QFile::encodeName(s)))
@@ -1464,7 +1486,7 @@ void ConfigMainWindow::saveConfig(void)
1464 1486
1465void ConfigMainWindow::saveConfigAs(void) 1487void ConfigMainWindow::saveConfigAs(void)
1466{ 1488{
1467 QString s = QFileDialog::getSaveFileName(conf_get_configname(), NULL, this); 1489 QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this);
1468 if (s.isNull()) 1490 if (s.isNull())
1469 return; 1491 return;
1470 if (conf_write(QFile::encodeName(s))) 1492 if (conf_write(QFile::encodeName(s)))
@@ -1633,7 +1655,7 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
1633 1655
1634void ConfigMainWindow::showIntro(void) 1656void ConfigMainWindow::showIntro(void)
1635{ 1657{
1636 static const QString str = _("Welcome to the qconf graphical kernel configuration tool for Linux.\n\n" 1658 static const QString str = _("Welcome to the qconf graphical configuration tool.\n\n"
1637 "For each option, a blank box indicates the feature is disabled, a check\n" 1659 "For each option, a blank box indicates the feature is disabled, a check\n"
1638 "indicates it is enabled, and a dot indicates that it is to be compiled\n" 1660 "indicates it is enabled, and a dot indicates that it is to be compiled\n"
1639 "as a module. Clicking on the box will cycle through the three states.\n\n" 1661 "as a module. Clicking on the box will cycle through the three states.\n\n"
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 636a74b23bf9..91677d900dbd 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -3,26 +3,25 @@
3 * Released under the terms of the GNU GPL v2.0. 3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#if QT_VERSION < 0x040000
6#include <qlistview.h> 7#include <qlistview.h>
7#if QT_VERSION >= 300
8#include <qsettings.h>
9#else 8#else
10class QSettings { 9#include <q3listview.h>
11public: 10#endif
12 void beginGroup(const QString& group) { } 11#include <qsettings.h>
13 void endGroup(void) { } 12
14 bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const 13#if QT_VERSION < 0x040000
15 { if (ok) *ok = FALSE; return def; } 14#define Q3ValueList QValueList
16 int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const 15#define Q3PopupMenu QPopupMenu
17 { if (ok) *ok = FALSE; return def; } 16#define Q3ListView QListView
18 QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const 17#define Q3ListViewItem QListViewItem
19 { if (ok) *ok = FALSE; return def; } 18#define Q3VBox QVBox
20 QStringList readListEntry(const QString& key, bool* ok = 0) const 19#define Q3TextBrowser QTextBrowser
21 { if (ok) *ok = FALSE; return QStringList(); } 20#define Q3MainWindow QMainWindow
22 template <class t> 21#define Q3Action QAction
23 bool writeEntry(const QString& key, t value) 22#define Q3ToolBar QToolBar
24 { return TRUE; } 23#define Q3ListViewItemIterator QListViewItemIterator
25}; 24#define Q3FileDialog QFileDialog
26#endif 25#endif
27 26
28class ConfigView; 27class ConfigView;
@@ -31,11 +30,10 @@ class ConfigItem;
31class ConfigLineEdit; 30class ConfigLineEdit;
32class ConfigMainWindow; 31class ConfigMainWindow;
33 32
34
35class ConfigSettings : public QSettings { 33class ConfigSettings : public QSettings {
36public: 34public:
37 QValueList<int> readSizes(const QString& key, bool *ok); 35 Q3ValueList<int> readSizes(const QString& key, bool *ok);
38 bool writeSizes(const QString& key, const QValueList<int>& value); 36 bool writeSizes(const QString& key, const Q3ValueList<int>& value);
39}; 37};
40 38
41enum colIdx { 39enum colIdx {
@@ -48,9 +46,9 @@ enum optionMode {
48 normalOpt = 0, allOpt, promptOpt 46 normalOpt = 0, allOpt, promptOpt
49}; 47};
50 48
51class ConfigList : public QListView { 49class ConfigList : public Q3ListView {
52 Q_OBJECT 50 Q_OBJECT
53 typedef class QListView Parent; 51 typedef class Q3ListView Parent;
54public: 52public:
55 ConfigList(ConfigView* p, const char *name = 0); 53 ConfigList(ConfigView* p, const char *name = 0);
56 void reinit(void); 54 void reinit(void);
@@ -135,17 +133,17 @@ public:
135 struct menu *rootEntry; 133 struct menu *rootEntry;
136 QColorGroup disabledColorGroup; 134 QColorGroup disabledColorGroup;
137 QColorGroup inactivedColorGroup; 135 QColorGroup inactivedColorGroup;
138 QPopupMenu* headerPopup; 136 Q3PopupMenu* headerPopup;
139 137
140private: 138private:
141 int colMap[colNr]; 139 int colMap[colNr];
142 int colRevMap[colNr]; 140 int colRevMap[colNr];
143}; 141};
144 142
145class ConfigItem : public QListViewItem { 143class ConfigItem : public Q3ListViewItem {
146 typedef class QListViewItem Parent; 144 typedef class Q3ListViewItem Parent;
147public: 145public:
148 ConfigItem(QListView *parent, ConfigItem *after, struct menu *m, bool v) 146 ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v)
149 : Parent(parent, after), menu(m), visible(v), goParent(false) 147 : Parent(parent, after), menu(m), visible(v), goParent(false)
150 { 148 {
151 init(); 149 init();
@@ -155,16 +153,14 @@ public:
155 { 153 {
156 init(); 154 init();
157 } 155 }
158 ConfigItem(QListView *parent, ConfigItem *after, bool v) 156 ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
159 : Parent(parent, after), menu(0), visible(v), goParent(true) 157 : Parent(parent, after), menu(0), visible(v), goParent(true)
160 { 158 {
161 init(); 159 init();
162 } 160 }
163 ~ConfigItem(void); 161 ~ConfigItem(void);
164 void init(void); 162 void init(void);
165#if QT_VERSION >= 300
166 void okRename(int col); 163 void okRename(int col);
167#endif
168 void updateMenu(void); 164 void updateMenu(void);
169 void testUpdateMenu(bool v); 165 void testUpdateMenu(bool v);
170 ConfigList* listView() const 166 ConfigList* listView() const
@@ -219,9 +215,9 @@ public:
219 ConfigItem *item; 215 ConfigItem *item;
220}; 216};
221 217
222class ConfigView : public QVBox { 218class ConfigView : public Q3VBox {
223 Q_OBJECT 219 Q_OBJECT
224 typedef class QVBox Parent; 220 typedef class Q3VBox Parent;
225public: 221public:
226 ConfigView(QWidget* parent, const char *name = 0); 222 ConfigView(QWidget* parent, const char *name = 0);
227 ~ConfigView(void); 223 ~ConfigView(void);
@@ -252,9 +248,9 @@ public:
252 static QAction *showPromptAction; 248 static QAction *showPromptAction;
253}; 249};
254 250
255class ConfigInfoView : public QTextBrowser { 251class ConfigInfoView : public Q3TextBrowser {
256 Q_OBJECT 252 Q_OBJECT
257 typedef class QTextBrowser Parent; 253 typedef class Q3TextBrowser Parent;
258public: 254public:
259 ConfigInfoView(QWidget* parent, const char *name = 0); 255 ConfigInfoView(QWidget* parent, const char *name = 0);
260 bool showDebug(void) const { return _showDebug; } 256 bool showDebug(void) const { return _showDebug; }
@@ -274,11 +270,11 @@ protected:
274 QString debug_info(struct symbol *sym); 270 QString debug_info(struct symbol *sym);
275 static QString print_filter(const QString &str); 271 static QString print_filter(const QString &str);
276 static void expr_print_help(void *data, struct symbol *sym, const char *str); 272 static void expr_print_help(void *data, struct symbol *sym, const char *str);
277 QPopupMenu* createPopupMenu(const QPoint& pos); 273 Q3PopupMenu* createPopupMenu(const QPoint& pos);
278 void contentsContextMenuEvent(QContextMenuEvent *e); 274 void contentsContextMenuEvent(QContextMenuEvent *e);
279 275
280 struct symbol *sym; 276 struct symbol *sym;
281 struct menu *menu; 277 struct menu *_menu;
282 bool _showDebug; 278 bool _showDebug;
283}; 279};
284 280
@@ -302,10 +298,10 @@ protected:
302 struct symbol **result; 298 struct symbol **result;
303}; 299};
304 300
305class ConfigMainWindow : public QMainWindow { 301class ConfigMainWindow : public Q3MainWindow {
306 Q_OBJECT 302 Q_OBJECT
307 303
308 static QAction *saveAction; 304 static Q3Action *saveAction;
309 static void conf_changed(void); 305 static void conf_changed(void);
310public: 306public:
311 ConfigMainWindow(void); 307 ConfigMainWindow(void);
@@ -334,8 +330,8 @@ protected:
334 ConfigView *configView; 330 ConfigView *configView;
335 ConfigList *configList; 331 ConfigList *configList;
336 ConfigInfoView *helpText; 332 ConfigInfoView *helpText;
337 QToolBar *toolBar; 333 Q3ToolBar *toolBar;
338 QAction *backAction; 334 Q3Action *backAction;
339 QSplitter* split1; 335 QSplitter* split1;
340 QSplitter* split2; 336 QSplitter* split2;
341}; 337};
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 943712ca6c0a..c0efe102d655 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -840,6 +840,55 @@ struct symbol *sym_find(const char *name)
840 return symbol; 840 return symbol;
841} 841}
842 842
843/*
844 * Expand symbol's names embedded in the string given in argument. Symbols'
845 * name to be expanded shall be prefixed by a '$'. Unknown symbol expands to
846 * the empty string.
847 */
848const char *sym_expand_string_value(const char *in)
849{
850 const char *src;
851 char *res;
852 size_t reslen;
853
854 reslen = strlen(in) + 1;
855 res = malloc(reslen);
856 res[0] = '\0';
857
858 while ((src = strchr(in, '$'))) {
859 char *p, name[SYMBOL_MAXLENGTH];
860 const char *symval = "";
861 struct symbol *sym;
862 size_t newlen;
863
864 strncat(res, in, src - in);
865 src++;
866
867 p = name;
868 while (isalnum(*src) || *src == '_')
869 *p++ = *src++;
870 *p = '\0';
871
872 sym = sym_find(name);
873 if (sym != NULL) {
874 sym_calc_value(sym);
875 symval = sym_get_string_value(sym);
876 }
877
878 newlen = strlen(res) + strlen(symval) + strlen(src);
879 if (newlen > reslen) {
880 reslen = newlen;
881 res = realloc(res, reslen);
882 }
883
884 strcat(res, symval);
885 in = src;
886 }
887 strcat(res, in);
888
889 return res;
890}
891
843struct symbol **sym_re_search(const char *pattern) 892struct symbol **sym_re_search(const char *pattern)
844{ 893{
845 struct symbol *sym, **sym_arr = NULL; 894 struct symbol *sym, **sym_arr = NULL;
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index 78b5c04e736b..6330cc871a47 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -12,15 +12,18 @@
12struct file *file_lookup(const char *name) 12struct file *file_lookup(const char *name)
13{ 13{
14 struct file *file; 14 struct file *file;
15 const char *file_name = sym_expand_string_value(name);
15 16
16 for (file = file_list; file; file = file->next) { 17 for (file = file_list; file; file = file->next) {
17 if (!strcmp(name, file->name)) 18 if (!strcmp(name, file->name)) {
19 free((void *)file_name);
18 return file; 20 return file;
21 }
19 } 22 }
20 23
21 file = malloc(sizeof(*file)); 24 file = malloc(sizeof(*file));
22 memset(file, 0, sizeof(*file)); 25 memset(file, 0, sizeof(*file));
23 file->name = strdup(name); 26 file->name = file_name;
24 file->next = file_list; 27 file->next = file_list;
25 file_list = file; 28 file_list = file;
26 return file; 29 return file;
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index d8f7236cb0a3..3dbaec185cc4 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -304,9 +304,10 @@ void zconf_nextfile(const char *name)
304 memset(buf, 0, sizeof(*buf)); 304 memset(buf, 0, sizeof(*buf));
305 305
306 current_buf->state = YY_CURRENT_BUFFER; 306 current_buf->state = YY_CURRENT_BUFFER;
307 yyin = zconf_fopen(name); 307 yyin = zconf_fopen(file->name);
308 if (!yyin) { 308 if (!yyin) {
309 printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name); 309 printf("%s:%d: can't open file \"%s\"\n",
310 zconf_curname(), zconf_lineno(), file->name);
310 exit(1); 311 exit(1);
311 } 312 }
312 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); 313 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
@@ -353,7 +354,7 @@ int zconf_lineno(void)
353 return current_pos.lineno; 354 return current_pos.lineno;
354} 355}
355 356
356char *zconf_curname(void) 357const char *zconf_curname(void)
357{ 358{
358 return current_pos.file ? current_pos.file->name : "<none>"; 359 return current_pos.file ? current_pos.file->name : "<none>";
359} 360}
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped
index 32a9eefd842c..699d4b265186 100644
--- a/scripts/kconfig/zconf.tab.c_shipped
+++ b/scripts/kconfig/zconf.tab.c_shipped
@@ -417,18 +417,18 @@ union yyalloc
417#endif 417#endif
418 418
419/* YYFINAL -- State number of the termination state. */ 419/* YYFINAL -- State number of the termination state. */
420#define YYFINAL 3 420#define YYFINAL 11
421/* YYLAST -- Last index in YYTABLE. */ 421/* YYLAST -- Last index in YYTABLE. */
422#define YYLAST 259 422#define YYLAST 277
423 423
424/* YYNTOKENS -- Number of terminals. */ 424/* YYNTOKENS -- Number of terminals. */
425#define YYNTOKENS 35 425#define YYNTOKENS 35
426/* YYNNTS -- Number of nonterminals. */ 426/* YYNNTS -- Number of nonterminals. */
427#define YYNNTS 46 427#define YYNNTS 48
428/* YYNRULES -- Number of rules. */ 428/* YYNRULES -- Number of rules. */
429#define YYNRULES 110 429#define YYNRULES 113
430/* YYNRULES -- Number of states. */ 430/* YYNRULES -- Number of states. */
431#define YYNSTATES 180 431#define YYNSTATES 185
432 432
433/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 433/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
434#define YYUNDEFTOK 2 434#define YYUNDEFTOK 2
@@ -476,73 +476,74 @@ static const yytype_uint8 yytranslate[] =
476 YYRHS. */ 476 YYRHS. */
477static const yytype_uint16 yyprhs[] = 477static const yytype_uint16 yyprhs[] =
478{ 478{
479 0, 0, 3, 5, 6, 9, 12, 15, 20, 23, 479 0, 0, 3, 6, 8, 11, 13, 14, 17, 20,
480 28, 33, 37, 39, 41, 43, 45, 47, 49, 51, 480 23, 26, 31, 36, 40, 42, 44, 46, 48, 50,
481 53, 55, 57, 59, 61, 63, 67, 70, 74, 77, 481 52, 54, 56, 58, 60, 62, 64, 66, 70, 73,
482 81, 84, 85, 88, 91, 94, 97, 100, 103, 107, 482 77, 80, 84, 87, 88, 91, 94, 97, 100, 103,
483 112, 117, 122, 128, 132, 133, 137, 138, 141, 145, 483 106, 110, 115, 120, 125, 131, 135, 136, 140, 141,
484 148, 150, 154, 155, 158, 161, 164, 167, 170, 175, 484 144, 148, 151, 153, 157, 158, 161, 164, 167, 170,
485 179, 182, 187, 188, 191, 195, 197, 201, 202, 205, 485 173, 178, 182, 185, 190, 191, 194, 198, 200, 204,
486 208, 211, 215, 218, 220, 224, 225, 228, 231, 234, 486 205, 208, 211, 214, 218, 222, 225, 227, 231, 232,
487 238, 242, 245, 248, 251, 252, 255, 258, 261, 266, 487 235, 238, 241, 245, 249, 252, 255, 258, 259, 262,
488 267, 270, 272, 274, 277, 280, 283, 285, 288, 289, 488 265, 268, 273, 274, 277, 279, 281, 284, 287, 290,
489 292, 294, 298, 302, 306, 309, 313, 317, 319, 321, 489 292, 295, 296, 299, 301, 305, 309, 313, 316, 320,
490 322 490 324, 326, 328, 329
491}; 491};
492 492
493/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 493/* YYRHS -- A `-1'-separated list of the rules' RHS. */
494static const yytype_int8 yyrhs[] = 494static const yytype_int8 yyrhs[] =
495{ 495{
496 36, 0, -1, 37, -1, -1, 37, 39, -1, 37, 496 36, 0, -1, 78, 37, -1, 37, -1, 62, 38,
497 53, -1, 37, 64, -1, 37, 3, 74, 76, -1, 497 -1, 38, -1, -1, 38, 40, -1, 38, 54, -1,
498 37, 75, -1, 37, 25, 1, 30, -1, 37, 38, 498 38, 66, -1, 38, 77, -1, 38, 25, 1, 30,
499 1, 30, -1, 37, 1, 30, -1, 16, -1, 18, 499 -1, 38, 39, 1, 30, -1, 38, 1, 30, -1,
500 -1, 19, -1, 21, -1, 17, -1, 22, -1, 20, 500 16, -1, 18, -1, 19, -1, 21, -1, 17, -1,
501 -1, 30, -1, 59, -1, 68, -1, 42, -1, 44, 501 22, -1, 20, -1, 30, -1, 60, -1, 70, -1,
502 -1, 66, -1, 25, 1, 30, -1, 1, 30, -1, 502 43, -1, 45, -1, 68, -1, 25, 1, 30, -1,
503 10, 25, 30, -1, 41, 45, -1, 11, 25, 30, 503 1, 30, -1, 10, 25, 30, -1, 42, 46, -1,
504 -1, 43, 45, -1, -1, 45, 46, -1, 45, 47, 504 11, 25, 30, -1, 44, 46, -1, -1, 46, 47,
505 -1, 45, 72, -1, 45, 70, -1, 45, 40, -1, 505 -1, 46, 48, -1, 46, 74, -1, 46, 72, -1,
506 45, 30, -1, 19, 73, 30, -1, 18, 74, 77, 506 46, 41, -1, 46, 30, -1, 19, 75, 30, -1,
507 30, -1, 20, 78, 77, 30, -1, 21, 25, 77, 507 18, 76, 79, 30, -1, 20, 80, 79, 30, -1,
508 30, -1, 22, 79, 79, 77, 30, -1, 23, 48, 508 21, 25, 79, 30, -1, 22, 81, 81, 79, 30,
509 30, -1, -1, 48, 25, 49, -1, -1, 33, 74, 509 -1, 23, 49, 30, -1, -1, 49, 25, 50, -1,
510 -1, 7, 80, 30, -1, 50, 54, -1, 75, -1, 510 -1, 33, 76, -1, 7, 82, 30, -1, 51, 55,
511 51, 56, 52, -1, -1, 54, 55, -1, 54, 72, 511 -1, 77, -1, 52, 57, 53, -1, -1, 55, 56,
512 -1, 54, 70, -1, 54, 30, -1, 54, 40, -1, 512 -1, 55, 74, -1, 55, 72, -1, 55, 30, -1,
513 18, 74, 77, 30, -1, 19, 73, 30, -1, 17, 513 55, 41, -1, 18, 76, 79, 30, -1, 19, 75,
514 30, -1, 20, 25, 77, 30, -1, -1, 56, 39, 514 30, -1, 17, 30, -1, 20, 25, 79, 30, -1,
515 -1, 14, 78, 76, -1, 75, -1, 57, 60, 58, 515 -1, 57, 40, -1, 14, 80, 78, -1, 77, -1,
516 -1, -1, 60, 39, -1, 60, 64, -1, 60, 53, 516 58, 61, 59, -1, -1, 61, 40, -1, 61, 66,
517 -1, 4, 74, 30, -1, 61, 71, -1, 75, -1, 517 -1, 61, 54, -1, 3, 76, 78, -1, 4, 76,
518 62, 65, 63, -1, -1, 65, 39, -1, 65, 64, 518 30, -1, 63, 73, -1, 77, -1, 64, 67, 65,
519 -1, 65, 53, -1, 6, 74, 30, -1, 9, 74, 519 -1, -1, 67, 40, -1, 67, 66, -1, 67, 54,
520 30, -1, 67, 71, -1, 12, 30, -1, 69, 13, 520 -1, 6, 76, 30, -1, 9, 76, 30, -1, 69,
521 -1, -1, 71, 72, -1, 71, 30, -1, 71, 40, 521 73, -1, 12, 30, -1, 71, 13, -1, -1, 73,
522 -1, 16, 24, 78, 30, -1, -1, 74, 77, -1, 522 74, -1, 73, 30, -1, 73, 41, -1, 16, 24,
523 25, -1, 26, -1, 5, 30, -1, 8, 30, -1, 523 80, 30, -1, -1, 76, 79, -1, 25, -1, 26,
524 15, 30, -1, 30, -1, 76, 30, -1, -1, 14, 524 -1, 5, 30, -1, 8, 30, -1, 15, 30, -1,
525 78, -1, 79, -1, 79, 33, 79, -1, 79, 27, 525 30, -1, 78, 30, -1, -1, 14, 80, -1, 81,
526 79, -1, 29, 78, 28, -1, 34, 78, -1, 78, 526 -1, 81, 33, 81, -1, 81, 27, 81, -1, 29,
527 31, 78, -1, 78, 32, 78, -1, 25, -1, 26, 527 80, 28, -1, 34, 80, -1, 80, 31, 80, -1,
528 -1, -1, 25, -1 528 80, 32, 80, -1, 25, -1, 26, -1, -1, 25,
529 -1
529}; 530};
530 531
531/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 532/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
532static const yytype_uint16 yyrline[] = 533static const yytype_uint16 yyrline[] =
533{ 534{
534 0, 107, 107, 109, 111, 112, 113, 114, 115, 116, 535 0, 107, 107, 107, 109, 109, 111, 113, 114, 115,
535 117, 121, 125, 125, 125, 125, 125, 125, 125, 129, 536 116, 117, 118, 122, 126, 126, 126, 126, 126, 126,
536 130, 131, 132, 133, 134, 138, 139, 145, 153, 159, 537 126, 130, 131, 132, 133, 134, 135, 139, 140, 146,
537 167, 177, 179, 180, 181, 182, 183, 184, 187, 195, 538 154, 160, 168, 178, 180, 181, 182, 183, 184, 185,
538 201, 211, 217, 223, 226, 228, 239, 240, 245, 254, 539 188, 196, 202, 212, 218, 224, 227, 229, 240, 241,
539 259, 267, 270, 272, 273, 274, 275, 276, 279, 285, 540 246, 255, 260, 268, 271, 273, 274, 275, 276, 277,
540 296, 302, 312, 314, 319, 327, 335, 338, 340, 341, 541 280, 286, 297, 303, 313, 315, 320, 328, 336, 339,
541 342, 347, 354, 359, 367, 370, 372, 373, 374, 377, 542 341, 342, 343, 348, 355, 362, 367, 375, 378, 380,
542 385, 392, 399, 405, 412, 414, 415, 416, 419, 427, 543 381, 382, 385, 393, 400, 407, 413, 420, 422, 423,
543 429, 434, 435, 438, 439, 440, 444, 445, 448, 449, 544 424, 427, 435, 437, 442, 443, 446, 447, 448, 452,
544 452, 453, 454, 455, 456, 457, 458, 461, 462, 465, 545 453, 456, 457, 460, 461, 462, 463, 464, 465, 466,
545 466 546 469, 470, 473, 474
546}; 547};
547#endif 548#endif
548 549
@@ -557,17 +558,17 @@ static const char *const yytname[] =
557 "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE", 558 "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE",
558 "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", 559 "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL",
559 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL", 560 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL",
560 "T_NOT", "$accept", "input", "stmt_list", "option_name", "common_stmt", 561 "T_NOT", "$accept", "input", "start", "stmt_list", "option_name",
561 "option_error", "config_entry_start", "config_stmt", 562 "common_stmt", "option_error", "config_entry_start", "config_stmt",
562 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list", 563 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
563 "config_option", "symbol_option", "symbol_option_list", 564 "config_option", "symbol_option", "symbol_option_list",
564 "symbol_option_arg", "choice", "choice_entry", "choice_end", 565 "symbol_option_arg", "choice", "choice_entry", "choice_end",
565 "choice_stmt", "choice_option_list", "choice_option", "choice_block", 566 "choice_stmt", "choice_option_list", "choice_option", "choice_block",
566 "if_entry", "if_end", "if_stmt", "if_block", "menu", "menu_entry", 567 "if_entry", "if_end", "if_stmt", "if_block", "mainmenu_stmt", "menu",
567 "menu_end", "menu_stmt", "menu_block", "source_stmt", "comment", 568 "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt",
568 "comment_stmt", "help_start", "help", "depends_list", "depends", 569 "comment", "comment_stmt", "help_start", "help", "depends_list",
569 "prompt_stmt_opt", "prompt", "end", "nl", "if_expr", "expr", "symbol", 570 "depends", "prompt_stmt_opt", "prompt", "end", "nl", "if_expr", "expr",
570 "word_opt", 0 571 "symbol", "word_opt", 0
571}; 572};
572#endif 573#endif
573 574
@@ -586,35 +587,35 @@ static const yytype_uint16 yytoknum[] =
586/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 587/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
587static const yytype_uint8 yyr1[] = 588static const yytype_uint8 yyr1[] =
588{ 589{
589 0, 35, 36, 37, 37, 37, 37, 37, 37, 37, 590 0, 35, 36, 36, 37, 37, 38, 38, 38, 38,
590 37, 37, 38, 38, 38, 38, 38, 38, 38, 39, 591 38, 38, 38, 38, 39, 39, 39, 39, 39, 39,
591 39, 39, 39, 39, 39, 40, 40, 41, 42, 43, 592 39, 40, 40, 40, 40, 40, 40, 41, 41, 42,
592 44, 45, 45, 45, 45, 45, 45, 45, 46, 46, 593 43, 44, 45, 46, 46, 46, 46, 46, 46, 46,
593 46, 46, 46, 47, 48, 48, 49, 49, 50, 51, 594 47, 47, 47, 47, 47, 48, 49, 49, 50, 50,
594 52, 53, 54, 54, 54, 54, 54, 54, 55, 55, 595 51, 52, 53, 54, 55, 55, 55, 55, 55, 55,
595 55, 55, 56, 56, 57, 58, 59, 60, 60, 60, 596 56, 56, 56, 56, 57, 57, 58, 59, 60, 61,
596 60, 61, 62, 63, 64, 65, 65, 65, 65, 66, 597 61, 61, 61, 62, 63, 64, 65, 66, 67, 67,
597 67, 68, 69, 70, 71, 71, 71, 71, 72, 73, 598 67, 67, 68, 69, 70, 71, 72, 73, 73, 73,
598 73, 74, 74, 75, 75, 75, 76, 76, 77, 77, 599 73, 74, 75, 75, 76, 76, 77, 77, 77, 78,
599 78, 78, 78, 78, 78, 78, 78, 79, 79, 80, 600 78, 79, 79, 80, 80, 80, 80, 80, 80, 80,
600 80 601 81, 81, 82, 82
601}; 602};
602 603
603/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 604/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
604static const yytype_uint8 yyr2[] = 605static const yytype_uint8 yyr2[] =
605{ 606{
606 0, 2, 1, 0, 2, 2, 2, 4, 2, 4, 607 0, 2, 2, 1, 2, 1, 0, 2, 2, 2,
607 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 608 2, 4, 4, 3, 1, 1, 1, 1, 1, 1,
608 1, 1, 1, 1, 1, 3, 2, 3, 2, 3, 609 1, 1, 1, 1, 1, 1, 1, 3, 2, 3,
609 2, 0, 2, 2, 2, 2, 2, 2, 3, 4, 610 2, 3, 2, 0, 2, 2, 2, 2, 2, 2,
610 4, 4, 5, 3, 0, 3, 0, 2, 3, 2, 611 3, 4, 4, 4, 5, 3, 0, 3, 0, 2,
611 1, 3, 0, 2, 2, 2, 2, 2, 4, 3, 612 3, 2, 1, 3, 0, 2, 2, 2, 2, 2,
612 2, 4, 0, 2, 3, 1, 3, 0, 2, 2, 613 4, 3, 2, 4, 0, 2, 3, 1, 3, 0,
613 2, 3, 2, 1, 3, 0, 2, 2, 2, 3, 614 2, 2, 2, 3, 3, 2, 1, 3, 0, 2,
614 3, 2, 2, 2, 0, 2, 2, 2, 4, 0, 615 2, 2, 3, 3, 2, 2, 2, 0, 2, 2,
615 2, 1, 1, 2, 2, 2, 1, 2, 0, 2, 616 2, 4, 0, 2, 1, 1, 2, 2, 2, 1,
616 1, 3, 3, 3, 2, 3, 3, 1, 1, 0, 617 2, 0, 2, 1, 3, 3, 3, 2, 3, 3,
617 1 618 1, 1, 0, 1
618}; 619};
619 620
620/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 621/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -622,158 +623,165 @@ static const yytype_uint8 yyr2[] =
622 means the default is an error. */ 623 means the default is an error. */
623static const yytype_uint8 yydefact[] = 624static const yytype_uint8 yydefact[] =
624{ 625{
625 3, 0, 0, 1, 0, 0, 0, 0, 0, 109, 626 6, 0, 99, 0, 3, 0, 6, 6, 94, 95,
626 0, 0, 0, 0, 0, 0, 12, 16, 13, 14, 627 0, 1, 0, 0, 0, 0, 112, 0, 0, 0,
627 18, 15, 17, 0, 19, 0, 4, 31, 22, 31, 628 0, 0, 0, 14, 18, 15, 16, 20, 17, 19,
628 23, 52, 62, 5, 67, 20, 84, 75, 6, 24, 629 0, 21, 0, 7, 33, 24, 33, 25, 54, 64,
629 84, 21, 8, 11, 91, 92, 0, 0, 93, 0, 630 8, 69, 22, 87, 78, 9, 26, 87, 23, 10,
630 110, 0, 94, 0, 0, 0, 107, 108, 0, 0, 631 0, 100, 2, 73, 13, 0, 96, 0, 113, 0,
631 0, 100, 95, 0, 0, 0, 0, 0, 0, 0, 632 97, 0, 0, 0, 110, 111, 0, 0, 0, 103,
632 0, 0, 0, 96, 7, 71, 79, 48, 80, 27, 633 98, 0, 0, 0, 0, 0, 0, 0, 0, 0,
633 29, 0, 104, 0, 0, 64, 0, 0, 9, 10, 634 0, 74, 82, 50, 83, 29, 31, 0, 107, 0,
634 0, 0, 0, 0, 89, 0, 0, 0, 44, 0, 635 0, 66, 0, 0, 11, 12, 0, 0, 0, 0,
635 37, 36, 32, 33, 0, 35, 34, 0, 0, 89, 636 92, 0, 0, 0, 46, 0, 39, 38, 34, 35,
636 0, 56, 57, 53, 55, 54, 63, 51, 50, 68, 637 0, 37, 36, 0, 0, 92, 0, 58, 59, 55,
637 70, 66, 69, 65, 86, 87, 85, 76, 78, 74, 638 57, 56, 65, 53, 52, 70, 72, 68, 71, 67,
638 77, 73, 97, 103, 105, 106, 102, 101, 26, 82, 639 89, 90, 88, 79, 81, 77, 80, 76, 106, 108,
639 0, 98, 0, 98, 98, 98, 0, 0, 0, 83, 640 109, 105, 104, 28, 85, 0, 101, 0, 101, 101,
640 60, 98, 0, 98, 0, 0, 0, 38, 90, 0, 641 101, 0, 0, 0, 86, 62, 101, 0, 101, 0,
641 0, 98, 46, 43, 25, 0, 59, 0, 88, 99, 642 0, 0, 40, 93, 0, 0, 101, 48, 45, 27,
642 39, 40, 41, 0, 0, 45, 58, 61, 42, 47 643 0, 61, 0, 91, 102, 41, 42, 43, 0, 0,
644 47, 60, 63, 44, 49
643}; 645};
644 646
645/* YYDEFGOTO[NTERM-NUM]. */ 647/* YYDEFGOTO[NTERM-NUM]. */
646static const yytype_int16 yydefgoto[] = 648static const yytype_int16 yydefgoto[] =
647{ 649{
648 -1, 1, 2, 25, 26, 101, 27, 28, 29, 30, 650 -1, 3, 4, 5, 32, 33, 107, 34, 35, 36,
649 65, 102, 103, 147, 175, 31, 32, 117, 33, 67, 651 37, 73, 108, 109, 152, 180, 38, 39, 123, 40,
650 113, 68, 34, 121, 35, 69, 36, 37, 129, 38, 652 75, 119, 76, 41, 127, 42, 77, 6, 43, 44,
651 71, 39, 40, 41, 104, 105, 70, 106, 142, 143, 653 135, 45, 79, 46, 47, 48, 110, 111, 78, 112,
652 42, 74, 156, 60, 61, 51 654 147, 148, 49, 7, 161, 68, 69, 59
653}; 655};
654 656
655/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 657/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
656 STATE-NUM. */ 658 STATE-NUM. */
657#define YYPACT_NINF -80 659#define YYPACT_NINF -89
658static const yytype_int16 yypact[] = 660static const yytype_int16 yypact[] =
659{ 661{
660 -80, 2, 132, -80, -13, -1, -1, -2, -1, 9, 662 3, 4, -89, 20, -89, 100, -89, 7, -89, -89,
661 33, -1, 27, 40, -3, 38, -80, -80, -80, -80, 663 -8, -89, 17, 4, 28, 4, 37, 36, 4, 68,
662 -80, -80, -80, 71, -80, 77, -80, -80, -80, -80, 664 87, -18, 69, -89, -89, -89, -89, -89, -89, -89,
663 -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, 665 128, -89, 138, -89, -89, -89, -89, -89, -89, -89,
664 -80, -80, -80, -80, -80, -80, 57, 61, -80, 63, 666 -89, -89, -89, -89, -89, -89, -89, -89, -89, -89,
665 -80, 76, -80, 87, 101, 133, -80, -80, -3, -3, 667 127, -89, -89, 110, -89, 126, -89, 136, -89, 137,
666 195, -6, -80, 136, 149, 39, 104, 65, 150, 5, 668 -89, 147, 150, 152, -89, -89, -18, -18, 171, -14,
667 194, 5, 167, -80, 176, -80, -80, -80, -80, -80, 669 -89, 153, 157, 34, 67, 180, 233, 220, 207, 220,
668 -80, 68, -80, -3, -3, 176, 72, 72, -80, -80, 670 154, -89, -89, -89, -89, -89, -89, 0, -89, -18,
669 177, 187, 78, -1, -1, -3, 196, 72, -80, 222, 671 -18, 110, 44, 44, -89, -89, 163, 174, 182, 4,
670 -80, -80, -80, -80, 221, -80, -80, 205, -1, -1, 672 4, -18, 194, 44, -89, 219, -89, -89, -89, -89,
671 211, -80, -80, -80, -80, -80, -80, -80, -80, -80, 673 223, -89, -89, 203, 4, 4, 215, -89, -89, -89,
672 -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, 674 -89, -89, -89, -89, -89, -89, -89, -89, -89, -89,
673 -80, -80, -80, -80, 206, -80, -80, -80, -80, -80, 675 -89, -89, -89, -89, -89, -89, -89, -89, -89, 213,
674 -3, 223, 209, 223, 197, 223, 72, 7, 210, -80, 676 -89, -89, -89, -89, -89, -18, 232, 227, 232, -5,
675 -80, 223, 212, 223, 201, -3, 213, -80, -80, 214, 677 232, 44, 35, 234, -89, -89, 232, 235, 232, 224,
676 215, 223, 208, -80, -80, 216, -80, 217, -80, 113, 678 -18, 236, -89, -89, 237, 238, 232, 216, -89, -89,
677 -80, -80, -80, 218, -1, -80, -80, -80, -80, -80 679 240, -89, 241, -89, 71, -89, -89, -89, 242, 4,
680 -89, -89, -89, -89, -89
678}; 681};
679 682
680/* YYPGOTO[NTERM-NUM]. */ 683/* YYPGOTO[NTERM-NUM]. */
681static const yytype_int16 yypgoto[] = 684static const yytype_int16 yypgoto[] =
682{ 685{
683 -80, -80, -80, -80, 122, -34, -80, -80, -80, -80, 686 -89, -89, 255, 267, -89, 47, -57, -89, -89, -89,
684 220, -80, -80, -80, -80, -80, -80, -80, 59, -80, 687 -89, 239, -89, -89, -89, -89, -89, -89, -89, 130,
685 -80, -80, -80, -80, -80, -80, -80, -80, -80, 125, 688 -89, -89, -89, -89, -89, -89, -89, -89, -89, -89,
686 -80, -80, -80, -80, -80, 183, 219, 22, 142, -5, 689 -89, 181, -89, -89, -89, -89, -89, 199, 229, 16,
687 147, 192, 69, -54, -79, -80 690 162, -1, 74, -7, 103, -65, -88, -89
688}; 691};
689 692
690/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 693/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
691 positive, shift that token. If negative, reduce the rule which 694 positive, shift that token. If negative, reduce the rule which
692 number is the opposite. If zero, do what YYDEFACT says. 695 number is the opposite. If zero, do what YYDEFACT says.
693 If YYTABLE_NINF, syntax error. */ 696 If YYTABLE_NINF, syntax error. */
694#define YYTABLE_NINF -82 697#define YYTABLE_NINF -85
695static const yytype_int16 yytable[] = 698static const yytype_int16 yytable[] =
696{ 699{
697 46, 47, 3, 49, 81, 82, 53, 136, 137, 6, 700 10, 87, 88, 53, 141, 142, 1, 64, 65, 160,
698 7, 8, 9, 10, 11, 12, 13, 43, 146, 14, 701 1, 66, 55, 92, 57, 151, 67, 61, 118, 93,
699 15, 86, 56, 57, 44, 45, 58, 87, 48, 134, 702 11, 131, 2, 131, 139, 140, 89, 90, 138, 8,
700 135, 59, 162, 112, 50, 24, 125, 163, 125, -28, 703 9, 89, 90, 2, -30, 96, 149, 51, -30, -30,
701 90, 144, -28, -28, -28, -28, -28, -28, -28, -28, 704 -30, -30, -30, -30, -30, -30, 97, 54, -30, -30,
702 -28, 91, 54, -28, -28, 92, -28, 93, 94, 95, 705 98, -30, 99, 100, 101, 102, 103, 104, 56, 105,
703 96, 97, 98, 52, 99, 55, 90, 161, 62, 100, 706 167, 91, 58, 166, 106, 168, 60, -32, 96, 64,
704 -49, -49, 63, -49, -49, -49, -49, 91, 64, -49, 707 65, -32, -32, -32, -32, -32, -32, -32, -32, 97,
705 -49, 92, 107, 108, 109, 110, 154, 73, 141, 115, 708 159, -32, -32, 98, -32, 99, 100, 101, 102, 103,
706 99, 75, 126, 76, 126, 111, 133, 56, 57, 83, 709 104, 121, 105, 62, 132, 174, 132, 106, 146, 70,
707 84, 169, 140, 151, -30, 90, 77, -30, -30, -30, 710 -5, 12, 89, 90, 13, 14, 15, 16, 17, 18,
708 -30, -30, -30, -30, -30, -30, 91, 78, -30, -30, 711 19, 20, 63, 156, 21, 22, 23, 24, 25, 26,
709 92, -30, 93, 94, 95, 96, 97, 98, 120, 99, 712 27, 28, 29, 122, 125, 30, 133, -4, 12, 71,
710 128, 79, -2, 4, 100, 5, 6, 7, 8, 9, 713 31, 13, 14, 15, 16, 17, 18, 19, 20, 72,
711 10, 11, 12, 13, 83, 84, 14, 15, 16, 17, 714 51, 21, 22, 23, 24, 25, 26, 27, 28, 29,
712 18, 19, 20, 21, 22, 7, 8, 23, 10, 11, 715 124, 129, 30, 137, -84, 96, 81, 31, -84, -84,
713 12, 13, 24, 80, 14, 15, 88, -81, 90, 179, 716 -84, -84, -84, -84, -84, -84, 82, 83, -84, -84,
714 -81, -81, -81, -81, -81, -81, -81, -81, -81, 89, 717 98, -84, -84, -84, -84, -84, -84, 84, 184, 105,
715 24, -81, -81, 92, -81, -81, -81, -81, -81, -81, 718 85, 96, 86, 94, 130, -51, -51, 95, -51, -51,
716 116, 119, 99, 127, 122, 90, 130, 124, -72, -72, 719 -51, -51, 97, 143, -51, -51, 98, 113, 114, 115,
717 -72, -72, -72, -72, -72, -72, 132, 138, -72, -72, 720 116, 2, 89, 90, 144, 105, 145, 126, 96, 134,
718 92, 155, 158, 159, 160, 118, 123, 139, 131, 99, 721 117, -75, -75, -75, -75, -75, -75, -75, -75, 150,
719 165, 145, 167, 148, 124, 73, 83, 84, 83, 84, 722 153, -75, -75, 98, 13, 14, 15, 16, 17, 18,
720 173, 168, 83, 84, 149, 150, 153, 155, 84, 157, 723 19, 20, 105, 155, 21, 22, 154, 130, 14, 15,
721 164, 174, 166, 170, 171, 172, 176, 177, 178, 66, 724 158, 17, 18, 19, 20, 90, 160, 21, 22, 179,
722 114, 152, 85, 0, 0, 0, 0, 0, 0, 72 725 31, 163, 164, 165, 173, 89, 90, 162, 128, 170,
726 136, 172, 52, 31, 169, 171, 175, 176, 177, 178,
727 181, 182, 183, 50, 120, 74, 80, 157
723}; 728};
724 729
725static const yytype_int16 yycheck[] = 730static const yytype_uint8 yycheck[] =
726{ 731{
727 5, 6, 0, 8, 58, 59, 11, 86, 87, 4, 732 1, 66, 67, 10, 92, 93, 3, 25, 26, 14,
728 5, 6, 7, 8, 9, 10, 11, 30, 97, 14, 733 3, 29, 13, 27, 15, 103, 34, 18, 75, 33,
729 15, 27, 25, 26, 25, 26, 29, 33, 30, 83, 734 0, 78, 30, 80, 89, 90, 31, 32, 28, 25,
730 84, 34, 25, 67, 25, 30, 70, 30, 72, 0, 735 26, 31, 32, 30, 0, 1, 101, 30, 4, 5,
731 1, 95, 3, 4, 5, 6, 7, 8, 9, 10,
732 11, 12, 25, 14, 15, 16, 17, 18, 19, 20,
733 21, 22, 23, 30, 25, 25, 1, 146, 30, 30,
734 5, 6, 1, 8, 9, 10, 11, 12, 1, 14,
735 15, 16, 17, 18, 19, 20, 140, 30, 93, 67,
736 25, 30, 70, 30, 72, 30, 28, 25, 26, 31,
737 32, 155, 24, 108, 0, 1, 30, 3, 4, 5,
738 6, 7, 8, 9, 10, 11, 12, 30, 14, 15, 736 6, 7, 8, 9, 10, 11, 12, 30, 14, 15,
739 16, 17, 18, 19, 20, 21, 22, 23, 69, 25, 737 16, 17, 18, 19, 20, 21, 22, 23, 30, 25,
740 71, 30, 0, 1, 30, 3, 4, 5, 6, 7, 738 25, 68, 25, 151, 30, 30, 30, 0, 1, 25,
741 8, 9, 10, 11, 31, 32, 14, 15, 16, 17, 739 26, 4, 5, 6, 7, 8, 9, 10, 11, 12,
742 18, 19, 20, 21, 22, 5, 6, 25, 8, 9, 740 145, 14, 15, 16, 17, 18, 19, 20, 21, 22,
743 10, 11, 30, 30, 14, 15, 30, 0, 1, 174, 741 23, 75, 25, 25, 78, 160, 80, 30, 99, 30,
744 3, 4, 5, 6, 7, 8, 9, 10, 11, 30, 742 0, 1, 31, 32, 4, 5, 6, 7, 8, 9,
743 10, 11, 25, 114, 14, 15, 16, 17, 18, 19,
744 20, 21, 22, 76, 77, 25, 79, 0, 1, 1,
745 30, 4, 5, 6, 7, 8, 9, 10, 11, 1,
745 30, 14, 15, 16, 17, 18, 19, 20, 21, 22, 746 30, 14, 15, 16, 17, 18, 19, 20, 21, 22,
746 68, 69, 25, 71, 69, 1, 71, 30, 4, 5, 747 76, 77, 25, 79, 0, 1, 30, 30, 4, 5,
747 6, 7, 8, 9, 10, 11, 30, 30, 14, 15, 748 6, 7, 8, 9, 10, 11, 30, 30, 14, 15,
748 16, 14, 143, 144, 145, 68, 69, 30, 71, 25, 749 16, 17, 18, 19, 20, 21, 22, 30, 179, 25,
749 151, 25, 153, 1, 30, 30, 31, 32, 31, 32, 750 30, 1, 30, 30, 30, 5, 6, 30, 8, 9,
750 161, 30, 31, 32, 13, 30, 25, 14, 32, 30, 751 10, 11, 12, 30, 14, 15, 16, 17, 18, 19,
751 30, 33, 30, 30, 30, 30, 30, 30, 30, 29, 752 20, 30, 31, 32, 30, 25, 24, 77, 1, 79,
752 67, 109, 60, -1, -1, -1, -1, -1, -1, 40 753 30, 4, 5, 6, 7, 8, 9, 10, 11, 25,
754 1, 14, 15, 16, 4, 5, 6, 7, 8, 9,
755 10, 11, 25, 30, 14, 15, 13, 30, 5, 6,
756 25, 8, 9, 10, 11, 32, 14, 14, 15, 33,
757 30, 148, 149, 150, 30, 31, 32, 30, 77, 156,
758 79, 158, 7, 30, 30, 30, 30, 30, 30, 166,
759 30, 30, 30, 6, 75, 36, 47, 115
753}; 760};
754 761
755/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 762/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
756 symbol of state STATE-NUM. */ 763 symbol of state STATE-NUM. */
757static const yytype_uint8 yystos[] = 764static const yytype_uint8 yystos[] =
758{ 765{
759 0, 36, 37, 0, 1, 3, 4, 5, 6, 7, 766 0, 3, 30, 36, 37, 38, 62, 78, 25, 26,
760 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 767 76, 0, 1, 4, 5, 6, 7, 8, 9, 10,
761 20, 21, 22, 25, 30, 38, 39, 41, 42, 43, 768 11, 14, 15, 16, 17, 18, 19, 20, 21, 22,
762 44, 50, 51, 53, 57, 59, 61, 62, 64, 66, 769 25, 30, 39, 40, 42, 43, 44, 45, 51, 52,
763 67, 68, 75, 30, 25, 26, 74, 74, 30, 74, 770 54, 58, 60, 63, 64, 66, 68, 69, 70, 77,
764 25, 80, 30, 74, 25, 25, 25, 26, 29, 34, 771 38, 30, 37, 78, 30, 76, 30, 76, 25, 82,
765 78, 79, 30, 1, 1, 45, 45, 54, 56, 60, 772 30, 76, 25, 25, 25, 26, 29, 34, 80, 81,
766 71, 65, 71, 30, 76, 30, 30, 30, 30, 30, 773 30, 1, 1, 46, 46, 55, 57, 61, 73, 67,
767 30, 78, 78, 31, 32, 76, 27, 33, 30, 30, 774 73, 30, 30, 30, 30, 30, 30, 80, 80, 31,
768 1, 12, 16, 18, 19, 20, 21, 22, 23, 25, 775 32, 78, 27, 33, 30, 30, 1, 12, 16, 18,
769 30, 40, 46, 47, 69, 70, 72, 17, 18, 19, 776 19, 20, 21, 22, 23, 25, 30, 41, 47, 48,
770 20, 30, 40, 55, 70, 72, 39, 52, 75, 39, 777 71, 72, 74, 17, 18, 19, 20, 30, 41, 56,
771 53, 58, 64, 75, 30, 40, 72, 39, 53, 63, 778 72, 74, 40, 53, 77, 40, 54, 59, 66, 77,
772 64, 75, 30, 28, 78, 78, 79, 79, 30, 30, 779 30, 41, 74, 40, 54, 65, 66, 77, 28, 80,
773 24, 74, 73, 74, 78, 25, 79, 48, 1, 13, 780 80, 81, 81, 30, 30, 24, 76, 75, 76, 80,
774 30, 74, 73, 25, 78, 14, 77, 30, 77, 77, 781 25, 81, 49, 1, 13, 30, 76, 75, 25, 80,
775 77, 79, 25, 30, 30, 77, 30, 77, 30, 78, 782 14, 79, 30, 79, 79, 79, 81, 25, 30, 30,
776 30, 30, 30, 77, 33, 49, 30, 30, 30, 74 783 79, 30, 79, 30, 80, 30, 30, 30, 79, 33,
784 50, 30, 30, 30, 76
777}; 785};
778 786
779#define yyerrok (yyerrstatus = 0) 787#define yyerrok (yyerrstatus = 0)
@@ -1284,7 +1292,7 @@ yydestruct (yymsg, yytype, yyvaluep)
1284 1292
1285 switch (yytype) 1293 switch (yytype)
1286 { 1294 {
1287 case 51: /* "choice_entry" */ 1295 case 52: /* "choice_entry" */
1288 1296
1289 { 1297 {
1290 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 1298 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
@@ -1294,7 +1302,7 @@ yydestruct (yymsg, yytype, yyvaluep)
1294}; 1302};
1295 1303
1296 break; 1304 break;
1297 case 57: /* "if_entry" */ 1305 case 58: /* "if_entry" */
1298 1306
1299 { 1307 {
1300 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 1308 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
@@ -1304,7 +1312,7 @@ yydestruct (yymsg, yytype, yyvaluep)
1304}; 1312};
1305 1313
1306 break; 1314 break;
1307 case 62: /* "menu_entry" */ 1315 case 64: /* "menu_entry" */
1308 1316
1309 { 1317 {
1310 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 1318 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
@@ -1614,39 +1622,39 @@ yyreduce:
1614 YY_REDUCE_PRINT (yyn); 1622 YY_REDUCE_PRINT (yyn);
1615 switch (yyn) 1623 switch (yyn)
1616 { 1624 {
1617 case 8: 1625 case 10:
1618 1626
1619 { zconf_error("unexpected end statement"); ;} 1627 { zconf_error("unexpected end statement"); ;}
1620 break; 1628 break;
1621 1629
1622 case 9: 1630 case 11:
1623 1631
1624 { zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); ;} 1632 { zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); ;}
1625 break; 1633 break;
1626 1634
1627 case 10: 1635 case 12:
1628 1636
1629 { 1637 {
1630 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name); 1638 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name);
1631;} 1639;}
1632 break; 1640 break;
1633 1641
1634 case 11: 1642 case 13:
1635 1643
1636 { zconf_error("invalid statement"); ;} 1644 { zconf_error("invalid statement"); ;}
1637 break; 1645 break;
1638 1646
1639 case 25: 1647 case 27:
1640 1648
1641 { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); ;} 1649 { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); ;}
1642 break; 1650 break;
1643 1651
1644 case 26: 1652 case 28:
1645 1653
1646 { zconf_error("invalid option"); ;} 1654 { zconf_error("invalid option"); ;}
1647 break; 1655 break;
1648 1656
1649 case 27: 1657 case 29:
1650 1658
1651 { 1659 {
1652 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0); 1660 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0);
@@ -1656,7 +1664,7 @@ yyreduce:
1656;} 1664;}
1657 break; 1665 break;
1658 1666
1659 case 28: 1667 case 30:
1660 1668
1661 { 1669 {
1662 menu_end_entry(); 1670 menu_end_entry();
@@ -1664,7 +1672,7 @@ yyreduce:
1664;} 1672;}
1665 break; 1673 break;
1666 1674
1667 case 29: 1675 case 31:
1668 1676
1669 { 1677 {
1670 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0); 1678 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0);
@@ -1674,7 +1682,7 @@ yyreduce:
1674;} 1682;}
1675 break; 1683 break;
1676 1684
1677 case 30: 1685 case 32:
1678 1686
1679 { 1687 {
1680 if (current_entry->prompt) 1688 if (current_entry->prompt)
@@ -1686,7 +1694,7 @@ yyreduce:
1686;} 1694;}
1687 break; 1695 break;
1688 1696
1689 case 38: 1697 case 40:
1690 1698
1691 { 1699 {
1692 menu_set_type((yyvsp[(1) - (3)].id)->stype); 1700 menu_set_type((yyvsp[(1) - (3)].id)->stype);
@@ -1696,7 +1704,7 @@ yyreduce:
1696;} 1704;}
1697 break; 1705 break;
1698 1706
1699 case 39: 1707 case 41:
1700 1708
1701 { 1709 {
1702 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr)); 1710 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
@@ -1704,7 +1712,7 @@ yyreduce:
1704;} 1712;}
1705 break; 1713 break;
1706 1714
1707 case 40: 1715 case 42:
1708 1716
1709 { 1717 {
1710 menu_add_expr(P_DEFAULT, (yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr)); 1718 menu_add_expr(P_DEFAULT, (yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr));
@@ -1716,7 +1724,7 @@ yyreduce:
1716;} 1724;}
1717 break; 1725 break;
1718 1726
1719 case 41: 1727 case 43:
1720 1728
1721 { 1729 {
1722 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr)); 1730 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr));
@@ -1724,7 +1732,7 @@ yyreduce:
1724;} 1732;}
1725 break; 1733 break;
1726 1734
1727 case 42: 1735 case 44:
1728 1736
1729 { 1737 {
1730 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr)); 1738 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr));
@@ -1732,7 +1740,7 @@ yyreduce:
1732;} 1740;}
1733 break; 1741 break;
1734 1742
1735 case 45: 1743 case 47:
1736 1744
1737 { 1745 {
1738 struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string))); 1746 struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string)));
@@ -1744,17 +1752,17 @@ yyreduce:
1744;} 1752;}
1745 break; 1753 break;
1746 1754
1747 case 46: 1755 case 48:
1748 1756
1749 { (yyval.string) = NULL; ;} 1757 { (yyval.string) = NULL; ;}
1750 break; 1758 break;
1751 1759
1752 case 47: 1760 case 49:
1753 1761
1754 { (yyval.string) = (yyvsp[(2) - (2)].string); ;} 1762 { (yyval.string) = (yyvsp[(2) - (2)].string); ;}
1755 break; 1763 break;
1756 1764
1757 case 48: 1765 case 50:
1758 1766
1759 { 1767 {
1760 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), SYMBOL_CHOICE); 1768 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), SYMBOL_CHOICE);
@@ -1765,14 +1773,14 @@ yyreduce:
1765;} 1773;}
1766 break; 1774 break;
1767 1775
1768 case 49: 1776 case 51:
1769 1777
1770 { 1778 {
1771 (yyval.menu) = menu_add_menu(); 1779 (yyval.menu) = menu_add_menu();
1772;} 1780;}
1773 break; 1781 break;
1774 1782
1775 case 50: 1783 case 52:
1776 1784
1777 { 1785 {
1778 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_CHOICE, T_ENDCHOICE)) { 1786 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_CHOICE, T_ENDCHOICE)) {
@@ -1782,7 +1790,7 @@ yyreduce:
1782;} 1790;}
1783 break; 1791 break;
1784 1792
1785 case 58: 1793 case 60:
1786 1794
1787 { 1795 {
1788 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr)); 1796 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
@@ -1790,7 +1798,7 @@ yyreduce:
1790;} 1798;}
1791 break; 1799 break;
1792 1800
1793 case 59: 1801 case 61:
1794 1802
1795 { 1803 {
1796 if ((yyvsp[(1) - (3)].id)->stype == S_BOOLEAN || (yyvsp[(1) - (3)].id)->stype == S_TRISTATE) { 1804 if ((yyvsp[(1) - (3)].id)->stype == S_BOOLEAN || (yyvsp[(1) - (3)].id)->stype == S_TRISTATE) {
@@ -1803,7 +1811,7 @@ yyreduce:
1803;} 1811;}
1804 break; 1812 break;
1805 1813
1806 case 60: 1814 case 62:
1807 1815
1808 { 1816 {
1809 current_entry->sym->flags |= SYMBOL_OPTIONAL; 1817 current_entry->sym->flags |= SYMBOL_OPTIONAL;
@@ -1811,7 +1819,7 @@ yyreduce:
1811;} 1819;}
1812 break; 1820 break;
1813 1821
1814 case 61: 1822 case 63:
1815 1823
1816 { 1824 {
1817 if ((yyvsp[(1) - (4)].id)->stype == S_UNKNOWN) { 1825 if ((yyvsp[(1) - (4)].id)->stype == S_UNKNOWN) {
@@ -1823,7 +1831,7 @@ yyreduce:
1823;} 1831;}
1824 break; 1832 break;
1825 1833
1826 case 64: 1834 case 66:
1827 1835
1828 { 1836 {
1829 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); 1837 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
@@ -1833,7 +1841,7 @@ yyreduce:
1833;} 1841;}
1834 break; 1842 break;
1835 1843
1836 case 65: 1844 case 67:
1837 1845
1838 { 1846 {
1839 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_IF, T_ENDIF)) { 1847 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_IF, T_ENDIF)) {
@@ -1843,7 +1851,14 @@ yyreduce:
1843;} 1851;}
1844 break; 1852 break;
1845 1853
1846 case 71: 1854 case 73:
1855
1856 {
1857 menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
1858;}
1859 break;
1860
1861 case 74:
1847 1862
1848 { 1863 {
1849 menu_add_entry(NULL); 1864 menu_add_entry(NULL);
@@ -1852,14 +1867,14 @@ yyreduce:
1852;} 1867;}
1853 break; 1868 break;
1854 1869
1855 case 72: 1870 case 75:
1856 1871
1857 { 1872 {
1858 (yyval.menu) = menu_add_menu(); 1873 (yyval.menu) = menu_add_menu();
1859;} 1874;}
1860 break; 1875 break;
1861 1876
1862 case 73: 1877 case 76:
1863 1878
1864 { 1879 {
1865 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_MENU, T_ENDMENU)) { 1880 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_MENU, T_ENDMENU)) {
@@ -1869,7 +1884,7 @@ yyreduce:
1869;} 1884;}
1870 break; 1885 break;
1871 1886
1872 case 79: 1887 case 82:
1873 1888
1874 { 1889 {
1875 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string)); 1890 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
@@ -1877,7 +1892,7 @@ yyreduce:
1877;} 1892;}
1878 break; 1893 break;
1879 1894
1880 case 80: 1895 case 83:
1881 1896
1882 { 1897 {
1883 menu_add_entry(NULL); 1898 menu_add_entry(NULL);
@@ -1886,14 +1901,14 @@ yyreduce:
1886;} 1901;}
1887 break; 1902 break;
1888 1903
1889 case 81: 1904 case 84:
1890 1905
1891 { 1906 {
1892 menu_end_entry(); 1907 menu_end_entry();
1893;} 1908;}
1894 break; 1909 break;
1895 1910
1896 case 82: 1911 case 85:
1897 1912
1898 { 1913 {
1899 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); 1914 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
@@ -1901,14 +1916,14 @@ yyreduce:
1901;} 1916;}
1902 break; 1917 break;
1903 1918
1904 case 83: 1919 case 86:
1905 1920
1906 { 1921 {
1907 current_entry->help = (yyvsp[(2) - (2)].string); 1922 current_entry->help = (yyvsp[(2) - (2)].string);
1908;} 1923;}
1909 break; 1924 break;
1910 1925
1911 case 88: 1926 case 91:
1912 1927
1913 { 1928 {
1914 menu_add_dep((yyvsp[(3) - (4)].expr)); 1929 menu_add_dep((yyvsp[(3) - (4)].expr));
@@ -1916,84 +1931,84 @@ yyreduce:
1916;} 1931;}
1917 break; 1932 break;
1918 1933
1919 case 90: 1934 case 93:
1920 1935
1921 { 1936 {
1922 menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr)); 1937 menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr));
1923;} 1938;}
1924 break; 1939 break;
1925 1940
1926 case 93: 1941 case 96:
1927 1942
1928 { (yyval.id) = (yyvsp[(1) - (2)].id); ;} 1943 { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
1929 break; 1944 break;
1930 1945
1931 case 94: 1946 case 97:
1932 1947
1933 { (yyval.id) = (yyvsp[(1) - (2)].id); ;} 1948 { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
1934 break; 1949 break;
1935 1950
1936 case 95: 1951 case 98:
1937 1952
1938 { (yyval.id) = (yyvsp[(1) - (2)].id); ;} 1953 { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
1939 break; 1954 break;
1940 1955
1941 case 98: 1956 case 101:
1942 1957
1943 { (yyval.expr) = NULL; ;} 1958 { (yyval.expr) = NULL; ;}
1944 break; 1959 break;
1945 1960
1946 case 99: 1961 case 102:
1947 1962
1948 { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;} 1963 { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;}
1949 break; 1964 break;
1950 1965
1951 case 100: 1966 case 103:
1952 1967
1953 { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); ;} 1968 { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); ;}
1954 break; 1969 break;
1955 1970
1956 case 101: 1971 case 104:
1957 1972
1958 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;} 1973 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;}
1959 break; 1974 break;
1960 1975
1961 case 102: 1976 case 105:
1962 1977
1963 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;} 1978 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;}
1964 break; 1979 break;
1965 1980
1966 case 103: 1981 case 106:
1967 1982
1968 { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} 1983 { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;}
1969 break; 1984 break;
1970 1985
1971 case 104: 1986 case 107:
1972 1987
1973 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); ;} 1988 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); ;}
1974 break; 1989 break;
1975 1990
1976 case 105: 1991 case 108:
1977 1992
1978 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} 1993 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
1979 break; 1994 break;
1980 1995
1981 case 106: 1996 case 109:
1982 1997
1983 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} 1998 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
1984 break; 1999 break;
1985 2000
1986 case 107: 2001 case 110:
1987 2002
1988 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); ;} 2003 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); ;}
1989 break; 2004 break;
1990 2005
1991 case 108: 2006 case 111:
1992 2007
1993 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); ;} 2008 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); ;}
1994 break; 2009 break;
1995 2010
1996 case 109: 2011 case 112:
1997 2012
1998 { (yyval.string) = NULL; ;} 2013 { (yyval.string) = NULL; ;}
1999 break; 2014 break;
@@ -2239,6 +2254,10 @@ void conf_parse(const char *name)
2239 prop = prop_alloc(P_DEFAULT, modules_sym); 2254 prop = prop_alloc(P_DEFAULT, modules_sym);
2240 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0)); 2255 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
2241 } 2256 }
2257
2258 rootmenu.prompt->text = _(rootmenu.prompt->text);
2259 rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
2260
2242 menu_finalize(&rootmenu); 2261 menu_finalize(&rootmenu);
2243 for_all_symbols(i, sym) { 2262 for_all_symbols(i, sym) {
2244 if (sym_check_deps(sym)) 2263 if (sym_check_deps(sym))
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 23dfd3baa7a1..2abd3c7ff15d 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -36,7 +36,7 @@ static struct menu *current_menu, *current_entry;
36#define YYERROR_VERBOSE 36#define YYERROR_VERBOSE
37#endif 37#endif
38%} 38%}
39%expect 26 39%expect 28
40 40
41%union 41%union
42{ 42{
@@ -104,14 +104,15 @@ static struct menu *current_menu, *current_entry;
104%} 104%}
105 105
106%% 106%%
107input: stmt_list; 107input: nl start | start;
108
109start: mainmenu_stmt stmt_list | stmt_list;
108 110
109stmt_list: 111stmt_list:
110 /* empty */ 112 /* empty */
111 | stmt_list common_stmt 113 | stmt_list common_stmt
112 | stmt_list choice_stmt 114 | stmt_list choice_stmt
113 | stmt_list menu_stmt 115 | stmt_list menu_stmt
114 | stmt_list T_MAINMENU prompt nl
115 | stmt_list end { zconf_error("unexpected end statement"); } 116 | stmt_list end { zconf_error("unexpected end statement"); }
116 | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); } 117 | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); }
117 | stmt_list option_name error T_EOL 118 | stmt_list option_name error T_EOL
@@ -342,6 +343,13 @@ if_block:
342 | if_block choice_stmt 343 | if_block choice_stmt
343; 344;
344 345
346/* mainmenu entry */
347
348mainmenu_stmt: T_MAINMENU prompt nl
349{
350 menu_add_prompt(P_MENU, $2, NULL);
351};
352
345/* menu entry */ 353/* menu entry */
346 354
347menu: T_MENU prompt T_EOL 355menu: T_MENU prompt T_EOL
@@ -494,6 +502,10 @@ void conf_parse(const char *name)
494 prop = prop_alloc(P_DEFAULT, modules_sym); 502 prop = prop_alloc(P_DEFAULT, modules_sym);
495 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0)); 503 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
496 } 504 }
505
506 rootmenu.prompt->text = _(rootmenu.prompt->text);
507 rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
508
497 menu_finalize(&rootmenu); 509 menu_finalize(&rootmenu);
498 for_all_symbols(i, sym) { 510 for_all_symbols(i, sym) {
499 if (sym_check_deps(sym)) 511 if (sym_check_deps(sym))
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index fcdfb245a575..102e1235fd5c 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1454,6 +1454,8 @@ sub dump_enum($$) {
1454 my $file = shift; 1454 my $file = shift;
1455 1455
1456 $x =~ s@/\*.*?\*/@@gos; # strip comments. 1456 $x =~ s@/\*.*?\*/@@gos; # strip comments.
1457 $x =~ s/^#\s*define\s+.*$//; # strip #define macros inside enums
1458
1457 if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { 1459 if ($x =~ /enum\s+(\w+)\s*{(.*)}/) {
1458 $declaration_name = $1; 1460 $declaration_name = $1;
1459 my $members = $2; 1461 my $members = $2;
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
index 67d59c7a18dc..5325423ceab4 100644
--- a/scripts/mkmakefile
+++ b/scripts/mkmakefile
@@ -44,7 +44,9 @@ all:
44 44
45Makefile:; 45Makefile:;
46 46
47\$(all) %/: all 47\$(all): all
48 @: 48 @:
49 49
50%/: all
51 @:
50EOF 52EOF
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 5758aab0d8bb..88f3f07205f8 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -884,16 +884,16 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
884 char *zeros = NULL; 884 char *zeros = NULL;
885 885
886 /* We're looking for a section relative symbol */ 886 /* We're looking for a section relative symbol */
887 if (!sym->st_shndx || sym->st_shndx >= info->hdr->e_shnum) 887 if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections)
888 return; 888 return;
889 889
890 /* Handle all-NULL symbols allocated into .bss */ 890 /* Handle all-NULL symbols allocated into .bss */
891 if (info->sechdrs[sym->st_shndx].sh_type & SHT_NOBITS) { 891 if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) {
892 zeros = calloc(1, sym->st_size); 892 zeros = calloc(1, sym->st_size);
893 symval = zeros; 893 symval = zeros;
894 } else { 894 } else {
895 symval = (void *)info->hdr 895 symval = (void *)info->hdr
896 + info->sechdrs[sym->st_shndx].sh_offset 896 + info->sechdrs[get_secindex(info, sym)].sh_offset
897 + sym->st_value; 897 + sym->st_value;
898 } 898 }
899 899
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index f6127b9f5aca..1ec7158b6c1f 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -14,6 +14,7 @@
14#define _GNU_SOURCE 14#define _GNU_SOURCE
15#include <stdio.h> 15#include <stdio.h>
16#include <ctype.h> 16#include <ctype.h>
17#include <string.h>
17#include "modpost.h" 18#include "modpost.h"
18#include "../../include/generated/autoconf.h" 19#include "../../include/generated/autoconf.h"
19#include "../../include/linux/license.h" 20#include "../../include/linux/license.h"
@@ -253,7 +254,7 @@ static enum export export_no(const char *s)
253 return export_unknown; 254 return export_unknown;
254} 255}
255 256
256static enum export export_from_sec(struct elf_info *elf, Elf_Section sec) 257static enum export export_from_sec(struct elf_info *elf, unsigned int sec)
257{ 258{
258 if (sec == elf->export_sec) 259 if (sec == elf->export_sec)
259 return export_plain; 260 return export_plain;
@@ -373,6 +374,8 @@ static int parse_elf(struct elf_info *info, const char *filename)
373 Elf_Ehdr *hdr; 374 Elf_Ehdr *hdr;
374 Elf_Shdr *sechdrs; 375 Elf_Shdr *sechdrs;
375 Elf_Sym *sym; 376 Elf_Sym *sym;
377 const char *secstrings;
378 unsigned int symtab_idx = ~0U, symtab_shndx_idx = ~0U;
376 379
377 hdr = grab_file(filename, &info->size); 380 hdr = grab_file(filename, &info->size);
378 if (!hdr) { 381 if (!hdr) {
@@ -417,8 +420,27 @@ static int parse_elf(struct elf_info *info, const char *filename)
417 return 0; 420 return 0;
418 } 421 }
419 422
423 if (hdr->e_shnum == 0) {
424 /*
425 * There are more than 64k sections,
426 * read count from .sh_size.
427 * note: it doesn't need shndx2secindex()
428 */
429 info->num_sections = TO_NATIVE(sechdrs[0].sh_size);
430 }
431 else {
432 info->num_sections = hdr->e_shnum;
433 }
434 if (hdr->e_shstrndx == SHN_XINDEX) {
435 info->secindex_strings =
436 shndx2secindex(TO_NATIVE(sechdrs[0].sh_link));
437 }
438 else {
439 info->secindex_strings = hdr->e_shstrndx;
440 }
441
420 /* Fix endianness in section headers */ 442 /* Fix endianness in section headers */
421 for (i = 0; i < hdr->e_shnum; i++) { 443 for (i = 0; i < info->num_sections; i++) {
422 sechdrs[i].sh_name = TO_NATIVE(sechdrs[i].sh_name); 444 sechdrs[i].sh_name = TO_NATIVE(sechdrs[i].sh_name);
423 sechdrs[i].sh_type = TO_NATIVE(sechdrs[i].sh_type); 445 sechdrs[i].sh_type = TO_NATIVE(sechdrs[i].sh_type);
424 sechdrs[i].sh_flags = TO_NATIVE(sechdrs[i].sh_flags); 446 sechdrs[i].sh_flags = TO_NATIVE(sechdrs[i].sh_flags);
@@ -431,9 +453,8 @@ static int parse_elf(struct elf_info *info, const char *filename)
431 sechdrs[i].sh_entsize = TO_NATIVE(sechdrs[i].sh_entsize); 453 sechdrs[i].sh_entsize = TO_NATIVE(sechdrs[i].sh_entsize);
432 } 454 }
433 /* Find symbol table. */ 455 /* Find symbol table. */
434 for (i = 1; i < hdr->e_shnum; i++) { 456 secstrings = (void *)hdr + sechdrs[info->secindex_strings].sh_offset;
435 const char *secstrings 457 for (i = 1; i < info->num_sections; i++) {
436 = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
437 const char *secname; 458 const char *secname;
438 int nobits = sechdrs[i].sh_type == SHT_NOBITS; 459 int nobits = sechdrs[i].sh_type == SHT_NOBITS;
439 460
@@ -461,14 +482,26 @@ static int parse_elf(struct elf_info *info, const char *filename)
461 else if (strcmp(secname, "__ksymtab_gpl_future") == 0) 482 else if (strcmp(secname, "__ksymtab_gpl_future") == 0)
462 info->export_gpl_future_sec = i; 483 info->export_gpl_future_sec = i;
463 484
464 if (sechdrs[i].sh_type != SHT_SYMTAB) 485 if (sechdrs[i].sh_type == SHT_SYMTAB) {
465 continue; 486 unsigned int sh_link_idx;
487 symtab_idx = i;
488 info->symtab_start = (void *)hdr +
489 sechdrs[i].sh_offset;
490 info->symtab_stop = (void *)hdr +
491 sechdrs[i].sh_offset + sechdrs[i].sh_size;
492 sh_link_idx = shndx2secindex(sechdrs[i].sh_link);
493 info->strtab = (void *)hdr +
494 sechdrs[sh_link_idx].sh_offset;
495 }
466 496
467 info->symtab_start = (void *)hdr + sechdrs[i].sh_offset; 497 /* 32bit section no. table? ("more than 64k sections") */
468 info->symtab_stop = (void *)hdr + sechdrs[i].sh_offset 498 if (sechdrs[i].sh_type == SHT_SYMTAB_SHNDX) {
469 + sechdrs[i].sh_size; 499 symtab_shndx_idx = i;
470 info->strtab = (void *)hdr + 500 info->symtab_shndx_start = (void *)hdr +
471 sechdrs[sechdrs[i].sh_link].sh_offset; 501 sechdrs[i].sh_offset;
502 info->symtab_shndx_stop = (void *)hdr +
503 sechdrs[i].sh_offset + sechdrs[i].sh_size;
504 }
472 } 505 }
473 if (!info->symtab_start) 506 if (!info->symtab_start)
474 fatal("%s has no symtab?\n", filename); 507 fatal("%s has no symtab?\n", filename);
@@ -480,6 +513,21 @@ static int parse_elf(struct elf_info *info, const char *filename)
480 sym->st_value = TO_NATIVE(sym->st_value); 513 sym->st_value = TO_NATIVE(sym->st_value);
481 sym->st_size = TO_NATIVE(sym->st_size); 514 sym->st_size = TO_NATIVE(sym->st_size);
482 } 515 }
516
517 if (symtab_shndx_idx != ~0U) {
518 Elf32_Word *p;
519 if (symtab_idx !=
520 shndx2secindex(sechdrs[symtab_shndx_idx].sh_link))
521 fatal("%s: SYMTAB_SHNDX has bad sh_link: %u!=%u\n",
522 filename,
523 shndx2secindex(sechdrs[symtab_shndx_idx].sh_link),
524 symtab_idx);
525 /* Fix endianness */
526 for (p = info->symtab_shndx_start; p < info->symtab_shndx_stop;
527 p++)
528 *p = TO_NATIVE(*p);
529 }
530
483 return 1; 531 return 1;
484} 532}
485 533
@@ -519,7 +567,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
519 Elf_Sym *sym, const char *symname) 567 Elf_Sym *sym, const char *symname)
520{ 568{
521 unsigned int crc; 569 unsigned int crc;
522 enum export export = export_from_sec(info, sym->st_shndx); 570 enum export export = export_from_sec(info, get_secindex(info, sym));
523 571
524 switch (sym->st_shndx) { 572 switch (sym->st_shndx) {
525 case SHN_COMMON: 573 case SHN_COMMON:
@@ -661,19 +709,19 @@ static const char *sym_name(struct elf_info *elf, Elf_Sym *sym)
661 return "(unknown)"; 709 return "(unknown)";
662} 710}
663 711
664static const char *sec_name(struct elf_info *elf, int shndx) 712static const char *sec_name(struct elf_info *elf, int secindex)
665{ 713{
666 Elf_Shdr *sechdrs = elf->sechdrs; 714 Elf_Shdr *sechdrs = elf->sechdrs;
667 return (void *)elf->hdr + 715 return (void *)elf->hdr +
668 elf->sechdrs[elf->hdr->e_shstrndx].sh_offset + 716 elf->sechdrs[elf->secindex_strings].sh_offset +
669 sechdrs[shndx].sh_name; 717 sechdrs[secindex].sh_name;
670} 718}
671 719
672static const char *sech_name(struct elf_info *elf, Elf_Shdr *sechdr) 720static const char *sech_name(struct elf_info *elf, Elf_Shdr *sechdr)
673{ 721{
674 return (void *)elf->hdr + 722 return (void *)elf->hdr +
675 elf->sechdrs[elf->hdr->e_shstrndx].sh_offset + 723 elf->sechdrs[elf->secindex_strings].sh_offset +
676 sechdr->sh_name; 724 sechdr->sh_name;
677} 725}
678 726
679/* if sym is empty or point to a string 727/* if sym is empty or point to a string
@@ -742,6 +790,7 @@ static const char *section_white_list[] =
742{ 790{
743 ".comment*", 791 ".comment*",
744 ".debug*", 792 ".debug*",
793 ".GCC-command-line", /* mn10300 */
745 ".mdebug*", /* alpha, score, mips etc. */ 794 ".mdebug*", /* alpha, score, mips etc. */
746 ".pdr", /* alpha, score, mips etc. */ 795 ".pdr", /* alpha, score, mips etc. */
747 ".stab*", 796 ".stab*",
@@ -986,6 +1035,13 @@ static const struct sectioncheck *section_mismatch(
986 * fromsec = .data* 1035 * fromsec = .data*
987 * atsym =__param* 1036 * atsym =__param*
988 * 1037 *
1038 * Pattern 1a:
1039 * module_param_call() ops can refer to __init set function if permissions=0
1040 * The pattern is identified by:
1041 * tosec = .init.text
1042 * fromsec = .data*
1043 * atsym = __param_ops_*
1044 *
989 * Pattern 2: 1045 * Pattern 2:
990 * Many drivers utilise a *driver container with references to 1046 * Many drivers utilise a *driver container with references to
991 * add, remove, probe functions etc. 1047 * add, remove, probe functions etc.
@@ -1020,6 +1076,12 @@ static int secref_whitelist(const struct sectioncheck *mismatch,
1020 (strncmp(fromsym, "__param", strlen("__param")) == 0)) 1076 (strncmp(fromsym, "__param", strlen("__param")) == 0))
1021 return 0; 1077 return 0;
1022 1078
1079 /* Check for pattern 1a */
1080 if (strcmp(tosec, ".init.text") == 0 &&
1081 match(fromsec, data_sections) &&
1082 (strncmp(fromsym, "__param_ops_", strlen("__param_ops_")) == 0))
1083 return 0;
1084
1023 /* Check for pattern 2 */ 1085 /* Check for pattern 2 */
1024 if (match(tosec, init_exit_sections) && 1086 if (match(tosec, init_exit_sections) &&
1025 match(fromsec, data_sections) && 1087 match(fromsec, data_sections) &&
@@ -1052,11 +1114,14 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr,
1052 Elf_Sym *near = NULL; 1114 Elf_Sym *near = NULL;
1053 Elf64_Sword distance = 20; 1115 Elf64_Sword distance = 20;
1054 Elf64_Sword d; 1116 Elf64_Sword d;
1117 unsigned int relsym_secindex;
1055 1118
1056 if (relsym->st_name != 0) 1119 if (relsym->st_name != 0)
1057 return relsym; 1120 return relsym;
1121
1122 relsym_secindex = get_secindex(elf, relsym);
1058 for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { 1123 for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) {
1059 if (sym->st_shndx != relsym->st_shndx) 1124 if (get_secindex(elf, sym) != relsym_secindex)
1060 continue; 1125 continue;
1061 if (ELF_ST_TYPE(sym->st_info) == STT_SECTION) 1126 if (ELF_ST_TYPE(sym->st_info) == STT_SECTION)
1062 continue; 1127 continue;
@@ -1118,9 +1183,9 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
1118 for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { 1183 for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) {
1119 const char *symsec; 1184 const char *symsec;
1120 1185
1121 if (sym->st_shndx >= SHN_LORESERVE) 1186 if (is_shndx_special(sym->st_shndx))
1122 continue; 1187 continue;
1123 symsec = sec_name(elf, sym->st_shndx); 1188 symsec = sec_name(elf, get_secindex(elf, sym));
1124 if (strcmp(symsec, sec) != 0) 1189 if (strcmp(symsec, sec) != 0)
1125 continue; 1190 continue;
1126 if (!is_valid_name(elf, sym)) 1191 if (!is_valid_name(elf, sym))
@@ -1167,7 +1232,7 @@ static char *sec2annotation(const char *s)
1167 strcat(p, " "); 1232 strcat(p, " ");
1168 return r; /* we leak her but we do not care */ 1233 return r; /* we leak her but we do not care */
1169 } else { 1234 } else {
1170 return ""; 1235 return strdup("");
1171 } 1236 }
1172} 1237}
1173 1238
@@ -1195,6 +1260,8 @@ static void report_sec_mismatch(const char *modname,
1195{ 1260{
1196 const char *from, *from_p; 1261 const char *from, *from_p;
1197 const char *to, *to_p; 1262 const char *to, *to_p;
1263 char *prl_from;
1264 char *prl_to;
1198 1265
1199 switch (from_is_func) { 1266 switch (from_is_func) {
1200 case 0: from = "variable"; from_p = ""; break; 1267 case 0: from = "variable"; from_p = ""; break;
@@ -1218,16 +1285,21 @@ static void report_sec_mismatch(const char *modname,
1218 1285
1219 switch (mismatch->mismatch) { 1286 switch (mismatch->mismatch) {
1220 case TEXT_TO_ANY_INIT: 1287 case TEXT_TO_ANY_INIT:
1288 prl_from = sec2annotation(fromsec);
1289 prl_to = sec2annotation(tosec);
1221 fprintf(stderr, 1290 fprintf(stderr,
1222 "The function %s%s() references\n" 1291 "The function %s%s() references\n"
1223 "the %s %s%s%s.\n" 1292 "the %s %s%s%s.\n"
1224 "This is often because %s lacks a %s\n" 1293 "This is often because %s lacks a %s\n"
1225 "annotation or the annotation of %s is wrong.\n", 1294 "annotation or the annotation of %s is wrong.\n",
1226 sec2annotation(fromsec), fromsym, 1295 prl_from, fromsym,
1227 to, sec2annotation(tosec), tosym, to_p, 1296 to, prl_to, tosym, to_p,
1228 fromsym, sec2annotation(tosec), tosym); 1297 fromsym, prl_to, tosym);
1298 free(prl_from);
1299 free(prl_to);
1229 break; 1300 break;
1230 case DATA_TO_ANY_INIT: { 1301 case DATA_TO_ANY_INIT: {
1302 prl_to = sec2annotation(tosec);
1231 const char *const *s = mismatch->symbol_white_list; 1303 const char *const *s = mismatch->symbol_white_list;
1232 fprintf(stderr, 1304 fprintf(stderr,
1233 "The variable %s references\n" 1305 "The variable %s references\n"
@@ -1235,20 +1307,24 @@ static void report_sec_mismatch(const char *modname,
1235 "If the reference is valid then annotate the\n" 1307 "If the reference is valid then annotate the\n"
1236 "variable with __init* or __refdata (see linux/init.h) " 1308 "variable with __init* or __refdata (see linux/init.h) "
1237 "or name the variable:\n", 1309 "or name the variable:\n",
1238 fromsym, to, sec2annotation(tosec), tosym, to_p); 1310 fromsym, to, prl_to, tosym, to_p);
1239 while (*s) 1311 while (*s)
1240 fprintf(stderr, "%s, ", *s++); 1312 fprintf(stderr, "%s, ", *s++);
1241 fprintf(stderr, "\n"); 1313 fprintf(stderr, "\n");
1314 free(prl_to);
1242 break; 1315 break;
1243 } 1316 }
1244 case TEXT_TO_ANY_EXIT: 1317 case TEXT_TO_ANY_EXIT:
1318 prl_to = sec2annotation(tosec);
1245 fprintf(stderr, 1319 fprintf(stderr,
1246 "The function %s() references a %s in an exit section.\n" 1320 "The function %s() references a %s in an exit section.\n"
1247 "Often the %s %s%s has valid usage outside the exit section\n" 1321 "Often the %s %s%s has valid usage outside the exit section\n"
1248 "and the fix is to remove the %sannotation of %s.\n", 1322 "and the fix is to remove the %sannotation of %s.\n",
1249 fromsym, to, to, tosym, to_p, sec2annotation(tosec), tosym); 1323 fromsym, to, to, tosym, to_p, prl_to, tosym);
1324 free(prl_to);
1250 break; 1325 break;
1251 case DATA_TO_ANY_EXIT: { 1326 case DATA_TO_ANY_EXIT: {
1327 prl_to = sec2annotation(tosec);
1252 const char *const *s = mismatch->symbol_white_list; 1328 const char *const *s = mismatch->symbol_white_list;
1253 fprintf(stderr, 1329 fprintf(stderr,
1254 "The variable %s references\n" 1330 "The variable %s references\n"
@@ -1256,24 +1332,31 @@ static void report_sec_mismatch(const char *modname,
1256 "If the reference is valid then annotate the\n" 1332 "If the reference is valid then annotate the\n"
1257 "variable with __exit* (see linux/init.h) or " 1333 "variable with __exit* (see linux/init.h) or "
1258 "name the variable:\n", 1334 "name the variable:\n",
1259 fromsym, to, sec2annotation(tosec), tosym, to_p); 1335 fromsym, to, prl_to, tosym, to_p);
1260 while (*s) 1336 while (*s)
1261 fprintf(stderr, "%s, ", *s++); 1337 fprintf(stderr, "%s, ", *s++);
1262 fprintf(stderr, "\n"); 1338 fprintf(stderr, "\n");
1339 free(prl_to);
1263 break; 1340 break;
1264 } 1341 }
1265 case XXXINIT_TO_SOME_INIT: 1342 case XXXINIT_TO_SOME_INIT:
1266 case XXXEXIT_TO_SOME_EXIT: 1343 case XXXEXIT_TO_SOME_EXIT:
1344 prl_from = sec2annotation(fromsec);
1345 prl_to = sec2annotation(tosec);
1267 fprintf(stderr, 1346 fprintf(stderr,
1268 "The %s %s%s%s references\n" 1347 "The %s %s%s%s references\n"
1269 "a %s %s%s%s.\n" 1348 "a %s %s%s%s.\n"
1270 "If %s is only used by %s then\n" 1349 "If %s is only used by %s then\n"
1271 "annotate %s with a matching annotation.\n", 1350 "annotate %s with a matching annotation.\n",
1272 from, sec2annotation(fromsec), fromsym, from_p, 1351 from, prl_from, fromsym, from_p,
1273 to, sec2annotation(tosec), tosym, to_p, 1352 to, prl_to, tosym, to_p,
1274 tosym, fromsym, tosym); 1353 tosym, fromsym, tosym);
1354 free(prl_from);
1355 free(prl_to);
1275 break; 1356 break;
1276 case ANY_INIT_TO_ANY_EXIT: 1357 case ANY_INIT_TO_ANY_EXIT:
1358 prl_from = sec2annotation(fromsec);
1359 prl_to = sec2annotation(tosec);
1277 fprintf(stderr, 1360 fprintf(stderr,
1278 "The %s %s%s%s references\n" 1361 "The %s %s%s%s references\n"
1279 "a %s %s%s%s.\n" 1362 "a %s %s%s%s.\n"
@@ -1282,11 +1365,15 @@ static void report_sec_mismatch(const char *modname,
1282 "uses functionality in the exit path.\n" 1365 "uses functionality in the exit path.\n"
1283 "The fix is often to remove the %sannotation of\n" 1366 "The fix is often to remove the %sannotation of\n"
1284 "%s%s so it may be used outside an exit section.\n", 1367 "%s%s so it may be used outside an exit section.\n",
1285 from, sec2annotation(fromsec), fromsym, from_p, 1368 from, prl_from, fromsym, from_p,
1286 to, sec2annotation(tosec), tosym, to_p, 1369 to, prl_to, tosym, to_p,
1287 sec2annotation(tosec), tosym, to_p); 1370 prl_to, tosym, to_p);
1371 free(prl_from);
1372 free(prl_to);
1288 break; 1373 break;
1289 case ANY_EXIT_TO_ANY_INIT: 1374 case ANY_EXIT_TO_ANY_INIT:
1375 prl_from = sec2annotation(fromsec);
1376 prl_to = sec2annotation(tosec);
1290 fprintf(stderr, 1377 fprintf(stderr,
1291 "The %s %s%s%s references\n" 1378 "The %s %s%s%s references\n"
1292 "a %s %s%s%s.\n" 1379 "a %s %s%s%s.\n"
@@ -1295,16 +1382,20 @@ static void report_sec_mismatch(const char *modname,
1295 "uses functionality in the init path.\n" 1382 "uses functionality in the init path.\n"
1296 "The fix is often to remove the %sannotation of\n" 1383 "The fix is often to remove the %sannotation of\n"
1297 "%s%s so it may be used outside an init section.\n", 1384 "%s%s so it may be used outside an init section.\n",
1298 from, sec2annotation(fromsec), fromsym, from_p, 1385 from, prl_from, fromsym, from_p,
1299 to, sec2annotation(tosec), tosym, to_p, 1386 to, prl_to, tosym, to_p,
1300 sec2annotation(tosec), tosym, to_p); 1387 prl_to, tosym, to_p);
1388 free(prl_from);
1389 free(prl_to);
1301 break; 1390 break;
1302 case EXPORT_TO_INIT_EXIT: 1391 case EXPORT_TO_INIT_EXIT:
1392 prl_to = sec2annotation(tosec);
1303 fprintf(stderr, 1393 fprintf(stderr,
1304 "The symbol %s is exported and annotated %s\n" 1394 "The symbol %s is exported and annotated %s\n"
1305 "Fix this by removing the %sannotation of %s " 1395 "Fix this by removing the %sannotation of %s "
1306 "or drop the export.\n", 1396 "or drop the export.\n",
1307 tosym, sec2annotation(tosec), sec2annotation(tosec), tosym); 1397 tosym, prl_to, prl_to, tosym);
1398 free(prl_to);
1308 break; 1399 break;
1309 } 1400 }
1310 fprintf(stderr, "\n"); 1401 fprintf(stderr, "\n");
@@ -1316,7 +1407,7 @@ static void check_section_mismatch(const char *modname, struct elf_info *elf,
1316 const char *tosec; 1407 const char *tosec;
1317 const struct sectioncheck *mismatch; 1408 const struct sectioncheck *mismatch;
1318 1409
1319 tosec = sec_name(elf, sym->st_shndx); 1410 tosec = sec_name(elf, get_secindex(elf, sym));
1320 mismatch = section_mismatch(fromsec, tosec); 1411 mismatch = section_mismatch(fromsec, tosec);
1321 if (mismatch) { 1412 if (mismatch) {
1322 Elf_Sym *to; 1413 Elf_Sym *to;
@@ -1344,7 +1435,7 @@ static unsigned int *reloc_location(struct elf_info *elf,
1344 Elf_Shdr *sechdr, Elf_Rela *r) 1435 Elf_Shdr *sechdr, Elf_Rela *r)
1345{ 1436{
1346 Elf_Shdr *sechdrs = elf->sechdrs; 1437 Elf_Shdr *sechdrs = elf->sechdrs;
1347 int section = sechdr->sh_info; 1438 int section = shndx2secindex(sechdr->sh_info);
1348 1439
1349 return (void *)elf->hdr + sechdrs[section].sh_offset + 1440 return (void *)elf->hdr + sechdrs[section].sh_offset +
1350 r->r_offset - sechdrs[section].sh_addr; 1441 r->r_offset - sechdrs[section].sh_addr;
@@ -1452,7 +1543,7 @@ static void section_rela(const char *modname, struct elf_info *elf,
1452 r.r_addend = TO_NATIVE(rela->r_addend); 1543 r.r_addend = TO_NATIVE(rela->r_addend);
1453 sym = elf->symtab_start + r_sym; 1544 sym = elf->symtab_start + r_sym;
1454 /* Skip special sections */ 1545 /* Skip special sections */
1455 if (sym->st_shndx >= SHN_LORESERVE) 1546 if (is_shndx_special(sym->st_shndx))
1456 continue; 1547 continue;
1457 check_section_mismatch(modname, elf, &r, sym, fromsec); 1548 check_section_mismatch(modname, elf, &r, sym, fromsec);
1458 } 1549 }
@@ -1510,7 +1601,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
1510 } 1601 }
1511 sym = elf->symtab_start + r_sym; 1602 sym = elf->symtab_start + r_sym;
1512 /* Skip special sections */ 1603 /* Skip special sections */
1513 if (sym->st_shndx >= SHN_LORESERVE) 1604 if (is_shndx_special(sym->st_shndx))
1514 continue; 1605 continue;
1515 check_section_mismatch(modname, elf, &r, sym, fromsec); 1606 check_section_mismatch(modname, elf, &r, sym, fromsec);
1516 } 1607 }
@@ -1535,7 +1626,7 @@ static void check_sec_ref(struct module *mod, const char *modname,
1535 Elf_Shdr *sechdrs = elf->sechdrs; 1626 Elf_Shdr *sechdrs = elf->sechdrs;
1536 1627
1537 /* Walk through all sections */ 1628 /* Walk through all sections */
1538 for (i = 0; i < elf->hdr->e_shnum; i++) { 1629 for (i = 0; i < elf->num_sections; i++) {
1539 check_section(modname, elf, &elf->sechdrs[i]); 1630 check_section(modname, elf, &elf->sechdrs[i]);
1540 /* We want to process only relocation sections and not .init */ 1631 /* We want to process only relocation sections and not .init */
1541 if (sechdrs[i].sh_type == SHT_RELA) 1632 if (sechdrs[i].sh_type == SHT_RELA)
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
index be987a44f250..0388cfccac8d 100644
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -129,8 +129,51 @@ struct elf_info {
129 const char *strtab; 129 const char *strtab;
130 char *modinfo; 130 char *modinfo;
131 unsigned int modinfo_len; 131 unsigned int modinfo_len;
132
133 /* support for 32bit section numbers */
134
135 unsigned int num_sections; /* max_secindex + 1 */
136 unsigned int secindex_strings;
137 /* if Nth symbol table entry has .st_shndx = SHN_XINDEX,
138 * take shndx from symtab_shndx_start[N] instead */
139 Elf32_Word *symtab_shndx_start;
140 Elf32_Word *symtab_shndx_stop;
132}; 141};
133 142
143static inline int is_shndx_special(unsigned int i)
144{
145 return i != SHN_XINDEX && i >= SHN_LORESERVE && i <= SHN_HIRESERVE;
146}
147
148/* shndx is in [0..SHN_LORESERVE) U (SHN_HIRESERVE, 0xfffffff], thus:
149 * shndx == 0 <=> sechdrs[0]
150 * ......
151 * shndx == SHN_LORESERVE-1 <=> sechdrs[SHN_LORESERVE-1]
152 * shndx == SHN_HIRESERVE+1 <=> sechdrs[SHN_LORESERVE]
153 * shndx == SHN_HIRESERVE+2 <=> sechdrs[SHN_LORESERVE+1]
154 * ......
155 * fyi: sym->st_shndx is uint16, SHN_LORESERVE = ff00, SHN_HIRESERVE = ffff,
156 * so basically we map 0000..feff -> 0000..feff
157 * ff00..ffff -> (you are a bad boy, dont do it)
158 * 10000..xxxx -> ff00..(xxxx-0x100)
159 */
160static inline unsigned int shndx2secindex(unsigned int i)
161{
162 if (i <= SHN_HIRESERVE)
163 return i;
164 return i - (SHN_HIRESERVE + 1 - SHN_LORESERVE);
165}
166
167/* Accessor for sym->st_shndx, hides ugliness of "64k sections" */
168static inline unsigned int get_secindex(const struct elf_info *info,
169 const Elf_Sym *sym)
170{
171 if (sym->st_shndx != SHN_XINDEX)
172 return sym->st_shndx;
173 return shndx2secindex(info->symtab_shndx_start[sym -
174 info->symtab_start]);
175}
176
134/* file2alias.c */ 177/* file2alias.c */
135extern unsigned int cross_build; 178extern unsigned int cross_build;
136void handle_moddevtable(struct module *mod, struct elf_info *info, 179void handle_moddevtable(struct module *mod, struct elf_info *info,
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index d2c29b63adda..d0b931b994fc 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -111,13 +111,38 @@ tar%pkg: FORCE
111clean-dirs += $(objtree)/tar-install/ 111clean-dirs += $(objtree)/tar-install/
112 112
113 113
114# perf-pkg - generate a source tarball with perf source
115# ---------------------------------------------------------------------------
116
117perf-tar=perf-$(KERNELVERSION)
118
119quiet_cmd_perf_tar = TAR
120 cmd_perf_tar = \
121git archive --prefix=$(perf-tar)/ HEAD^{tree} \
122 $$(cat $(srctree)/tools/perf/MANIFEST) -o $(perf-tar).tar; \
123mkdir -p $(perf-tar); \
124git rev-parse HEAD > $(perf-tar)/HEAD; \
125tar rf $(perf-tar).tar $(perf-tar)/HEAD; \
126rm -r $(perf-tar); \
127$(if $(findstring tar-src,$@),, \
128$(if $(findstring bz2,$@),bzip2, \
129$(if $(findstring gz,$@),gzip, \
130$(error unknown target $@))) \
131 -f -9 $(perf-tar).tar)
132
133perf-%pkg: FORCE
134 $(call cmd,perf_tar)
135
114# Help text displayed when executing 'make help' 136# Help text displayed when executing 'make help'
115# --------------------------------------------------------------------------- 137# ---------------------------------------------------------------------------
116help: FORCE 138help: FORCE
117 @echo ' rpm-pkg - Build both source and binary RPM kernel packages' 139 @echo ' rpm-pkg - Build both source and binary RPM kernel packages'
118 @echo ' binrpm-pkg - Build only the binary kernel package' 140 @echo ' binrpm-pkg - Build only the binary kernel package'
119 @echo ' deb-pkg - Build the kernel as an deb package' 141 @echo ' deb-pkg - Build the kernel as an deb package'
120 @echo ' tar-pkg - Build the kernel as an uncompressed tarball' 142 @echo ' tar-pkg - Build the kernel as an uncompressed tarball'
121 @echo ' targz-pkg - Build the kernel as a gzip compressed tarball' 143 @echo ' targz-pkg - Build the kernel as a gzip compressed tarball'
122 @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball' 144 @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'
145 @echo ' perf-tar-src-pkg - Build $(perf-tar).tar source tarball'
146 @echo ' perf-targz-src-pkg - Build $(perf-tar).tar.gz source tarball'
147 @echo ' perf-tarbz2-src-pkg - Build $(perf-tar).tar.bz2 source tarball'
123 148
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 07f2fbde2abf..5f1e2fc7f171 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -148,10 +148,11 @@ EOF
148# Generate a control file 148# Generate a control file
149cat <<EOF > debian/control 149cat <<EOF > debian/control
150Source: linux-upstream 150Source: linux-upstream
151Section: admin 151Section: kernel
152Priority: optional 152Priority: optional
153Maintainer: $maintainer 153Maintainer: $maintainer
154Standards-Version: 3.8.1 154Standards-Version: 3.8.4
155Homepage: http://www.kernel.org/
155EOF 156EOF
156 157
157if [ "$ARCH" = "um" ]; then 158if [ "$ARCH" = "um" ]; then
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index f3c9c0a90b98..0171060b5fd6 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -326,7 +326,7 @@ if ($arch eq "x86_64") {
326 # 14: R_MIPS_NONE *ABS* 326 # 14: R_MIPS_NONE *ABS*
327 # 18: 00020021 nop 327 # 18: 00020021 nop
328 if ($is_module eq "0") { 328 if ($is_module eq "0") {
329 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$"; 329 $mcount_regex = "^\\s*([0-9a-fA-F]+): R_MIPS_26\\s+_mcount\$";
330 } else { 330 } else {
331 $mcount_regex = "^\\s*([0-9a-fA-F]+): R_MIPS_HI16\\s+_mcount\$"; 331 $mcount_regex = "^\\s*([0-9a-fA-F]+): R_MIPS_HI16\\s+_mcount\$";
332 } 332 }
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 64a9cb5556cd..057b6b3c5dfb 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -43,7 +43,7 @@ scm_version()
43 fi 43 fi
44 44
45 # Check for git and a git repo. 45 # Check for git and a git repo.
46 if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then 46 if test -d .git && head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
47 47
48 # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore 48 # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
49 # it, because this version is defined in the top level Makefile. 49 # it, because this version is defined in the top level Makefile.
@@ -85,8 +85,8 @@ scm_version()
85 fi 85 fi
86 86
87 # Check for mercurial and a mercurial repo. 87 # Check for mercurial and a mercurial repo.
88 if hgid=`hg id 2>/dev/null`; then 88 if test -d .hg && hgid=`hg id 2>/dev/null`; then
89 tag=`printf '%s' "$hgid" | cut -d' ' -f2` 89 tag=`printf '%s' "$hgid" | cut -s -d' ' -f2`
90 90
91 # Do we have an untagged version? 91 # Do we have an untagged version?
92 if [ -z "$tag" -o "$tag" = tip ]; then 92 if [ -z "$tag" -o "$tag" = tip ]; then