aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/.gitignore1
-rw-r--r--scripts/Makefile.build13
-rw-r--r--scripts/basic/fixdep.c119
-rwxr-xr-xscripts/checksyscalls.sh4
-rw-r--r--scripts/coccinelle/misc/doubleinit.cocci6
-rw-r--r--scripts/coccinelle/null/deref_null.cocci39
-rwxr-xr-xscripts/config13
-rw-r--r--scripts/genksyms/parse.c_shipped2
-rw-r--r--scripts/genksyms/parse.y2
-rwxr-xr-xscripts/headers.sh2
-rw-r--r--scripts/headers_check.pl6
-rw-r--r--scripts/headers_install.pl7
-rw-r--r--scripts/kconfig/conf.c2
-rw-r--r--scripts/kconfig/confdata.c27
-rw-r--r--scripts/kconfig/expr.c44
-rw-r--r--scripts/kconfig/expr.h3
-rw-r--r--scripts/kconfig/lkc.h7
-rw-r--r--scripts/kconfig/menu.c29
-rw-r--r--scripts/kconfig/nconf.c10
-rw-r--r--scripts/kconfig/symbol.c8
-rwxr-xr-xscripts/kernel-doc102
-rwxr-xr-xscripts/mkuboot.sh2
-rw-r--r--scripts/mod/modpost.c3
-rw-r--r--scripts/package/builddeb93
-rw-r--r--scripts/recordmcount.c7
-rw-r--r--scripts/recordmcount.h5
-rwxr-xr-xscripts/tags.sh2
27 files changed, 373 insertions, 185 deletions
diff --git a/scripts/.gitignore b/scripts/.gitignore
index c5d5db54c009..e2741d23bab8 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -7,3 +7,4 @@ pnmtologo
7bin2c 7bin2c
8unifdef 8unifdef
9ihex2fw 9ihex2fw
10recordmcount
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 5ad25e17b6cb..4eb99ab34053 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -214,17 +214,22 @@ ifdef BUILD_C_RECORDMCOUNT
214# The empty.o file is created in the make process in order to determine 214# The empty.o file is created in the make process in order to determine
215# the target endianness and word size. It is made before all other C 215# the target endianness and word size. It is made before all other C
216# files, including recordmcount. 216# files, including recordmcount.
217cmd_record_mcount = if [ $(@) != "scripts/mod/empty.o" ]; then \ 217sub_cmd_record_mcount = \
218 $(objtree)/scripts/recordmcount "$(@)"; \ 218 if [ $(@) != "scripts/mod/empty.o" ]; then \
219 fi; 219 $(objtree)/scripts/recordmcount "$(@)"; \
220 fi;
220else 221else
221cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ 222sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
222 "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \ 223 "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
223 "$(if $(CONFIG_64BIT),64,32)" \ 224 "$(if $(CONFIG_64BIT),64,32)" \
224 "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \ 225 "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \
225 "$(LD)" "$(NM)" "$(RM)" "$(MV)" \ 226 "$(LD)" "$(NM)" "$(RM)" "$(MV)" \
226 "$(if $(part-of-module),1,0)" "$(@)"; 227 "$(if $(part-of-module),1,0)" "$(@)";
227endif 228endif
229cmd_record_mcount = \
230 if [ "$(findstring -pg,$(_c_flags))" = "-pg" ]; then \
231 $(sub_cmd_record_mcount) \
232 fi;
228endif 233endif
229 234
230define rule_cc_o_c 235define rule_cc_o_c
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index ea26b23de082..c9a16abacab4 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -138,38 +138,36 @@ static void print_cmdline(void)
138 printf("cmd_%s := %s\n\n", target, cmdline); 138 printf("cmd_%s := %s\n\n", target, cmdline);
139} 139}
140 140
141char * str_config = NULL; 141struct item {
142int size_config = 0; 142 struct item *next;
143int len_config = 0; 143 unsigned int len;
144 unsigned int hash;
145 char name[0];
146};
144 147
145/* 148#define HASHSZ 256
146 * Grow the configuration string to a desired length. 149static struct item *hashtab[HASHSZ];
147 * Usually the first growth is plenty.
148 */
149static void grow_config(int len)
150{
151 while (len_config + len > size_config) {
152 if (size_config == 0)
153 size_config = 2048;
154 str_config = realloc(str_config, size_config *= 2);
155 if (str_config == NULL)
156 { perror("fixdep:malloc"); exit(1); }
157 }
158}
159 150
151static unsigned int strhash(const char *str, unsigned int sz)
152{
153 /* fnv32 hash */
154 unsigned int i, hash = 2166136261U;
160 155
156 for (i = 0; i < sz; i++)
157 hash = (hash ^ str[i]) * 0x01000193;
158 return hash;
159}
161 160
162/* 161/*
163 * Lookup a value in the configuration string. 162 * Lookup a value in the configuration string.
164 */ 163 */
165static int is_defined_config(const char * name, int len) 164static int is_defined_config(const char *name, int len, unsigned int hash)
166{ 165{
167 const char * pconfig; 166 struct item *aux;
168 const char * plast = str_config + len_config - len; 167
169 for ( pconfig = str_config + 1; pconfig < plast; pconfig++ ) { 168 for (aux = hashtab[hash % HASHSZ]; aux; aux = aux->next) {
170 if (pconfig[ -1] == '\n' 169 if (aux->hash == hash && aux->len == len &&
171 && pconfig[len] == '\n' 170 memcmp(aux->name, name, len) == 0)
172 && !memcmp(pconfig, name, len))
173 return 1; 171 return 1;
174 } 172 }
175 return 0; 173 return 0;
@@ -178,13 +176,19 @@ static int is_defined_config(const char * name, int len)
178/* 176/*
179 * Add a new value to the configuration string. 177 * Add a new value to the configuration string.
180 */ 178 */
181static void define_config(const char * name, int len) 179static void define_config(const char *name, int len, unsigned int hash)
182{ 180{
183 grow_config(len + 1); 181 struct item *aux = malloc(sizeof(*aux) + len);
184 182
185 memcpy(str_config+len_config, name, len); 183 if (!aux) {
186 len_config += len; 184 perror("fixdep:malloc");
187 str_config[len_config++] = '\n'; 185 exit(1);
186 }
187 memcpy(aux->name, name, len);
188 aux->len = len;
189 aux->hash = hash;
190 aux->next = hashtab[hash % HASHSZ];
191 hashtab[hash % HASHSZ] = aux;
188} 192}
189 193
190/* 194/*
@@ -192,40 +196,49 @@ static void define_config(const char * name, int len)
192 */ 196 */
193static void clear_config(void) 197static void clear_config(void)
194{ 198{
195 len_config = 0; 199 struct item *aux, *next;
196 define_config("", 0); 200 unsigned int i;
201
202 for (i = 0; i < HASHSZ; i++) {
203 for (aux = hashtab[i]; aux; aux = next) {
204 next = aux->next;
205 free(aux);
206 }
207 hashtab[i] = NULL;
208 }
197} 209}
198 210
199/* 211/*
200 * Record the use of a CONFIG_* word. 212 * Record the use of a CONFIG_* word.
201 */ 213 */
202static void use_config(char *m, int slen) 214static void use_config(const char *m, int slen)
203{ 215{
204 char s[PATH_MAX]; 216 unsigned int hash = strhash(m, slen);
205 char *p; 217 int c, i;
206 218
207 if (is_defined_config(m, slen)) 219 if (is_defined_config(m, slen, hash))
208 return; 220 return;
209 221
210 define_config(m, slen); 222 define_config(m, slen, hash);
211 223
212 memcpy(s, m, slen); s[slen] = 0; 224 printf(" $(wildcard include/config/");
213 225 for (i = 0; i < slen; i++) {
214 for (p = s; p < s + slen; p++) { 226 c = m[i];
215 if (*p == '_') 227 if (c == '_')
216 *p = '/'; 228 c = '/';
217 else 229 else
218 *p = tolower((int)*p); 230 c = tolower(c);
231 putchar(c);
219 } 232 }
220 printf(" $(wildcard include/config/%s.h) \\\n", s); 233 printf(".h) \\\n");
221} 234}
222 235
223static void parse_config_file(char *map, size_t len) 236static void parse_config_file(const char *map, size_t len)
224{ 237{
225 int *end = (int *) (map + len); 238 const int *end = (const int *) (map + len);
226 /* start at +1, so that p can never be < map */ 239 /* start at +1, so that p can never be < map */
227 int *m = (int *) map + 1; 240 const int *m = (const int *) map + 1;
228 char *p, *q; 241 const char *p, *q;
229 242
230 for (; m < end; m++) { 243 for (; m < end; m++) {
231 if (*m == INT_CONF) { p = (char *) m ; goto conf; } 244 if (*m == INT_CONF) { p = (char *) m ; goto conf; }
@@ -265,7 +278,7 @@ static int strrcmp(char *s, char *sub)
265 return memcmp(s + slen - sublen, sub, sublen); 278 return memcmp(s + slen - sublen, sub, sublen);
266} 279}
267 280
268static void do_config_file(char *filename) 281static void do_config_file(const char *filename)
269{ 282{
270 struct stat st; 283 struct stat st;
271 int fd; 284 int fd;
@@ -273,7 +286,7 @@ static void do_config_file(char *filename)
273 286
274 fd = open(filename, O_RDONLY); 287 fd = open(filename, O_RDONLY);
275 if (fd < 0) { 288 if (fd < 0) {
276 fprintf(stderr, "fixdep: "); 289 fprintf(stderr, "fixdep: error opening config file: ");
277 perror(filename); 290 perror(filename);
278 exit(2); 291 exit(2);
279 } 292 }
@@ -344,11 +357,15 @@ static void print_deps(void)
344 357
345 fd = open(depfile, O_RDONLY); 358 fd = open(depfile, O_RDONLY);
346 if (fd < 0) { 359 if (fd < 0) {
347 fprintf(stderr, "fixdep: "); 360 fprintf(stderr, "fixdep: error opening depfile: ");
348 perror(depfile); 361 perror(depfile);
349 exit(2); 362 exit(2);
350 } 363 }
351 fstat(fd, &st); 364 if (fstat(fd, &st) < 0) {
365 fprintf(stderr, "fixdep: error fstat'ing depfile: ");
366 perror(depfile);
367 exit(2);
368 }
352 if (st.st_size == 0) { 369 if (st.st_size == 0) {
353 fprintf(stderr,"fixdep: %s is empty\n",depfile); 370 fprintf(stderr,"fixdep: %s is empty\n",depfile);
354 close(fd); 371 close(fd);
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index 6bb42e72e0e5..3ab316e52313 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -6,7 +6,7 @@
6# and listed below so they are ignored. 6# and listed below so they are ignored.
7# 7#
8# Usage: 8# Usage:
9# syscallchk gcc gcc-options 9# checksyscalls.sh gcc gcc-options
10# 10#
11 11
12ignore_list() { 12ignore_list() {
@@ -204,5 +204,5 @@ sed -n -e '/^\#define/ s/[^_]*__NR_\([^[:space:]]*\).*/\
204\#endif/p' $1 204\#endif/p' $1
205} 205}
206 206
207(ignore_list && syscall_list ${srctree}/arch/x86/include/asm/unistd_32.h) | \ 207(ignore_list && syscall_list $(dirname $0)/../arch/x86/include/asm/unistd_32.h) | \
208$* -E -x c - > /dev/null 208$* -E -x c - > /dev/null
diff --git a/scripts/coccinelle/misc/doubleinit.cocci b/scripts/coccinelle/misc/doubleinit.cocci
index 55d7dc19dfe0..156b20adb351 100644
--- a/scripts/coccinelle/misc/doubleinit.cocci
+++ b/scripts/coccinelle/misc/doubleinit.cocci
@@ -7,7 +7,7 @@
7// Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. 7// Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2.
8// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. 8// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2.
9// URL: http://coccinelle.lip6.fr/ 9// URL: http://coccinelle.lip6.fr/
10// Comments: 10// Comments: requires at least Coccinelle 0.2.4, lex or parse error otherwise
11// Options: -no_includes -include_headers 11// Options: -no_includes -include_headers
12 12
13virtual org 13virtual org
@@ -19,7 +19,7 @@ position p0,p;
19expression E; 19expression E;
20@@ 20@@
21 21
22struct I s =@p0 { ... .fld@p = E, ...}; 22struct I s =@p0 { ..., .fld@p = E, ...};
23 23
24@s@ 24@s@
25identifier I, s, r.fld; 25identifier I, s, r.fld;
@@ -27,7 +27,7 @@ position r.p0,p;
27expression E; 27expression E;
28@@ 28@@
29 29
30struct I s =@p0 { ... .fld@p = E, ...}; 30struct I s =@p0 { ..., .fld@p = E, ...};
31 31
32@script:python depends on org@ 32@script:python depends on org@
33p0 << r.p0; 33p0 << r.p0;
diff --git a/scripts/coccinelle/null/deref_null.cocci b/scripts/coccinelle/null/deref_null.cocci
index 9969d76d0f4b..cdac6cfcce92 100644
--- a/scripts/coccinelle/null/deref_null.cocci
+++ b/scripts/coccinelle/null/deref_null.cocci
@@ -11,21 +11,10 @@
11// Options: 11// Options:
12 12
13virtual context 13virtual context
14virtual patch
15virtual org 14virtual org
16virtual report 15virtual report
17 16
18@initialize:python depends on !context && patch && !org && !report@ 17@ifm@
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; 18expression *E;
30statement S1,S2; 19statement S1,S2;
31position p1; 20position p1;
@@ -35,7 +24,7 @@ if@p1 ((E == NULL && ...) || ...) S1 else S2
35 24
36// The following two rules are separate, because both can match a single 25// The following two rules are separate, because both can match a single
37// expression in different ways 26// expression in different ways
38@pr1 depends on !patch expression@ 27@pr1 expression@
39expression *ifm.E; 28expression *ifm.E;
40identifier f; 29identifier f;
41position p1; 30position p1;
@@ -43,7 +32,7 @@ position p1;
43 32
44 (E != NULL && ...) ? <+...E->f@p1...+> : ... 33 (E != NULL && ...) ? <+...E->f@p1...+> : ...
45 34
46@pr2 depends on !patch expression@ 35@pr2 expression@
47expression *ifm.E; 36expression *ifm.E;
48identifier f; 37identifier f;
49position p2; 38position p2;
@@ -59,7 +48,7 @@ position p2;
59 48
60// For org and report modes 49// For org and report modes
61 50
62@r depends on !context && !patch && (org || report) exists@ 51@r depends on !context && (org || report) exists@
63expression subE <= ifm.E; 52expression subE <= ifm.E;
64expression *ifm.E; 53expression *ifm.E;
65expression E1,E2; 54expression E1,E2;
@@ -99,7 +88,7 @@ if@p1 ((E == NULL && ...) || ...)
99} 88}
100else S3 89else S3
101 90
102@script:python depends on !context && !patch && !org && report@ 91@script:python depends on !context && !org && report@
103p << r.p; 92p << r.p;
104p1 << ifm.p1; 93p1 << ifm.p1;
105x << ifm.E; 94x << ifm.E;
@@ -109,7 +98,7 @@ msg="ERROR: %s is NULL but dereferenced." % (x)
109coccilib.report.print_report(p[0], msg) 98coccilib.report.print_report(p[0], msg)
110cocci.include_match(False) 99cocci.include_match(False)
111 100
112@script:python depends on !context && !patch && org && !report@ 101@script:python depends on !context && org && !report@
113p << r.p; 102p << r.p;
114p1 << ifm.p1; 103p1 << ifm.p1;
115x << ifm.E; 104x << ifm.E;
@@ -120,7 +109,7 @@ msg_safe=msg.replace("[","@(").replace("]",")")
120cocci.print_main(msg_safe,p) 109cocci.print_main(msg_safe,p)
121cocci.include_match(False) 110cocci.include_match(False)
122 111
123@s depends on !context && !patch && (org || report) exists@ 112@s depends on !context && (org || report) exists@
124expression subE <= ifm.E; 113expression subE <= ifm.E;
125expression *ifm.E; 114expression *ifm.E;
126expression E1,E2; 115expression E1,E2;
@@ -159,7 +148,7 @@ if@p1 ((E == NULL && ...) || ...)
159} 148}
160else S3 149else S3
161 150
162@script:python depends on !context && !patch && !org && report@ 151@script:python depends on !context && !org && report@
163p << s.p; 152p << s.p;
164p1 << ifm.p1; 153p1 << ifm.p1;
165x << ifm.E; 154x << ifm.E;
@@ -168,7 +157,7 @@ x << ifm.E;
168msg="ERROR: %s is NULL but dereferenced." % (x) 157msg="ERROR: %s is NULL but dereferenced." % (x)
169coccilib.report.print_report(p[0], msg) 158coccilib.report.print_report(p[0], msg)
170 159
171@script:python depends on !context && !patch && org && !report@ 160@script:python depends on !context && org && !report@
172p << s.p; 161p << s.p;
173p1 << ifm.p1; 162p1 << ifm.p1;
174x << ifm.E; 163x << ifm.E;
@@ -180,7 +169,7 @@ cocci.print_main(msg_safe,p)
180 169
181// For context mode 170// For context mode
182 171
183@depends on context && !patch && !org && !report exists@ 172@depends on context && !org && !report exists@
184expression subE <= ifm.E; 173expression subE <= ifm.E;
185expression *ifm.E; 174expression *ifm.E;
186expression E1,E2; 175expression E1,E2;
@@ -223,7 +212,7 @@ else S3
223// The following three rules are duplicates of ifm, pr1 and pr2 respectively. 212// 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". 213// It is need because the previous rule as already made a "change".
225 214
226@ifm1 depends on !patch@ 215@ifm1@
227expression *E; 216expression *E;
228statement S1,S2; 217statement S1,S2;
229position p1; 218position p1;
@@ -231,7 +220,7 @@ position p1;
231 220
232if@p1 ((E == NULL && ...) || ...) S1 else S2 221if@p1 ((E == NULL && ...) || ...) S1 else S2
233 222
234@pr11 depends on !patch expression@ 223@pr11 expression@
235expression *ifm1.E; 224expression *ifm1.E;
236identifier f; 225identifier f;
237position p1; 226position p1;
@@ -239,7 +228,7 @@ position p1;
239 228
240 (E != NULL && ...) ? <+...E->f@p1...+> : ... 229 (E != NULL && ...) ? <+...E->f@p1...+> : ...
241 230
242@pr12 depends on !patch expression@ 231@pr12 expression@
243expression *ifm1.E; 232expression *ifm1.E;
244identifier f; 233identifier f;
245position p2; 234position p2;
@@ -253,7 +242,7 @@ position p2;
253 sizeof(<+...E->f@p2...+>) 242 sizeof(<+...E->f@p2...+>)
254) 243)
255 244
256@depends on context && !patch && !org && !report exists@ 245@depends on context && !org && !report exists@
257expression subE <= ifm1.E; 246expression subE <= ifm1.E;
258expression *ifm1.E; 247expression *ifm1.E;
259expression E1,E2; 248expression E1,E2;
diff --git a/scripts/config b/scripts/config
index 608d7fdb13e8..a7c7c4b8e957 100755
--- a/scripts/config
+++ b/scripts/config
@@ -10,8 +10,10 @@ commands:
10 --enable|-e option Enable option 10 --enable|-e option Enable option
11 --disable|-d option Disable option 11 --disable|-d option Disable option
12 --module|-m option Turn option into a module 12 --module|-m option Turn option into a module
13 --set-str option value 13 --set-str option string
14 Set option to "value" 14 Set option to "string"
15 --set-val option value
16 Set option to value
15 --state|-s option Print state of option (n,y,m,undef) 17 --state|-s option Print state of option (n,y,m,undef)
16 18
17 --enable-after|-E beforeopt option 19 --enable-after|-E beforeopt option
@@ -86,7 +88,7 @@ while [ "$1" != "" ] ; do
86 B=$ARG 88 B=$ARG
87 shift 2 89 shift 2
88 ;; 90 ;;
89 --*) 91 -*)
90 checkarg "$1" 92 checkarg "$1"
91 shift 93 shift
92 ;; 94 ;;
@@ -109,6 +111,11 @@ while [ "$1" != "" ] ; do
109 shift 111 shift
110 ;; 112 ;;
111 113
114 --set-val)
115 set_var "CONFIG_$ARG" "CONFIG_$ARG=$1"
116 shift
117 ;;
118
112 --state|-s) 119 --state|-s)
113 if grep -q "# CONFIG_$ARG is not set" $FN ; then 120 if grep -q "# CONFIG_$ARG is not set" $FN ; then
114 echo n 121 echo n
diff --git a/scripts/genksyms/parse.c_shipped b/scripts/genksyms/parse.c_shipped
index eaee44e66a43..809b949e495b 100644
--- a/scripts/genksyms/parse.c_shipped
+++ b/scripts/genksyms/parse.c_shipped
@@ -160,7 +160,7 @@
160 160
161 161
162#include <assert.h> 162#include <assert.h>
163#include <malloc.h> 163#include <stdlib.h>
164#include "genksyms.h" 164#include "genksyms.h"
165 165
166static int is_typedef; 166static int is_typedef;
diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y
index 10d7dc724b6d..09a265cd7193 100644
--- a/scripts/genksyms/parse.y
+++ b/scripts/genksyms/parse.y
@@ -24,7 +24,7 @@
24%{ 24%{
25 25
26#include <assert.h> 26#include <assert.h>
27#include <malloc.h> 27#include <stdlib.h>
28#include "genksyms.h" 28#include "genksyms.h"
29 29
30static int is_typedef; 30static int is_typedef;
diff --git a/scripts/headers.sh b/scripts/headers.sh
index 1ddcdd38d97f..978b42b3acd7 100755
--- a/scripts/headers.sh
+++ b/scripts/headers.sh
@@ -13,7 +13,7 @@ do_command()
13 fi 13 fi
14} 14}
15 15
16archs=$(ls ${srctree}/arch) 16archs=${HDR_ARCH_LIST:-$(ls ${srctree}/arch)}
17 17
18for arch in ${archs}; do 18for arch in ${archs}; do
19 case ${arch} in 19 case ${arch} in
diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl
index 50d6cfd1fa77..7957e7a5166a 100644
--- a/scripts/headers_check.pl
+++ b/scripts/headers_check.pl
@@ -64,10 +64,10 @@ sub check_include
64 64
65sub check_declarations 65sub check_declarations
66{ 66{
67 if ($line =~m/^\s*extern\b/) { 67 if ($line =~m/^(\s*extern|unsigned|char|short|int|long|void)\b/) {
68 printf STDERR "$filename:$lineno: " . 68 printf STDERR "$filename:$lineno: " .
69 "userspace cannot call function or variable " . 69 "userspace cannot reference function or " .
70 "defined in the kernel\n"; 70 "variable defined in the kernel\n";
71 } 71 }
72} 72}
73 73
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
index 4ca3be3b2e50..efb3be10d428 100644
--- a/scripts/headers_install.pl
+++ b/scripts/headers_install.pl
@@ -45,6 +45,13 @@ foreach my $file (@files) {
45 close $in; 45 close $in;
46 46
47 system $unifdef . " $tmpfile > $installdir/$file"; 47 system $unifdef . " $tmpfile > $installdir/$file";
48 # unifdef will exit 0 on success, and will exit 1 when the
49 # file was processed successfully but no changes were made,
50 # so abort only when it's higher than that.
51 my $e = $? >> 8;
52 if ($e > 1) {
53 die "$tmpfile: $!\n";
54 }
48 unlink $tmpfile; 55 unlink $tmpfile;
49} 56}
50exit 0; 57exit 0;
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 5459a38be866..659326c3e895 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -529,8 +529,6 @@ int main(int ac, char **av)
529 } 529 }
530 break; 530 break;
531 case savedefconfig: 531 case savedefconfig:
532 conf_read(NULL);
533 break;
534 case silentoldconfig: 532 case silentoldconfig:
535 case oldaskconfig: 533 case oldaskconfig:
536 case oldconfig: 534 case oldconfig:
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 9df80114b47b..61c35bf2d9cb 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -440,12 +440,11 @@ static void conf_write_string(bool headerfile, const char *name,
440 fputs("\"\n", out); 440 fputs("\"\n", out);
441} 441}
442 442
443static void conf_write_symbol(struct symbol *sym, enum symbol_type type, 443static void conf_write_symbol(struct symbol *sym, FILE *out, bool write_no)
444 FILE *out, bool write_no)
445{ 444{
446 const char *str; 445 const char *str;
447 446
448 switch (type) { 447 switch (sym->type) {
449 case S_BOOLEAN: 448 case S_BOOLEAN:
450 case S_TRISTATE: 449 case S_TRISTATE:
451 switch (sym_get_tristate_value(sym)) { 450 switch (sym_get_tristate_value(sym)) {
@@ -532,7 +531,7 @@ int conf_write_defconfig(const char *filename)
532 goto next_menu; 531 goto next_menu;
533 } 532 }
534 } 533 }
535 conf_write_symbol(sym, sym->type, out, true); 534 conf_write_symbol(sym, out, true);
536 } 535 }
537next_menu: 536next_menu:
538 if (menu->list != NULL) { 537 if (menu->list != NULL) {
@@ -561,7 +560,6 @@ int conf_write(const char *name)
561 const char *basename; 560 const char *basename;
562 const char *str; 561 const char *str;
563 char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1]; 562 char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
564 enum symbol_type type;
565 time_t now; 563 time_t now;
566 int use_timestamp = 1; 564 int use_timestamp = 1;
567 char *env; 565 char *env;
@@ -633,14 +631,8 @@ int conf_write(const char *name)
633 if (!(sym->flags & SYMBOL_WRITE)) 631 if (!(sym->flags & SYMBOL_WRITE))
634 goto next; 632 goto next;
635 sym->flags &= ~SYMBOL_WRITE; 633 sym->flags &= ~SYMBOL_WRITE;
636 type = sym->type;
637 if (type == S_TRISTATE) {
638 sym_calc_value(modules_sym);
639 if (modules_sym->curr.tri == no)
640 type = S_BOOLEAN;
641 }
642 /* Write config symbol to file */ 634 /* Write config symbol to file */
643 conf_write_symbol(sym, type, out, true); 635 conf_write_symbol(sym, out, true);
644 } 636 }
645 637
646next: 638next:
@@ -833,8 +825,7 @@ int conf_write_autoconf(void)
833 " * Automatically generated C config: don't edit\n" 825 " * Automatically generated C config: don't edit\n"
834 " * %s\n" 826 " * %s\n"
835 " * %s" 827 " * %s"
836 " */\n" 828 " */\n",
837 "#define AUTOCONF_INCLUDED\n",
838 rootmenu.prompt->text, ctime(&now)); 829 rootmenu.prompt->text, ctime(&now));
839 830
840 for_all_symbols(i, sym) { 831 for_all_symbols(i, sym) {
@@ -843,7 +834,7 @@ int conf_write_autoconf(void)
843 continue; 834 continue;
844 835
845 /* write symbol to config file */ 836 /* write symbol to config file */
846 conf_write_symbol(sym, sym->type, out, false); 837 conf_write_symbol(sym, out, false);
847 838
848 /* update autoconf and tristate files */ 839 /* update autoconf and tristate files */
849 switch (sym->type) { 840 switch (sym->type) {
@@ -946,7 +937,7 @@ static void randomize_choice_values(struct symbol *csym)
946 int cnt, def; 937 int cnt, def;
947 938
948 /* 939 /*
949 * If choice is mod then we may have more items slected 940 * If choice is mod then we may have more items selected
950 * and if no then no-one. 941 * and if no then no-one.
951 * In both cases stop. 942 * In both cases stop.
952 */ 943 */
@@ -1042,10 +1033,10 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
1042 1033
1043 /* 1034 /*
1044 * We have different type of choice blocks. 1035 * We have different type of choice blocks.
1045 * If curr.tri equal to mod then we can select several 1036 * If curr.tri equals to mod then we can select several
1046 * choice symbols in one block. 1037 * choice symbols in one block.
1047 * In this case we do nothing. 1038 * In this case we do nothing.
1048 * If curr.tri equal yes then only one symbol can be 1039 * If curr.tri equals yes then only one symbol can be
1049 * selected in a choice block and we set it to yes, 1040 * selected in a choice block and we set it to yes,
1050 * and the rest to no. 1041 * and the rest to no.
1051 */ 1042 */
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 330e7c0048a8..001003452f68 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -64,7 +64,7 @@ struct expr *expr_alloc_or(struct expr *e1, struct expr *e2)
64 return e2 ? expr_alloc_two(E_OR, e1, e2) : e1; 64 return e2 ? expr_alloc_two(E_OR, e1, e2) : e1;
65} 65}
66 66
67struct expr *expr_copy(struct expr *org) 67struct expr *expr_copy(const struct expr *org)
68{ 68{
69 struct expr *e; 69 struct expr *e;
70 70
@@ -1013,6 +1013,48 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2)
1013#endif 1013#endif
1014} 1014}
1015 1015
1016static inline struct expr *
1017expr_get_leftmost_symbol(const struct expr *e)
1018{
1019
1020 if (e == NULL)
1021 return NULL;
1022
1023 while (e->type != E_SYMBOL)
1024 e = e->left.expr;
1025
1026 return expr_copy(e);
1027}
1028
1029/*
1030 * Given expression `e1' and `e2', returns the leaf of the longest
1031 * sub-expression of `e1' not containing 'e2.
1032 */
1033struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2)
1034{
1035 struct expr *ret;
1036
1037 switch (e1->type) {
1038 case E_OR:
1039 return expr_alloc_and(
1040 expr_simplify_unmet_dep(e1->left.expr, e2),
1041 expr_simplify_unmet_dep(e1->right.expr, e2));
1042 case E_AND: {
1043 struct expr *e;
1044 e = expr_alloc_and(expr_copy(e1), expr_copy(e2));
1045 e = expr_eliminate_dups(e);
1046 ret = (!expr_eq(e, e1)) ? e1 : NULL;
1047 expr_free(e);
1048 break;
1049 }
1050 default:
1051 ret = e1;
1052 break;
1053 }
1054
1055 return expr_get_leftmost_symbol(ret);
1056}
1057
1016void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken) 1058void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)
1017{ 1059{
1018 if (!e) { 1060 if (!e) {
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index e57826ced380..3d238db49764 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -192,7 +192,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e
192struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2); 192struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2);
193struct expr *expr_alloc_and(struct expr *e1, struct expr *e2); 193struct expr *expr_alloc_and(struct expr *e1, struct expr *e2);
194struct expr *expr_alloc_or(struct expr *e1, struct expr *e2); 194struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
195struct expr *expr_copy(struct expr *org); 195struct expr *expr_copy(const struct expr *org);
196void expr_free(struct expr *e); 196void expr_free(struct expr *e);
197int expr_eq(struct expr *e1, struct expr *e2); 197int expr_eq(struct expr *e1, struct expr *e2);
198void expr_eliminate_eq(struct expr **ep1, struct expr **ep2); 198void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
@@ -207,6 +207,7 @@ struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2);
207struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2); 207struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2);
208void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2); 208void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2);
209struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym); 209struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
210struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2);
210 211
211void expr_fprint(struct expr *e, FILE *out); 212void expr_fprint(struct expr *e, FILE *out);
212struct gstr; /* forward */ 213struct gstr; /* forward */
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 3f7240df0f3b..febf0c94d558 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -14,6 +14,7 @@
14static inline const char *gettext(const char *txt) { return txt; } 14static inline const char *gettext(const char *txt) { return txt; }
15static inline void textdomain(const char *domainname) {} 15static inline void textdomain(const char *domainname) {}
16static inline void bindtextdomain(const char *name, const char *dir) {} 16static inline void bindtextdomain(const char *name, const char *dir) {}
17static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c; }
17#endif 18#endif
18 19
19#ifdef __cplusplus 20#ifdef __cplusplus
@@ -67,10 +68,12 @@ struct kconf_id {
67 enum symbol_type stype; 68 enum symbol_type stype;
68}; 69};
69 70
71#ifdef YYDEBUG
72extern int zconfdebug;
73#endif
74
70int zconfparse(void); 75int zconfparse(void);
71void zconfdump(FILE *out); 76void zconfdump(FILE *out);
72
73extern int zconfdebug;
74void zconf_starthelp(void); 77void zconf_starthelp(void);
75FILE *zconf_fopen(const char *name); 78FILE *zconf_fopen(const char *name);
76void zconf_initscan(const char *name); 79void zconf_initscan(const char *name);
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index b9d9aa18e6d6..5fdf10dc1d8a 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -140,6 +140,20 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e
140 } 140 }
141 if (current_entry->prompt && current_entry != &rootmenu) 141 if (current_entry->prompt && current_entry != &rootmenu)
142 prop_warn(prop, "prompt redefined"); 142 prop_warn(prop, "prompt redefined");
143
144 /* Apply all upper menus' visibilities to actual prompts. */
145 if(type == P_PROMPT) {
146 struct menu *menu = current_entry;
147
148 while ((menu = menu->parent) != NULL) {
149 if (!menu->visibility)
150 continue;
151 prop->visible.expr
152 = expr_alloc_and(prop->visible.expr,
153 menu->visibility);
154 }
155 }
156
143 current_entry->prompt = prop; 157 current_entry->prompt = prop;
144 } 158 }
145 prop->text = prompt; 159 prop->text = prompt;
@@ -189,7 +203,7 @@ void menu_add_option(int token, char *arg)
189 } 203 }
190} 204}
191 205
192static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2) 206static int menu_validate_number(struct symbol *sym, struct symbol *sym2)
193{ 207{
194 return sym2->type == S_INT || sym2->type == S_HEX || 208 return sym2->type == S_INT || sym2->type == S_HEX ||
195 (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); 209 (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name));
@@ -207,6 +221,15 @@ static void sym_check_prop(struct symbol *sym)
207 prop_warn(prop, 221 prop_warn(prop,
208 "default for config symbol '%s'" 222 "default for config symbol '%s'"
209 " must be a single symbol", sym->name); 223 " must be a single symbol", sym->name);
224 if (prop->expr->type != E_SYMBOL)
225 break;
226 sym2 = prop_get_symbol(prop);
227 if (sym->type == S_HEX || sym->type == S_INT) {
228 if (!menu_validate_number(sym, sym2))
229 prop_warn(prop,
230 "'%s': number is invalid",
231 sym->name);
232 }
210 break; 233 break;
211 case P_SELECT: 234 case P_SELECT:
212 sym2 = prop_get_symbol(prop); 235 sym2 = prop_get_symbol(prop);
@@ -226,8 +249,8 @@ static void sym_check_prop(struct symbol *sym)
226 if (sym->type != S_INT && sym->type != S_HEX) 249 if (sym->type != S_INT && sym->type != S_HEX)
227 prop_warn(prop, "range is only allowed " 250 prop_warn(prop, "range is only allowed "
228 "for int or hex symbols"); 251 "for int or hex symbols");
229 if (!menu_range_valid_sym(sym, prop->expr->left.sym) || 252 if (!menu_validate_number(sym, prop->expr->left.sym) ||
230 !menu_range_valid_sym(sym, prop->expr->right.sym)) 253 !menu_validate_number(sym, prop->expr->right.sym))
231 prop_warn(prop, "range is invalid"); 254 prop_warn(prop, "range is invalid");
232 break; 255 break;
233 default: 256 default:
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 272a987f23e0..db56377393d7 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -248,7 +248,7 @@ search_help[] = N_(
248"Only relevant lines are shown.\n" 248"Only relevant lines are shown.\n"
249"\n\n" 249"\n\n"
250"Search examples:\n" 250"Search examples:\n"
251"Examples: USB = > find all symbols containing USB\n" 251"Examples: USB => find all symbols containing USB\n"
252" ^USB => find all symbols starting with USB\n" 252" ^USB => find all symbols starting with USB\n"
253" USB$ => find all symbols ending with USB\n" 253" USB$ => find all symbols ending with USB\n"
254"\n"); 254"\n");
@@ -1266,9 +1266,13 @@ static void conf_choice(struct menu *menu)
1266 if (child->sym == sym_get_choice_value(menu->sym)) 1266 if (child->sym == sym_get_choice_value(menu->sym))
1267 item_make(child, ':', "<X> %s", 1267 item_make(child, ':', "<X> %s",
1268 _(menu_get_prompt(child))); 1268 _(menu_get_prompt(child)));
1269 else 1269 else if (child->sym)
1270 item_make(child, ':', " %s", 1270 item_make(child, ':', " %s",
1271 _(menu_get_prompt(child))); 1271 _(menu_get_prompt(child)));
1272 else
1273 item_make(child, ':', "*** %s ***",
1274 _(menu_get_prompt(child)));
1275
1272 if (child->sym == active){ 1276 if (child->sym == active){
1273 last_top_row = top_row(curses_menu); 1277 last_top_row = top_row(curses_menu);
1274 selected_index = i; 1278 selected_index = i;
@@ -1334,7 +1338,7 @@ static void conf_choice(struct menu *menu)
1334 break; 1338 break;
1335 1339
1336 child = item_data(); 1340 child = item_data();
1337 if (!child || !menu_is_visible(child)) 1341 if (!child || !menu_is_visible(child) || !child->sym)
1338 continue; 1342 continue;
1339 switch (res) { 1343 switch (res) {
1340 case ' ': 1344 case ' ':
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index af6e9f3de950..a796c95fe8a0 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -351,12 +351,16 @@ void sym_calc_value(struct symbol *sym)
351 } 351 }
352 calc_newval: 352 calc_newval:
353 if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) { 353 if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) {
354 struct expr *e;
355 e = expr_simplify_unmet_dep(sym->rev_dep.expr,
356 sym->dir_dep.expr);
354 fprintf(stderr, "warning: ("); 357 fprintf(stderr, "warning: (");
355 expr_fprint(sym->rev_dep.expr, stderr); 358 expr_fprint(e, stderr);
356 fprintf(stderr, ") selects %s which has unmet direct dependencies (", 359 fprintf(stderr, ") selects %s which has unmet direct dependencies (",
357 sym->name); 360 sym->name);
358 expr_fprint(sym->dir_dep.expr, stderr); 361 expr_fprint(sym->dir_dep.expr, stderr);
359 fprintf(stderr, ")\n"); 362 fprintf(stderr, ")\n");
363 expr_free(e);
360 } 364 }
361 newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri); 365 newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
362 } 366 }
@@ -686,7 +690,7 @@ const char *sym_get_string_default(struct symbol *sym)
686 switch (sym->type) { 690 switch (sym->type) {
687 case S_BOOLEAN: 691 case S_BOOLEAN:
688 case S_TRISTATE: 692 case S_TRISTATE:
689 /* The visibility imay limit the value from yes => mod */ 693 /* The visibility may limit the value from yes => mod */
690 val = EXPR_AND(expr_calc_value(prop->expr), prop->visible.tri); 694 val = EXPR_AND(expr_calc_value(prop->expr), prop->visible.tri);
691 break; 695 break;
692 default: 696 default:
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 39580a5dc5df..9f85012acf0d 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -155,6 +155,8 @@ use strict;
155# '@parameter' - name of a parameter 155# '@parameter' - name of a parameter
156# '%CONST' - name of a constant. 156# '%CONST' - name of a constant.
157 157
158## init lots of data
159
158my $errors = 0; 160my $errors = 0;
159my $warnings = 0; 161my $warnings = 0;
160my $anon_struct_union = 0; 162my $anon_struct_union = 0;
@@ -218,21 +220,14 @@ my %highlights_list = ( $type_constant, "\$1",
218 $type_param, "\$1" ); 220 $type_param, "\$1" );
219my $blankline_list = ""; 221my $blankline_list = "";
220 222
221sub usage {
222 print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man | -list ]\n";
223 print " [ -no-doc-sections ]\n";
224 print " [ -function funcname [ -function funcname ...] ]\n";
225 print " [ -nofunction funcname [ -nofunction funcname ...] ]\n";
226 print " c source file(s) > outputfile\n";
227 print " -v : verbose output, more warnings & other info listed\n";
228 exit 1;
229}
230
231# read arguments 223# read arguments
232if ($#ARGV == -1) { 224if ($#ARGV == -1) {
233 usage(); 225 usage();
234} 226}
235 227
228my $kernelversion;
229my $dohighlight = "";
230
236my $verbose = 0; 231my $verbose = 0;
237my $output_mode = "man"; 232my $output_mode = "man";
238my $no_doc_sections = 0; 233my $no_doc_sections = 0;
@@ -245,7 +240,7 @@ my $man_date = ('January', 'February', 'March', 'April', 'May', 'June',
245 'November', 'December')[(localtime)[4]] . 240 'November', 'December')[(localtime)[4]] .
246 " " . ((localtime)[5]+1900); 241 " " . ((localtime)[5]+1900);
247 242
248# Essentially these are globals 243# Essentially these are globals.
249# They probably want to be tidied up, made more localised or something. 244# They probably want to be tidied up, made more localised or something.
250# CAVEAT EMPTOR! Some of the others I localised may not want to be, which 245# CAVEAT EMPTOR! Some of the others I localised may not want to be, which
251# could cause "use of undefined value" or other bugs. 246# could cause "use of undefined value" or other bugs.
@@ -353,6 +348,18 @@ while ($ARGV[0] =~ m/^-(.*)/) {
353 } 348 }
354} 349}
355 350
351# continue execution near EOF;
352
353sub usage {
354 print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man | -list ]\n";
355 print " [ -no-doc-sections ]\n";
356 print " [ -function funcname [ -function funcname ...] ]\n";
357 print " [ -nofunction funcname [ -nofunction funcname ...] ]\n";
358 print " c source file(s) > outputfile\n";
359 print " -v : verbose output, more warnings & other info listed\n";
360 exit 1;
361}
362
356# get kernel version from env 363# get kernel version from env
357sub get_kernel_version() { 364sub get_kernel_version() {
358 my $version = 'unknown kernel version'; 365 my $version = 'unknown kernel version';
@@ -362,15 +369,6 @@ sub get_kernel_version() {
362 } 369 }
363 return $version; 370 return $version;
364} 371}
365my $kernelversion = get_kernel_version();
366
367# generate a sequence of code that will splice in highlighting information
368# using the s// operator.
369my $dohighlight = "";
370foreach my $pattern (keys %highlights) {
371# print STDERR "scanning pattern:$pattern, highlight:($highlights{$pattern})\n";
372 $dohighlight .= "\$contents =~ s:$pattern:$highlights{$pattern}:gs;\n";
373}
374 372
375## 373##
376# dumps section contents to arrays/hashes intended for that purpose. 374# dumps section contents to arrays/hashes intended for that purpose.
@@ -1851,34 +1849,6 @@ sub dump_function($$) {
1851 }); 1849 });
1852} 1850}
1853 1851
1854sub process_file($);
1855
1856# Read the file that maps relative names to absolute names for
1857# separate source and object directories and for shadow trees.
1858if (open(SOURCE_MAP, "<.tmp_filelist.txt")) {
1859 my ($relname, $absname);
1860 while(<SOURCE_MAP>) {
1861 chop();
1862 ($relname, $absname) = (split())[0..1];
1863 $relname =~ s:^/+::;
1864 $source_map{$relname} = $absname;
1865 }
1866 close(SOURCE_MAP);
1867}
1868
1869foreach (@ARGV) {
1870 chomp;
1871 process_file($_);
1872}
1873if ($verbose && $errors) {
1874 print STDERR "$errors errors\n";
1875}
1876if ($verbose && $warnings) {
1877 print STDERR "$warnings warnings\n";
1878}
1879
1880exit($errors);
1881
1882sub reset_state { 1852sub reset_state {
1883 $function = ""; 1853 $function = "";
1884 %constants = (); 1854 %constants = ();
@@ -2285,3 +2255,39 @@ sub process_file($) {
2285 } 2255 }
2286 } 2256 }
2287} 2257}
2258
2259
2260$kernelversion = get_kernel_version();
2261
2262# generate a sequence of code that will splice in highlighting information
2263# using the s// operator.
2264foreach my $pattern (keys %highlights) {
2265# print STDERR "scanning pattern:$pattern, highlight:($highlights{$pattern})\n";
2266 $dohighlight .= "\$contents =~ s:$pattern:$highlights{$pattern}:gs;\n";
2267}
2268
2269# Read the file that maps relative names to absolute names for
2270# separate source and object directories and for shadow trees.
2271if (open(SOURCE_MAP, "<.tmp_filelist.txt")) {
2272 my ($relname, $absname);
2273 while(<SOURCE_MAP>) {
2274 chop();
2275 ($relname, $absname) = (split())[0..1];
2276 $relname =~ s:^/+::;
2277 $source_map{$relname} = $absname;
2278 }
2279 close(SOURCE_MAP);
2280}
2281
2282foreach (@ARGV) {
2283 chomp;
2284 process_file($_);
2285}
2286if ($verbose && $errors) {
2287 print STDERR "$errors errors\n";
2288}
2289if ($verbose && $warnings) {
2290 print STDERR "$warnings warnings\n";
2291}
2292
2293exit($errors);
diff --git a/scripts/mkuboot.sh b/scripts/mkuboot.sh
index 2e3d3cd916b8..446739c7843a 100755
--- a/scripts/mkuboot.sh
+++ b/scripts/mkuboot.sh
@@ -11,7 +11,7 @@ if [ -z "${MKIMAGE}" ]; then
11 if [ -z "${MKIMAGE}" ]; then 11 if [ -z "${MKIMAGE}" ]; then
12 # Doesn't exist 12 # Doesn't exist
13 echo '"mkimage" command not found - U-Boot images will not be built' >&2 13 echo '"mkimage" command not found - U-Boot images will not be built' >&2
14 exit 0; 14 exit 1;
15 fi 15 fi
16fi 16fi
17 17
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 33122ca04e7c..97d2259ae999 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -790,6 +790,7 @@ static const char *section_white_list[] =
790{ 790{
791 ".comment*", 791 ".comment*",
792 ".debug*", 792 ".debug*",
793 ".zdebug*", /* Compressed debug sections. */
793 ".GCC-command-line", /* mn10300 */ 794 ".GCC-command-line", /* mn10300 */
794 ".mdebug*", /* alpha, score, mips etc. */ 795 ".mdebug*", /* alpha, score, mips etc. */
795 ".pdr", /* alpha, score, mips etc. */ 796 ".pdr", /* alpha, score, mips etc. */
@@ -1441,7 +1442,7 @@ static unsigned int *reloc_location(struct elf_info *elf,
1441 int section = shndx2secindex(sechdr->sh_info); 1442 int section = shndx2secindex(sechdr->sh_info);
1442 1443
1443 return (void *)elf->hdr + sechdrs[section].sh_offset + 1444 return (void *)elf->hdr + sechdrs[section].sh_offset +
1444 r->r_offset - sechdrs[section].sh_addr; 1445 r->r_offset;
1445} 1446}
1446 1447
1447static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) 1448static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 49b74e1ee12d..b0b2357aef42 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -25,8 +25,44 @@ create_package() {
25 chown -R root:root "$pdir" 25 chown -R root:root "$pdir"
26 chmod -R go-w "$pdir" 26 chmod -R go-w "$pdir"
27 27
28 # Attempt to find the correct Debian architecture
29 local forcearch="" debarch=""
30 case "$UTS_MACHINE" in
31 i386|ia64|alpha)
32 debarch="$UTS_MACHINE" ;;
33 x86_64)
34 debarch=amd64 ;;
35 sparc*)
36 debarch=sparc ;;
37 s390*)
38 debarch=s390 ;;
39 ppc*)
40 debarch=powerpc ;;
41 parisc*)
42 debarch=hppa ;;
43 mips*)
44 debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y .config && echo el) ;;
45 arm*)
46 debarch=arm$(grep -q CONFIG_AEABI=y .config && echo el) ;;
47 *)
48 echo "" >&2
49 echo "** ** ** WARNING ** ** **" >&2
50 echo "" >&2
51 echo "Your architecture doesn't have it's equivalent" >&2
52 echo "Debian userspace architecture defined!" >&2
53 echo "Falling back to using your current userspace instead!" >&2
54 echo "Please add support for $UTS_MACHINE to ${0} ..." >&2
55 echo "" >&2
56 esac
57 if [ -n "$KBUILD_DEBARCH" ] ; then
58 debarch="$KBUILD_DEBARCH"
59 fi
60 if [ -n "$debarch" ] ; then
61 forcearch="-DArchitecture=$debarch"
62 fi
63
28 # Create the package 64 # Create the package
29 dpkg-gencontrol -isp -p$pname -P"$pdir" 65 dpkg-gencontrol -isp $forcearch -p$pname -P"$pdir"
30 dpkg --build "$pdir" .. 66 dpkg --build "$pdir" ..
31} 67}
32 68
@@ -40,17 +76,27 @@ else
40fi 76fi
41tmpdir="$objtree/debian/tmp" 77tmpdir="$objtree/debian/tmp"
42fwdir="$objtree/debian/fwtmp" 78fwdir="$objtree/debian/fwtmp"
79kernel_headers_dir="$objtree/debian/hdrtmp"
80libc_headers_dir="$objtree/debian/headertmp"
43packagename=linux-image-$version 81packagename=linux-image-$version
44fwpackagename=linux-firmware-image 82fwpackagename=linux-firmware-image
83kernel_headers_packagename=linux-headers-$version
84libc_headers_packagename=linux-libc-dev
45 85
46if [ "$ARCH" = "um" ] ; then 86if [ "$ARCH" = "um" ] ; then
47 packagename=user-mode-linux-$version 87 packagename=user-mode-linux-$version
48fi 88fi
49 89
50# Setup the directory structure 90# Setup the directory structure
51rm -rf "$tmpdir" "$fwdir" 91rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir"
52mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" 92mkdir -m 755 -p "$tmpdir/DEBIAN"
53mkdir -p "$fwdir/DEBIAN" "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename" 93mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename"
94mkdir -m 755 -p "$fwdir/DEBIAN"
95mkdir -p "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename"
96mkdir -m 755 -p "$libc_headers_dir/DEBIAN"
97mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename"
98mkdir -m 755 -p "$kernel_headers_dir/DEBIAN"
99mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename"
54if [ "$ARCH" = "um" ] ; then 100if [ "$ARCH" = "um" ] ; then
55 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" 101 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin"
56fi 102fi
@@ -81,6 +127,9 @@ if grep -q '^CONFIG_MODULES=y' .config ; then
81 fi 127 fi
82fi 128fi
83 129
130make headers_check
131make headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
132
84# Install the maintainer scripts 133# Install the maintainer scripts
85# Note: hook scripts under /etc/kernel are also executed by official Debian 134# Note: hook scripts under /etc/kernel are also executed by official Debian
86# kernel packages, as well as kernel packages built using make-kpkg 135# kernel packages, as well as kernel packages built using make-kpkg
@@ -188,6 +237,30 @@ EOF
188 237
189fi 238fi
190 239
240# Build header package
241find . -name Makefile -o -name Kconfig\* -o -name \*.pl > /tmp/files$$
242find arch/x86/include include scripts -type f >> /tmp/files$$
243(cd $objtree; find .config Module.symvers include scripts -type f >> /tmp/objfiles$$)
244destdir=$kernel_headers_dir/usr/src/linux-headers-$version
245mkdir -p "$destdir"
246tar -c -f - -T /tmp/files$$ | (cd $destdir; tar -xf -)
247(cd $objtree; tar -c -f - -T /tmp/objfiles$$) | (cd $destdir; tar -xf -)
248rm -f /tmp/files$$ /tmp/objfiles$$
249arch=$(dpkg --print-architecture)
250
251cat <<EOF >> debian/control
252
253Package: $kernel_headers_packagename
254Provides: linux-headers, linux-headers-2.6
255Architecture: $arch
256Description: Linux kernel headers for $KERNELRELEASE on $arch
257 This package provides kernel header files for $KERNELRELEASE on $arch
258 .
259 This is useful for people who need to build external modules
260EOF
261
262create_package "$kernel_headers_packagename" "$kernel_headers_dir"
263
191# Do we have firmware? Move it out of the way and build it into a package. 264# Do we have firmware? Move it out of the way and build it into a package.
192if [ -e "$tmpdir/lib/firmware" ]; then 265if [ -e "$tmpdir/lib/firmware" ]; then
193 mv "$tmpdir/lib/firmware" "$fwdir/lib/" 266 mv "$tmpdir/lib/firmware" "$fwdir/lib/"
@@ -203,6 +276,18 @@ EOF
203 create_package "$fwpackagename" "$fwdir" 276 create_package "$fwpackagename" "$fwdir"
204fi 277fi
205 278
279cat <<EOF >> debian/control
280
281Package: $libc_headers_packagename
282Section: devel
283Provides: linux-kernel-headers
284Architecture: any
285Description: Linux support headers for userspace development
286 This package provides userspaces headers from the Linux kernel. These headers
287 are used by the installed headers for GNU glibc and other system libraries.
288EOF
289
290create_package "$libc_headers_packagename" "$libc_headers_dir"
206create_package "$packagename" "$tmpdir" 291create_package "$packagename" "$tmpdir"
207 292
208exit 0 293exit 0
diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
index f2f32eee2c5b..038b3d1e2981 100644
--- a/scripts/recordmcount.c
+++ b/scripts/recordmcount.c
@@ -38,6 +38,7 @@ static void *ehdr_curr; /* current ElfXX_Ehdr * for resource cleanup */
38static char gpfx; /* prefix for global symbol name (sometimes '_') */ 38static char gpfx; /* prefix for global symbol name (sometimes '_') */
39static struct stat sb; /* Remember .st_size, etc. */ 39static struct stat sb; /* Remember .st_size, etc. */
40static jmp_buf jmpenv; /* setjmp/longjmp per-file error escape */ 40static jmp_buf jmpenv; /* setjmp/longjmp per-file error escape */
41static const char *altmcount; /* alternate mcount symbol name */
41 42
42/* setjmp() return values */ 43/* setjmp() return values */
43enum { 44enum {
@@ -299,7 +300,9 @@ do_file(char const *const fname)
299 fail_file(); 300 fail_file();
300 } break; 301 } break;
301 case EM_386: reltype = R_386_32; break; 302 case EM_386: reltype = R_386_32; break;
302 case EM_ARM: reltype = R_ARM_ABS32; break; 303 case EM_ARM: reltype = R_ARM_ABS32;
304 altmcount = "__gnu_mcount_nc";
305 break;
303 case EM_IA_64: reltype = R_IA64_IMM64; gpfx = '_'; break; 306 case EM_IA_64: reltype = R_IA64_IMM64; gpfx = '_'; break;
304 case EM_MIPS: /* reltype: e_class */ gpfx = '_'; break; 307 case EM_MIPS: /* reltype: e_class */ gpfx = '_'; break;
305 case EM_PPC: reltype = R_PPC_ADDR32; gpfx = '_'; break; 308 case EM_PPC: reltype = R_PPC_ADDR32; gpfx = '_'; break;
@@ -357,7 +360,7 @@ do_file(char const *const fname)
357int 360int
358main(int argc, char const *argv[]) 361main(int argc, char const *argv[])
359{ 362{
360 const char ftrace[] = "kernel/trace/ftrace.o"; 363 const char ftrace[] = "/ftrace.o";
361 int ftrace_size = sizeof(ftrace) - 1; 364 int ftrace_size = sizeof(ftrace) - 1;
362 int n_error = 0; /* gcc-4.3.0 false positive complaint */ 365 int n_error = 0; /* gcc-4.3.0 false positive complaint */
363 366
diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index 39667174971d..baf187bee983 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -275,11 +275,12 @@ static uint_t *sift_rel_mcount(uint_t *mlocp,
275 Elf_Sym const *const symp = 275 Elf_Sym const *const symp =
276 &sym0[Elf_r_sym(relp)]; 276 &sym0[Elf_r_sym(relp)];
277 char const *symname = &str0[w(symp->st_name)]; 277 char const *symname = &str0[w(symp->st_name)];
278 char const *mcount = '_' == gpfx ? "_mcount" : "mcount";
278 279
279 if ('.' == symname[0]) 280 if ('.' == symname[0])
280 ++symname; /* ppc64 hack */ 281 ++symname; /* ppc64 hack */
281 if (0 == strcmp((('_' == gpfx) ? "_mcount" : "mcount"), 282 if (0 == strcmp(mcount, symname) ||
282 symname)) 283 (altmcount && 0 == strcmp(altmcount, symname)))
283 mcountsym = Elf_r_sym(relp); 284 mcountsym = Elf_r_sym(relp);
284 } 285 }
285 286
diff --git a/scripts/tags.sh b/scripts/tags.sh
index bbbe584d4494..92fdc4546141 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -123,7 +123,7 @@ exuberant()
123 -I ____cacheline_internodealigned_in_smp \ 123 -I ____cacheline_internodealigned_in_smp \
124 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ 124 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
125 -I DEFINE_TRACE,EXPORT_TRACEPOINT_SYMBOL,EXPORT_TRACEPOINT_SYMBOL_GPL \ 125 -I DEFINE_TRACE,EXPORT_TRACEPOINT_SYMBOL,EXPORT_TRACEPOINT_SYMBOL_GPL \
126 --extra=+f --c-kinds=-px \ 126 --extra=+f --c-kinds=+px \
127 --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \ 127 --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \
128 --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' \ 128 --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' \
129 --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \ 129 --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \