aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-14 17:12:18 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-14 17:12:18 -0400
commit45e3e1935e2857c54783291107d33323b3ef33c8 (patch)
tree26a6e3228b52d0f96f6e56e5879ca898fe909592 /scripts
parentcf5046323ea254be72535648a9d090b18b8510f3 (diff)
parent3f8d9ced7746f3f329ccca0bb3f3c7a2c15c47bb (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next: (53 commits) .gitignore: ignore *.lzma files kbuild: add generic --set-str option to scripts/config kbuild: simplify argument loop in scripts/config kbuild: handle non-existing options in scripts/config kallsyms: generalize text region handling kallsyms: support kernel symbols in Blackfin on-chip memory documentation: make version fix kbuild: fix a compile warning gitignore: Add GNU GLOBAL files to top .gitignore kbuild: fix delay in setlocalversion on readonly source README: fix misleading pointer to the defconf directory vmlinux.lds.h update kernel-doc: cleanup perl script Improve vmlinux.lds.h support for arch specific linker scripts kbuild: fix headers_exports with boolean expression kbuild/headers_check: refine extern check kbuild: fix "Argument list too long" error for "make headers_check", ignore *.patch files Remove bashisms from scripts menu: fix embedded menu presentation ...
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.headersinst8
-rw-r--r--scripts/basic/docproc.c13
-rw-r--r--scripts/basic/fixdep.c5
-rwxr-xr-xscripts/config87
-rw-r--r--scripts/gcc-version.sh2
-rwxr-xr-xscripts/headers.sh7
-rw-r--r--scripts/headers_check.pl14
-rw-r--r--scripts/kallsyms.c76
-rw-r--r--scripts/kconfig/.gitignore3
-rw-r--r--scripts/kconfig/Makefile4
-rw-r--r--scripts/kconfig/conf.c7
-rw-r--r--scripts/kconfig/confdata.c20
-rw-r--r--scripts/kconfig/lkc.h1
-rw-r--r--scripts/kconfig/lxdialog/checklist.c3
-rw-r--r--scripts/kconfig/mconf.c10
-rw-r--r--scripts/kconfig/qconf.cc48
-rw-r--r--scripts/kconfig/util.c6
-rwxr-xr-xscripts/kernel-doc174
-rw-r--r--scripts/mod/modpost.c50
-rw-r--r--scripts/package/builddeb149
-rwxr-xr-xscripts/setlocalversion6
-rw-r--r--scripts/unifdef.c48
-rwxr-xr-xscripts/ver_linux2
23 files changed, 462 insertions, 281 deletions
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 095cfc8b9db..0fcd8383877 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -54,8 +54,12 @@ quiet_cmd_remove = REMOVE $(unwanted)
54 cmd_remove = rm -f $(unwanted-file) 54 cmd_remove = rm -f $(unwanted-file)
55 55
56quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files) 56quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files)
57 cmd_check = $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH) \ 57# Headers list can be pretty long, xargs helps to avoid
58 $(addprefix $(install)/, $(all-files)); \ 58# the "Argument list too long" error.
59 cmd_check = for f in $(all-files); do \
60 echo "$(install)/$${f}"; done \
61 | xargs \
62 $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \
59 touch $@ 63 touch $@
60 64
61PHONY += __headersinst __headerscheck 65PHONY += __headersinst __headerscheck
diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c
index 35bdc68b6e6..4c9523ef9c0 100644
--- a/scripts/basic/docproc.c
+++ b/scripts/basic/docproc.c
@@ -69,7 +69,7 @@ FILELINE * docsection;
69#define NOFUNCTION "-nofunction" 69#define NOFUNCTION "-nofunction"
70#define NODOCSECTIONS "-no-doc-sections" 70#define NODOCSECTIONS "-no-doc-sections"
71 71
72char *srctree; 72static char *srctree, *kernsrctree;
73 73
74void usage (void) 74void usage (void)
75{ 75{
@@ -77,7 +77,8 @@ void usage (void)
77 fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); 77 fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n");
78 fprintf(stderr, "doc: frontend when generating kernel documentation\n"); 78 fprintf(stderr, "doc: frontend when generating kernel documentation\n");
79 fprintf(stderr, "depend: generate list of files referenced within file\n"); 79 fprintf(stderr, "depend: generate list of files referenced within file\n");
80 fprintf(stderr, "Environment variable SRCTREE: absolute path to kernel source tree.\n"); 80 fprintf(stderr, "Environment variable SRCTREE: absolute path to sources.\n");
81 fprintf(stderr, " KBUILD_SRC: absolute path to kernel source tree.\n");
81} 82}
82 83
83/* 84/*
@@ -96,8 +97,8 @@ void exec_kernel_doc(char **svec)
96 exit(1); 97 exit(1);
97 case 0: 98 case 0:
98 memset(real_filename, 0, sizeof(real_filename)); 99 memset(real_filename, 0, sizeof(real_filename));
99 strncat(real_filename, srctree, PATH_MAX); 100 strncat(real_filename, kernsrctree, PATH_MAX);
100 strncat(real_filename, KERNELDOCPATH KERNELDOC, 101 strncat(real_filename, "/" KERNELDOCPATH KERNELDOC,
101 PATH_MAX - strlen(real_filename)); 102 PATH_MAX - strlen(real_filename));
102 execvp(real_filename, svec); 103 execvp(real_filename, svec);
103 fprintf(stderr, "exec "); 104 fprintf(stderr, "exec ");
@@ -178,6 +179,7 @@ void find_export_symbols(char * filename)
178 char real_filename[PATH_MAX + 1]; 179 char real_filename[PATH_MAX + 1];
179 memset(real_filename, 0, sizeof(real_filename)); 180 memset(real_filename, 0, sizeof(real_filename));
180 strncat(real_filename, srctree, PATH_MAX); 181 strncat(real_filename, srctree, PATH_MAX);
182 strncat(real_filename, "/", PATH_MAX - strlen(real_filename));
181 strncat(real_filename, filename, 183 strncat(real_filename, filename,
182 PATH_MAX - strlen(real_filename)); 184 PATH_MAX - strlen(real_filename));
183 sym = add_new_file(filename); 185 sym = add_new_file(filename);
@@ -382,6 +384,9 @@ int main(int argc, char *argv[])
382 srctree = getenv("SRCTREE"); 384 srctree = getenv("SRCTREE");
383 if (!srctree) 385 if (!srctree)
384 srctree = getcwd(NULL, 0); 386 srctree = getcwd(NULL, 0);
387 kernsrctree = getenv("KBUILD_SRC");
388 if (!kernsrctree)
389 kernsrctree = srctree;
385 if (argc != 3) { 390 if (argc != 3) {
386 usage(); 391 usage();
387 exit(1); 392 exit(1);
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 8912c0f5460..72c15205bb2 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -373,10 +373,11 @@ void print_deps(void)
373void traps(void) 373void traps(void)
374{ 374{
375 static char test[] __attribute__((aligned(sizeof(int)))) = "CONF"; 375 static char test[] __attribute__((aligned(sizeof(int)))) = "CONF";
376 int *p = (int *)test;
376 377
377 if (*(int *)test != INT_CONF) { 378 if (*p != INT_CONF) {
378 fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n", 379 fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n",
379 *(int *)test); 380 *p);
380 exit(2); 381 exit(2);
381 } 382 }
382} 383}
diff --git a/scripts/config b/scripts/config
index db6084b78a1..608d7fdb13e 100755
--- a/scripts/config
+++ b/scripts/config
@@ -9,8 +9,10 @@ config options command ...
9commands: 9commands:
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 --state|-s option Print state of option (n,y,m,undef) 13 --set-str option value
14 Set option to "value"
15 --state|-s option Print state of option (n,y,m,undef)
14 16
15 --enable-after|-E beforeopt option 17 --enable-after|-E beforeopt option
16 Enable option directly after other option 18 Enable option directly after other option
@@ -26,8 +28,6 @@ options:
26 28
27config doesn't check the validity of the .config file. This is done at next 29config doesn't check the validity of the .config file. This is done at next
28 make time. 30 make time.
29The options need to be already in the file before they can be changed,
30but sometimes you can cheat with the --*-after options.
31EOL 31EOL
32 exit 1 32 exit 1
33} 33}
@@ -45,8 +45,18 @@ checkarg() {
45 ARG="`echo $ARG | tr a-z A-Z`" 45 ARG="`echo $ARG | tr a-z A-Z`"
46} 46}
47 47
48replace() { 48set_var() {
49 sed -i -e "$@" $FN 49 local name=$1 new=$2 before=$3
50
51 name_re="^($name=|# $name is not set)"
52 before_re="^($before=|# $before is not set)"
53 if test -n "$before" && grep -Eq "$before_re" "$FN"; then
54 sed -ri "/$before_re/a $new" "$FN"
55 elif grep -Eq "$name_re" "$FN"; then
56 sed -ri "s:$name_re.*:$new:" "$FN"
57 else
58 echo "$new" >>"$FN"
59 fi
50} 60}
51 61
52if [ "$1" = "--file" ]; then 62if [ "$1" = "--file" ]; then
@@ -54,8 +64,7 @@ if [ "$1" = "--file" ]; then
54 if [ "$FN" = "" ] ; then 64 if [ "$FN" = "" ] ; then
55 usage 65 usage
56 fi 66 fi
57 shift 67 shift 2
58 shift
59else 68else
60 FN=.config 69 FN=.config
61fi 70fi
@@ -68,27 +77,39 @@ while [ "$1" != "" ] ; do
68 CMD="$1" 77 CMD="$1"
69 shift 78 shift
70 case "$CMD" in 79 case "$CMD" in
71 --enable|-e) 80 --refresh)
81 ;;
82 --*-after)
83 checkarg "$1"
84 A=$ARG
85 checkarg "$2"
86 B=$ARG
87 shift 2
88 ;;
89 --*)
72 checkarg "$1" 90 checkarg "$1"
73 replace "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/"
74 shift 91 shift
75 ;; 92 ;;
93 esac
94 case "$CMD" in
95 --enable|-e)
96 set_var "CONFIG_$ARG" "CONFIG_$ARG=y"
97 ;;
76 98
77 --disable|-d) 99 --disable|-d)
78 checkarg "$1" 100 set_var "CONFIG_$ARG" "# CONFIG_$ARG is not set"
79 replace "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/"
80 shift
81 ;; 101 ;;
82 102
83 --module|-m) 103 --module|-m)
84 checkarg "$1" 104 set_var "CONFIG_$ARG" "CONFIG_$ARG=m"
85 replace "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \ 105 ;;
86 -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/" 106
107 --set-str)
108 set_var "CONFIG_$ARG" "CONFIG_$ARG=\"$1\""
87 shift 109 shift
88 ;; 110 ;;
89 111
90 --state|-s) 112 --state|-s)
91 checkarg "$1"
92 if grep -q "# CONFIG_$ARG is not set" $FN ; then 113 if grep -q "# CONFIG_$ARG is not set" $FN ; then
93 echo n 114 echo n
94 else 115 else
@@ -101,44 +122,18 @@ while [ "$1" != "" ] ; do
101 echo "$V" 122 echo "$V"
102 fi 123 fi
103 fi 124 fi
104 shift
105 ;; 125 ;;
106 126
107 --enable-after|-E) 127 --enable-after|-E)
108 checkarg "$1" 128 set_var "CONFIG_$B" "CONFIG_$B=y" "CONFIG_$A"
109 A=$ARG
110 checkarg "$2"
111 B=$ARG
112 replace "/CONFIG_$A=[my]/aCONFIG_$B=y" \
113 -e "/# CONFIG_$ARG is not set/a/CONFIG_$ARG=y" \
114 -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/"
115 shift
116 shift
117 ;; 129 ;;
118 130
119 --disable-after|-D) 131 --disable-after|-D)
120 checkarg "$1" 132 set_var "CONFIG_$B" "# CONFIG_$B is not set" "CONFIG_$A"
121 A=$ARG
122 checkarg "$2"
123 B=$ARG
124 replace "/CONFIG_$A=[my]/a# CONFIG_$B is not set" \
125 -e "/# CONFIG_$ARG is not set/a/# CONFIG_$ARG is not set" \
126 -e "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/"
127 shift
128 shift
129 ;; 133 ;;
130 134
131 --module-after|-M) 135 --module-after|-M)
132 checkarg "$1" 136 set_var "CONFIG_$B" "CONFIG_$B=m" "CONFIG_$A"
133 A=$ARG
134 checkarg "$2"
135 B=$ARG
136 replace "/CONFIG_$A=[my]/aCONFIG_$B=m" \
137 -e "/# CONFIG_$ARG is not set/a/CONFIG_$ARG=m" \
138 -e "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \
139 -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/"
140 shift
141 shift
142 ;; 137 ;;
143 138
144 # undocumented because it ignores --file (fixme) 139 # undocumented because it ignores --file (fixme)
diff --git a/scripts/gcc-version.sh b/scripts/gcc-version.sh
index cc767b388ba..debecb5561c 100644
--- a/scripts/gcc-version.sh
+++ b/scripts/gcc-version.sh
@@ -18,7 +18,7 @@ compiler="$*"
18 18
19if [ ${#compiler} -eq 0 ]; then 19if [ ${#compiler} -eq 0 ]; then
20 echo "Error: No compiler specified." 20 echo "Error: No compiler specified."
21 echo -e "Usage:\n\t$0 <gcc-command>" 21 printf "Usage:\n\t$0 <gcc-command>\n"
22 exit 1 22 exit 1
23fi 23fi
24 24
diff --git a/scripts/headers.sh b/scripts/headers.sh
index d33426f866d..0308ecc10d5 100755
--- a/scripts/headers.sh
+++ b/scripts/headers.sh
@@ -15,19 +15,12 @@ do_command()
15 fi 15 fi
16} 16}
17 17
18# Do not try this architecture
19drop="generic um ppc sparc64 cris"
20
21archs=$(ls ${srctree}/arch) 18archs=$(ls ${srctree}/arch)
22 19
23for arch in ${archs}; do 20for arch in ${archs}; do
24 case ${arch} in 21 case ${arch} in
25 um) # no userspace export 22 um) # no userspace export
26 ;; 23 ;;
27 ppc) # headers exported by powerpc
28 ;;
29 sparc64) # headers exported by sparc
30 ;;
31 cris) # headers export are known broken 24 cris) # headers export are known broken
32 ;; 25 ;;
33 *) 26 *)
diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl
index 56f90a48089..db1dd7a549f 100644
--- a/scripts/headers_check.pl
+++ b/scripts/headers_check.pl
@@ -2,7 +2,7 @@
2# 2#
3# headers_check.pl execute a number of trivial consistency checks 3# headers_check.pl execute a number of trivial consistency checks
4# 4#
5# Usage: headers_check.pl dir [files...] 5# Usage: headers_check.pl dir arch [files...]
6# dir: dir to look for included files 6# dir: dir to look for included files
7# arch: architecture 7# arch: architecture
8# files: list of files to check 8# files: list of files to check
@@ -37,7 +37,7 @@ foreach my $file (@files) {
37 &check_include(); 37 &check_include();
38 &check_asm_types(); 38 &check_asm_types();
39 &check_sizetypes(); 39 &check_sizetypes();
40 &check_prototypes(); 40 &check_declarations();
41 # Dropped for now. Too much noise &check_config(); 41 # Dropped for now. Too much noise &check_config();
42 } 42 }
43 close FH; 43 close FH;
@@ -61,16 +61,18 @@ sub check_include
61 } 61 }
62} 62}
63 63
64sub check_prototypes 64sub check_declarations
65{ 65{
66 if ($line =~ m/^\s*extern\b/) { 66 if ($line =~m/^\s*extern\b/) {
67 printf STDERR "$filename:$lineno: extern's make no sense in userspace\n"; 67 printf STDERR "$filename:$lineno: " .
68 "userspace cannot call function or variable " .
69 "defined in the kernel\n";
68 } 70 }
69} 71}
70 72
71sub check_config 73sub check_config
72{ 74{
73 if ($line =~ m/[^a-zA-Z0-9_]+CONFIG_([a-zA-Z0-9]+)[^a-zA-Z0-9]/) { 75 if ($line =~ m/[^a-zA-Z0-9_]+CONFIG_([a-zA-Z0-9_]+)[^a-zA-Z0-9_]/) {
74 printf STDERR "$filename:$lineno: leaks CONFIG_$1 to userspace where it is not valid\n"; 76 printf STDERR "$filename:$lineno: leaks CONFIG_$1 to userspace where it is not valid\n";
75 } 77 }
76} 78}
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 6654cbed965..3cb57895c9e 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -23,6 +23,10 @@
23#include <string.h> 23#include <string.h>
24#include <ctype.h> 24#include <ctype.h>
25 25
26#ifndef ARRAY_SIZE
27#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
28#endif
29
26#define KSYM_NAME_LEN 128 30#define KSYM_NAME_LEN 128
27 31
28struct sym_entry { 32struct sym_entry {
@@ -32,9 +36,23 @@ struct sym_entry {
32 unsigned char *sym; 36 unsigned char *sym;
33}; 37};
34 38
39struct text_range {
40 const char *stext, *etext;
41 unsigned long long start, end;
42};
43
44static unsigned long long _text;
45static struct text_range text_ranges[] = {
46 { "_stext", "_etext" },
47 { "_sinittext", "_einittext" },
48 { "_stext_l1", "_etext_l1" }, /* Blackfin on-chip L1 inst SRAM */
49 { "_stext_l2", "_etext_l2" }, /* Blackfin on-chip L2 SRAM */
50};
51#define text_range_text (&text_ranges[0])
52#define text_range_inittext (&text_ranges[1])
53
35static struct sym_entry *table; 54static struct sym_entry *table;
36static unsigned int table_size, table_cnt; 55static unsigned int table_size, table_cnt;
37static unsigned long long _text, _stext, _etext, _sinittext, _einittext;
38static int all_symbols = 0; 56static int all_symbols = 0;
39static char symbol_prefix_char = '\0'; 57static char symbol_prefix_char = '\0';
40 58
@@ -61,6 +79,26 @@ static inline int is_arm_mapping_symbol(const char *str)
61 && (str[2] == '\0' || str[2] == '.'); 79 && (str[2] == '\0' || str[2] == '.');
62} 80}
63 81
82static int read_symbol_tr(const char *sym, unsigned long long addr)
83{
84 size_t i;
85 struct text_range *tr;
86
87 for (i = 0; i < ARRAY_SIZE(text_ranges); ++i) {
88 tr = &text_ranges[i];
89
90 if (strcmp(sym, tr->stext) == 0) {
91 tr->start = addr;
92 return 0;
93 } else if (strcmp(sym, tr->etext) == 0) {
94 tr->end = addr;
95 return 0;
96 }
97 }
98
99 return 1;
100}
101
64static int read_symbol(FILE *in, struct sym_entry *s) 102static int read_symbol(FILE *in, struct sym_entry *s)
65{ 103{
66 char str[500]; 104 char str[500];
@@ -84,14 +122,8 @@ static int read_symbol(FILE *in, struct sym_entry *s)
84 /* Ignore most absolute/undefined (?) symbols. */ 122 /* Ignore most absolute/undefined (?) symbols. */
85 if (strcmp(sym, "_text") == 0) 123 if (strcmp(sym, "_text") == 0)
86 _text = s->addr; 124 _text = s->addr;
87 else if (strcmp(sym, "_stext") == 0) 125 else if (read_symbol_tr(sym, s->addr) == 0)
88 _stext = s->addr; 126 /* nothing to do */;
89 else if (strcmp(sym, "_etext") == 0)
90 _etext = s->addr;
91 else if (strcmp(sym, "_sinittext") == 0)
92 _sinittext = s->addr;
93 else if (strcmp(sym, "_einittext") == 0)
94 _einittext = s->addr;
95 else if (toupper(stype) == 'A') 127 else if (toupper(stype) == 'A')
96 { 128 {
97 /* Keep these useful absolute symbols */ 129 /* Keep these useful absolute symbols */
@@ -127,6 +159,21 @@ static int read_symbol(FILE *in, struct sym_entry *s)
127 return 0; 159 return 0;
128} 160}
129 161
162static int symbol_valid_tr(struct sym_entry *s)
163{
164 size_t i;
165 struct text_range *tr;
166
167 for (i = 0; i < ARRAY_SIZE(text_ranges); ++i) {
168 tr = &text_ranges[i];
169
170 if (s->addr >= tr->start && s->addr < tr->end)
171 return 0;
172 }
173
174 return 1;
175}
176
130static int symbol_valid(struct sym_entry *s) 177static int symbol_valid(struct sym_entry *s)
131{ 178{
132 /* Symbols which vary between passes. Passes 1 and 2 must have 179 /* Symbols which vary between passes. Passes 1 and 2 must have
@@ -156,8 +203,7 @@ static int symbol_valid(struct sym_entry *s)
156 /* if --all-symbols is not specified, then symbols outside the text 203 /* if --all-symbols is not specified, then symbols outside the text
157 * and inittext sections are discarded */ 204 * and inittext sections are discarded */
158 if (!all_symbols) { 205 if (!all_symbols) {
159 if ((s->addr < _stext || s->addr > _etext) 206 if (symbol_valid_tr(s) == 0)
160 && (s->addr < _sinittext || s->addr > _einittext))
161 return 0; 207 return 0;
162 /* Corner case. Discard any symbols with the same value as 208 /* Corner case. Discard any symbols with the same value as
163 * _etext _einittext; they can move between pass 1 and 2 when 209 * _etext _einittext; they can move between pass 1 and 2 when
@@ -165,10 +211,10 @@ static int symbol_valid(struct sym_entry *s)
165 * they may get dropped in pass 2, which breaks the kallsyms 211 * they may get dropped in pass 2, which breaks the kallsyms
166 * rules. 212 * rules.
167 */ 213 */
168 if ((s->addr == _etext && 214 if ((s->addr == text_range_text->end &&
169 strcmp((char *)s->sym + offset, "_etext")) || 215 strcmp((char *)s->sym + offset, text_range_text->etext)) ||
170 (s->addr == _einittext && 216 (s->addr == text_range_inittext->end &&
171 strcmp((char *)s->sym + offset, "_einittext"))) 217 strcmp((char *)s->sym + offset, text_range_inittext->etext)))
172 return 0; 218 return 0;
173 } 219 }
174 220
diff --git a/scripts/kconfig/.gitignore b/scripts/kconfig/.gitignore
index b49584c932c..6a36a76e660 100644
--- a/scripts/kconfig/.gitignore
+++ b/scripts/kconfig/.gitignore
@@ -8,6 +8,9 @@ lex.*.c
8zconf.hash.c 8zconf.hash.c
9*.moc 9*.moc
10lkc_defs.h 10lkc_defs.h
11gconf.glade.h
12*.pot
13*.mo
11 14
12# 15#
13# configuration programs 16# configuration programs
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index fa8c2dd9c98..5ddf8becd7a 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -83,7 +83,7 @@ help:
83 @echo ' xconfig - Update current config utilising a QT based front-end' 83 @echo ' xconfig - Update current config utilising a QT based front-end'
84 @echo ' gconfig - Update current config utilising a GTK based front-end' 84 @echo ' gconfig - Update current config utilising a GTK based front-end'
85 @echo ' oldconfig - Update current config utilising a provided .config as base' 85 @echo ' oldconfig - Update current config utilising a provided .config as base'
86 @echo ' silentoldconfig - Same as oldconfig, but quietly' 86 @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
87 @echo ' randconfig - New config with random answer to all options' 87 @echo ' randconfig - New config with random answer to all options'
88 @echo ' defconfig - New config with default answer to all options' 88 @echo ' defconfig - New config with default answer to all options'
89 @echo ' allmodconfig - New config selecting modules when possible' 89 @echo ' allmodconfig - New config selecting modules when possible'
@@ -104,7 +104,7 @@ HOST_EXTRACFLAGS += -DLOCALE
104# =========================================================================== 104# ===========================================================================
105# Shared Makefile for the various kconfig executables: 105# Shared Makefile for the various kconfig executables:
106# conf: Used for defconfig, oldconfig and related targets 106# conf: Used for defconfig, oldconfig and related targets
107# mconf: Used for the mconfig target. 107# mconf: Used for the menuconfig target
108# Utilizes the lxdialog package 108# Utilizes the lxdialog package
109# qconf: Used for the xconfig target 109# qconf: Used for the xconfig target
110# Based on QT which needs to be installed to compile it 110# Based on QT which needs to be installed to compile it
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index d190092c3b6..3baaaecd6b1 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -498,14 +498,15 @@ int main(int ac, char **av)
498 conf_parse(name); 498 conf_parse(name);
499 //zconfdump(stdout); 499 //zconfdump(stdout);
500 if (sync_kconfig) { 500 if (sync_kconfig) {
501 if (stat(".config", &tmpstat)) { 501 name = conf_get_configname();
502 if (stat(name, &tmpstat)) {
502 fprintf(stderr, _("***\n" 503 fprintf(stderr, _("***\n"
503 "*** You have not yet configured your kernel!\n" 504 "*** You have not yet configured your kernel!\n"
504 "*** (missing kernel .config file)\n" 505 "*** (missing kernel config file \"%s\")\n"
505 "***\n" 506 "***\n"
506 "*** Please run some configurator (e.g. \"make oldconfig\" or\n" 507 "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
507 "*** \"make menuconfig\" or \"make xconfig\").\n" 508 "*** \"make menuconfig\" or \"make xconfig\").\n"
508 "***\n")); 509 "***\n"), name);
509 exit(1); 510 exit(1);
510 } 511 }
511 } 512 }
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 273d73888f9..a04da3459f0 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -41,6 +41,13 @@ const char *conf_get_configname(void)
41 return name ? name : ".config"; 41 return name ? name : ".config";
42} 42}
43 43
44const char *conf_get_autoconfig_name(void)
45{
46 char *name = getenv("KCONFIG_AUTOCONFIG");
47
48 return name ? name : "include/config/auto.conf";
49}
50
44static char *conf_expand_value(const char *in) 51static char *conf_expand_value(const char *in)
45{ 52{
46 struct symbol *sym; 53 struct symbol *sym;
@@ -555,15 +562,14 @@ int conf_write(const char *name)
555 562
556int conf_split_config(void) 563int conf_split_config(void)
557{ 564{
558 char *name, path[128]; 565 const char *name;
566 char path[128];
559 char *s, *d, c; 567 char *s, *d, c;
560 struct symbol *sym; 568 struct symbol *sym;
561 struct stat sb; 569 struct stat sb;
562 int res, i, fd; 570 int res, i, fd;
563 571
564 name = getenv("KCONFIG_AUTOCONFIG"); 572 name = conf_get_autoconfig_name();
565 if (!name)
566 name = "include/config/auto.conf";
567 conf_read_simple(name, S_DEF_AUTO); 573 conf_read_simple(name, S_DEF_AUTO);
568 574
569 if (chdir("include/config")) 575 if (chdir("include/config"))
@@ -670,7 +676,7 @@ int conf_write_autoconf(void)
670{ 676{
671 struct symbol *sym; 677 struct symbol *sym;
672 const char *str; 678 const char *str;
673 char *name; 679 const char *name;
674 FILE *out, *out_h; 680 FILE *out, *out_h;
675 time_t now; 681 time_t now;
676 int i, l; 682 int i, l;
@@ -773,9 +779,7 @@ int conf_write_autoconf(void)
773 name = "include/linux/autoconf.h"; 779 name = "include/linux/autoconf.h";
774 if (rename(".tmpconfig.h", name)) 780 if (rename(".tmpconfig.h", name))
775 return 1; 781 return 1;
776 name = getenv("KCONFIG_AUTOCONFIG"); 782 name = conf_get_autoconfig_name();
777 if (!name)
778 name = "include/config/auto.conf";
779 /* 783 /*
780 * This must be the last step, kbuild has a dependency on auto.conf 784 * This must be the last step, kbuild has a dependency on auto.conf
781 * and this marks the successful completion of the previous steps. 785 * and this marks the successful completion of the previous steps.
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 4a9af6f7886..f379b0bf8c9 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -74,6 +74,7 @@ char *zconf_curname(void);
74 74
75/* confdata.c */ 75/* confdata.c */
76const char *conf_get_configname(void); 76const char *conf_get_configname(void);
77const char *conf_get_autoconfig_name(void);
77char *conf_get_default_confname(void); 78char *conf_get_default_confname(void);
78void sym_set_change_count(int count); 79void sym_set_change_count(int count);
79void sym_add_change_count(int count); 80void sym_add_change_count(int count);
diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c
index b2a878c936d..bcc6f19c3a3 100644
--- a/scripts/kconfig/lxdialog/checklist.c
+++ b/scripts/kconfig/lxdialog/checklist.c
@@ -41,7 +41,8 @@ static void print_item(WINDOW * win, int choice, int selected)
41 wmove(win, choice, check_x); 41 wmove(win, choice, check_x);
42 wattrset(win, selected ? dlg.check_selected.atr 42 wattrset(win, selected ? dlg.check_selected.atr
43 : dlg.check.atr); 43 : dlg.check.atr);
44 wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' '); 44 if (!item_is_tag(':'))
45 wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' ');
45 46
46 wattrset(win, selected ? dlg.tag_selected.atr : dlg.tag.atr); 47 wattrset(win, selected ? dlg.tag_selected.atr : dlg.tag.atr);
47 mvwaddch(win, choice, item_x, item_str()[0]); 48 mvwaddch(win, choice, item_x, item_str()[0]);
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 6841e95c098..3bcacb4bfd3 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -732,7 +732,12 @@ static void conf_choice(struct menu *menu)
732 for (child = menu->list; child; child = child->next) { 732 for (child = menu->list; child; child = child->next) {
733 if (!menu_is_visible(child)) 733 if (!menu_is_visible(child))
734 continue; 734 continue;
735 item_make("%s", _(menu_get_prompt(child))); 735 if (child->sym)
736 item_make("%s", _(menu_get_prompt(child)));
737 else {
738 item_make("*** %s ***", _(menu_get_prompt(child)));
739 item_set_tag(':');
740 }
736 item_set_data(child); 741 item_set_data(child);
737 if (child->sym == active) 742 if (child->sym == active)
738 item_set_selected(1); 743 item_set_selected(1);
@@ -748,6 +753,9 @@ static void conf_choice(struct menu *menu)
748 case 0: 753 case 0:
749 if (selected) { 754 if (selected) {
750 child = item_data(); 755 child = item_data();
756 if (!child->sym)
757 break;
758
751 sym_set_tristate_value(child->sym, yes); 759 sym_set_tristate_value(child->sym, yes);
752 } 760 }
753 return; 761 return;
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 5d0fd38b089..ce7d508c752 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -5,6 +5,7 @@
5 5
6#include <qapplication.h> 6#include <qapplication.h>
7#include <qmainwindow.h> 7#include <qmainwindow.h>
8#include <qdesktopwidget.h>
8#include <qtoolbar.h> 9#include <qtoolbar.h>
9#include <qlayout.h> 10#include <qlayout.h>
10#include <qvbox.h> 11#include <qvbox.h>
@@ -297,10 +298,10 @@ void ConfigLineEdit::show(ConfigItem* i)
297void ConfigLineEdit::keyPressEvent(QKeyEvent* e) 298void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
298{ 299{
299 switch (e->key()) { 300 switch (e->key()) {
300 case Key_Escape: 301 case Qt::Key_Escape:
301 break; 302 break;
302 case Key_Return: 303 case Qt::Key_Return:
303 case Key_Enter: 304 case Qt::Key_Enter:
304 sym_set_string_value(item->menu->sym, text().latin1()); 305 sym_set_string_value(item->menu->sym, text().latin1());
305 parent()->updateList(item); 306 parent()->updateList(item);
306 break; 307 break;
@@ -639,7 +640,7 @@ void ConfigList::keyPressEvent(QKeyEvent* ev)
639 struct menu *menu; 640 struct menu *menu;
640 enum prop_type type; 641 enum prop_type type;
641 642
642 if (ev->key() == Key_Escape && mode != fullMode && mode != listMode) { 643 if (ev->key() == Qt::Key_Escape && mode != fullMode && mode != listMode) {
643 emit parentSelected(); 644 emit parentSelected();
644 ev->accept(); 645 ev->accept();
645 return; 646 return;
@@ -652,8 +653,8 @@ void ConfigList::keyPressEvent(QKeyEvent* ev)
652 item = (ConfigItem*)i; 653 item = (ConfigItem*)i;
653 654
654 switch (ev->key()) { 655 switch (ev->key()) {
655 case Key_Return: 656 case Qt::Key_Return:
656 case Key_Enter: 657 case Qt::Key_Enter:
657 if (item->goParent) { 658 if (item->goParent) {
658 emit parentSelected(); 659 emit parentSelected();
659 break; 660 break;
@@ -667,16 +668,16 @@ void ConfigList::keyPressEvent(QKeyEvent* ev)
667 emit menuSelected(menu); 668 emit menuSelected(menu);
668 break; 669 break;
669 } 670 }
670 case Key_Space: 671 case Qt::Key_Space:
671 changeValue(item); 672 changeValue(item);
672 break; 673 break;
673 case Key_N: 674 case Qt::Key_N:
674 setValue(item, no); 675 setValue(item, no);
675 break; 676 break;
676 case Key_M: 677 case Qt::Key_M:
677 setValue(item, mod); 678 setValue(item, mod);
678 break; 679 break;
679 case Key_Y: 680 case Qt::Key_Y:
680 setValue(item, yes); 681 setValue(item, yes);
681 break; 682 break;
682 default: 683 default:
@@ -920,7 +921,7 @@ void ConfigView::updateListAll(void)
920} 921}
921 922
922ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) 923ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
923 : Parent(parent, name), menu(0), sym(0) 924 : Parent(parent, name), sym(0), menu(0)
924{ 925{
925 if (name) { 926 if (name) {
926 configSettings->beginGroup(name); 927 configSettings->beginGroup(name);
@@ -1199,7 +1200,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
1199 layout1->addLayout(layout2); 1200 layout1->addLayout(layout2);
1200 1201
1201 split = new QSplitter(this); 1202 split = new QSplitter(this);
1202 split->setOrientation(QSplitter::Vertical); 1203 split->setOrientation(Qt::Vertical);
1203 list = new ConfigView(split, name); 1204 list = new ConfigView(split, name);
1204 list->list->mode = listMode; 1205 list->list->mode = listMode;
1205 info = new ConfigInfoView(split, name); 1206 info = new ConfigInfoView(split, name);
@@ -1275,7 +1276,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1275 int x, y, width, height; 1276 int x, y, width, height;
1276 char title[256]; 1277 char title[256];
1277 1278
1278 QWidget *d = configApp->desktop(); 1279 QDesktopWidget *d = configApp->desktop();
1279 snprintf(title, sizeof(title), _("Linux Kernel v%s Configuration"), 1280 snprintf(title, sizeof(title), _("Linux Kernel v%s Configuration"),
1280 getenv("KERNELVERSION")); 1281 getenv("KERNELVERSION"));
1281 setCaption(title); 1282 setCaption(title);
@@ -1290,14 +1291,14 @@ ConfigMainWindow::ConfigMainWindow(void)
1290 move(x, y); 1291 move(x, y);
1291 1292
1292 split1 = new QSplitter(this); 1293 split1 = new QSplitter(this);
1293 split1->setOrientation(QSplitter::Horizontal); 1294 split1->setOrientation(Qt::Horizontal);
1294 setCentralWidget(split1); 1295 setCentralWidget(split1);
1295 1296
1296 menuView = new ConfigView(split1, "menu"); 1297 menuView = new ConfigView(split1, "menu");
1297 menuList = menuView->list; 1298 menuList = menuView->list;
1298 1299
1299 split2 = new QSplitter(split1); 1300 split2 = new QSplitter(split1);
1300 split2->setOrientation(QSplitter::Vertical); 1301 split2->setOrientation(Qt::Vertical);
1301 1302
1302 // create config tree 1303 // create config tree
1303 configView = new ConfigView(split2, "config"); 1304 configView = new ConfigView(split2, "config");
@@ -1315,18 +1316,18 @@ ConfigMainWindow::ConfigMainWindow(void)
1315 backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this); 1316 backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this);
1316 connect(backAction, SIGNAL(activated()), SLOT(goBack())); 1317 connect(backAction, SIGNAL(activated()), SLOT(goBack()));
1317 backAction->setEnabled(FALSE); 1318 backAction->setEnabled(FALSE);
1318 QAction *quitAction = new QAction("Quit", _("&Quit"), CTRL+Key_Q, this); 1319 QAction *quitAction = new QAction("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this);
1319 connect(quitAction, SIGNAL(activated()), SLOT(close())); 1320 connect(quitAction, SIGNAL(activated()), SLOT(close()));
1320 QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), CTRL+Key_L, this); 1321 QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this);
1321 connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); 1322 connect(loadAction, SIGNAL(activated()), SLOT(loadConfig()));
1322 saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), CTRL+Key_S, this); 1323 saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this);
1323 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); 1324 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig()));
1324 conf_set_changed_callback(conf_changed); 1325 conf_set_changed_callback(conf_changed);
1325 // Set saveAction's initial state 1326 // Set saveAction's initial state
1326 conf_changed(); 1327 conf_changed();
1327 QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this); 1328 QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this);
1328 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); 1329 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
1329 QAction *searchAction = new QAction("Find", _("&Find"), CTRL+Key_F, this); 1330 QAction *searchAction = new QAction("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this);
1330 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); 1331 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig()));
1331 QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this); 1332 QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this);
1332 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); 1333 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
@@ -1447,7 +1448,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1447 1448
1448void ConfigMainWindow::loadConfig(void) 1449void ConfigMainWindow::loadConfig(void)
1449{ 1450{
1450 QString s = QFileDialog::getOpenFileName(".config", NULL, this); 1451 QString s = QFileDialog::getOpenFileName(conf_get_configname(), NULL, this);
1451 if (s.isNull()) 1452 if (s.isNull())
1452 return; 1453 return;
1453 if (conf_read(QFile::encodeName(s))) 1454 if (conf_read(QFile::encodeName(s)))
@@ -1463,7 +1464,7 @@ void ConfigMainWindow::saveConfig(void)
1463 1464
1464void ConfigMainWindow::saveConfigAs(void) 1465void ConfigMainWindow::saveConfigAs(void)
1465{ 1466{
1466 QString s = QFileDialog::getSaveFileName(".config", NULL, this); 1467 QString s = QFileDialog::getSaveFileName(conf_get_configname(), NULL, this);
1467 if (s.isNull()) 1468 if (s.isNull())
1468 return; 1469 return;
1469 if (conf_write(QFile::encodeName(s))) 1470 if (conf_write(QFile::encodeName(s)))
@@ -1524,6 +1525,8 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
1524 case fullMode: 1525 case fullMode:
1525 list = configList; 1526 list = configList;
1526 break; 1527 break;
1528 default:
1529 break;
1527 } 1530 }
1528 1531
1529 if (list) { 1532 if (list) {
@@ -1673,6 +1676,9 @@ void ConfigMainWindow::saveSettings(void)
1673 case fullMode : 1676 case fullMode :
1674 entry = "full"; 1677 entry = "full";
1675 break; 1678 break;
1679
1680 default:
1681 break;
1676 } 1682 }
1677 configSettings->writeEntry("/listMode", entry); 1683 configSettings->writeEntry("/listMode", entry);
1678 1684
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index 3cc9f936903..b6b2a46af14 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -46,8 +46,8 @@ int file_write_dep(const char *name)
46 else 46 else
47 fprintf(out, "\t%s\n", file->name); 47 fprintf(out, "\t%s\n", file->name);
48 } 48 }
49 fprintf(out, "\ninclude/config/auto.conf: \\\n" 49 fprintf(out, "\n%s: \\\n"
50 "\t$(deps_config)\n\n"); 50 "\t$(deps_config)\n\n", conf_get_autoconfig_name());
51 51
52 expr_list_for_each_sym(sym_env_list, e, sym) { 52 expr_list_for_each_sym(sym_env_list, e, sym) {
53 struct property *prop; 53 struct property *prop;
@@ -61,7 +61,7 @@ int file_write_dep(const char *name)
61 if (!value) 61 if (!value)
62 value = ""; 62 value = "";
63 fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value); 63 fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value);
64 fprintf(out, "include/config/auto.conf: FORCE\n"); 64 fprintf(out, "%s: FORCE\n", conf_get_autoconfig_name());
65 fprintf(out, "endif\n"); 65 fprintf(out, "endif\n");
66 } 66 }
67 67
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index acd8c4a8e3e..a193fa3f527 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -5,7 +5,7 @@ use strict;
5## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## 5## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
6## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## 6## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ##
7## Copyright (C) 2001 Simon Huggins ## 7## Copyright (C) 2001 Simon Huggins ##
8## Copyright (C) 2005-2008 Randy Dunlap ## 8## Copyright (C) 2005-2009 Randy Dunlap ##
9## ## 9## ##
10## #define enhancements by Armin Kuster <akuster@mvista.com> ## 10## #define enhancements by Armin Kuster <akuster@mvista.com> ##
11## Copyright (c) 2000 MontaVista Software, Inc. ## 11## Copyright (c) 2000 MontaVista Software, Inc. ##
@@ -85,7 +85,7 @@ use strict;
85# 85#
86# /** 86# /**
87# * my_function 87# * my_function
88# **/ 88# */
89# 89#
90# If the Description: header tag is omitted, then there must be a blank line 90# If the Description: header tag is omitted, then there must be a blank line
91# after the last parameter specification. 91# after the last parameter specification.
@@ -105,7 +105,7 @@ use strict;
105# */ 105# */
106# etc. 106# etc.
107# 107#
108# Beside functions you can also write documentation for structs, unions, 108# Besides functions you can also write documentation for structs, unions,
109# enums and typedefs. Instead of the function name you must write the name 109# enums and typedefs. Instead of the function name you must write the name
110# of the declaration; the struct/union/enum/typedef must always precede 110# of the declaration; the struct/union/enum/typedef must always precede
111# the name. Nesting of declarations is not supported. 111# the name. Nesting of declarations is not supported.
@@ -223,7 +223,7 @@ sub usage {
223} 223}
224 224
225# read arguments 225# read arguments
226if ($#ARGV==-1) { 226if ($#ARGV == -1) {
227 usage(); 227 usage();
228} 228}
229 229
@@ -240,12 +240,12 @@ my $man_date = ('January', 'February', 'March', 'April', 'May', 'June',
240 " " . ((localtime)[5]+1900); 240 " " . ((localtime)[5]+1900);
241 241
242# Essentially these are globals 242# Essentially these are globals
243# They probably want to be tidied up made more localised or summat. 243# They probably want to be tidied up, made more localised or something.
244# CAVEAT EMPTOR! Some of the others I localised may not want to be which 244# CAVEAT EMPTOR! Some of the others I localised may not want to be, which
245# could cause "use of undefined value" or other bugs. 245# could cause "use of undefined value" or other bugs.
246my ($function, %function_table,%parametertypes,$declaration_purpose); 246my ($function, %function_table, %parametertypes, $declaration_purpose);
247my ($type,$declaration_name,$return_type); 247my ($type, $declaration_name, $return_type);
248my ($newsection,$newcontents,$prototype,$filelist, $brcount, %source_map); 248my ($newsection, $newcontents, $prototype, $filelist, $brcount, %source_map);
249 249
250if (defined($ENV{'KBUILD_VERBOSE'})) { 250if (defined($ENV{'KBUILD_VERBOSE'})) {
251 $verbose = "$ENV{'KBUILD_VERBOSE'}"; 251 $verbose = "$ENV{'KBUILD_VERBOSE'}";
@@ -279,10 +279,10 @@ my $doc_special = "\@\%\$\&";
279my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start. 279my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start.
280my $doc_end = '\*/'; 280my $doc_end = '\*/';
281my $doc_com = '\s*\*\s*'; 281my $doc_com = '\s*\*\s*';
282my $doc_decl = $doc_com.'(\w+)'; 282my $doc_decl = $doc_com . '(\w+)';
283my $doc_sect = $doc_com.'(['.$doc_special.']?[\w\s]+):(.*)'; 283my $doc_sect = $doc_com . '([' . $doc_special . ']?[\w\s]+):(.*)';
284my $doc_content = $doc_com.'(.*)'; 284my $doc_content = $doc_com . '(.*)';
285my $doc_block = $doc_com.'DOC:\s*(.*)?'; 285my $doc_block = $doc_com . 'DOC:\s*(.*)?';
286 286
287my %constants; 287my %constants;
288my %parameterdescs; 288my %parameterdescs;
@@ -485,12 +485,12 @@ sub output_enum_html(%) {
485 my %args = %{$_[0]}; 485 my %args = %{$_[0]};
486 my ($parameter); 486 my ($parameter);
487 my $count; 487 my $count;
488 print "<h2>enum ".$args{'enum'}."</h2>\n"; 488 print "<h2>enum " . $args{'enum'} . "</h2>\n";
489 489
490 print "<b>enum ".$args{'enum'}."</b> {<br>\n"; 490 print "<b>enum " . $args{'enum'} . "</b> {<br>\n";
491 $count = 0; 491 $count = 0;
492 foreach $parameter (@{$args{'parameterlist'}}) { 492 foreach $parameter (@{$args{'parameterlist'}}) {
493 print " <b>".$parameter."</b>"; 493 print " <b>" . $parameter . "</b>";
494 if ($count != $#{$args{'parameterlist'}}) { 494 if ($count != $#{$args{'parameterlist'}}) {
495 $count++; 495 $count++;
496 print ",\n"; 496 print ",\n";
@@ -502,7 +502,7 @@ sub output_enum_html(%) {
502 print "<h3>Constants</h3>\n"; 502 print "<h3>Constants</h3>\n";
503 print "<dl>\n"; 503 print "<dl>\n";
504 foreach $parameter (@{$args{'parameterlist'}}) { 504 foreach $parameter (@{$args{'parameterlist'}}) {
505 print "<dt><b>".$parameter."</b>\n"; 505 print "<dt><b>" . $parameter . "</b>\n";
506 print "<dd>"; 506 print "<dd>";
507 output_highlight($args{'parameterdescs'}{$parameter}); 507 output_highlight($args{'parameterdescs'}{$parameter});
508 } 508 }
@@ -516,9 +516,9 @@ sub output_typedef_html(%) {
516 my %args = %{$_[0]}; 516 my %args = %{$_[0]};
517 my ($parameter); 517 my ($parameter);
518 my $count; 518 my $count;
519 print "<h2>typedef ".$args{'typedef'}."</h2>\n"; 519 print "<h2>typedef " . $args{'typedef'} . "</h2>\n";
520 520
521 print "<b>typedef ".$args{'typedef'}."</b>\n"; 521 print "<b>typedef " . $args{'typedef'} . "</b>\n";
522 output_section_html(@_); 522 output_section_html(@_);
523 print "<hr>\n"; 523 print "<hr>\n";
524} 524}
@@ -528,8 +528,8 @@ sub output_struct_html(%) {
528 my %args = %{$_[0]}; 528 my %args = %{$_[0]};
529 my ($parameter); 529 my ($parameter);
530 530
531 print "<h2>".$args{'type'}." ".$args{'struct'}. " - " .$args{'purpose'}."</h2>\n"; 531 print "<h2>" . $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "</h2>\n";
532 print "<b>".$args{'type'}." ".$args{'struct'}."</b> {<br>\n"; 532 print "<b>" . $args{'type'} . " " . $args{'struct'} . "</b> {<br>\n";
533 foreach $parameter (@{$args{'parameterlist'}}) { 533 foreach $parameter (@{$args{'parameterlist'}}) {
534 if ($parameter =~ /^#/) { 534 if ($parameter =~ /^#/) {
535 print "$parameter<br>\n"; 535 print "$parameter<br>\n";
@@ -561,7 +561,7 @@ sub output_struct_html(%) {
561 $parameter_name =~ s/\[.*//; 561 $parameter_name =~ s/\[.*//;
562 562
563 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; 563 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
564 print "<dt><b>".$parameter."</b>\n"; 564 print "<dt><b>" . $parameter . "</b>\n";
565 print "<dd>"; 565 print "<dd>";
566 output_highlight($args{'parameterdescs'}{$parameter_name}); 566 output_highlight($args{'parameterdescs'}{$parameter_name});
567 } 567 }
@@ -576,9 +576,9 @@ sub output_function_html(%) {
576 my ($parameter, $section); 576 my ($parameter, $section);
577 my $count; 577 my $count;
578 578
579 print "<h2>" .$args{'function'}." - ".$args{'purpose'}."</h2>\n"; 579 print "<h2>" . $args{'function'} . " - " . $args{'purpose'} . "</h2>\n";
580 print "<i>".$args{'functiontype'}."</i>\n"; 580 print "<i>" . $args{'functiontype'} . "</i>\n";
581 print "<b>".$args{'function'}."</b>\n"; 581 print "<b>" . $args{'function'} . "</b>\n";
582 print "("; 582 print "(";
583 $count = 0; 583 $count = 0;
584 foreach $parameter (@{$args{'parameterlist'}}) { 584 foreach $parameter (@{$args{'parameterlist'}}) {
@@ -587,7 +587,7 @@ sub output_function_html(%) {
587 # pointer-to-function 587 # pointer-to-function
588 print "<i>$1</i><b>$parameter</b>) <i>($2)</i>"; 588 print "<i>$1</i><b>$parameter</b>) <i>($2)</i>";
589 } else { 589 } else {
590 print "<i>".$type."</i> <b>".$parameter."</b>"; 590 print "<i>" . $type . "</i> <b>" . $parameter . "</b>";
591 } 591 }
592 if ($count != $#{$args{'parameterlist'}}) { 592 if ($count != $#{$args{'parameterlist'}}) {
593 $count++; 593 $count++;
@@ -603,7 +603,7 @@ sub output_function_html(%) {
603 $parameter_name =~ s/\[.*//; 603 $parameter_name =~ s/\[.*//;
604 604
605 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; 605 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
606 print "<dt><b>".$parameter."</b>\n"; 606 print "<dt><b>" . $parameter . "</b>\n";
607 print "<dd>"; 607 print "<dd>";
608 output_highlight($args{'parameterdescs'}{$parameter_name}); 608 output_highlight($args{'parameterdescs'}{$parameter_name});
609 } 609 }
@@ -657,7 +657,7 @@ sub output_function_xml(%) {
657 my $count; 657 my $count;
658 my $id; 658 my $id;
659 659
660 $id = "API-".$args{'function'}; 660 $id = "API-" . $args{'function'};
661 $id =~ s/[^A-Za-z0-9]/-/g; 661 $id =~ s/[^A-Za-z0-9]/-/g;
662 662
663 print "<refentry id=\"$id\">\n"; 663 print "<refentry id=\"$id\">\n";
@@ -667,12 +667,12 @@ sub output_function_xml(%) {
667 print " <date>$man_date</date>\n"; 667 print " <date>$man_date</date>\n";
668 print "</refentryinfo>\n"; 668 print "</refentryinfo>\n";
669 print "<refmeta>\n"; 669 print "<refmeta>\n";
670 print " <refentrytitle><phrase>".$args{'function'}."</phrase></refentrytitle>\n"; 670 print " <refentrytitle><phrase>" . $args{'function'} . "</phrase></refentrytitle>\n";
671 print " <manvolnum>9</manvolnum>\n"; 671 print " <manvolnum>9</manvolnum>\n";
672 print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n"; 672 print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
673 print "</refmeta>\n"; 673 print "</refmeta>\n";
674 print "<refnamediv>\n"; 674 print "<refnamediv>\n";
675 print " <refname>".$args{'function'}."</refname>\n"; 675 print " <refname>" . $args{'function'} . "</refname>\n";
676 print " <refpurpose>\n"; 676 print " <refpurpose>\n";
677 print " "; 677 print " ";
678 output_highlight ($args{'purpose'}); 678 output_highlight ($args{'purpose'});
@@ -682,8 +682,8 @@ sub output_function_xml(%) {
682 print "<refsynopsisdiv>\n"; 682 print "<refsynopsisdiv>\n";
683 print " <title>Synopsis</title>\n"; 683 print " <title>Synopsis</title>\n";
684 print " <funcsynopsis><funcprototype>\n"; 684 print " <funcsynopsis><funcprototype>\n";
685 print " <funcdef>".$args{'functiontype'}." "; 685 print " <funcdef>" . $args{'functiontype'} . " ";
686 print "<function>".$args{'function'}." </function></funcdef>\n"; 686 print "<function>" . $args{'function'} . " </function></funcdef>\n";
687 687
688 $count = 0; 688 $count = 0;
689 if ($#{$args{'parameterlist'}} >= 0) { 689 if ($#{$args{'parameterlist'}} >= 0) {
@@ -694,7 +694,7 @@ sub output_function_xml(%) {
694 print " <paramdef>$1<parameter>$parameter</parameter>)\n"; 694 print " <paramdef>$1<parameter>$parameter</parameter>)\n";
695 print " <funcparams>$2</funcparams></paramdef>\n"; 695 print " <funcparams>$2</funcparams></paramdef>\n";
696 } else { 696 } else {
697 print " <paramdef>".$type; 697 print " <paramdef>" . $type;
698 print " <parameter>$parameter</parameter></paramdef>\n"; 698 print " <parameter>$parameter</parameter></paramdef>\n";
699 } 699 }
700 } 700 }
@@ -734,7 +734,7 @@ sub output_struct_xml(%) {
734 my ($parameter, $section); 734 my ($parameter, $section);
735 my $id; 735 my $id;
736 736
737 $id = "API-struct-".$args{'struct'}; 737 $id = "API-struct-" . $args{'struct'};
738 $id =~ s/[^A-Za-z0-9]/-/g; 738 $id =~ s/[^A-Za-z0-9]/-/g;
739 739
740 print "<refentry id=\"$id\">\n"; 740 print "<refentry id=\"$id\">\n";
@@ -744,12 +744,12 @@ sub output_struct_xml(%) {
744 print " <date>$man_date</date>\n"; 744 print " <date>$man_date</date>\n";
745 print "</refentryinfo>\n"; 745 print "</refentryinfo>\n";
746 print "<refmeta>\n"; 746 print "<refmeta>\n";
747 print " <refentrytitle><phrase>".$args{'type'}." ".$args{'struct'}."</phrase></refentrytitle>\n"; 747 print " <refentrytitle><phrase>" . $args{'type'} . " " . $args{'struct'} . "</phrase></refentrytitle>\n";
748 print " <manvolnum>9</manvolnum>\n"; 748 print " <manvolnum>9</manvolnum>\n";
749 print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n"; 749 print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
750 print "</refmeta>\n"; 750 print "</refmeta>\n";
751 print "<refnamediv>\n"; 751 print "<refnamediv>\n";
752 print " <refname>".$args{'type'}." ".$args{'struct'}."</refname>\n"; 752 print " <refname>" . $args{'type'} . " " . $args{'struct'} . "</refname>\n";
753 print " <refpurpose>\n"; 753 print " <refpurpose>\n";
754 print " "; 754 print " ";
755 output_highlight ($args{'purpose'}); 755 output_highlight ($args{'purpose'});
@@ -759,7 +759,7 @@ sub output_struct_xml(%) {
759 print "<refsynopsisdiv>\n"; 759 print "<refsynopsisdiv>\n";
760 print " <title>Synopsis</title>\n"; 760 print " <title>Synopsis</title>\n";
761 print " <programlisting>\n"; 761 print " <programlisting>\n";
762 print $args{'type'}." ".$args{'struct'}." {\n"; 762 print $args{'type'} . " " . $args{'struct'} . " {\n";
763 foreach $parameter (@{$args{'parameterlist'}}) { 763 foreach $parameter (@{$args{'parameterlist'}}) {
764 if ($parameter =~ /^#/) { 764 if ($parameter =~ /^#/) {
765 print "$parameter\n"; 765 print "$parameter\n";
@@ -779,7 +779,7 @@ sub output_struct_xml(%) {
779 # bitfield 779 # bitfield
780 print " $1 $parameter$2;\n"; 780 print " $1 $parameter$2;\n";
781 } else { 781 } else {
782 print " ".$type." ".$parameter.";\n"; 782 print " " . $type . " " . $parameter . ";\n";
783 } 783 }
784 } 784 }
785 print "};"; 785 print "};";
@@ -824,7 +824,7 @@ sub output_enum_xml(%) {
824 my $count; 824 my $count;
825 my $id; 825 my $id;
826 826
827 $id = "API-enum-".$args{'enum'}; 827 $id = "API-enum-" . $args{'enum'};
828 $id =~ s/[^A-Za-z0-9]/-/g; 828 $id =~ s/[^A-Za-z0-9]/-/g;
829 829
830 print "<refentry id=\"$id\">\n"; 830 print "<refentry id=\"$id\">\n";
@@ -834,12 +834,12 @@ sub output_enum_xml(%) {
834 print " <date>$man_date</date>\n"; 834 print " <date>$man_date</date>\n";
835 print "</refentryinfo>\n"; 835 print "</refentryinfo>\n";
836 print "<refmeta>\n"; 836 print "<refmeta>\n";
837 print " <refentrytitle><phrase>enum ".$args{'enum'}."</phrase></refentrytitle>\n"; 837 print " <refentrytitle><phrase>enum " . $args{'enum'} . "</phrase></refentrytitle>\n";
838 print " <manvolnum>9</manvolnum>\n"; 838 print " <manvolnum>9</manvolnum>\n";
839 print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n"; 839 print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
840 print "</refmeta>\n"; 840 print "</refmeta>\n";
841 print "<refnamediv>\n"; 841 print "<refnamediv>\n";
842 print " <refname>enum ".$args{'enum'}."</refname>\n"; 842 print " <refname>enum " . $args{'enum'} . "</refname>\n";
843 print " <refpurpose>\n"; 843 print " <refpurpose>\n";
844 print " "; 844 print " ";
845 output_highlight ($args{'purpose'}); 845 output_highlight ($args{'purpose'});
@@ -849,7 +849,7 @@ sub output_enum_xml(%) {
849 print "<refsynopsisdiv>\n"; 849 print "<refsynopsisdiv>\n";
850 print " <title>Synopsis</title>\n"; 850 print " <title>Synopsis</title>\n";
851 print " <programlisting>\n"; 851 print " <programlisting>\n";
852 print "enum ".$args{'enum'}." {\n"; 852 print "enum " . $args{'enum'} . " {\n";
853 $count = 0; 853 $count = 0;
854 foreach $parameter (@{$args{'parameterlist'}}) { 854 foreach $parameter (@{$args{'parameterlist'}}) {
855 print " $parameter"; 855 print " $parameter";
@@ -891,7 +891,7 @@ sub output_typedef_xml(%) {
891 my ($parameter, $section); 891 my ($parameter, $section);
892 my $id; 892 my $id;
893 893
894 $id = "API-typedef-".$args{'typedef'}; 894 $id = "API-typedef-" . $args{'typedef'};
895 $id =~ s/[^A-Za-z0-9]/-/g; 895 $id =~ s/[^A-Za-z0-9]/-/g;
896 896
897 print "<refentry id=\"$id\">\n"; 897 print "<refentry id=\"$id\">\n";
@@ -901,11 +901,11 @@ sub output_typedef_xml(%) {
901 print " <date>$man_date</date>\n"; 901 print " <date>$man_date</date>\n";
902 print "</refentryinfo>\n"; 902 print "</refentryinfo>\n";
903 print "<refmeta>\n"; 903 print "<refmeta>\n";
904 print " <refentrytitle><phrase>typedef ".$args{'typedef'}."</phrase></refentrytitle>\n"; 904 print " <refentrytitle><phrase>typedef " . $args{'typedef'} . "</phrase></refentrytitle>\n";
905 print " <manvolnum>9</manvolnum>\n"; 905 print " <manvolnum>9</manvolnum>\n";
906 print "</refmeta>\n"; 906 print "</refmeta>\n";
907 print "<refnamediv>\n"; 907 print "<refnamediv>\n";
908 print " <refname>typedef ".$args{'typedef'}."</refname>\n"; 908 print " <refname>typedef " . $args{'typedef'} . "</refname>\n";
909 print " <refpurpose>\n"; 909 print " <refpurpose>\n";
910 print " "; 910 print " ";
911 output_highlight ($args{'purpose'}); 911 output_highlight ($args{'purpose'});
@@ -914,7 +914,7 @@ sub output_typedef_xml(%) {
914 914
915 print "<refsynopsisdiv>\n"; 915 print "<refsynopsisdiv>\n";
916 print " <title>Synopsis</title>\n"; 916 print " <title>Synopsis</title>\n";
917 print " <synopsis>typedef ".$args{'typedef'}.";</synopsis>\n"; 917 print " <synopsis>typedef " . $args{'typedef'} . ";</synopsis>\n";
918 print "</refsynopsisdiv>\n"; 918 print "</refsynopsisdiv>\n";
919 919
920 output_section_xml(@_); 920 output_section_xml(@_);
@@ -963,15 +963,15 @@ sub output_function_gnome {
963 my $count; 963 my $count;
964 my $id; 964 my $id;
965 965
966 $id = $args{'module'}."-".$args{'function'}; 966 $id = $args{'module'} . "-" . $args{'function'};
967 $id =~ s/[^A-Za-z0-9]/-/g; 967 $id =~ s/[^A-Za-z0-9]/-/g;
968 968
969 print "<sect2>\n"; 969 print "<sect2>\n";
970 print " <title id=\"$id\">".$args{'function'}."</title>\n"; 970 print " <title id=\"$id\">" . $args{'function'} . "</title>\n";
971 971
972 print " <funcsynopsis>\n"; 972 print " <funcsynopsis>\n";
973 print " <funcdef>".$args{'functiontype'}." "; 973 print " <funcdef>" . $args{'functiontype'} . " ";
974 print "<function>".$args{'function'}." "; 974 print "<function>" . $args{'function'} . " ";
975 print "</function></funcdef>\n"; 975 print "</function></funcdef>\n";
976 976
977 $count = 0; 977 $count = 0;
@@ -983,7 +983,7 @@ sub output_function_gnome {
983 print " <paramdef>$1 <parameter>$parameter</parameter>)\n"; 983 print " <paramdef>$1 <parameter>$parameter</parameter>)\n";
984 print " <funcparams>$2</funcparams></paramdef>\n"; 984 print " <funcparams>$2</funcparams></paramdef>\n";
985 } else { 985 } else {
986 print " <paramdef>".$type; 986 print " <paramdef>" . $type;
987 print " <parameter>$parameter</parameter></paramdef>\n"; 987 print " <parameter>$parameter</parameter></paramdef>\n";
988 } 988 }
989 } 989 }
@@ -1043,13 +1043,13 @@ sub output_function_man(%) {
1043 print ".TH \"$args{'function'}\" 9 \"$args{'function'}\" \"$man_date\" \"Kernel Hacker's Manual\" LINUX\n"; 1043 print ".TH \"$args{'function'}\" 9 \"$args{'function'}\" \"$man_date\" \"Kernel Hacker's Manual\" LINUX\n";
1044 1044
1045 print ".SH NAME\n"; 1045 print ".SH NAME\n";
1046 print $args{'function'}." \\- ".$args{'purpose'}."\n"; 1046 print $args{'function'} . " \\- " . $args{'purpose'} . "\n";
1047 1047
1048 print ".SH SYNOPSIS\n"; 1048 print ".SH SYNOPSIS\n";
1049 if ($args{'functiontype'} ne "") { 1049 if ($args{'functiontype'} ne "") {
1050 print ".B \"".$args{'functiontype'}."\" ".$args{'function'}."\n"; 1050 print ".B \"" . $args{'functiontype'} . "\" " . $args{'function'} . "\n";
1051 } else { 1051 } else {
1052 print ".B \"".$args{'function'}."\n"; 1052 print ".B \"" . $args{'function'} . "\n";
1053 } 1053 }
1054 $count = 0; 1054 $count = 0;
1055 my $parenth = "("; 1055 my $parenth = "(";
@@ -1061,10 +1061,10 @@ sub output_function_man(%) {
1061 $type = $args{'parametertypes'}{$parameter}; 1061 $type = $args{'parametertypes'}{$parameter};
1062 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { 1062 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1063 # pointer-to-function 1063 # pointer-to-function
1064 print ".BI \"".$parenth.$1."\" ".$parameter." \") (".$2.")".$post."\"\n"; 1064 print ".BI \"" . $parenth . $1 . "\" " . $parameter . " \") (" . $2 . ")" . $post . "\"\n";
1065 } else { 1065 } else {
1066 $type =~ s/([^\*])$/$1 /; 1066 $type =~ s/([^\*])$/$1 /;
1067 print ".BI \"".$parenth.$type."\" ".$parameter." \"".$post."\"\n"; 1067 print ".BI \"" . $parenth . $type . "\" " . $parameter . " \"" . $post . "\"\n";
1068 } 1068 }
1069 $count++; 1069 $count++;
1070 $parenth = ""; 1070 $parenth = "";
@@ -1075,7 +1075,7 @@ sub output_function_man(%) {
1075 my $parameter_name = $parameter; 1075 my $parameter_name = $parameter;
1076 $parameter_name =~ s/\[.*//; 1076 $parameter_name =~ s/\[.*//;
1077 1077
1078 print ".IP \"".$parameter."\" 12\n"; 1078 print ".IP \"" . $parameter . "\" 12\n";
1079 output_highlight($args{'parameterdescs'}{$parameter_name}); 1079 output_highlight($args{'parameterdescs'}{$parameter_name});
1080 } 1080 }
1081 foreach $section (@{$args{'sectionlist'}}) { 1081 foreach $section (@{$args{'sectionlist'}}) {
@@ -1094,10 +1094,10 @@ sub output_enum_man(%) {
1094 print ".TH \"$args{'module'}\" 9 \"enum $args{'enum'}\" \"$man_date\" \"API Manual\" LINUX\n"; 1094 print ".TH \"$args{'module'}\" 9 \"enum $args{'enum'}\" \"$man_date\" \"API Manual\" LINUX\n";
1095 1095
1096 print ".SH NAME\n"; 1096 print ".SH NAME\n";
1097 print "enum ".$args{'enum'}." \\- ".$args{'purpose'}."\n"; 1097 print "enum " . $args{'enum'} . " \\- " . $args{'purpose'} . "\n";
1098 1098
1099 print ".SH SYNOPSIS\n"; 1099 print ".SH SYNOPSIS\n";
1100 print "enum ".$args{'enum'}." {\n"; 1100 print "enum " . $args{'enum'} . " {\n";
1101 $count = 0; 1101 $count = 0;
1102 foreach my $parameter (@{$args{'parameterlist'}}) { 1102 foreach my $parameter (@{$args{'parameterlist'}}) {
1103 print ".br\n.BI \" $parameter\"\n"; 1103 print ".br\n.BI \" $parameter\"\n";
@@ -1116,7 +1116,7 @@ sub output_enum_man(%) {
1116 my $parameter_name = $parameter; 1116 my $parameter_name = $parameter;
1117 $parameter_name =~ s/\[.*//; 1117 $parameter_name =~ s/\[.*//;
1118 1118
1119 print ".IP \"".$parameter."\" 12\n"; 1119 print ".IP \"" . $parameter . "\" 12\n";
1120 output_highlight($args{'parameterdescs'}{$parameter_name}); 1120 output_highlight($args{'parameterdescs'}{$parameter_name});
1121 } 1121 }
1122 foreach $section (@{$args{'sectionlist'}}) { 1122 foreach $section (@{$args{'sectionlist'}}) {
@@ -1131,13 +1131,13 @@ sub output_struct_man(%) {
1131 my %args = %{$_[0]}; 1131 my %args = %{$_[0]};
1132 my ($parameter, $section); 1132 my ($parameter, $section);
1133 1133
1134 print ".TH \"$args{'module'}\" 9 \"".$args{'type'}." ".$args{'struct'}."\" \"$man_date\" \"API Manual\" LINUX\n"; 1134 print ".TH \"$args{'module'}\" 9 \"" . $args{'type'} . " " . $args{'struct'} . "\" \"$man_date\" \"API Manual\" LINUX\n";
1135 1135
1136 print ".SH NAME\n"; 1136 print ".SH NAME\n";
1137 print $args{'type'}." ".$args{'struct'}." \\- ".$args{'purpose'}."\n"; 1137 print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose'} . "\n";
1138 1138
1139 print ".SH SYNOPSIS\n"; 1139 print ".SH SYNOPSIS\n";
1140 print $args{'type'}." ".$args{'struct'}." {\n.br\n"; 1140 print $args{'type'} . " " . $args{'struct'} . " {\n.br\n";
1141 1141
1142 foreach my $parameter (@{$args{'parameterlist'}}) { 1142 foreach my $parameter (@{$args{'parameterlist'}}) {
1143 if ($parameter =~ /^#/) { 1143 if ($parameter =~ /^#/) {
@@ -1151,13 +1151,13 @@ sub output_struct_man(%) {
1151 $type = $args{'parametertypes'}{$parameter}; 1151 $type = $args{'parametertypes'}{$parameter};
1152 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { 1152 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1153 # pointer-to-function 1153 # pointer-to-function
1154 print ".BI \" ".$1."\" ".$parameter." \") (".$2.")"."\"\n;\n"; 1154 print ".BI \" " . $1 . "\" " . $parameter . " \") (" . $2 . ")" . "\"\n;\n";
1155 } elsif ($type =~ m/^(.*?)\s*(:.*)/) { 1155 } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
1156 # bitfield 1156 # bitfield
1157 print ".BI \" ".$1."\ \" ".$parameter.$2." \""."\"\n;\n"; 1157 print ".BI \" " . $1 . "\ \" " . $parameter . $2 . " \"" . "\"\n;\n";
1158 } else { 1158 } else {
1159 $type =~ s/([^\*])$/$1 /; 1159 $type =~ s/([^\*])$/$1 /;
1160 print ".BI \" ".$type."\" ".$parameter." \""."\"\n;\n"; 1160 print ".BI \" " . $type . "\" " . $parameter . " \"" . "\"\n;\n";
1161 } 1161 }
1162 print "\n.br\n"; 1162 print "\n.br\n";
1163 } 1163 }
@@ -1171,7 +1171,7 @@ sub output_struct_man(%) {
1171 $parameter_name =~ s/\[.*//; 1171 $parameter_name =~ s/\[.*//;
1172 1172
1173 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; 1173 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1174 print ".IP \"".$parameter."\" 12\n"; 1174 print ".IP \"" . $parameter . "\" 12\n";
1175 output_highlight($args{'parameterdescs'}{$parameter_name}); 1175 output_highlight($args{'parameterdescs'}{$parameter_name});
1176 } 1176 }
1177 foreach $section (@{$args{'sectionlist'}}) { 1177 foreach $section (@{$args{'sectionlist'}}) {
@@ -1189,7 +1189,7 @@ sub output_typedef_man(%) {
1189 print ".TH \"$args{'module'}\" 9 \"$args{'typedef'}\" \"$man_date\" \"API Manual\" LINUX\n"; 1189 print ".TH \"$args{'module'}\" 9 \"$args{'typedef'}\" \"$man_date\" \"API Manual\" LINUX\n";
1190 1190
1191 print ".SH NAME\n"; 1191 print ".SH NAME\n";
1192 print "typedef ".$args{'typedef'}." \\- ".$args{'purpose'}."\n"; 1192 print "typedef " . $args{'typedef'} . " \\- " . $args{'purpose'} . "\n";
1193 1193
1194 foreach $section (@{$args{'sectionlist'}}) { 1194 foreach $section (@{$args{'sectionlist'}}) {
1195 print ".SH \"$section\"\n"; 1195 print ".SH \"$section\"\n";
@@ -1218,13 +1218,13 @@ sub output_function_text(%) {
1218 my $start; 1218 my $start;
1219 1219
1220 print "Name:\n\n"; 1220 print "Name:\n\n";
1221 print $args{'function'}." - ".$args{'purpose'}."\n"; 1221 print $args{'function'} . " - " . $args{'purpose'} . "\n";
1222 1222
1223 print "\nSynopsis:\n\n"; 1223 print "\nSynopsis:\n\n";
1224 if ($args{'functiontype'} ne "") { 1224 if ($args{'functiontype'} ne "") {
1225 $start = $args{'functiontype'}." ".$args{'function'}." ("; 1225 $start = $args{'functiontype'} . " " . $args{'function'} . " (";
1226 } else { 1226 } else {
1227 $start = $args{'function'}." ("; 1227 $start = $args{'function'} . " (";
1228 } 1228 }
1229 print $start; 1229 print $start;
1230 1230
@@ -1233,9 +1233,9 @@ sub output_function_text(%) {
1233 $type = $args{'parametertypes'}{$parameter}; 1233 $type = $args{'parametertypes'}{$parameter};
1234 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { 1234 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
1235 # pointer-to-function 1235 # pointer-to-function
1236 print $1.$parameter.") (".$2; 1236 print $1 . $parameter . ") (" . $2;
1237 } else { 1237 } else {
1238 print $type." ".$parameter; 1238 print $type . " " . $parameter;
1239 } 1239 }
1240 if ($count != $#{$args{'parameterlist'}}) { 1240 if ($count != $#{$args{'parameterlist'}}) {
1241 $count++; 1241 $count++;
@@ -1251,7 +1251,7 @@ sub output_function_text(%) {
1251 my $parameter_name = $parameter; 1251 my $parameter_name = $parameter;
1252 $parameter_name =~ s/\[.*//; 1252 $parameter_name =~ s/\[.*//;
1253 1253
1254 print $parameter."\n\t".$args{'parameterdescs'}{$parameter_name}."\n"; 1254 print $parameter . "\n\t" . $args{'parameterdescs'}{$parameter_name} . "\n";
1255 } 1255 }
1256 output_section_text(@_); 1256 output_section_text(@_);
1257} 1257}
@@ -1276,8 +1276,8 @@ sub output_enum_text(%) {
1276 my $count; 1276 my $count;
1277 print "Enum:\n\n"; 1277 print "Enum:\n\n";
1278 1278
1279 print "enum ".$args{'enum'}." - ".$args{'purpose'}."\n\n"; 1279 print "enum " . $args{'enum'} . " - " . $args{'purpose'} . "\n\n";
1280 print "enum ".$args{'enum'}." {\n"; 1280 print "enum " . $args{'enum'} . " {\n";
1281 $count = 0; 1281 $count = 0;
1282 foreach $parameter (@{$args{'parameterlist'}}) { 1282 foreach $parameter (@{$args{'parameterlist'}}) {
1283 print "\t$parameter"; 1283 print "\t$parameter";
@@ -1292,7 +1292,7 @@ sub output_enum_text(%) {
1292 print "Constants:\n\n"; 1292 print "Constants:\n\n";
1293 foreach $parameter (@{$args{'parameterlist'}}) { 1293 foreach $parameter (@{$args{'parameterlist'}}) {
1294 print "$parameter\n\t"; 1294 print "$parameter\n\t";
1295 print $args{'parameterdescs'}{$parameter}."\n"; 1295 print $args{'parameterdescs'}{$parameter} . "\n";
1296 } 1296 }
1297 1297
1298 output_section_text(@_); 1298 output_section_text(@_);
@@ -1305,7 +1305,7 @@ sub output_typedef_text(%) {
1305 my $count; 1305 my $count;
1306 print "Typedef:\n\n"; 1306 print "Typedef:\n\n";
1307 1307
1308 print "typedef ".$args{'typedef'}." - ".$args{'purpose'}."\n"; 1308 print "typedef " . $args{'typedef'} . " - " . $args{'purpose'} . "\n";
1309 output_section_text(@_); 1309 output_section_text(@_);
1310} 1310}
1311 1311
@@ -1314,8 +1314,8 @@ sub output_struct_text(%) {
1314 my %args = %{$_[0]}; 1314 my %args = %{$_[0]};
1315 my ($parameter); 1315 my ($parameter);
1316 1316
1317 print $args{'type'}." ".$args{'struct'}." - ".$args{'purpose'}."\n\n"; 1317 print $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "\n\n";
1318 print $args{'type'}." ".$args{'struct'}." {\n"; 1318 print $args{'type'} . " " . $args{'struct'} . " {\n";
1319 foreach $parameter (@{$args{'parameterlist'}}) { 1319 foreach $parameter (@{$args{'parameterlist'}}) {
1320 if ($parameter =~ /^#/) { 1320 if ($parameter =~ /^#/) {
1321 print "$parameter\n"; 1321 print "$parameter\n";
@@ -1334,7 +1334,7 @@ sub output_struct_text(%) {
1334 # bitfield 1334 # bitfield
1335 print "\t$1 $parameter$2;\n"; 1335 print "\t$1 $parameter$2;\n";
1336 } else { 1336 } else {
1337 print "\t".$type." ".$parameter.";\n"; 1337 print "\t" . $type . " " . $parameter . ";\n";
1338 } 1338 }
1339 } 1339 }
1340 print "};\n\n"; 1340 print "};\n\n";
@@ -1348,7 +1348,7 @@ sub output_struct_text(%) {
1348 1348
1349 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; 1349 ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
1350 print "$parameter\n\t"; 1350 print "$parameter\n\t";
1351 print $args{'parameterdescs'}{$parameter_name}."\n"; 1351 print $args{'parameterdescs'}{$parameter_name} . "\n";
1352 } 1352 }
1353 print "\n"; 1353 print "\n";
1354 output_section_text(@_); 1354 output_section_text(@_);
@@ -1387,7 +1387,7 @@ sub output_declaration {
1387# generic output function - calls the right one based on current output mode. 1387# generic output function - calls the right one based on current output mode.
1388sub output_blockhead { 1388sub output_blockhead {
1389 no strict 'refs'; 1389 no strict 'refs';
1390 my $func = "output_blockhead_".$output_mode; 1390 my $func = "output_blockhead_" . $output_mode;
1391 &$func(@_); 1391 &$func(@_);
1392 $section_counter++; 1392 $section_counter++;
1393} 1393}
@@ -1398,7 +1398,7 @@ sub output_blockhead {
1398sub dump_declaration($$) { 1398sub dump_declaration($$) {
1399 no strict 'refs'; 1399 no strict 'refs';
1400 my ($prototype, $file) = @_; 1400 my ($prototype, $file) = @_;
1401 my $func = "dump_".$decl_type; 1401 my $func = "dump_" . $decl_type;
1402 &$func(@_); 1402 &$func(@_);
1403} 1403}
1404 1404
@@ -1645,7 +1645,7 @@ sub push_parameter($$$) {
1645 "or member '$param' not " . 1645 "or member '$param' not " .
1646 "described in '$declaration_name'\n"; 1646 "described in '$declaration_name'\n";
1647 } 1647 }
1648 print STDERR "Warning(${file}:$.):". 1648 print STDERR "Warning(${file}:$.):" .
1649 " No description found for parameter '$param'\n"; 1649 " No description found for parameter '$param'\n";
1650 ++$warnings; 1650 ++$warnings;
1651 } 1651 }
@@ -1929,7 +1929,7 @@ sub process_state3_type($$) {
1929 ($2 eq '{') && $brcount++; 1929 ($2 eq '{') && $brcount++;
1930 ($2 eq '}') && $brcount--; 1930 ($2 eq '}') && $brcount--;
1931 if (($2 eq ';') && ($brcount == 0)) { 1931 if (($2 eq ';') && ($brcount == 0)) {
1932 dump_declaration($prototype,$file); 1932 dump_declaration($prototype, $file);
1933 reset_state(); 1933 reset_state();
1934 last; 1934 last;
1935 } 1935 }
@@ -2106,7 +2106,7 @@ sub process_file($) {
2106 $section = $section_default; 2106 $section = $section_default;
2107 $contents = ""; 2107 $contents = "";
2108 } else { 2108 } else {
2109 $contents .= $1."\n"; 2109 $contents .= $1 . "\n";
2110 } 2110 }
2111 } else { 2111 } else {
2112 # i dont know - bad line? ignore. 2112 # i dont know - bad line? ignore.
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 161b7846733..4522948a012 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -763,6 +763,8 @@ static void check_section(const char *modname, struct elf_info *elf,
763 763
764 764
765#define ALL_INIT_DATA_SECTIONS \ 765#define ALL_INIT_DATA_SECTIONS \
766 ".init.setup$", ".init.rodata$", \
767 ".devinit.rodata$", ".cpuinit.rodata$", ".meminit.rodata$" \
766 ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$" 768 ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$"
767#define ALL_EXIT_DATA_SECTIONS \ 769#define ALL_EXIT_DATA_SECTIONS \
768 ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$" 770 ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$"
@@ -772,21 +774,23 @@ static void check_section(const char *modname, struct elf_info *elf,
772#define ALL_EXIT_TEXT_SECTIONS \ 774#define ALL_EXIT_TEXT_SECTIONS \
773 ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$" 775 ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$"
774 776
775#define ALL_INIT_SECTIONS ALL_INIT_DATA_SECTIONS, ALL_INIT_TEXT_SECTIONS 777#define ALL_INIT_SECTIONS INIT_SECTIONS, DEV_INIT_SECTIONS, \
776#define ALL_EXIT_SECTIONS ALL_EXIT_DATA_SECTIONS, ALL_EXIT_TEXT_SECTIONS 778 CPU_INIT_SECTIONS, MEM_INIT_SECTIONS
779#define ALL_EXIT_SECTIONS EXIT_SECTIONS, DEV_EXIT_SECTIONS, \
780 CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS
777 781
778#define DATA_SECTIONS ".data$", ".data.rel$" 782#define DATA_SECTIONS ".data$", ".data.rel$"
779#define TEXT_SECTIONS ".text$" 783#define TEXT_SECTIONS ".text$"
780 784
781#define INIT_SECTIONS ".init.data$", ".init.text$" 785#define INIT_SECTIONS ".init.*"
782#define DEV_INIT_SECTIONS ".devinit.data$", ".devinit.text$" 786#define DEV_INIT_SECTIONS ".devinit.*"
783#define CPU_INIT_SECTIONS ".cpuinit.data$", ".cpuinit.text$" 787#define CPU_INIT_SECTIONS ".cpuinit.*"
784#define MEM_INIT_SECTIONS ".meminit.data$", ".meminit.text$" 788#define MEM_INIT_SECTIONS ".meminit.*"
785 789
786#define EXIT_SECTIONS ".exit.data$", ".exit.text$" 790#define EXIT_SECTIONS ".exit.*"
787#define DEV_EXIT_SECTIONS ".devexit.data$", ".devexit.text$" 791#define DEV_EXIT_SECTIONS ".devexit.*"
788#define CPU_EXIT_SECTIONS ".cpuexit.data$", ".cpuexit.text$" 792#define CPU_EXIT_SECTIONS ".cpuexit.*"
789#define MEM_EXIT_SECTIONS ".memexit.data$", ".memexit.text$" 793#define MEM_EXIT_SECTIONS ".memexit.*"
790 794
791/* init data sections */ 795/* init data sections */
792static const char *init_data_sections[] = { ALL_INIT_DATA_SECTIONS, NULL }; 796static const char *init_data_sections[] = { ALL_INIT_DATA_SECTIONS, NULL };
@@ -869,12 +873,36 @@ const struct sectioncheck sectioncheck[] = {
869 .tosec = { INIT_SECTIONS, NULL }, 873 .tosec = { INIT_SECTIONS, NULL },
870 .mismatch = XXXINIT_TO_INIT, 874 .mismatch = XXXINIT_TO_INIT,
871}, 875},
876/* Do not reference cpuinit code/data from meminit code/data */
877{
878 .fromsec = { MEM_INIT_SECTIONS, NULL },
879 .tosec = { CPU_INIT_SECTIONS, NULL },
880 .mismatch = XXXINIT_TO_INIT,
881},
882/* Do not reference meminit code/data from cpuinit code/data */
883{
884 .fromsec = { CPU_INIT_SECTIONS, NULL },
885 .tosec = { MEM_INIT_SECTIONS, NULL },
886 .mismatch = XXXINIT_TO_INIT,
887},
872/* Do not reference exit code/data from devexit/cpuexit/memexit code/data */ 888/* Do not reference exit code/data from devexit/cpuexit/memexit code/data */
873{ 889{
874 .fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL }, 890 .fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL },
875 .tosec = { EXIT_SECTIONS, NULL }, 891 .tosec = { EXIT_SECTIONS, NULL },
876 .mismatch = XXXEXIT_TO_EXIT, 892 .mismatch = XXXEXIT_TO_EXIT,
877}, 893},
894/* Do not reference cpuexit code/data from memexit code/data */
895{
896 .fromsec = { MEM_EXIT_SECTIONS, NULL },
897 .tosec = { CPU_EXIT_SECTIONS, NULL },
898 .mismatch = XXXEXIT_TO_EXIT,
899},
900/* Do not reference memexit code/data from cpuexit code/data */
901{
902 .fromsec = { CPU_EXIT_SECTIONS, NULL },
903 .tosec = { MEM_EXIT_SECTIONS, NULL },
904 .mismatch = XXXEXIT_TO_EXIT,
905},
878/* Do not use exit code/data from init code */ 906/* Do not use exit code/data from init code */
879{ 907{
880 .fromsec = { ALL_INIT_SECTIONS, NULL }, 908 .fromsec = { ALL_INIT_SECTIONS, NULL },
@@ -1168,7 +1196,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch,
1168 "The variable %s references\n" 1196 "The variable %s references\n"
1169 "the %s %s%s%s\n" 1197 "the %s %s%s%s\n"
1170 "If the reference is valid then annotate the\n" 1198 "If the reference is valid then annotate the\n"
1171 "variable with __init* (see linux/init.h) " 1199 "variable with __init* or __refdata (see linux/init.h) "
1172 "or name the variable:\n", 1200 "or name the variable:\n",
1173 fromsym, to, sec2annotation(tosec), tosym, to_p); 1201 fromsym, to, sec2annotation(tosec), tosym, to_p);
1174 while (*s) 1202 while (*s)
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 1264b8e2829..01c2d13dd02 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -1,38 +1,58 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# builddeb 1.2 3# builddeb 1.3
4# Copyright 2003 Wichert Akkerman <wichert@wiggy.net> 4# Copyright 2003 Wichert Akkerman <wichert@wiggy.net>
5# 5#
6# Simple script to generate a deb package for a Linux kernel. All the 6# Simple script to generate a deb package for a Linux kernel. All the
7# complexity of what to do with a kernel after it is installer or removed 7# complexity of what to do with a kernel after it is installed or removed
8# is left to other scripts and packages: they can install scripts in the 8# is left to other scripts and packages: they can install scripts in the
9# /etc/kernel/{pre,post}{inst,rm}.d/ directories that will be called on 9# /etc/kernel/{pre,post}{inst,rm}.d/ directories (or an alternative location
10# package install and removal. 10# specified in KDEB_HOOKDIR) that will be called on package install and
11# removal.
11 12
12set -e 13set -e
13 14
15create_package() {
16 local pname="$1" pdir="$2"
17
18 cp debian/copyright "$pdir/usr/share/doc/$pname/"
19
20 # Fix ownership and permissions
21 chown -R root:root "$pdir"
22 chmod -R go-w "$pdir"
23
24 # Create the package
25 dpkg-gencontrol -isp -p$pname -P"$pdir"
26 dpkg --build "$pdir" ..
27}
28
14# Some variables and settings used throughout the script 29# Some variables and settings used throughout the script
15version=$KERNELRELEASE 30version=$KERNELRELEASE
16revision=`cat .version` 31revision=$(cat .version)
32if [ -n "$KDEB_PKGVERSION" ]; then
33 packageversion=$KDEB_PKGVERSION
34else
35 packageversion=$version-$revision
36fi
17tmpdir="$objtree/debian/tmp" 37tmpdir="$objtree/debian/tmp"
18fwdir="$objtree/debian/fwtmp" 38fwdir="$objtree/debian/fwtmp"
19packagename=linux-$version 39packagename=linux-image-$version
20fwpackagename=linux-firmware-image 40fwpackagename=linux-firmware-image
21 41
22if [ "$ARCH" == "um" ] ; then 42if [ "$ARCH" = "um" ] ; then
23 packagename=user-mode-linux-$version 43 packagename=user-mode-linux-$version
24fi 44fi
25 45
26# Setup the directory structure 46# Setup the directory structure
27rm -rf "$tmpdir" "$fwdir" 47rm -rf "$tmpdir" "$fwdir"
28mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" 48mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename"
29mkdir -p "$fwdir/DEBIAN" "$fwdir/lib" 49mkdir -p "$fwdir/DEBIAN" "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename"
30if [ "$ARCH" == "um" ] ; then 50if [ "$ARCH" = "um" ] ; then
31 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/share/doc/$packagename" "$tmpdir/usr/bin" 51 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin"
32fi 52fi
33 53
34# Build and install the kernel 54# Build and install the kernel
35if [ "$ARCH" == "um" ] ; then 55if [ "$ARCH" = "um" ] ; then
36 $MAKE linux 56 $MAKE linux
37 cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map" 57 cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
38 cp .config "$tmpdir/usr/share/doc/$packagename/config" 58 cp .config "$tmpdir/usr/share/doc/$packagename/config"
@@ -41,53 +61,100 @@ if [ "$ARCH" == "um" ] ; then
41else 61else
42 cp System.map "$tmpdir/boot/System.map-$version" 62 cp System.map "$tmpdir/boot/System.map-$version"
43 cp .config "$tmpdir/boot/config-$version" 63 cp .config "$tmpdir/boot/config-$version"
44 cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" 64 # Not all arches include the boot path in KBUILD_IMAGE
65 if ! cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version"; then
66 cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version"
67 fi
45fi 68fi
46 69
47if grep -q '^CONFIG_MODULES=y' .config ; then 70if grep -q '^CONFIG_MODULES=y' .config ; then
48 INSTALL_MOD_PATH="$tmpdir" make KBUILD_SRC= modules_install 71 INSTALL_MOD_PATH="$tmpdir" make KBUILD_SRC= modules_install
49 if [ "$ARCH" == "um" ] ; then 72 if [ "$ARCH" = "um" ] ; then
50 mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" 73 mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/"
51 rmdir "$tmpdir/lib/modules/$version" 74 rmdir "$tmpdir/lib/modules/$version"
52 fi 75 fi
53fi 76fi
54 77
55# Install the maintainer scripts 78# Install the maintainer scripts
79# Note: hook scripts under /etc/kernel are also executed by official Debian
80# kernel packages, as well as kernel packages built using make-kpkg
81debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
56for script in postinst postrm preinst prerm ; do 82for script in postinst postrm preinst prerm ; do
57 mkdir -p "$tmpdir/etc/kernel/$script.d" 83 mkdir -p "$tmpdir$debhookdir/$script.d"
58 cat <<EOF > "$tmpdir/DEBIAN/$script" 84 cat <<EOF > "$tmpdir/DEBIAN/$script"
59#!/bin/sh 85#!/bin/sh
60 86
61set -e 87set -e
62 88
63test -d /etc/kernel/$script.d && run-parts --arg="$version" /etc/kernel/$script.d 89# Pass maintainer script parameters to hook scripts
90export DEB_MAINT_PARAMS="\$@"
91
92test -d $debhookdir/$script.d && run-parts --arg="$version" $debhookdir/$script.d
64exit 0 93exit 0
65EOF 94EOF
66 chmod 755 "$tmpdir/DEBIAN/$script" 95 chmod 755 "$tmpdir/DEBIAN/$script"
67done 96done
68 97
69name="Kernel Compiler <$(id -nu)@$(hostname -f)>" 98# Try to determine maintainer and email values
99if [ -n "$DEBEMAIL" ]; then
100 email=$DEBEMAIL
101elif [ -n "$EMAIL" ]; then
102 email=$EMAIL
103else
104 email=$(id -nu)@$(hostname -f)
105fi
106if [ -n "$DEBFULLNAME" ]; then
107 name=$DEBFULLNAME
108elif [ -n "$NAME" ]; then
109 name=$NAME
110else
111 name="Anonymous"
112fi
113maintainer="$name <$email>"
114
70# Generate a simple changelog template 115# Generate a simple changelog template
71cat <<EOF > debian/changelog 116cat <<EOF > debian/changelog
72linux ($version-$revision) unstable; urgency=low 117linux-upstream ($packageversion) unstable; urgency=low
73 118
74 * A standard release 119 * Custom built Linux kernel.
75 120
76 -- $name $(date -R) 121 -- $maintainer $(date -R)
77EOF 122EOF
78 123
79# Generate a control file 124# Generate copyright file
80if [ "$ARCH" == "um" ]; then 125cat <<EOF > debian/copyright
126This is a packacked upstream version of the Linux kernel.
127
128The sources may be found at most Linux ftp sites, including:
129ftp://ftp.kernel.org/pub/linux/kernel
81 130
131Copyright: 1991 - 2009 Linus Torvalds and others.
132
133The git repository for mainline kernel development is at:
134git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
135
136 This program is free software; you can redistribute it and/or modify
137 it under the terms of the GNU General Public License as published by
138 the Free Software Foundation; version 2 dated June, 1991.
139
140On Debian GNU/Linux systems, the complete text of the GNU General Public
141License version 2 can be found in \`/usr/share/common-licenses/GPL-2'.
142EOF
143
144# Generate a control file
82cat <<EOF > debian/control 145cat <<EOF > debian/control
83Source: linux 146Source: linux-upstream
84Section: base 147Section: admin
85Priority: optional 148Priority: optional
86Maintainer: $name 149Maintainer: $maintainer
87Standards-Version: 3.6.1 150Standards-Version: 3.8.1
151EOF
152
153if [ "$ARCH" = "um" ]; then
154 cat <<EOF >> debian/control
88 155
89Package: $packagename 156Package: $packagename
90Provides: kernel-image-$version, linux-image-$version 157Provides: linux-image, linux-image-2.6, linux-modules-$version
91Architecture: any 158Architecture: any
92Description: User Mode Linux kernel, version $version 159Description: User Mode Linux kernel, version $version
93 User-mode Linux is a port of the Linux kernel to its own system call 160 User-mode Linux is a port of the Linux kernel to its own system call
@@ -97,30 +164,22 @@ Description: User Mode Linux kernel, version $version
97 many other things. 164 many other things.
98 . 165 .
99 This package contains the Linux kernel, modules and corresponding other 166 This package contains the Linux kernel, modules and corresponding other
100 files version $version 167 files, version: $version.
101EOF 168EOF
102 169
103else 170else
104cat <<EOF > debian/control 171 cat <<EOF >> debian/control
105Source: linux
106Section: base
107Priority: optional
108Maintainer: $name
109Standards-Version: 3.6.1
110 172
111Package: $packagename 173Package: $packagename
112Provides: kernel-image-$version, linux-image-$version 174Provides: linux-image, linux-image-2.6, linux-modules-$version
113Suggests: $fwpackagename 175Suggests: $fwpackagename
114Architecture: any 176Architecture: any
115Description: Linux kernel, version $version 177Description: Linux kernel, version $version
116 This package contains the Linux kernel, modules and corresponding other 178 This package contains the Linux kernel, modules and corresponding other
117 files version $version 179 files, version: $version.
118EOF 180EOF
119fi
120 181
121# Fix some ownership and permissions 182fi
122chown -R root:root "$tmpdir"
123chmod -R go-w "$tmpdir"
124 183
125# Do we have firmware? Move it out of the way and build it into a package. 184# Do we have firmware? Move it out of the way and build it into a package.
126if [ -e "$tmpdir/lib/firmware" ]; then 185if [ -e "$tmpdir/lib/firmware" ]; then
@@ -131,16 +190,12 @@ if [ -e "$tmpdir/lib/firmware" ]; then
131Package: $fwpackagename 190Package: $fwpackagename
132Architecture: all 191Architecture: all
133Description: Linux kernel firmware, version $version 192Description: Linux kernel firmware, version $version
134 This package contains firmware from the Linux kernel, version $version 193 This package contains firmware from the Linux kernel, version $version.
135EOF 194EOF
136 195
137 dpkg-gencontrol -isp -p$fwpackagename -P"$fwdir" 196 create_package "$fwpackagename" "$fwdir"
138 dpkg --build "$fwdir" ..
139fi 197fi
140 198
141# Perform the final magic 199create_package "$packagename" "$tmpdir"
142dpkg-gencontrol -isp -p$packagename
143dpkg --build "$tmpdir" ..
144 200
145exit 0 201exit 0
146
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 00790472f64..46989b88d73 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -39,8 +39,10 @@ if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
39 printf -- '-svn%s' "`git svn find-rev $head`" 39 printf -- '-svn%s' "`git svn find-rev $head`"
40 fi 40 fi
41 41
42 # Are there uncommitted changes? 42 # Update index only on r/w media
43 git update-index --refresh --unmerged > /dev/null 43 [ -w . ] && git update-index --refresh --unmerged > /dev/null
44
45 # Check for uncommitted changes
44 if git diff-index --name-only HEAD | grep -v "^scripts/package" \ 46 if git diff-index --name-only HEAD | grep -v "^scripts/package" \
45 | read dummy; then 47 | read dummy; then
46 printf '%s' -dirty 48 printf '%s' -dirty
diff --git a/scripts/unifdef.c b/scripts/unifdef.c
index 05a31a6c7e1..30d459fb070 100644
--- a/scripts/unifdef.c
+++ b/scripts/unifdef.c
@@ -678,8 +678,10 @@ eval_unary(const struct ops *ops, int *valp, const char **cpp)
678 if (*cp == '!') { 678 if (*cp == '!') {
679 debug("eval%d !", ops - eval_ops); 679 debug("eval%d !", ops - eval_ops);
680 cp++; 680 cp++;
681 if (eval_unary(ops, valp, &cp) == LT_IF) 681 if (eval_unary(ops, valp, &cp) == LT_IF) {
682 *cpp = cp;
682 return (LT_IF); 683 return (LT_IF);
684 }
683 *valp = !*valp; 685 *valp = !*valp;
684 } else if (*cp == '(') { 686 } else if (*cp == '(') {
685 cp++; 687 cp++;
@@ -700,13 +702,16 @@ eval_unary(const struct ops *ops, int *valp, const char **cpp)
700 return (LT_IF); 702 return (LT_IF);
701 cp = skipcomment(cp); 703 cp = skipcomment(cp);
702 sym = findsym(cp); 704 sym = findsym(cp);
703 if (sym < 0)
704 return (LT_IF);
705 *valp = (value[sym] != NULL);
706 cp = skipsym(cp); 705 cp = skipsym(cp);
707 cp = skipcomment(cp); 706 cp = skipcomment(cp);
708 if (*cp++ != ')') 707 if (*cp++ != ')')
709 return (LT_IF); 708 return (LT_IF);
709 if (sym >= 0)
710 *valp = (value[sym] != NULL);
711 else {
712 *cpp = cp;
713 return (LT_IF);
714 }
710 keepthis = false; 715 keepthis = false;
711 } else if (!endsym(*cp)) { 716 } else if (!endsym(*cp)) {
712 debug("eval%d symbol", ops - eval_ops); 717 debug("eval%d symbol", ops - eval_ops);
@@ -741,11 +746,11 @@ eval_table(const struct ops *ops, int *valp, const char **cpp)
741 const struct op *op; 746 const struct op *op;
742 const char *cp; 747 const char *cp;
743 int val; 748 int val;
749 Linetype lhs, rhs;
744 750
745 debug("eval%d", ops - eval_ops); 751 debug("eval%d", ops - eval_ops);
746 cp = *cpp; 752 cp = *cpp;
747 if (ops->inner(ops+1, valp, &cp) == LT_IF) 753 lhs = ops->inner(ops+1, valp, &cp);
748 return (LT_IF);
749 for (;;) { 754 for (;;) {
750 cp = skipcomment(cp); 755 cp = skipcomment(cp);
751 for (op = ops->op; op->str != NULL; op++) 756 for (op = ops->op; op->str != NULL; op++)
@@ -755,14 +760,32 @@ eval_table(const struct ops *ops, int *valp, const char **cpp)
755 break; 760 break;
756 cp += strlen(op->str); 761 cp += strlen(op->str);
757 debug("eval%d %s", ops - eval_ops, op->str); 762 debug("eval%d %s", ops - eval_ops, op->str);
758 if (ops->inner(ops+1, &val, &cp) == LT_IF) 763 rhs = ops->inner(ops+1, &val, &cp);
759 return (LT_IF); 764 if (op->fn == op_and && (lhs == LT_FALSE || rhs == LT_FALSE)) {
760 *valp = op->fn(*valp, val); 765 debug("eval%d: and always false", ops - eval_ops);
766 if (lhs == LT_IF)
767 *valp = val;
768 lhs = LT_FALSE;
769 continue;
770 }
771 if (op->fn == op_or && (lhs == LT_TRUE || rhs == LT_TRUE)) {
772 debug("eval%d: or always true", ops - eval_ops);
773 if (lhs == LT_IF)
774 *valp = val;
775 lhs = LT_TRUE;
776 continue;
777 }
778 if (rhs == LT_IF)
779 lhs = LT_IF;
780 if (lhs != LT_IF)
781 *valp = op->fn(*valp, val);
761 } 782 }
762 783
763 *cpp = cp; 784 *cpp = cp;
764 debug("eval%d = %d", ops - eval_ops, *valp); 785 debug("eval%d = %d", ops - eval_ops, *valp);
765 return (*valp ? LT_TRUE : LT_FALSE); 786 if (lhs != LT_IF)
787 lhs = (*valp ? LT_TRUE : LT_FALSE);
788 return lhs;
766} 789}
767 790
768/* 791/*
@@ -773,12 +796,15 @@ eval_table(const struct ops *ops, int *valp, const char **cpp)
773static Linetype 796static Linetype
774ifeval(const char **cpp) 797ifeval(const char **cpp)
775{ 798{
799 const char *cp = *cpp;
776 int ret; 800 int ret;
777 int val; 801 int val;
778 802
779 debug("eval %s", *cpp); 803 debug("eval %s", *cpp);
780 keepthis = killconsts ? false : true; 804 keepthis = killconsts ? false : true;
781 ret = eval_table(eval_ops, &val, cpp); 805 ret = eval_table(eval_ops, &val, &cp);
806 if (ret != LT_IF)
807 *cpp = cp;
782 debug("eval = %d", val); 808 debug("eval = %d", val);
783 return (keepthis ? LT_IF : ret); 809 return (keepthis ? LT_IF : ret);
784} 810}
diff --git a/scripts/ver_linux b/scripts/ver_linux
index dbb3037f134..7de36df4eaa 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -65,7 +65,7 @@ sed -n -e '/^.*\/libc-\([^/]*\)\.so$/{s//\1/;p;q}' < /proc/self/maps
65ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \ 65ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \
66'NR==1{print "Dynamic linker (ldd) ", $NF}' 66'NR==1{print "Dynamic linker (ldd) ", $NF}'
67 67
68ls -l /usr/lib/lib{g,stdc}++.so 2>/dev/null | awk -F. \ 68ls -l /usr/lib/libg++.so /usr/lib/libstdc++.so 2>/dev/null | awk -F. \
69 '{print "Linux C++ Library " $4"."$5"."$6}' 69 '{print "Linux C++ Library " $4"."$5"."$6}'
70 70
71ps --version 2>&1 | grep version | awk \ 71ps --version 2>&1 | grep version | awk \