aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-09-08 05:43:49 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-08 05:43:49 -0400
commit1d6ae775d7a948c9575658eb41184fd2e506c0df (patch)
tree8128a28e89d82f13bb8e3a2160382240c66e2816 /scripts
parent739cdbf1d8f0739b80035b80d69d871e33749b86 (diff)
parentcaf39e87cc1182f7dae84eefc43ca14d54c78ef9 (diff)
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Kbuild.include96
-rw-r--r--scripts/Makefile.build7
-rw-r--r--scripts/Makefile.clean14
-rw-r--r--scripts/Makefile.host3
-rw-r--r--scripts/Makefile.lib99
-rw-r--r--scripts/Makefile.modinst2
-rw-r--r--scripts/Makefile.modpost1
-rw-r--r--scripts/conmakehash.c2
-rw-r--r--scripts/kallsyms.c433
-rw-r--r--scripts/kconfig/Makefile16
-rw-r--r--scripts/kconfig/kxgettext.c16
-rw-r--r--scripts/kconfig/lkc.h2
-rw-r--r--scripts/kconfig/menu.c4
-rw-r--r--scripts/kconfig/zconf.tab.c_shipped8
-rw-r--r--scripts/kconfig/zconf.y8
-rwxr-xr-xscripts/kernel-doc8
-rw-r--r--scripts/lxdialog/dialog.h2
-rw-r--r--scripts/lxdialog/inputbox.c4
-rwxr-xr-xscripts/mkcompile_h12
-rw-r--r--scripts/mod/file2alias.c19
-rw-r--r--scripts/mod/sumversion.c8
-rw-r--r--scripts/package/Makefile24
-rw-r--r--scripts/package/builddeb56
-rw-r--r--scripts/package/buildtar111
-rwxr-xr-xscripts/package/mkspec9
-rw-r--r--scripts/reference_discarded.pl1
-rw-r--r--scripts/reference_init.pl1
-rw-r--r--scripts/setlocalversion56
-rwxr-xr-xscripts/ver_linux6
29 files changed, 543 insertions, 485 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
new file mode 100644
index 000000000000..9087273abf91
--- /dev/null
+++ b/scripts/Kbuild.include
@@ -0,0 +1,96 @@
1####
2# kbuild: Generic definitions
3
4# Convinient variables
5comma := ,
6empty :=
7space := $(empty) $(empty)
8
9###
10# The temporary file to save gcc -MD generated dependencies must not
11# contain a comma
12depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
13
14###
15# filechk is used to check if the content of a generated file is updated.
16# Sample usage:
17# define filechk_sample
18# echo $KERNELRELEASE
19# endef
20# version.h : Makefile
21# $(call filechk,sample)
22# The rule defined shall write to stdout the content of the new file.
23# The existing file will be compared with the new one.
24# - If no file exist it is created
25# - If the content differ the new file is used
26# - If they are equal no change, and no timestamp update
27# - stdin is piped in from the first prerequisite ($<) so one has
28# to specify a valid file as first prerequisite (often the kbuild file)
29define filechk
30 $(Q)set -e; \
31 echo ' CHK $@'; \
32 mkdir -p $(dir $@); \
33 $(filechk_$(1)) < $< > $@.tmp; \
34 if [ -r $@ ] && cmp -s $@ $@.tmp; then \
35 rm -f $@.tmp; \
36 else \
37 echo ' UPD $@'; \
38 mv -f $@.tmp $@; \
39 fi
40endef
41
42###
43# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
44# Usage:
45# $(Q)$(MAKE) $(build)=dir
46build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
47
48# If quiet is set, only print short version of command
49cmd = @$(if $($(quiet)cmd_$(1)),\
50 echo ' $(subst ','\'',$($(quiet)cmd_$(1)))' &&) $(cmd_$(1))
51
52###
53# if_changed - execute command if any prerequisite is newer than
54# target, or command line has changed
55# if_changed_dep - as if_changed, but uses fixdep to reveal dependencies
56# including used config symbols
57# if_changed_rule - as if_changed but execute rule instead
58# See Documentation/kbuild/makefiles.txt for more info
59
60ifneq ($(KBUILD_NOCMDDEP),1)
61# Check if both arguments has same arguments. Result in empty string if equal
62# User may override this check using make KBUILD_NOCMDDEP=1
63arg-check = $(strip $(filter-out $(1), $(2)) $(filter-out $(2), $(1)) )
64endif
65
66# echo command. Short version is $(quiet) equals quiet, otherwise full command
67echo-cmd = $(if $($(quiet)cmd_$(1)), \
68 echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';)
69
70# function to only execute the passed command if necessary
71# >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file
72# note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars
73#
74if_changed = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
75 @set -e; \
76 $(echo-cmd) \
77 $(cmd_$(1)); \
78 echo 'cmd_$@ := $(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).cmd)
79
80# execute the command and also postprocess generated .d dependencies
81# file
82if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
83 $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
84 @set -e; \
85 $(echo-cmd) \
86 $(cmd_$(1)); \
87 scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \
88 rm -f $(depfile); \
89 mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
90
91# Usage: $(call if_changed_rule,foo)
92# will check if $(cmd_foo) changed, or any of the prequisites changed,
93# and if so will execute $(rule_foo)
94if_changed_rule = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\
95 @set -e; \
96 $(rule_$(1)))
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 76ba6be3dfc9..506e3f3befe3 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -10,8 +10,11 @@ __build:
10# Read .config if it exist, otherwise ignore 10# Read .config if it exist, otherwise ignore
11-include .config 11-include .config
12 12
13include $(if $(wildcard $(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile) 13# The filename Kbuild has precedence over Makefile
14kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
15include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile)
14 16
17include scripts/Kbuild.include
15include scripts/Makefile.lib 18include scripts/Makefile.lib
16 19
17ifdef host-progs 20ifdef host-progs
@@ -169,7 +172,7 @@ cmd_modversions = \
169 -T $(@D)/.tmp_$(@F:.o=.ver); \ 172 -T $(@D)/.tmp_$(@F:.o=.ver); \
170 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ 173 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
171 else \ 174 else \
172 mv $(@D)/.tmp_$(@F) $@; \ 175 mv -f $(@D)/.tmp_$(@F) $@; \
173 fi; 176 fi;
174endif 177endif
175 178
diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean
index ff3e87dbf387..8974ea5fc878 100644
--- a/scripts/Makefile.clean
+++ b/scripts/Makefile.clean
@@ -7,7 +7,14 @@ src := $(obj)
7.PHONY: __clean 7.PHONY: __clean
8__clean: 8__clean:
9 9
10include $(if $(wildcard $(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile) 10# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir
11# Usage:
12# $(Q)$(MAKE) $(clean)=dir
13clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
14
15# The filename Kbuild has precedence over Makefile
16kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
17include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile)
11 18
12# Figure out what we need to build from the various variables 19# Figure out what we need to build from the various variables
13# ========================================================================== 20# ==========================================================================
@@ -87,8 +94,3 @@ $(subdir-ymn):
87# If quiet is set, only print short version of command 94# If quiet is set, only print short version of command
88 95
89cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1)) 96cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
90
91# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir
92# Usage:
93# $(Q)$(MAKE) $(clean)=dir
94clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index 2821a2b83bbb..2d519704b8fd 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -98,7 +98,8 @@ hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags)
98# Create executable from a single .c file 98# Create executable from a single .c file
99# host-csingle -> Executable 99# host-csingle -> Executable
100quiet_cmd_host-csingle = HOSTCC $@ 100quiet_cmd_host-csingle = HOSTCC $@
101 cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(HOST_LOADLIBES) -o $@ $< 101 cmd_host-csingle = $(HOSTCC) $(hostc_flags) -o $@ $< \
102 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
102$(host-csingle): %: %.c FORCE 103$(host-csingle): %: %.c FORCE
103 $(call if_changed_dep,host-csingle) 104 $(call if_changed_dep,host-csingle)
104 105
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 7cf75cc4f849..0f81dcfd6909 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -1,13 +1,3 @@
1# ===========================================================================
2# kbuild: Generic definitions
3# ===========================================================================
4
5# Standard vars
6
7comma := ,
8empty :=
9space := $(empty) $(empty)
10
11# Backward compatibility - to be removed... 1# Backward compatibility - to be removed...
12extra-y += $(EXTRA_TARGETS) 2extra-y += $(EXTRA_TARGETS)
13# Figure out what we need to build from the various variables 3# Figure out what we need to build from the various variables
@@ -84,10 +74,6 @@ multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m))
84subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) 74subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
85obj-dirs := $(addprefix $(obj)/,$(obj-dirs)) 75obj-dirs := $(addprefix $(obj)/,$(obj-dirs))
86 76
87# The temporary file to save gcc -MD generated dependencies must not
88# contain a comma
89depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
90
91# These flags are needed for modversions and compiling, so we define them here 77# These flags are needed for modversions and compiling, so we define them here
92# already 78# already
93# $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will 79# $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will
@@ -179,89 +165,4 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
179quiet_cmd_gzip = GZIP $@ 165quiet_cmd_gzip = GZIP $@
180cmd_gzip = gzip -f -9 < $< > $@ 166cmd_gzip = gzip -f -9 < $< > $@
181 167
182# ===========================================================================
183# Generic stuff
184# ===========================================================================
185
186ifneq ($(KBUILD_NOCMDDEP),1)
187# Check if both arguments has same arguments. Result in empty string if equal
188# User may override this check using make KBUILD_NOCMDDEP=1
189arg-check = $(strip $(filter-out $(1), $(2)) $(filter-out $(2), $(1)) )
190
191endif
192
193# echo command. Short version is $(quiet) equals quiet, otherwise full command
194echo-cmd = $(if $($(quiet)cmd_$(1)), \
195 echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';)
196
197# function to only execute the passed command if necessary
198# >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file
199# note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars
200#
201if_changed = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
202 @set -e; \
203 $(echo-cmd) \
204 $(cmd_$(1)); \
205 echo 'cmd_$@ := $(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).cmd)
206
207
208# execute the command and also postprocess generated .d dependencies
209# file
210
211if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
212 $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
213 @set -e; \
214 $(echo-cmd) \
215 $(cmd_$(1)); \
216 scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \
217 rm -f $(depfile); \
218 mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
219
220# Usage: $(call if_changed_rule,foo)
221# will check if $(cmd_foo) changed, or any of the prequisites changed,
222# and if so will execute $(rule_foo)
223
224if_changed_rule = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\
225 @set -e; \
226 $(rule_$(1)))
227
228# If quiet is set, only print short version of command
229
230cmd = @$(if $($(quiet)cmd_$(1)),echo ' $(subst ','\'',$($(quiet)cmd_$(1)))' &&) $(cmd_$(1))
231
232# $(call descend,<dir>,<target>)
233# Recursively call a sub-make in <dir> with target <target>
234# Usage is deprecated, because make do not see this as an invocation of make.
235descend =$(Q)$(MAKE) -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj=$(1) $(2)
236
237# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
238# Usage:
239# $(Q)$(MAKE) $(build)=dir
240build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
241
242# filechk is used to check if the content of a generated file is updated.
243# Sample usage:
244# define filechk_sample
245# echo $KERNELRELEASE
246# endef
247# version.h : Makefile
248# $(call filechk,sample)
249# The rule defined shall write to stdout the content of the new file.
250# The existing file will be compared with the new one.
251# - If no file exist it is created
252# - If the content differ the new file is used
253# - If they are equal no change, and no timestamp update
254
255define filechk
256 $(Q)set -e; \
257 echo ' CHK $@'; \
258 mkdir -p $(dir $@); \
259 $(filechk_$(1)) $(2) > $@.tmp; \
260 if [ -r $@ ] && cmp -s $@ $@.tmp; then \
261 rm -f $@.tmp; \
262 else \
263 echo ' UPD $@'; \
264 mv -f $@.tmp $@; \
265 fi
266endef
267 168
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index 85d6494e3c24..23fd1bdc25ce 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -5,7 +5,7 @@
5.PHONY: __modinst 5.PHONY: __modinst
6__modinst: 6__modinst:
7 7
8include scripts/Makefile.lib 8include scripts/Kbuild.include
9 9
10# 10#
11 11
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 94b550e21be8..0c4f3a9f2ea9 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -36,6 +36,7 @@
36_modpost: __modpost 36_modpost: __modpost
37 37
38include .config 38include .config
39include scripts/Kbuild.include
39include scripts/Makefile.lib 40include scripts/Makefile.lib
40 41
41symverfile := $(objtree)/Module.symvers 42symverfile := $(objtree)/Module.symvers
diff --git a/scripts/conmakehash.c b/scripts/conmakehash.c
index 93dd23f21ec9..e0c6891a9ad4 100644
--- a/scripts/conmakehash.c
+++ b/scripts/conmakehash.c
@@ -33,7 +33,7 @@ void usage(char *argv0)
33 33
34int getunicode(char **p0) 34int getunicode(char **p0)
35{ 35{
36 unsigned char *p = *p0; 36 char *p = *p0;
37 37
38 while (*p == ' ' || *p == '\t') 38 while (*p == ' ' || *p == '\t')
39 p++; 39 p++;
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index d3d2e5341051..d591578bd3b2 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -24,75 +24,37 @@
24 * 24 *
25 */ 25 */
26 26
27#define _GNU_SOURCE
28
27#include <stdio.h> 29#include <stdio.h>
28#include <stdlib.h> 30#include <stdlib.h>
29#include <string.h> 31#include <string.h>
30#include <ctype.h> 32#include <ctype.h>
31 33
32/* maximum token length used. It doesn't pay to increase it a lot, because
33 * very long substrings probably don't repeat themselves too often. */
34#define MAX_TOK_SIZE 11
35#define KSYM_NAME_LEN 127 34#define KSYM_NAME_LEN 127
36 35
37/* we use only a subset of the complete symbol table to gather the token count,
38 * to speed up compression, at the expense of a little compression ratio */
39#define WORKING_SET 1024
40
41/* first find the best token only on the list of tokens that would profit more
42 * than GOOD_BAD_THRESHOLD. Only if this list is empty go to the "bad" list.
43 * Increasing this value will put less tokens on the "good" list, so the search
44 * is faster. However, if the good list runs out of tokens, we must painfully
45 * search the bad list. */
46#define GOOD_BAD_THRESHOLD 10
47
48/* token hash parameters */
49#define HASH_BITS 18
50#define HASH_TABLE_SIZE (1 << HASH_BITS)
51#define HASH_MASK (HASH_TABLE_SIZE - 1)
52#define HASH_BASE_OFFSET 2166136261U
53#define HASH_FOLD(a) ((a)&(HASH_MASK))
54
55/* flags to mark symbols */
56#define SYM_FLAG_VALID 1
57#define SYM_FLAG_SAMPLED 2
58 36
59struct sym_entry { 37struct sym_entry {
60 unsigned long long addr; 38 unsigned long long addr;
61 char type; 39 unsigned int len;
62 unsigned char flags;
63 unsigned char len;
64 unsigned char *sym; 40 unsigned char *sym;
65}; 41};
66 42
67 43
68static struct sym_entry *table; 44static struct sym_entry *table;
69static int size, cnt; 45static unsigned int table_size, table_cnt;
70static unsigned long long _stext, _etext, _sinittext, _einittext, _sextratext, _eextratext; 46static unsigned long long _stext, _etext, _sinittext, _einittext, _sextratext, _eextratext;
71static int all_symbols = 0; 47static int all_symbols = 0;
72static char symbol_prefix_char = '\0'; 48static char symbol_prefix_char = '\0';
73 49
74struct token { 50int token_profit[0x10000];
75 unsigned char data[MAX_TOK_SIZE];
76 unsigned char len;
77 /* profit: the number of bytes that could be saved by inserting this
78 * token into the table */
79 int profit;
80 struct token *next; /* next token on the hash list */
81 struct token *right; /* next token on the good/bad list */
82 struct token *left; /* previous token on the good/bad list */
83 struct token *smaller; /* token that is less one letter than this one */
84 };
85
86struct token bad_head, good_head;
87struct token *hash_table[HASH_TABLE_SIZE];
88 51
89/* the table that holds the result of the compression */ 52/* the table that holds the result of the compression */
90unsigned char best_table[256][MAX_TOK_SIZE+1]; 53unsigned char best_table[256][2];
91unsigned char best_table_len[256]; 54unsigned char best_table_len[256];
92 55
93 56
94static void 57static void usage(void)
95usage(void)
96{ 58{
97 fprintf(stderr, "Usage: kallsyms [--all-symbols] [--symbol-prefix=<prefix char>] < in.map > out.S\n"); 59 fprintf(stderr, "Usage: kallsyms [--all-symbols] [--symbol-prefix=<prefix char>] < in.map > out.S\n");
98 exit(1); 60 exit(1);
@@ -102,21 +64,19 @@ usage(void)
102 * This ignores the intensely annoying "mapping symbols" found 64 * This ignores the intensely annoying "mapping symbols" found
103 * in ARM ELF files: $a, $t and $d. 65 * in ARM ELF files: $a, $t and $d.
104 */ 66 */
105static inline int 67static inline int is_arm_mapping_symbol(const char *str)
106is_arm_mapping_symbol(const char *str)
107{ 68{
108 return str[0] == '$' && strchr("atd", str[1]) 69 return str[0] == '$' && strchr("atd", str[1])
109 && (str[2] == '\0' || str[2] == '.'); 70 && (str[2] == '\0' || str[2] == '.');
110} 71}
111 72
112static int 73static int read_symbol(FILE *in, struct sym_entry *s)
113read_symbol(FILE *in, struct sym_entry *s)
114{ 74{
115 char str[500]; 75 char str[500];
116 char *sym; 76 char *sym, stype;
117 int rc; 77 int rc;
118 78
119 rc = fscanf(in, "%llx %c %499s\n", &s->addr, &s->type, str); 79 rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, str);
120 if (rc != 3) { 80 if (rc != 3) {
121 if (rc != EOF) { 81 if (rc != EOF) {
122 /* skip line */ 82 /* skip line */
@@ -143,7 +103,7 @@ read_symbol(FILE *in, struct sym_entry *s)
143 _sextratext = s->addr; 103 _sextratext = s->addr;
144 else if (strcmp(sym, "_eextratext") == 0) 104 else if (strcmp(sym, "_eextratext") == 0)
145 _eextratext = s->addr; 105 _eextratext = s->addr;
146 else if (toupper(s->type) == 'A') 106 else if (toupper(stype) == 'A')
147 { 107 {
148 /* Keep these useful absolute symbols */ 108 /* Keep these useful absolute symbols */
149 if (strcmp(sym, "__kernel_syscall_via_break") && 109 if (strcmp(sym, "__kernel_syscall_via_break") &&
@@ -153,22 +113,24 @@ read_symbol(FILE *in, struct sym_entry *s)
153 return -1; 113 return -1;
154 114
155 } 115 }
156 else if (toupper(s->type) == 'U' || 116 else if (toupper(stype) == 'U' ||
157 is_arm_mapping_symbol(sym)) 117 is_arm_mapping_symbol(sym))
158 return -1; 118 return -1;
119 /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */
120 else if (str[0] == '$')
121 return -1;
159 122
160 /* include the type field in the symbol name, so that it gets 123 /* include the type field in the symbol name, so that it gets
161 * compressed together */ 124 * compressed together */
162 s->len = strlen(str) + 1; 125 s->len = strlen(str) + 1;
163 s->sym = (char *) malloc(s->len + 1); 126 s->sym = malloc(s->len + 1);
164 strcpy(s->sym + 1, str); 127 strcpy((char *)s->sym + 1, str);
165 s->sym[0] = s->type; 128 s->sym[0] = stype;
166 129
167 return 0; 130 return 0;
168} 131}
169 132
170static int 133static int symbol_valid(struct sym_entry *s)
171symbol_valid(struct sym_entry *s)
172{ 134{
173 /* Symbols which vary between passes. Passes 1 and 2 must have 135 /* Symbols which vary between passes. Passes 1 and 2 must have
174 * identical symbol lists. The kallsyms_* symbols below are only added 136 * identical symbol lists. The kallsyms_* symbols below are only added
@@ -207,37 +169,36 @@ symbol_valid(struct sym_entry *s)
207 * move then they may get dropped in pass 2, which breaks the 169 * move then they may get dropped in pass 2, which breaks the
208 * kallsyms rules. 170 * kallsyms rules.
209 */ 171 */
210 if ((s->addr == _etext && strcmp(s->sym + offset, "_etext")) || 172 if ((s->addr == _etext && strcmp((char*)s->sym + offset, "_etext")) ||
211 (s->addr == _einittext && strcmp(s->sym + offset, "_einittext")) || 173 (s->addr == _einittext && strcmp((char*)s->sym + offset, "_einittext")) ||
212 (s->addr == _eextratext && strcmp(s->sym + offset, "_eextratext"))) 174 (s->addr == _eextratext && strcmp((char*)s->sym + offset, "_eextratext")))
213 return 0; 175 return 0;
214 } 176 }
215 177
216 /* Exclude symbols which vary between passes. */ 178 /* Exclude symbols which vary between passes. */
217 if (strstr(s->sym + offset, "_compiled.")) 179 if (strstr((char *)s->sym + offset, "_compiled."))
218 return 0; 180 return 0;
219 181
220 for (i = 0; special_symbols[i]; i++) 182 for (i = 0; special_symbols[i]; i++)
221 if( strcmp(s->sym + offset, special_symbols[i]) == 0 ) 183 if( strcmp((char *)s->sym + offset, special_symbols[i]) == 0 )
222 return 0; 184 return 0;
223 185
224 return 1; 186 return 1;
225} 187}
226 188
227static void 189static void read_map(FILE *in)
228read_map(FILE *in)
229{ 190{
230 while (!feof(in)) { 191 while (!feof(in)) {
231 if (cnt >= size) { 192 if (table_cnt >= table_size) {
232 size += 10000; 193 table_size += 10000;
233 table = realloc(table, sizeof(*table) * size); 194 table = realloc(table, sizeof(*table) * table_size);
234 if (!table) { 195 if (!table) {
235 fprintf(stderr, "out of memory\n"); 196 fprintf(stderr, "out of memory\n");
236 exit (1); 197 exit (1);
237 } 198 }
238 } 199 }
239 if (read_symbol(in, &table[cnt]) == 0) 200 if (read_symbol(in, &table[table_cnt]) == 0)
240 cnt++; 201 table_cnt++;
241 } 202 }
242} 203}
243 204
@@ -281,10 +242,9 @@ static int expand_symbol(unsigned char *data, int len, char *result)
281 return total; 242 return total;
282} 243}
283 244
284static void 245static void write_src(void)
285write_src(void)
286{ 246{
287 int i, k, off, valid; 247 unsigned int i, k, off;
288 unsigned int best_idx[256]; 248 unsigned int best_idx[256];
289 unsigned int *markers; 249 unsigned int *markers;
290 char buf[KSYM_NAME_LEN+1]; 250 char buf[KSYM_NAME_LEN+1];
@@ -301,33 +261,24 @@ write_src(void)
301 printf(".data\n"); 261 printf(".data\n");
302 262
303 output_label("kallsyms_addresses"); 263 output_label("kallsyms_addresses");
304 valid = 0; 264 for (i = 0; i < table_cnt; i++) {
305 for (i = 0; i < cnt; i++) { 265 printf("\tPTR\t%#llx\n", table[i].addr);
306 if (table[i].flags & SYM_FLAG_VALID) {
307 printf("\tPTR\t%#llx\n", table[i].addr);
308 valid++;
309 }
310 } 266 }
311 printf("\n"); 267 printf("\n");
312 268
313 output_label("kallsyms_num_syms"); 269 output_label("kallsyms_num_syms");
314 printf("\tPTR\t%d\n", valid); 270 printf("\tPTR\t%d\n", table_cnt);
315 printf("\n"); 271 printf("\n");
316 272
317 /* table of offset markers, that give the offset in the compressed stream 273 /* table of offset markers, that give the offset in the compressed stream
318 * every 256 symbols */ 274 * every 256 symbols */
319 markers = (unsigned int *) malloc(sizeof(unsigned int)*((valid + 255) / 256)); 275 markers = (unsigned int *) malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256));
320 276
321 output_label("kallsyms_names"); 277 output_label("kallsyms_names");
322 valid = 0;
323 off = 0; 278 off = 0;
324 for (i = 0; i < cnt; i++) { 279 for (i = 0; i < table_cnt; i++) {
325 280 if ((i & 0xFF) == 0)
326 if (!table[i].flags & SYM_FLAG_VALID) 281 markers[i >> 8] = off;
327 continue;
328
329 if ((valid & 0xFF) == 0)
330 markers[valid >> 8] = off;
331 282
332 printf("\t.byte 0x%02x", table[i].len); 283 printf("\t.byte 0x%02x", table[i].len);
333 for (k = 0; k < table[i].len; k++) 284 for (k = 0; k < table[i].len; k++)
@@ -335,12 +286,11 @@ write_src(void)
335 printf("\n"); 286 printf("\n");
336 287
337 off += table[i].len + 1; 288 off += table[i].len + 1;
338 valid++;
339 } 289 }
340 printf("\n"); 290 printf("\n");
341 291
342 output_label("kallsyms_markers"); 292 output_label("kallsyms_markers");
343 for (i = 0; i < ((valid + 255) >> 8); i++) 293 for (i = 0; i < ((table_cnt + 255) >> 8); i++)
344 printf("\tPTR\t%d\n", markers[i]); 294 printf("\tPTR\t%d\n", markers[i]);
345 printf("\n"); 295 printf("\n");
346 296
@@ -350,7 +300,7 @@ write_src(void)
350 off = 0; 300 off = 0;
351 for (i = 0; i < 256; i++) { 301 for (i = 0; i < 256; i++) {
352 best_idx[i] = off; 302 best_idx[i] = off;
353 expand_symbol(best_table[i],best_table_len[i],buf); 303 expand_symbol(best_table[i], best_table_len[i], buf);
354 printf("\t.asciz\t\"%s\"\n", buf); 304 printf("\t.asciz\t\"%s\"\n", buf);
355 off += strlen(buf) + 1; 305 off += strlen(buf) + 1;
356 } 306 }
@@ -365,153 +315,13 @@ write_src(void)
365 315
366/* table lookup compression functions */ 316/* table lookup compression functions */
367 317
368static inline unsigned int rehash_token(unsigned int hash, unsigned char data)
369{
370 return ((hash * 16777619) ^ data);
371}
372
373static unsigned int hash_token(unsigned char *data, int len)
374{
375 unsigned int hash=HASH_BASE_OFFSET;
376 int i;
377
378 for (i = 0; i < len; i++)
379 hash = rehash_token(hash, data[i]);
380
381 return HASH_FOLD(hash);
382}
383
384/* find a token given its data and hash value */
385static struct token *find_token_hash(unsigned char *data, int len, unsigned int hash)
386{
387 struct token *ptr;
388
389 ptr = hash_table[hash];
390
391 while (ptr) {
392 if ((ptr->len == len) && (memcmp(ptr->data, data, len) == 0))
393 return ptr;
394 ptr=ptr->next;
395 }
396
397 return NULL;
398}
399
400static inline void insert_token_in_group(struct token *head, struct token *ptr)
401{
402 ptr->right = head->right;
403 ptr->right->left = ptr;
404 head->right = ptr;
405 ptr->left = head;
406}
407
408static inline void remove_token_from_group(struct token *ptr)
409{
410 ptr->left->right = ptr->right;
411 ptr->right->left = ptr->left;
412}
413
414
415/* build the counts for all the tokens that start with "data", and have lenghts
416 * from 2 to "len" */
417static void learn_token(unsigned char *data, int len)
418{
419 struct token *ptr,*last_ptr;
420 int i, newprofit;
421 unsigned int hash = HASH_BASE_OFFSET;
422 unsigned int hashes[MAX_TOK_SIZE + 1];
423
424 if (len > MAX_TOK_SIZE)
425 len = MAX_TOK_SIZE;
426
427 /* calculate and store the hash values for all the sub-tokens */
428 hash = rehash_token(hash, data[0]);
429 for (i = 2; i <= len; i++) {
430 hash = rehash_token(hash, data[i-1]);
431 hashes[i] = HASH_FOLD(hash);
432 }
433
434 last_ptr = NULL;
435 ptr = NULL;
436
437 for (i = len; i >= 2; i--) {
438 hash = hashes[i];
439
440 if (!ptr) ptr = find_token_hash(data, i, hash);
441
442 if (!ptr) {
443 /* create a new token entry */
444 ptr = (struct token *) malloc(sizeof(*ptr));
445
446 memcpy(ptr->data, data, i);
447 ptr->len = i;
448
449 /* when we create an entry, it's profit is 0 because
450 * we also take into account the size of the token on
451 * the compressed table. We then subtract GOOD_BAD_THRESHOLD
452 * so that the test to see if this token belongs to
453 * the good or bad list, is a comparison to zero */
454 ptr->profit = -GOOD_BAD_THRESHOLD;
455
456 ptr->next = hash_table[hash];
457 hash_table[hash] = ptr;
458
459 insert_token_in_group(&bad_head, ptr);
460
461 ptr->smaller = NULL;
462 } else {
463 newprofit = ptr->profit + (ptr->len - 1);
464 /* check to see if this token needs to be moved to a
465 * different list */
466 if((ptr->profit < 0) && (newprofit >= 0)) {
467 remove_token_from_group(ptr);
468 insert_token_in_group(&good_head,ptr);
469 }
470 ptr->profit = newprofit;
471 }
472
473 if (last_ptr) last_ptr->smaller = ptr;
474 last_ptr = ptr;
475
476 ptr = ptr->smaller;
477 }
478}
479
480/* decrease the counts for all the tokens that start with "data", and have lenghts
481 * from 2 to "len". This function is much simpler than learn_token because we have
482 * more guarantees (tho tokens exist, the ->smaller pointer is set, etc.)
483 * The two separate functions exist only because of compression performance */
484static void forget_token(unsigned char *data, int len)
485{
486 struct token *ptr;
487 int i, newprofit;
488 unsigned int hash=0;
489
490 if (len > MAX_TOK_SIZE) len = MAX_TOK_SIZE;
491
492 hash = hash_token(data, len);
493 ptr = find_token_hash(data, len, hash);
494
495 for (i = len; i >= 2; i--) {
496
497 newprofit = ptr->profit - (ptr->len - 1);
498 if ((ptr->profit >= 0) && (newprofit < 0)) {
499 remove_token_from_group(ptr);
500 insert_token_in_group(&bad_head, ptr);
501 }
502 ptr->profit=newprofit;
503
504 ptr=ptr->smaller;
505 }
506}
507
508/* count all the possible tokens in a symbol */ 318/* count all the possible tokens in a symbol */
509static void learn_symbol(unsigned char *symbol, int len) 319static void learn_symbol(unsigned char *symbol, int len)
510{ 320{
511 int i; 321 int i;
512 322
513 for (i = 0; i < len - 1; i++) 323 for (i = 0; i < len - 1; i++)
514 learn_token(symbol + i, len - i); 324 token_profit[ symbol[i] + (symbol[i + 1] << 8) ]++;
515} 325}
516 326
517/* decrease the count for all the possible tokens in a symbol */ 327/* decrease the count for all the possible tokens in a symbol */
@@ -520,117 +330,90 @@ static void forget_symbol(unsigned char *symbol, int len)
520 int i; 330 int i;
521 331
522 for (i = 0; i < len - 1; i++) 332 for (i = 0; i < len - 1; i++)
523 forget_token(symbol + i, len - i); 333 token_profit[ symbol[i] + (symbol[i + 1] << 8) ]--;
524} 334}
525 335
526/* set all the symbol flags and do the initial token count */ 336/* remove all the invalid symbols from the table and do the initial token count */
527static void build_initial_tok_table(void) 337static void build_initial_tok_table(void)
528{ 338{
529 int i, use_it, valid; 339 unsigned int i, pos;
530 340
531 valid = 0; 341 pos = 0;
532 for (i = 0; i < cnt; i++) { 342 for (i = 0; i < table_cnt; i++) {
533 table[i].flags = 0;
534 if ( symbol_valid(&table[i]) ) { 343 if ( symbol_valid(&table[i]) ) {
535 table[i].flags |= SYM_FLAG_VALID; 344 if (pos != i)
536 valid++; 345 table[pos] = table[i];
346 learn_symbol(table[pos].sym, table[pos].len);
347 pos++;
537 } 348 }
538 } 349 }
539 350 table_cnt = pos;
540 use_it = 0;
541 for (i = 0; i < cnt; i++) {
542
543 /* subsample the available symbols. This method is almost like
544 * a Bresenham's algorithm to get uniformly distributed samples
545 * across the symbol table */
546 if (table[i].flags & SYM_FLAG_VALID) {
547
548 use_it += WORKING_SET;
549
550 if (use_it >= valid) {
551 table[i].flags |= SYM_FLAG_SAMPLED;
552 use_it -= valid;
553 }
554 }
555 if (table[i].flags & SYM_FLAG_SAMPLED)
556 learn_symbol(table[i].sym, table[i].len);
557 }
558} 351}
559 352
560/* replace a given token in all the valid symbols. Use the sampled symbols 353/* replace a given token in all the valid symbols. Use the sampled symbols
561 * to update the counts */ 354 * to update the counts */
562static void compress_symbols(unsigned char *str, int tlen, int idx) 355static void compress_symbols(unsigned char *str, int idx)
563{ 356{
564 int i, len, learn, size; 357 unsigned int i, len, size;
565 unsigned char *p; 358 unsigned char *p1, *p2;
566 359
567 for (i = 0; i < cnt; i++) { 360 for (i = 0; i < table_cnt; i++) {
568
569 if (!(table[i].flags & SYM_FLAG_VALID)) continue;
570 361
571 len = table[i].len; 362 len = table[i].len;
572 learn = 0; 363 p1 = table[i].sym;
573 p = table[i].sym; 364
365 /* find the token on the symbol */
366 p2 = memmem(p1, len, str, 2);
367 if (!p2) continue;
368
369 /* decrease the counts for this symbol's tokens */
370 forget_symbol(table[i].sym, len);
371
372 size = len;
574 373
575 do { 374 do {
375 *p2 = idx;
376 p2++;
377 size -= (p2 - p1);
378 memmove(p2, p2 + 1, size);
379 p1 = p2;
380 len--;
381
382 if (size < 2) break;
383
576 /* find the token on the symbol */ 384 /* find the token on the symbol */
577 p = (unsigned char *) strstr((char *) p, (char *) str); 385 p2 = memmem(p1, size, str, 2);
578 if (!p) break;
579
580 if (!learn) {
581 /* if this symbol was used to count, decrease it */
582 if (table[i].flags & SYM_FLAG_SAMPLED)
583 forget_symbol(table[i].sym, len);
584 learn = 1;
585 }
586 386
587 *p = idx; 387 } while (p2);
588 size = (len - (p - table[i].sym)) - tlen + 1;
589 memmove(p + 1, p + tlen, size);
590 p++;
591 len -= tlen - 1;
592 388
593 } while (size >= tlen); 389 table[i].len = len;
594 390
595 if(learn) { 391 /* increase the counts for this symbol's new tokens */
596 table[i].len = len; 392 learn_symbol(table[i].sym, len);
597 /* if this symbol was used to count, learn it again */
598 if(table[i].flags & SYM_FLAG_SAMPLED)
599 learn_symbol(table[i].sym, len);
600 }
601 } 393 }
602} 394}
603 395
604/* search the token with the maximum profit */ 396/* search the token with the maximum profit */
605static struct token *find_best_token(void) 397static int find_best_token(void)
606{ 398{
607 struct token *ptr,*best,*head; 399 int i, best, bestprofit;
608 int bestprofit;
609 400
610 bestprofit=-10000; 401 bestprofit=-10000;
402 best = 0;
611 403
612 /* failsafe: if the "good" list is empty search from the "bad" list */ 404 for (i = 0; i < 0x10000; i++) {
613 if(good_head.right == &good_head) head = &bad_head; 405 if (token_profit[i] > bestprofit) {
614 else head = &good_head; 406 best = i;
615 407 bestprofit = token_profit[i];
616 ptr = head->right;
617 best = NULL;
618 while (ptr != head) {
619 if (ptr->profit > bestprofit) {
620 bestprofit = ptr->profit;
621 best = ptr;
622 } 408 }
623 ptr = ptr->right;
624 } 409 }
625
626 return best; 410 return best;
627} 411}
628 412
629/* this is the core of the algorithm: calculate the "best" table */ 413/* this is the core of the algorithm: calculate the "best" table */
630static void optimize_result(void) 414static void optimize_result(void)
631{ 415{
632 struct token *best; 416 int i, best;
633 int i;
634 417
635 /* using the '\0' symbol last allows compress_symbols to use standard 418 /* using the '\0' symbol last allows compress_symbols to use standard
636 * fast string functions */ 419 * fast string functions */
@@ -644,14 +427,12 @@ static void optimize_result(void)
644 best = find_best_token(); 427 best = find_best_token();
645 428
646 /* place it in the "best" table */ 429 /* place it in the "best" table */
647 best_table_len[i] = best->len; 430 best_table_len[i] = 2;
648 memcpy(best_table[i], best->data, best_table_len[i]); 431 best_table[i][0] = best & 0xFF;
649 /* zero terminate the token so that we can use strstr 432 best_table[i][1] = (best >> 8) & 0xFF;
650 in compress_symbols */
651 best_table[i][best_table_len[i]]='\0';
652 433
653 /* replace this token in all the valid symbols */ 434 /* replace this token in all the valid symbols */
654 compress_symbols(best_table[i], best_table_len[i], i); 435 compress_symbols(best_table[i], i);
655 } 436 }
656 } 437 }
657} 438}
@@ -659,39 +440,28 @@ static void optimize_result(void)
659/* start by placing the symbols that are actually used on the table */ 440/* start by placing the symbols that are actually used on the table */
660static void insert_real_symbols_in_table(void) 441static void insert_real_symbols_in_table(void)
661{ 442{
662 int i, j, c; 443 unsigned int i, j, c;
663 444
664 memset(best_table, 0, sizeof(best_table)); 445 memset(best_table, 0, sizeof(best_table));
665 memset(best_table_len, 0, sizeof(best_table_len)); 446 memset(best_table_len, 0, sizeof(best_table_len));
666 447
667 for (i = 0; i < cnt; i++) { 448 for (i = 0; i < table_cnt; i++) {
668 if (table[i].flags & SYM_FLAG_VALID) { 449 for (j = 0; j < table[i].len; j++) {
669 for (j = 0; j < table[i].len; j++) { 450 c = table[i].sym[j];
670 c = table[i].sym[j]; 451 best_table[c][0]=c;
671 best_table[c][0]=c; 452 best_table_len[c]=1;
672 best_table_len[c]=1;
673 }
674 } 453 }
675 } 454 }
676} 455}
677 456
678static void optimize_token_table(void) 457static void optimize_token_table(void)
679{ 458{
680 memset(hash_table, 0, sizeof(hash_table));
681
682 good_head.left = &good_head;
683 good_head.right = &good_head;
684
685 bad_head.left = &bad_head;
686 bad_head.right = &bad_head;
687
688 build_initial_tok_table(); 459 build_initial_tok_table();
689 460
690 insert_real_symbols_in_table(); 461 insert_real_symbols_in_table();
691 462
692 /* When valid symbol is not registered, exit to error */ 463 /* When valid symbol is not registered, exit to error */
693 if (good_head.left == good_head.right && 464 if (!table_cnt) {
694 bad_head.left == bad_head.right) {
695 fprintf(stderr, "No valid symbol.\n"); 465 fprintf(stderr, "No valid symbol.\n");
696 exit(1); 466 exit(1);
697 } 467 }
@@ -700,8 +470,7 @@ static void optimize_token_table(void)
700} 470}
701 471
702 472
703int 473int main(int argc, char **argv)
704main(int argc, char **argv)
705{ 474{
706 if (argc >= 2) { 475 if (argc >= 2) {
707 int i; 476 int i;
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 09abb891d11f..2fcb244a9e18 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -27,8 +27,20 @@ update-po-config: $(obj)/kxgettext
27 xgettext --default-domain=linux \ 27 xgettext --default-domain=linux \
28 --add-comments --keyword=_ --keyword=N_ \ 28 --add-comments --keyword=_ --keyword=N_ \
29 --files-from=scripts/kconfig/POTFILES.in \ 29 --files-from=scripts/kconfig/POTFILES.in \
30 -o scripts/kconfig/linux.pot 30 --output scripts/kconfig/config.pot
31 scripts/kconfig/kxgettext arch/$(ARCH)/Kconfig >> scripts/kconfig/linux.pot 31 $(Q)ln -fs Kconfig_i386 arch/um/Kconfig_arch
32 $(Q)for i in `ls arch/`; \
33 do \
34 scripts/kconfig/kxgettext arch/$$i/Kconfig \
35 | msguniq -o scripts/kconfig/linux_$${i}.pot; \
36 done
37 $(Q)msgcat scripts/kconfig/config.pot \
38 `find scripts/kconfig/ -type f -name linux_*.pot` \
39 --output scripts/kconfig/linux_raw.pot
40 $(Q)msguniq --sort-by-file scripts/kconfig/linux_raw.pot \
41 --output scripts/kconfig/linux.pot
42 $(Q)rm -f arch/um/Kconfig_arch
43 $(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot
32 44
33.PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig 45.PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig
34 46
diff --git a/scripts/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c
index 1c88d7c6d5a7..abee55ca6174 100644
--- a/scripts/kconfig/kxgettext.c
+++ b/scripts/kconfig/kxgettext.c
@@ -14,6 +14,11 @@ static char *escape(const char* text, char *bf, int len)
14{ 14{
15 char *bfp = bf; 15 char *bfp = bf;
16 int multiline = strchr(text, '\n') != NULL; 16 int multiline = strchr(text, '\n') != NULL;
17 int eol = 0;
18 int textlen = strlen(text);
19
20 if ((textlen > 0) && (text[textlen-1] == '\n'))
21 eol = 1;
17 22
18 *bfp++ = '"'; 23 *bfp++ = '"';
19 --len; 24 --len;
@@ -43,7 +48,7 @@ next:
43 --len; 48 --len;
44 } 49 }
45 50
46 if (multiline) 51 if (multiline && eol)
47 bfp -= 3; 52 bfp -= 3;
48 53
49 *bfp++ = '"'; 54 *bfp++ = '"';
@@ -179,7 +184,11 @@ static void message__print_file_lineno(struct message *self)
179{ 184{
180 struct file_line *fl = self->files; 185 struct file_line *fl = self->files;
181 186
182 printf("\n#: %s:%d", fl->file, fl->lineno); 187 putchar('\n');
188 if (self->option != NULL)
189 printf("# %s:00000\n", self->option);
190
191 printf("#: %s:%d", fl->file, fl->lineno);
183 fl = fl->next; 192 fl = fl->next;
184 193
185 while (fl != NULL) { 194 while (fl != NULL) {
@@ -187,9 +196,6 @@ static void message__print_file_lineno(struct message *self)
187 fl = fl->next; 196 fl = fl->next;
188 } 197 }
189 198
190 if (self->option != NULL)
191 printf(", %s:00000", self->option);
192
193 putchar('\n'); 199 putchar('\n');
194} 200}
195 201
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 8b84c42b49b5..c3d25786a64d 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -59,7 +59,7 @@ void menu_add_entry(struct symbol *sym);
59void menu_end_entry(void); 59void menu_end_entry(void);
60void menu_add_dep(struct expr *dep); 60void menu_add_dep(struct expr *dep);
61struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep); 61struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep);
62void menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); 62struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
63void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); 63void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
64void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); 64void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
65void menu_finalize(struct menu *parent); 65void menu_finalize(struct menu *parent);
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 8c59b212722d..5cfa6c405cf0 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -136,9 +136,9 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e
136 return prop; 136 return prop;
137} 137}
138 138
139void menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep) 139struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep)
140{ 140{
141 menu_add_prop(type, prompt, NULL, dep); 141 return menu_add_prop(type, prompt, NULL, dep);
142} 142}
143 143
144void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep) 144void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep)
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped
index f163d8d2d9ef..ff4fcc09720e 100644
--- a/scripts/kconfig/zconf.tab.c_shipped
+++ b/scripts/kconfig/zconf.tab.c_shipped
@@ -1531,7 +1531,7 @@ yyreduce:
1531 1531
1532 { 1532 {
1533 menu_add_entry(NULL); 1533 menu_add_entry(NULL);
1534 menu_add_prop(P_MENU, yyvsp[-1].string, NULL, NULL); 1534 menu_add_prompt(P_MENU, yyvsp[-1].string, NULL);
1535 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); 1535 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1536;} 1536;}
1537 break; 1537 break;
@@ -1586,7 +1586,7 @@ yyreduce:
1586 1586
1587 { 1587 {
1588 menu_add_entry(NULL); 1588 menu_add_entry(NULL);
1589 menu_add_prop(P_COMMENT, yyvsp[-1].string, NULL, NULL); 1589 menu_add_prompt(P_COMMENT, yyvsp[-1].string, NULL);
1590 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); 1590 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1591;} 1591;}
1592 break; 1592 break;
@@ -1640,7 +1640,7 @@ yyreduce:
1640 case 86: 1640 case 86:
1641 1641
1642 { 1642 {
1643 menu_add_prop(P_PROMPT, yyvsp[-1].string, NULL, yyvsp[0].expr); 1643 menu_add_prompt(P_PROMPT, yyvsp[-1].string, yyvsp[0].expr);
1644;} 1644;}
1645 break; 1645 break;
1646 1646
@@ -1925,7 +1925,7 @@ void conf_parse(const char *name)
1925 sym_init(); 1925 sym_init();
1926 menu_init(); 1926 menu_init();
1927 modules_sym = sym_lookup("MODULES", 0); 1927 modules_sym = sym_lookup("MODULES", 0);
1928 rootmenu.prompt = menu_add_prop(P_MENU, "Linux Kernel Configuration", NULL, NULL); 1928 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
1929 1929
1930 //zconfdebug = 1; 1930 //zconfdebug = 1;
1931 zconfparse(); 1931 zconfparse();
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 54460f8d3696..e1a0f455d4a8 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -342,7 +342,7 @@ if_block:
342menu: T_MENU prompt T_EOL 342menu: T_MENU prompt T_EOL
343{ 343{
344 menu_add_entry(NULL); 344 menu_add_entry(NULL);
345 menu_add_prop(P_MENU, $2, NULL, NULL); 345 menu_add_prompt(P_MENU, $2, NULL);
346 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); 346 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
347}; 347};
348 348
@@ -392,7 +392,7 @@ source_stmt: source
392comment: T_COMMENT prompt T_EOL 392comment: T_COMMENT prompt T_EOL
393{ 393{
394 menu_add_entry(NULL); 394 menu_add_entry(NULL);
395 menu_add_prop(P_COMMENT, $2, NULL, NULL); 395 menu_add_prompt(P_COMMENT, $2, NULL);
396 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); 396 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
397}; 397};
398 398
@@ -443,7 +443,7 @@ prompt_stmt_opt:
443 /* empty */ 443 /* empty */
444 | prompt if_expr 444 | prompt if_expr
445{ 445{
446 menu_add_prop(P_PROMPT, $1, NULL, $2); 446 menu_add_prompt(P_PROMPT, $1, $2);
447}; 447};
448 448
449prompt: T_WORD 449prompt: T_WORD
@@ -487,7 +487,7 @@ void conf_parse(const char *name)
487 sym_init(); 487 sym_init();
488 menu_init(); 488 menu_init();
489 modules_sym = sym_lookup("MODULES", 0); 489 modules_sym = sym_lookup("MODULES", 0);
490 rootmenu.prompt = menu_add_prop(P_MENU, "Linux Kernel Configuration", NULL, NULL); 490 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
491 491
492 //zconfdebug = 1; 492 //zconfdebug = 1;
493 zconfparse(); 493 zconfparse();
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 0835dc2a8aa9..8aaf74e64183 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1665,11 +1665,17 @@ sub xml_escape($) {
1665} 1665}
1666 1666
1667sub process_file($) { 1667sub process_file($) {
1668 my ($file) = "$ENV{'SRCTREE'}@_"; 1668 my $file;
1669 my $identifier; 1669 my $identifier;
1670 my $func; 1670 my $func;
1671 my $initial_section_counter = $section_counter; 1671 my $initial_section_counter = $section_counter;
1672 1672
1673 if (defined($ENV{'SRCTREE'})) {
1674 $file = "$ENV{'SRCTREE'}" . "/" . "@_";
1675 }
1676 else {
1677 $file = "@_";
1678 }
1673 if (defined($source_map{$file})) { 1679 if (defined($source_map{$file})) {
1674 $file = $source_map{$file}; 1680 $file = $source_map{$file};
1675 } 1681 }
diff --git a/scripts/lxdialog/dialog.h b/scripts/lxdialog/dialog.h
index c571548daa82..eb63e1bb63a3 100644
--- a/scripts/lxdialog/dialog.h
+++ b/scripts/lxdialog/dialog.h
@@ -163,7 +163,7 @@ int dialog_menu (const char *title, const char *prompt, int height, int width,
163int dialog_checklist (const char *title, const char *prompt, int height, 163int dialog_checklist (const char *title, const char *prompt, int height,
164 int width, int list_height, int item_no, 164 int width, int list_height, int item_no,
165 const char * const * items, int flag); 165 const char * const * items, int flag);
166extern unsigned char dialog_input_result[]; 166extern char dialog_input_result[];
167int dialog_inputbox (const char *title, const char *prompt, int height, 167int dialog_inputbox (const char *title, const char *prompt, int height,
168 int width, const char *init); 168 int width, const char *init);
169 169
diff --git a/scripts/lxdialog/inputbox.c b/scripts/lxdialog/inputbox.c
index fa7bebc693b9..074d2d68bd31 100644
--- a/scripts/lxdialog/inputbox.c
+++ b/scripts/lxdialog/inputbox.c
@@ -21,7 +21,7 @@
21 21
22#include "dialog.h" 22#include "dialog.h"
23 23
24unsigned char dialog_input_result[MAX_LEN + 1]; 24char dialog_input_result[MAX_LEN + 1];
25 25
26/* 26/*
27 * Print the termination buttons 27 * Print the termination buttons
@@ -48,7 +48,7 @@ dialog_inputbox (const char *title, const char *prompt, int height, int width,
48{ 48{
49 int i, x, y, box_y, box_x, box_width; 49 int i, x, y, box_y, box_x, box_width;
50 int input_x = 0, scroll = 0, key = 0, button = -1; 50 int input_x = 0, scroll = 0, key = 0, button = -1;
51 unsigned char *instr = dialog_input_result; 51 char *instr = dialog_input_result;
52 WINDOW *dialog; 52 WINDOW *dialog;
53 53
54 /* center dialog box on screen */ 54 /* center dialog box on screen */
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index 8d118d181950..d7b8a384b4a7 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -1,7 +1,8 @@
1TARGET=$1 1TARGET=$1
2ARCH=$2 2ARCH=$2
3SMP=$3 3SMP=$3
4CC=$4 4PREEMPT=$4
5CC=$5
5 6
6# If compile.h exists already and we don't own autoconf.h 7# If compile.h exists already and we don't own autoconf.h
7# (i.e. we're not the same user who did make *config), don't 8# (i.e. we're not the same user who did make *config), don't
@@ -26,8 +27,10 @@ fi
26 27
27 28
28UTS_VERSION="#$VERSION" 29UTS_VERSION="#$VERSION"
29if [ -n "$SMP" ] ; then UTS_VERSION="$UTS_VERSION SMP"; fi 30CONFIG_FLAGS=""
30UTS_VERSION="$UTS_VERSION `LC_ALL=C LANG=C date`" 31if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
32if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
33UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS `LC_ALL=C LANG=C date`"
31 34
32# Truncate to maximum length 35# Truncate to maximum length
33 36
@@ -37,7 +40,8 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/"
37# Generate a temporary compile.h 40# Generate a temporary compile.h
38 41
39( echo /\* This file is auto generated, version $VERSION \*/ 42( echo /\* This file is auto generated, version $VERSION \*/
40 43 if [ -n "$CONFIG_FLAGS" ] ; then echo "/* $CONFIG_FLAGS */"; fi
44
41 echo \#define UTS_MACHINE \"$ARCH\" 45 echo \#define UTS_MACHINE \"$ARCH\"
42 46
43 echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\" 47 echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\"
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 5180405c1a84..d8ee38aede26 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -341,6 +341,22 @@ static int do_of_entry (const char *filename, struct of_device_id *of, char *ali
341 return 1; 341 return 1;
342} 342}
343 343
344static int do_vio_entry(const char *filename, struct vio_device_id *vio,
345 char *alias)
346{
347 char *tmp;
348
349 sprintf(alias, "vio:T%sS%s", vio->type[0] ? vio->type : "*",
350 vio->compat[0] ? vio->compat : "*");
351
352 /* Replace all whitespace with underscores */
353 for (tmp = alias; tmp && *tmp; tmp++)
354 if (isspace (*tmp))
355 *tmp = '_';
356
357 return 1;
358}
359
344/* Ignore any prefix, eg. v850 prepends _ */ 360/* Ignore any prefix, eg. v850 prepends _ */
345static inline int sym_is(const char *symbol, const char *name) 361static inline int sym_is(const char *symbol, const char *name)
346{ 362{
@@ -422,6 +438,9 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
422 else if (sym_is(symname, "__mod_of_device_table")) 438 else if (sym_is(symname, "__mod_of_device_table"))
423 do_table(symval, sym->st_size, sizeof(struct of_device_id), 439 do_table(symval, sym->st_size, sizeof(struct of_device_id),
424 do_of_entry, mod); 440 do_of_entry, mod);
441 else if (sym_is(symname, "__mod_vio_device_table"))
442 do_table(symval, sym->st_size, sizeof(struct vio_device_id),
443 do_vio_entry, mod);
425 444
426} 445}
427 446
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c
index 1112347245c0..43271a1ca01e 100644
--- a/scripts/mod/sumversion.c
+++ b/scripts/mod/sumversion.c
@@ -252,9 +252,9 @@ static int parse_comment(const char *file, unsigned long len)
252} 252}
253 253
254/* FIXME: Handle .s files differently (eg. # starts comments) --RR */ 254/* FIXME: Handle .s files differently (eg. # starts comments) --RR */
255static int parse_file(const signed char *fname, struct md4_ctx *md) 255static int parse_file(const char *fname, struct md4_ctx *md)
256{ 256{
257 signed char *file; 257 char *file;
258 unsigned long i, len; 258 unsigned long i, len;
259 259
260 file = grab_file(fname, &len); 260 file = grab_file(fname, &len);
@@ -332,7 +332,7 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md)
332 Sum all files in the same dir or subdirs. 332 Sum all files in the same dir or subdirs.
333 */ 333 */
334 while ((line = get_next_line(&pos, file, flen)) != NULL) { 334 while ((line = get_next_line(&pos, file, flen)) != NULL) {
335 signed char* p = line; 335 char* p = line;
336 if (strncmp(line, "deps_", sizeof("deps_")-1) == 0) { 336 if (strncmp(line, "deps_", sizeof("deps_")-1) == 0) {
337 check_files = 1; 337 check_files = 1;
338 continue; 338 continue;
@@ -458,7 +458,7 @@ out:
458 close(fd); 458 close(fd);
459} 459}
460 460
461static int strip_rcs_crap(signed char *version) 461static int strip_rcs_crap(char *version)
462{ 462{
463 unsigned int len, full_len; 463 unsigned int len, full_len;
464 464
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 3b1f2eff2584..f3e7e8e4a500 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -59,7 +59,7 @@ $(objtree)/binkernel.spec: $(MKSPEC) $(srctree)/Makefile
59 $(CONFIG_SHELL) $(MKSPEC) prebuilt > $@ 59 $(CONFIG_SHELL) $(MKSPEC) prebuilt > $@
60 60
61binrpm-pkg: $(objtree)/binkernel.spec 61binrpm-pkg: $(objtree)/binkernel.spec
62 $(MAKE) 62 $(MAKE) KBUILD_SRC=
63 set -e; \ 63 set -e; \
64 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version 64 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
65 set -e; \ 65 set -e; \
@@ -74,16 +74,30 @@ clean-files += $(objtree)/binkernel.spec
74# 74#
75.PHONY: deb-pkg 75.PHONY: deb-pkg
76deb-pkg: 76deb-pkg:
77 $(MAKE) 77 $(MAKE) KBUILD_SRC=
78 $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb 78 $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
79 79
80clean-dirs += $(objtree)/debian/ 80clean-dirs += $(objtree)/debian/
81 81
82 82
83# tarball targets
84# ---------------------------------------------------------------------------
85.PHONY: tar%pkg
86tar%pkg:
87 $(MAKE)
88 $(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@
89
90clean-dirs += $(objtree)/tar-install/
91
92
83# Help text displayed when executing 'make help' 93# Help text displayed when executing 'make help'
84# --------------------------------------------------------------------------- 94# ---------------------------------------------------------------------------
85help: 95help:
86 @echo ' rpm-pkg - Build the kernel as an RPM package' 96 @echo ' rpm-pkg - Build the kernel as an RPM package'
87 @echo ' binrpm-pkg - Build an rpm package containing the compiled kernel & modules' 97 @echo ' binrpm-pkg - Build an rpm package containing the compiled kernel'
88 @echo ' deb-pkg - Build the kernel as an deb package' 98 @echo ' and modules'
99 @echo ' deb-pkg - Build the kernel as an deb package'
100 @echo ' tar-pkg - Build the kernel as an uncompressed tarball'
101 @echo ' targz-pkg - Build the kernel as a gzip compressed tarball'
102 @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'
89 103
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index c279b6310f02..6edb29f2b4a6 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -14,18 +14,38 @@ set -e
14# Some variables and settings used throughout the script 14# Some variables and settings used throughout the script
15version=$KERNELRELEASE 15version=$KERNELRELEASE
16tmpdir="$objtree/debian/tmp" 16tmpdir="$objtree/debian/tmp"
17packagename=linux-$version
18
19if [ "$ARCH" == "um" ] ; then
20 packagename=user-mode-linux-$version
21fi
17 22
18# Setup the directory structure 23# Setup the directory structure
19rm -rf "$tmpdir" 24rm -rf "$tmpdir"
20mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" 25mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot"
26if [ "$ARCH" == "um" ] ; then
27 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/share/doc/$packagename" "$tmpdir/usr/bin"
28fi
21 29
22# Build and install the kernel 30# Build and install the kernel
23cp System.map "$tmpdir/boot/System.map-$version" 31if [ "$ARCH" == "um" ] ; then
24cp .config "$tmpdir/boot/config-$version" 32 $MAKE linux
25cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" 33 cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
34 cp .config "$tmpdir/usr/share/doc/$packagename/config"
35 gzip "$tmpdir/usr/share/doc/$packagename/config"
36 cp $KBUILD_IMAGE "$tmpdir/usr/bin/linux-$version"
37else
38 cp System.map "$tmpdir/boot/System.map-$version"
39 cp .config "$tmpdir/boot/config-$version"
40 cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version"
41fi
26 42
27if grep -q '^CONFIG_MODULES=y' .config ; then 43if grep -q '^CONFIG_MODULES=y' .config ; then
28 INSTALL_MOD_PATH="$tmpdir" make modules_install 44 INSTALL_MOD_PATH="$tmpdir" make KBUILD_SRC= modules_install
45 if [ "$ARCH" == "um" ] ; then
46 mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/"
47 rmdir "$tmpdir/lib/modules/$version"
48 fi
29fi 49fi
30 50
31# Install the maintainer scripts 51# Install the maintainer scripts
@@ -53,6 +73,8 @@ linux ($version) unstable; urgency=low
53EOF 73EOF
54 74
55# Generate a control file 75# Generate a control file
76if [ "$ARCH" == "um" ]; then
77
56cat <<EOF > debian/control 78cat <<EOF > debian/control
57Source: linux 79Source: linux
58Section: base 80Section: base
@@ -60,12 +82,34 @@ Priority: optional
60Maintainer: $name 82Maintainer: $name
61Standards-Version: 3.6.1 83Standards-Version: 3.6.1
62 84
63Package: linux-$version 85Package: $packagename
86Architecture: any
87Description: User Mode Linux kernel, version $version
88 User-mode Linux is a port of the Linux kernel to its own system call
89 interface. It provides a kind of virtual machine, which runs Linux
90 as a user process under another Linux kernel. This is useful for
91 kernel development, sandboxes, jails, experimentation, and
92 many other things.
93 .
94 This package contains the Linux kernel, modules and corresponding other
95 files version $version
96EOF
97
98else
99cat <<EOF > debian/control
100Source: linux
101Section: base
102Priority: optional
103Maintainer: $name
104Standards-Version: 3.6.1
105
106Package: $packagename
64Architecture: any 107Architecture: any
65Description: Linux kernel, version $version 108Description: Linux kernel, version $version
66 This package contains the Linux kernel, modules and corresponding other 109 This package contains the Linux kernel, modules and corresponding other
67 files version $version. 110 files version $version
68EOF 111EOF
112fi
69 113
70# Fix some ownership and permissions 114# Fix some ownership and permissions
71chown -R root:root "$tmpdir" 115chown -R root:root "$tmpdir"
diff --git a/scripts/package/buildtar b/scripts/package/buildtar
new file mode 100644
index 000000000000..d8fffe6f8906
--- /dev/null
+++ b/scripts/package/buildtar
@@ -0,0 +1,111 @@
1#!/bin/sh
2
3#
4# buildtar 0.0.3
5#
6# (C) 2004-2005 by Jan-Benedict Glaw <jbglaw@lug-owl.de>
7#
8# This script is used to compile a tarball from the currently
9# prepared kernel. Based upon the builddeb script from
10# Wichert Akkerman <wichert@wiggy.net>.
11#
12
13set -e
14
15#
16# Some variables and settings used throughout the script
17#
18version="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}${EXTRANAME}"
19tmpdir="${objtree}/tar-install"
20tarball="${objtree}/linux-${version}.tar"
21
22
23#
24# Figure out how to compress, if requested at all
25#
26case "${1}" in
27 tar-pkg)
28 compress="cat"
29 file_ext=""
30 ;;
31 targz-pkg)
32 compress="gzip -c9"
33 file_ext=".gz"
34 ;;
35 tarbz2-pkg)
36 compress="bzip2 -c9"
37 file_ext=".bz2"
38 ;;
39 *)
40 echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2
41 exit 1
42 ;;
43esac
44
45
46#
47# Clean-up and re-create the temporary directory
48#
49rm -rf -- "${tmpdir}"
50mkdir -p -- "${tmpdir}/boot"
51
52
53#
54# Try to install modules
55#
56if ! make INSTALL_MOD_PATH="${tmpdir}" modules_install; then
57 echo "" >&2
58 echo "Ignoring error at module_install time, since that could be" >&2
59 echo "a result of missing local modutils/module-init-tools," >&2
60 echo "or you just didn't compile in module support at all..." >&2
61 echo "" >&2
62fi
63
64
65#
66# Install basic kernel files
67#
68cp -v -- System.map "${tmpdir}/boot/System.map-${version}"
69cp -v -- .config "${tmpdir}/boot/config-${version}"
70cp -v -- vmlinux "${tmpdir}/boot/vmlinux-${version}"
71
72
73#
74# Install arch-specific kernel image(s)
75#
76case "${ARCH}" in
77 i386)
78 [ -f arch/i386/boot/bzImage ] && cp -v -- arch/i386/boot/bzImage "${tmpdir}/boot/vmlinuz-${version}"
79 ;;
80 alpha)
81 [ -f arch/alpha/boot/vmlinux.gz ] && cp -v -- arch/alpha/boot/vmlinux.gz "${tmpdir}/boot/vmlinuz-${version}"
82 ;;
83 vax)
84 [ -f vmlinux.SYS ] && cp -v -- vmlinux.SYS "${tmpdir}/boot/vmlinux-${version}.SYS"
85 [ -f vmlinux.dsk ] && cp -v -- vmlinux.dsk "${tmpdir}/boot/vmlinux-${version}.dsk"
86 ;;
87 *)
88 [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${version}"
89 echo "" >&2
90 echo '** ** ** WARNING ** ** **' >&2
91 echo "" >&2
92 echo "Your architecture did not define any architecture-dependant files" >&2
93 echo "to be placed into the tarball. Please add those to ${0} ..." >&2
94 echo "" >&2
95 sleep 5
96 ;;
97esac
98
99
100#
101# Create the tarball
102#
103(
104 cd "${tmpdir}"
105 tar cf - . | ${compress} > "${tarball}${file_ext}"
106)
107
108echo "Tarball successfully created in ${tarball}${file_ext}"
109
110exit 0
111
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index 6e7a58f145ad..0b1038737548 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -62,10 +62,19 @@ echo ""
62fi 62fi
63 63
64echo "%install" 64echo "%install"
65echo "%ifarch ia64"
66echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules'
67echo "%else"
65echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules' 68echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules'
69echo "%endif"
66 70
67echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install' 71echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install'
72echo "%ifarch ia64"
73echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
74echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"
75echo "%else"
68echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" 76echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
77echo "%endif"
69 78
70echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" 79echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE"
71 80
diff --git a/scripts/reference_discarded.pl b/scripts/reference_discarded.pl
index d5cabb81bd1b..f04f62736851 100644
--- a/scripts/reference_discarded.pl
+++ b/scripts/reference_discarded.pl
@@ -96,6 +96,7 @@ foreach $object (keys(%object)) {
96 $from !~ /\.debug_ranges$/ && 96 $from !~ /\.debug_ranges$/ &&
97 $from !~ /\.debug_line$/ && 97 $from !~ /\.debug_line$/ &&
98 $from !~ /\.debug_frame$/ && 98 $from !~ /\.debug_frame$/ &&
99 $from !~ /\.debug_loc$/ &&
99 $from !~ /\.exitcall\.exit$/ && 100 $from !~ /\.exitcall\.exit$/ &&
100 $from !~ /\.eh_frame$/ && 101 $from !~ /\.eh_frame$/ &&
101 $from !~ /\.stab$/)) { 102 $from !~ /\.stab$/)) {
diff --git a/scripts/reference_init.pl b/scripts/reference_init.pl
index 9a2408453869..7f6960b175a2 100644
--- a/scripts/reference_init.pl
+++ b/scripts/reference_init.pl
@@ -98,6 +98,7 @@ foreach $object (sort(keys(%object))) {
98 $from !~ /\.pdr$/ && 98 $from !~ /\.pdr$/ &&
99 $from !~ /\__param$/ && 99 $from !~ /\__param$/ &&
100 $from !~ /\.altinstructions/ && 100 $from !~ /\.altinstructions/ &&
101 $from !~ /\.eh_frame/ &&
101 $from !~ /\.debug_/)) { 102 $from !~ /\.debug_/)) {
102 printf("Error: %s %s refers to %s\n", $object, $from, $line); 103 printf("Error: %s %s refers to %s\n", $object, $from, $line);
103 } 104 }
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
new file mode 100644
index 000000000000..7c805c8fccd2
--- /dev/null
+++ b/scripts/setlocalversion
@@ -0,0 +1,56 @@
1#!/usr/bin/perl
2# Copyright 2004 - Ryan Anderson <ryan@michonline.com> GPL v2
3
4use strict;
5use warnings;
6use Digest::MD5;
7require 5.006;
8
9if (@ARGV != 1) {
10 print <<EOT;
11Usage: setlocalversion <srctree>
12EOT
13 exit(1);
14}
15
16my ($srctree) = @ARGV;
17chdir($srctree);
18
19my @LOCALVERSIONS = ();
20
21# We are going to use the following commands to try and determine if this
22# repository is at a Version boundary (i.e, 2.6.10 vs 2.6.10 + some patches) We
23# currently assume that all meaningful version boundaries are marked by a tag.
24# We don't care what the tag is, just that something exists.
25
26# Git/Cogito store the top-of-tree "commit" in .git/HEAD
27# A list of known tags sits in .git/refs/tags/
28#
29# The simple trick here is to just compare the two of these, and if we get a
30# match, return nothing, otherwise, return a subset of the SHA-1 hash in
31# .git/HEAD
32
33sub do_git_checks {
34 open(H,"<.git/HEAD") or return;
35 my $head = <H>;
36 chomp $head;
37 close(H);
38
39 opendir(D,".git/refs/tags") or return;
40 foreach my $tagfile (grep !/^\.{1,2}$/, readdir(D)) {
41 open(F,"<.git/refs/tags/" . $tagfile) or return;
42 my $tag = <F>;
43 chomp $tag;
44 close(F);
45 return if ($tag eq $head);
46 }
47 closedir(D);
48
49 push @LOCALVERSIONS, "g" . substr($head,0,8);
50}
51
52if ( -d ".git") {
53 do_git_checks();
54}
55
56printf "-%s\n", join("-",@LOCALVERSIONS) if (scalar @LOCALVERSIONS > 0);
diff --git a/scripts/ver_linux b/scripts/ver_linux
index a28c279c49dd..beb43ef7f761 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -25,9 +25,11 @@ ld -v | awk -F\) '{print $1}' | awk \
25'/BFD/{print "binutils ",$NF} \ 25'/BFD/{print "binutils ",$NF} \
26/^GNU/{print "binutils ",$4}' 26/^GNU/{print "binutils ",$4}'
27 27
28fdformat --version | awk -F\- '{print "util-linux ", $NF}' 28echo -n "util-linux "
29fdformat --version | awk '{print $NF}' | sed -e s/^util-linux-// -e s/\)$//
29 30
30mount --version | awk -F\- '{print "mount ", $NF}' 31echo -n "mount "
32mount --version | awk '{print $NF}' | sed -e s/^mount-// -e s/\)$//
31 33
32depmod -V 2>&1 | awk 'NR==1 {print "module-init-tools ",$NF}' 34depmod -V 2>&1 | awk 'NR==1 {print "module-init-tools ",$NF}'
33 35