aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-06 16:21:57 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-06 16:21:57 -0400
commit15700770ef7c5d12e2f1659d2ddbeb3f658d9f37 (patch)
tree7fa2f81c33c9efcb1a1568385beead75c5892cfb /scripts
parent6de410c2b0cc055ae9ee640c84331f6a70878d9b (diff)
parent11de39e2fbbc592018e0a231d0ee773653dcc8d6 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild: (38 commits) kconfig: fix mconf segmentation fault kbuild: enable use of code from a different dir kconfig: error out if recursive dependencies are found kbuild: scripts/basic/fixdep segfault on pathological string-o-death kconfig: correct minor typo in Kconfig warning message. kconfig: fix path to modules.txt in Kconfig help usr/Kconfig: fix typo kernel-doc: alphabetically-sorted entries in index.html of 'htmldocs' kbuild: be more explicit on missing .config file kbuild: clarify the creation of the LOCALVERSION_AUTO string. kbuild: propagate errors from find in scripts/gen_initramfs_list.sh kconfig: refer to qt3 if we cannot find qt libraries kbuild: handle compressed cpio initramfs-es kbuild: ignore section mismatch warning for references from .paravirtprobe to .init.text kbuild: remove stale comment in modpost.c kbuild/mkuboot.sh: allow spaces in CROSS_COMPILE kbuild: fix make mrproper for Documentation/DocBook/man kbuild: remove kconfig binaries during make mrproper kconfig/menuconfig: do not hardcode '.config' kbuild: override build timestamp & version ...
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.build19
-rw-r--r--scripts/Makefile.host14
-rw-r--r--scripts/Makefile.modpost8
-rw-r--r--scripts/basic/fixdep.c2
-rwxr-xr-xscripts/checksyscalls.sh118
-rwxr-xr-xscripts/cleanfile126
-rwxr-xr-xscripts/cleanpatch206
-rw-r--r--scripts/gen_initramfs_list.sh12
-rw-r--r--scripts/kconfig/Makefile5
-rw-r--r--scripts/kconfig/conf.c1
-rw-r--r--scripts/kconfig/lex.zconf.c_shipped2
-rw-r--r--scripts/kconfig/lkc.h1
-rw-r--r--scripts/kconfig/lxdialog/dialog.h1
-rw-r--r--scripts/kconfig/lxdialog/util.c9
-rw-r--r--scripts/kconfig/mconf.c43
-rw-r--r--scripts/kconfig/menu.c2
-rw-r--r--scripts/kconfig/qconf.cc5
-rw-r--r--scripts/kconfig/qconf.h2
-rw-r--r--scripts/kconfig/symbol.c13
-rw-r--r--scripts/kconfig/zconf.l2
-rw-r--r--scripts/kconfig/zconf.tab.c_shipped6
-rw-r--r--scripts/kconfig/zconf.y6
-rwxr-xr-xscripts/mkcompile_h27
-rwxr-xr-xscripts/mkuboot.sh2
-rw-r--r--scripts/mod/file2alias.c21
-rw-r--r--scripts/mod/modpost.c141
-rw-r--r--scripts/mod/modpost.h1
-rw-r--r--scripts/mod/sumversion.c5
28 files changed, 689 insertions, 111 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index e2ad2dccccdb..a525112847fd 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -131,13 +131,13 @@ $(multi-objs-y:.o=.lst) : modname = $(modname-multi)
131quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ 131quiet_cmd_cc_s_c = CC $(quiet_modtag) $@
132cmd_cc_s_c = $(CC) $(c_flags) -fverbose-asm -S -o $@ $< 132cmd_cc_s_c = $(CC) $(c_flags) -fverbose-asm -S -o $@ $<
133 133
134%.s: %.c FORCE 134$(obj)/%.s: $(src)/%.c FORCE
135 $(call if_changed_dep,cc_s_c) 135 $(call if_changed_dep,cc_s_c)
136 136
137quiet_cmd_cc_i_c = CPP $(quiet_modtag) $@ 137quiet_cmd_cc_i_c = CPP $(quiet_modtag) $@
138cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $< 138cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<
139 139
140%.i: %.c FORCE 140$(obj)/%.i: $(src)/%.c FORCE
141 $(call if_changed_dep,cc_i_c) 141 $(call if_changed_dep,cc_i_c)
142 142
143quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@ 143quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
@@ -146,7 +146,7 @@ cmd_cc_symtypes_c = \
146 | $(GENKSYMS) -T $@ >/dev/null; \ 146 | $(GENKSYMS) -T $@ >/dev/null; \
147 test -s $@ || rm -f $@ 147 test -s $@ || rm -f $@
148 148
149%.symtypes : %.c FORCE 149$(obj)/%.symtypes : $(src)/%.c FORCE
150 $(call if_changed_dep,cc_symtypes_c) 150 $(call if_changed_dep,cc_symtypes_c)
151 151
152# C (.c) files 152# C (.c) files
@@ -198,14 +198,13 @@ define rule_cc_o_c
198endef 198endef
199 199
200# Built-in and composite module parts 200# Built-in and composite module parts
201 201$(obj)/%.o: $(src)/%.c FORCE
202%.o: %.c FORCE
203 $(call cmd,force_checksrc) 202 $(call cmd,force_checksrc)
204 $(call if_changed_rule,cc_o_c) 203 $(call if_changed_rule,cc_o_c)
205 204
206# Single-part modules are special since we need to mark them in $(MODVERDIR) 205# Single-part modules are special since we need to mark them in $(MODVERDIR)
207 206
208$(single-used-m): %.o: %.c FORCE 207$(single-used-m): $(obj)/%.o: $(src)/%.c FORCE
209 $(call cmd,force_checksrc) 208 $(call cmd,force_checksrc)
210 $(call if_changed_rule,cc_o_c) 209 $(call if_changed_rule,cc_o_c)
211 @{ echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod) 210 @{ echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod)
@@ -215,7 +214,7 @@ quiet_cmd_cc_lst_c = MKLST $@
215 $(CONFIG_SHELL) $(srctree)/scripts/makelst $*.o \ 214 $(CONFIG_SHELL) $(srctree)/scripts/makelst $*.o \
216 System.map $(OBJDUMP) > $@ 215 System.map $(OBJDUMP) > $@
217 216
218%.lst: %.c FORCE 217$(obj)/%.lst: $(src)/%.c FORCE
219 $(call if_changed_dep,cc_lst_c) 218 $(call if_changed_dep,cc_lst_c)
220 219
221# Compile assembler sources (.S) 220# Compile assembler sources (.S)
@@ -229,13 +228,13 @@ $(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE)
229quiet_cmd_as_s_S = CPP $(quiet_modtag) $@ 228quiet_cmd_as_s_S = CPP $(quiet_modtag) $@
230cmd_as_s_S = $(CPP) $(a_flags) -o $@ $< 229cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
231 230
232%.s: %.S FORCE 231$(obj)/%.s: $(src)/%.S FORCE
233 $(call if_changed_dep,as_s_S) 232 $(call if_changed_dep,as_s_S)
234 233
235quiet_cmd_as_o_S = AS $(quiet_modtag) $@ 234quiet_cmd_as_o_S = AS $(quiet_modtag) $@
236cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< 235cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
237 236
238%.o: %.S FORCE 237$(obj)/%.o: $(src)/%.S FORCE
239 $(call if_changed_dep,as_o_S) 238 $(call if_changed_dep,as_o_S)
240 239
241targets += $(real-objs-y) $(real-objs-m) $(lib-y) 240targets += $(real-objs-y) $(real-objs-m) $(lib-y)
@@ -246,7 +245,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $(always)
246quiet_cmd_cpp_lds_S = LDS $@ 245quiet_cmd_cpp_lds_S = LDS $@
247 cmd_cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -o $@ $< 246 cmd_cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -o $@ $<
248 247
249%.lds: %.lds.S FORCE 248$(obj)/%.lds: $(src)/%.lds.S FORCE
250 $(call if_changed_dep,cpp_lds_S) 249 $(call if_changed_dep,cpp_lds_S)
251 250
252# Build the compiled-in targets 251# Build the compiled-in targets
diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index 575afbe5e370..6943a7a5bb98 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -114,7 +114,7 @@ hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags)
114quiet_cmd_host-csingle = HOSTCC $@ 114quiet_cmd_host-csingle = HOSTCC $@
115 cmd_host-csingle = $(HOSTCC) $(hostc_flags) -o $@ $< \ 115 cmd_host-csingle = $(HOSTCC) $(hostc_flags) -o $@ $< \
116 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) 116 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
117$(host-csingle): %: %.c FORCE 117$(host-csingle): $(obj)/%: $(src)/%.c FORCE
118 $(call if_changed_dep,host-csingle) 118 $(call if_changed_dep,host-csingle)
119 119
120# Link an executable based on list of .o files, all plain c 120# Link an executable based on list of .o files, all plain c
@@ -123,14 +123,14 @@ quiet_cmd_host-cmulti = HOSTLD $@
123 cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \ 123 cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \
124 $(addprefix $(obj)/,$($(@F)-objs)) \ 124 $(addprefix $(obj)/,$($(@F)-objs)) \
125 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) 125 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
126$(host-cmulti): %: $(host-cobjs) $(host-cshlib) FORCE 126$(host-cmulti): $(obj)/%: $(host-cobjs) $(host-cshlib) FORCE
127 $(call if_changed,host-cmulti) 127 $(call if_changed,host-cmulti)
128 128
129# Create .o file from a single .c file 129# Create .o file from a single .c file
130# host-cobjs -> .o 130# host-cobjs -> .o
131quiet_cmd_host-cobjs = HOSTCC $@ 131quiet_cmd_host-cobjs = HOSTCC $@
132 cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $< 132 cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $<
133$(host-cobjs): %.o: %.c FORCE 133$(host-cobjs): $(obj)/%.o: $(src)/%.c FORCE
134 $(call if_changed_dep,host-cobjs) 134 $(call if_changed_dep,host-cobjs)
135 135
136# Link an executable based on list of .o files, a mixture of .c and .cc 136# Link an executable based on list of .o files, a mixture of .c and .cc
@@ -140,20 +140,20 @@ quiet_cmd_host-cxxmulti = HOSTLD $@
140 $(foreach o,objs cxxobjs,\ 140 $(foreach o,objs cxxobjs,\
141 $(addprefix $(obj)/,$($(@F)-$(o)))) \ 141 $(addprefix $(obj)/,$($(@F)-$(o)))) \
142 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) 142 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
143$(host-cxxmulti): %: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE 143$(host-cxxmulti): $(obj)/%: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE
144 $(call if_changed,host-cxxmulti) 144 $(call if_changed,host-cxxmulti)
145 145
146# Create .o file from a single .cc (C++) file 146# Create .o file from a single .cc (C++) file
147quiet_cmd_host-cxxobjs = HOSTCXX $@ 147quiet_cmd_host-cxxobjs = HOSTCXX $@
148 cmd_host-cxxobjs = $(HOSTCXX) $(hostcxx_flags) -c -o $@ $< 148 cmd_host-cxxobjs = $(HOSTCXX) $(hostcxx_flags) -c -o $@ $<
149$(host-cxxobjs): %.o: %.cc FORCE 149$(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE
150 $(call if_changed_dep,host-cxxobjs) 150 $(call if_changed_dep,host-cxxobjs)
151 151
152# Compile .c file, create position independent .o file 152# Compile .c file, create position independent .o file
153# host-cshobjs -> .o 153# host-cshobjs -> .o
154quiet_cmd_host-cshobjs = HOSTCC -fPIC $@ 154quiet_cmd_host-cshobjs = HOSTCC -fPIC $@
155 cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $< 155 cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $<
156$(host-cshobjs): %.o: %.c FORCE 156$(host-cshobjs): $(obj)/%.o: $(src)/%.c FORCE
157 $(call if_changed_dep,host-cshobjs) 157 $(call if_changed_dep,host-cshobjs)
158 158
159# Link a shared library, based on position independent .o files 159# Link a shared library, based on position independent .o files
@@ -162,7 +162,7 @@ quiet_cmd_host-cshlib = HOSTLLD -shared $@
162 cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \ 162 cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \
163 $(addprefix $(obj)/,$($(@F:.so=-objs))) \ 163 $(addprefix $(obj)/,$($(@F:.so=-objs))) \
164 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) 164 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
165$(host-cshlib): %: $(host-cshobjs) FORCE 165$(host-cshlib): $(obj)/%: $(host-cshobjs) FORCE
166 $(call if_changed,host-cshlib) 166 $(call if_changed,host-cshlib)
167 167
168targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\ 168targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 65e0a79c36cf..d5bbbcce31ef 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -63,16 +63,16 @@ quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
63 $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ 63 $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
64 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ 64 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
65 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ 65 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
66 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \ 66 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
67 $(wildcard vmlinux) $(filter-out FORCE,$^)
68 67
69PHONY += __modpost 68PHONY += __modpost
70__modpost: $(modules:.ko=.o) FORCE 69__modpost: $(modules:.ko=.o) FORCE
71 $(call cmd,modpost) 70 $(call cmd,modpost) $(wildcard vmlinux) $(filter-out FORCE,$^)
72 71
73quiet_cmd_kernel-mod = MODPOST $@ 72quiet_cmd_kernel-mod = MODPOST $@
74 cmd_kernel-mod = $(cmd_modpost) 73 cmd_kernel-mod = $(cmd_modpost) $(KBUILD_VMLINUX_OBJS)
75 74
75PHONY += vmlinux
76vmlinux: FORCE 76vmlinux: FORCE
77 $(call cmd,kernel-mod) 77 $(call cmd,kernel-mod)
78 78
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 6bc7e7cfccf6..8912c0f5460b 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -249,6 +249,8 @@ void parse_config_file(char *map, size_t len)
249 found: 249 found:
250 if (!memcmp(q - 7, "_MODULE", 7)) 250 if (!memcmp(q - 7, "_MODULE", 7))
251 q -= 7; 251 q -= 7;
252 if( (q-p-7) < 0 )
253 continue;
252 use_config(p+7, q-p-7); 254 use_config(p+7, q-p-7);
253 } 255 }
254} 256}
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
new file mode 100755
index 000000000000..f98171f5a3df
--- /dev/null
+++ b/scripts/checksyscalls.sh
@@ -0,0 +1,118 @@
1#!/bin/sh
2#
3# Check if current architecture are missing any function calls compared
4# to i386.
5# i386 define a number of legacy system calls that are i386 specific
6# and listed below so they are ignored.
7#
8# Usage:
9# syscallchk gcc gcc-options
10#
11
12ignore_list() {
13cat << EOF
14#include <asm/types.h>
15#include <asm/unistd.h>
16
17/* System calls for 32-bit kernels only */
18#if BITS_PER_LONG == 64
19#define __IGNORE_sendfile64
20#define __IGNORE_ftruncate64
21#define __IGNORE_truncate64
22#define __IGNORE_stat64
23#define __IGNORE_lstat64
24#define __IGNORE_fstat64
25#define __IGNORE_fcntl64
26#define __IGNORE_fadvise64_64
27#define __IGNORE_fstatat64
28#define __IGNORE_fstatfs64
29#define __IGNORE_statfs64
30#endif
31
32/* i386-specific or historical system calls */
33#define __IGNORE_break
34#define __IGNORE_stty
35#define __IGNORE_gtty
36#define __IGNORE_ftime
37#define __IGNORE_prof
38#define __IGNORE_lock
39#define __IGNORE_mpx
40#define __IGNORE_ulimit
41#define __IGNORE_profil
42#define __IGNORE_ioperm
43#define __IGNORE_iopl
44#define __IGNORE_idle
45#define __IGNORE_modify_ldt
46#define __IGNORE_ugetrlimit
47#define __IGNORE_mmap2
48#define __IGNORE_vm86
49#define __IGNORE_vm86old
50#define __IGNORE_set_thread_area
51#define __IGNORE_get_thread_area
52#define __IGNORE_madvise1
53#define __IGNORE_oldstat
54#define __IGNORE_oldfstat
55#define __IGNORE_oldlstat
56#define __IGNORE_oldolduname
57#define __IGNORE_olduname
58#define __IGNORE_umount2
59#define __IGNORE_umount
60#define __IGNORE_waitpid
61#define __IGNORE_stime
62#define __IGNORE_nice
63#define __IGNORE_signal
64#define __IGNORE_sigaction
65#define __IGNORE_sgetmask
66#define __IGNORE_sigsuspend
67#define __IGNORE_sigpending
68#define __IGNORE_ssetmask
69#define __IGNORE_readdir
70#define __IGNORE_socketcall
71#define __IGNORE_ipc
72#define __IGNORE_sigreturn
73#define __IGNORE_sigprocmask
74#define __IGNORE_bdflush
75#define __IGNORE__llseek
76#define __IGNORE__newselect
77#define __IGNORE_create_module
78#define __IGNORE_delete_module
79#define __IGNORE_query_module
80#define __IGNORE_get_kernel_syms
81/* ... including the "new" 32-bit uid syscalls */
82#define __IGNORE_lchown32
83#define __IGNORE_getuid32
84#define __IGNORE_getgid32
85#define __IGNORE_geteuid32
86#define __IGNORE_getegid32
87#define __IGNORE_setreuid32
88#define __IGNORE_setregid32
89#define __IGNORE_getgroups32
90#define __IGNORE_setgroups32
91#define __IGNORE_fchown32
92#define __IGNORE_setresuid32
93#define __IGNORE_getresuid32
94#define __IGNORE_setresgid32
95#define __IGNORE_getresgid32
96#define __IGNORE_chown32
97#define __IGNORE_setuid32
98#define __IGNORE_setgid32
99#define __IGNORE_setfsuid32
100#define __IGNORE_setfsgid32
101
102/* Unmerged syscalls for AFS, STREAMS, etc. */
103#define __IGNORE_afs_syscall
104#define __IGNORE_getpmsg
105#define __IGNORE_putpmsg
106#define __IGNORE_vserver
107EOF
108}
109
110syscall_list() {
111sed -n -e '/^\#define/ { s/[^_]*__NR_\([^[:space:]]*\).*/\
112\#if !defined \(__NR_\1\) \&\& !defined \(__IGNORE_\1\)\
113\#warning syscall \1 not implemented\
114\#endif/p }' $1
115}
116
117(ignore_list && syscall_list ${srctree}/include/asm-i386/unistd.h) | \
118$* -E -x c - > /dev/null
diff --git a/scripts/cleanfile b/scripts/cleanfile
new file mode 100755
index 000000000000..f1ba8aa58a40
--- /dev/null
+++ b/scripts/cleanfile
@@ -0,0 +1,126 @@
1#!/usr/bin/perl -w
2#
3# Clean a text file -- or directory of text files -- of stealth whitespace.
4# WARNING: this can be a highly destructive operation. Use with caution.
5#
6
7use bytes;
8use File::Basename;
9
10#
11# Clean up space-tab sequences, either by removing spaces or
12# replacing them with tabs.
13sub clean_space_tabs($)
14{
15 no bytes; # Tab alignment depends on characters
16
17 my($li) = @_;
18 my($lo) = '';
19 my $pos = 0;
20 my $nsp = 0;
21 my($i, $c);
22
23 for ($i = 0; $i < length($li); $i++) {
24 $c = substr($li, $i, 1);
25 if ($c eq "\t") {
26 my $npos = ($pos+$nsp+8) & ~7;
27 my $ntab = ($npos >> 3) - ($pos >> 3);
28 $lo .= "\t" x $ntab;
29 $pos = $npos;
30 $nsp = 0;
31 } elsif ($c eq "\n" || $c eq "\r") {
32 $lo .= " " x $nsp;
33 $pos += $nsp;
34 $nsp = 0;
35 $lo .= $c;
36 $pos = 0;
37 } elsif ($c eq " ") {
38 $nsp++;
39 } else {
40 $lo .= " " x $nsp;
41 $pos += $nsp;
42 $nsp = 0;
43 $lo .= $c;
44 $pos++;
45 }
46 }
47 $lo .= " " x $nsp;
48 return $lo;
49}
50
51$name = basename($0);
52
53foreach $f ( @ARGV ) {
54 print STDERR "$name: $f\n";
55
56 if (! -f $f) {
57 print STDERR "$f: not a file\n";
58 next;
59 }
60
61 if (!open(FILE, '+<', $f)) {
62 print STDERR "$name: Cannot open file: $f: $!\n";
63 next;
64 }
65
66 binmode FILE;
67
68 # First, verify that it is not a binary file; consider any file
69 # with a zero byte to be a binary file. Is there any better, or
70 # additional, heuristic that should be applied?
71 $is_binary = 0;
72
73 while (read(FILE, $data, 65536) > 0) {
74 if ($data =~ /\0/) {
75 $is_binary = 1;
76 last;
77 }
78 }
79
80 if ($is_binary) {
81 print STDERR "$name: $f: binary file\n";
82 next;
83 }
84
85 seek(FILE, 0, 0);
86
87 $in_bytes = 0;
88 $out_bytes = 0;
89 $blank_bytes = 0;
90
91 @blanks = ();
92 @lines = ();
93
94 while ( defined($line = <FILE>) ) {
95 $in_bytes += length($line);
96 $line =~ s/[ \t\r]*$//; # Remove trailing spaces
97 $line = clean_space_tabs($line);
98
99 if ( $line eq "\n" ) {
100 push(@blanks, $line);
101 $blank_bytes += length($line);
102 } else {
103 push(@lines, @blanks);
104 $out_bytes += $blank_bytes;
105 push(@lines, $line);
106 $out_bytes += length($line);
107 @blanks = ();
108 $blank_bytes = 0;
109 }
110 }
111
112 # Any blanks at the end of the file are discarded
113
114 if ($in_bytes != $out_bytes) {
115 # Only write to the file if changed
116 seek(FILE, 0, 0);
117 print FILE @lines;
118
119 if ( !defined($where = tell(FILE)) ||
120 !truncate(FILE, $where) ) {
121 die "$name: Failed to truncate modified file: $f: $!\n";
122 }
123 }
124
125 close(FILE);
126}
diff --git a/scripts/cleanpatch b/scripts/cleanpatch
new file mode 100755
index 000000000000..a53f987708f5
--- /dev/null
+++ b/scripts/cleanpatch
@@ -0,0 +1,206 @@
1#!/usr/bin/perl -w
2#
3# Clean a patch file -- or directory of patch files -- of stealth whitespace.
4# WARNING: this can be a highly destructive operation. Use with caution.
5#
6
7use bytes;
8use File::Basename;
9
10#
11# Clean up space-tab sequences, either by removing spaces or
12# replacing them with tabs.
13sub clean_space_tabs($)
14{
15 no bytes; # Tab alignment depends on characters
16
17 my($li) = @_;
18 my($lo) = '';
19 my $pos = 0;
20 my $nsp = 0;
21 my($i, $c);
22
23 for ($i = 0; $i < length($li); $i++) {
24 $c = substr($li, $i, 1);
25 if ($c eq "\t") {
26 my $npos = ($pos+$nsp+8) & ~7;
27 my $ntab = ($npos >> 3) - ($pos >> 3);
28 $lo .= "\t" x $ntab;
29 $pos = $npos;
30 $nsp = 0;
31 } elsif ($c eq "\n" || $c eq "\r") {
32 $lo .= " " x $nsp;
33 $pos += $nsp;
34 $nsp = 0;
35 $lo .= $c;
36 $pos = 0;
37 } elsif ($c eq " ") {
38 $nsp++;
39 } else {
40 $lo .= " " x $nsp;
41 $pos += $nsp;
42 $nsp = 0;
43 $lo .= $c;
44 $pos++;
45 }
46 }
47 $lo .= " " x $nsp;
48 return $lo;
49}
50
51$name = basename($0);
52
53foreach $f ( @ARGV ) {
54 print STDERR "$name: $f\n";
55
56 if (! -f $f) {
57 print STDERR "$f: not a file\n";
58 next;
59 }
60
61 if (!open(FILE, '+<', $f)) {
62 print STDERR "$name: Cannot open file: $f: $!\n";
63 next;
64 }
65
66 binmode FILE;
67
68 # First, verify that it is not a binary file; consider any file
69 # with a zero byte to be a binary file. Is there any better, or
70 # additional, heuristic that should be applied?
71 $is_binary = 0;
72
73 while (read(FILE, $data, 65536) > 0) {
74 if ($data =~ /\0/) {
75 $is_binary = 1;
76 last;
77 }
78 }
79
80 if ($is_binary) {
81 print STDERR "$name: $f: binary file\n";
82 next;
83 }
84
85 seek(FILE, 0, 0);
86
87 $in_bytes = 0;
88 $out_bytes = 0;
89
90 @lines = ();
91
92 $in_hunk = 0;
93 $err = 0;
94
95 while ( defined($line = <FILE>) ) {
96 $in_bytes += length($line);
97
98 if (!$in_hunk) {
99 if ($line =~ /^\@\@\s+\-([0-9]+),([0-9]+)\s+\+([0-9]+),([0-9]+)\s\@\@/) {
100 $minus_lines = $2;
101 $plus_lines = $4;
102 if ($minus_lines || $plus_lines) {
103 $in_hunk = 1;
104 @hunk_lines = ($line);
105 }
106 } else {
107 push(@lines, $line);
108 $out_bytes += length($line);
109 }
110 } else {
111 # We're in a hunk
112
113 if ($line =~ /^\+/) {
114 $plus_lines--;
115
116 $text = substr($line, 1);
117 $text =~ s/[ \t\r]*$//; # Remove trailing spaces
118 $text = clean_space_tabs($text);
119
120 push(@hunk_lines, '+'.$text);
121 } elsif ($line =~ /^\-/) {
122 $minus_lines--;
123 push(@hunk_lines, $line);
124 } elsif ($line =~ /^ /) {
125 $plus_lines--;
126 $minus_lines--;
127 push(@hunk_lines, $line);
128 } else {
129 print STDERR "$name: $f: malformed patch\n";
130 $err = 1;
131 last;
132 }
133
134 if ($plus_lines < 0 || $minus_lines < 0) {
135 print STDERR "$name: $f: malformed patch\n";
136 $err = 1;
137 last;
138 } elsif ($plus_lines == 0 && $minus_lines == 0) {
139 # End of a hunk. Process this hunk.
140 my $i;
141 my $l;
142 my @h = ();
143 my $adj = 0;
144 my $done = 0;
145
146 for ($i = scalar(@hunk_lines)-1; $i > 0; $i--) {
147 $l = $hunk_lines[$i];
148 if (!$done && $l eq "+\n") {
149 $adj++; # Skip this line
150 } elsif ($l =~ /^[ +]/) {
151 $done = 1;
152 unshift(@h, $l);
153 } else {
154 unshift(@h, $l);
155 }
156 }
157
158 $l = $hunk_lines[0]; # Hunk header
159 undef @hunk_lines; # Free memory
160
161 if ($adj) {
162 die unless
163 ($l =~ /^\@\@\s+\-([0-9]+),([0-9]+)\s+\+([0-9]+),([0-9]+)\s\@\@(.*)$/);
164 my $mstart = $1;
165 my $mlin = $2;
166 my $pstart = $3;
167 my $plin = $4;
168 my $tail = $5; # doesn't include the final newline
169
170 $l = sprintf("@@ -%d,%d +%d,%d @@%s\n",
171 $mstart, $mlin, $pstart, $plin-$adj,
172 $tail);
173 }
174 unshift(@h, $l);
175
176 # Transfer to the output array
177 foreach $l (@h) {
178 $out_bytes += length($l);
179 push(@lines, $l);
180 }
181
182 $in_hunk = 0;
183 }
184 }
185 }
186
187 if ($in_hunk) {
188 print STDERR "$name: $f: malformed patch\n";
189 $err = 1;
190 }
191
192 if (!$err) {
193 if ($in_bytes != $out_bytes) {
194 # Only write to the file if changed
195 seek(FILE, 0, 0);
196 print FILE @lines;
197
198 if ( !defined($where = tell(FILE)) ||
199 !truncate(FILE, $where) ) {
200 die "$name: Failed to truncate modified file: $f: $!\n";
201 }
202 }
203 }
204
205 close(FILE);
206}
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index 43f75d6e4d96..683eb12babbb 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -171,7 +171,7 @@ dir_filelist() {
171 ${dep_list}header "$1" 171 ${dep_list}header "$1"
172 172
173 srcdir=$(echo "$1" | sed -e 's://*:/:g') 173 srcdir=$(echo "$1" | sed -e 's://*:/:g')
174 dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" 2>/dev/null) 174 dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n")
175 175
176 # If $dirlist is only one line, then the directory is empty 176 # If $dirlist is only one line, then the directory is empty
177 if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then 177 if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then
@@ -191,9 +191,10 @@ input_file() {
191 source="$1" 191 source="$1"
192 if [ -f "$1" ]; then 192 if [ -f "$1" ]; then
193 ${dep_list}header "$1" 193 ${dep_list}header "$1"
194 is_cpio="$(echo "$1" | sed 's/^.*\.cpio/cpio/')" 194 is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\?/cpio/')"
195 if [ $2 -eq 0 -a ${is_cpio} == "cpio" ]; then 195 if [ $2 -eq 0 -a ${is_cpio} == "cpio" ]; then
196 cpio_file=$1 196 cpio_file=$1
197 echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed"
197 [ ! -z ${dep_list} ] && echo "$1" 198 [ ! -z ${dep_list} ] && echo "$1"
198 return 0 199 return 0
199 fi 200 fi
@@ -223,6 +224,7 @@ cpio_file=
223cpio_list= 224cpio_list=
224output="/dev/stdout" 225output="/dev/stdout"
225output_file="" 226output_file=""
227is_cpio_compressed=
226 228
227arg="$1" 229arg="$1"
228case "$arg" in 230case "$arg" in
@@ -282,7 +284,11 @@ if [ ! -z ${output_file} ]; then
282 cpio_tfile=${cpio_file} 284 cpio_tfile=${cpio_file}
283 fi 285 fi
284 rm ${cpio_list} 286 rm ${cpio_list}
285 cat ${cpio_tfile} | gzip -f -9 - > ${output_file} 287 if [ "${is_cpio_compressed}" = "compressed" ]; then
288 cat ${cpio_tfile} > ${output_file}
289 else
290 cat ${cpio_tfile} | gzip -f -9 - > ${output_file}
291 fi
286 [ -z ${cpio_file} ] && rm ${cpio_tfile} 292 [ -z ${cpio_file} ] && rm ${cpio_tfile}
287fi 293fi
288exit 0 294exit 0
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 7e7e147875bf..fb2bb3099dd9 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -140,6 +140,7 @@ endif
140 140
141clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ 141clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
142 .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c 142 .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c
143clean-files += mconf qconf gconf
143 144
144# Needed for systems without gettext 145# Needed for systems without gettext
145KBUILD_HAVE_NLS := $(shell \ 146KBUILD_HAVE_NLS := $(shell \
@@ -183,8 +184,8 @@ $(obj)/.tmp_qtcheck:
183 done; \ 184 done; \
184 if [ -z "$$dir" ]; then \ 185 if [ -z "$$dir" ]; then \
185 echo "*"; \ 186 echo "*"; \
186 echo "* Unable to find the QT installation. Please make sure that"; \ 187 echo "* Unable to find the QT3 installation. Please make sure that"; \
187 echo "* the QT development package is correctly installed and"; \ 188 echo "* the QT3 development package is correctly installed and"; \
188 echo "* either install pkg-config or set the QTDIR environment"; \ 189 echo "* either install pkg-config or set the QTDIR environment"; \
189 echo "* variable to the correct location."; \ 190 echo "* variable to the correct location."; \
190 echo "*"; \ 191 echo "*"; \
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 124b341a18c0..1199baf866ca 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -558,6 +558,7 @@ int main(int ac, char **av)
558 if (stat(".config", &tmpstat)) { 558 if (stat(".config", &tmpstat)) {
559 printf(_("***\n" 559 printf(_("***\n"
560 "*** You have not yet configured your kernel!\n" 560 "*** You have not yet configured your kernel!\n"
561 "*** (missing kernel .config file)\n"
561 "***\n" 562 "***\n"
562 "*** Please run some configurator (e.g. \"make oldconfig\" or\n" 563 "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
563 "*** \"make menuconfig\" or \"make xconfig\").\n" 564 "*** \"make menuconfig\" or \"make xconfig\").\n"
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped
index 800f8c71c407..0fdc9049296f 100644
--- a/scripts/kconfig/lex.zconf.c_shipped
+++ b/scripts/kconfig/lex.zconf.c_shipped
@@ -2264,7 +2264,7 @@ FILE *zconf_fopen(const char *name)
2264 FILE *f; 2264 FILE *f;
2265 2265
2266 f = fopen(name, "r"); 2266 f = fopen(name, "r");
2267 if (!f && name[0] != '/') { 2267 if (!f && name != NULL && name[0] != '/') {
2268 env = getenv(SRCTREE); 2268 env = getenv(SRCTREE);
2269 if (env) { 2269 if (env) {
2270 sprintf(fullname, "%s/%s", env, name); 2270 sprintf(fullname, "%s/%s", env, name);
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 9b2706a41548..8a07ee4f6bd4 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -64,6 +64,7 @@ int zconf_lineno(void);
64char *zconf_curname(void); 64char *zconf_curname(void);
65 65
66/* confdata.c */ 66/* confdata.c */
67const char *conf_get_configname(void);
67char *conf_get_default_confname(void); 68char *conf_get_default_confname(void);
68void sym_set_change_count(int count); 69void sym_set_change_count(int count);
69void sym_add_change_count(int count); 70void sym_add_change_count(int count);
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h
index fd695e1070f7..7e17eba75ae8 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -188,6 +188,7 @@ int on_key_esc(WINDOW *win);
188int on_key_resize(void); 188int on_key_resize(void);
189 189
190void init_dialog(const char *backtitle); 190void init_dialog(const char *backtitle);
191void set_dialog_backtitle(const char *backtitle);
191void reset_dialog(void); 192void reset_dialog(void);
192void end_dialog(void); 193void end_dialog(void);
193void attr_clear(WINDOW * win, int height, int width, chtype attr); 194void attr_clear(WINDOW * win, int height, int width, chtype attr);
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c
index d54440fc166c..a1bddefe73d0 100644
--- a/scripts/kconfig/lxdialog/util.c
+++ b/scripts/kconfig/lxdialog/util.c
@@ -272,6 +272,11 @@ void init_dialog(const char *backtitle)
272 color_setup(getenv("MENUCONFIG_COLOR")); 272 color_setup(getenv("MENUCONFIG_COLOR"));
273} 273}
274 274
275void set_dialog_backtitle(const char *backtitle)
276{
277 dlg.backtitle = backtitle;
278}
279
275void reset_dialog(void) 280void reset_dialog(void)
276{ 281{
277 initscr(); /* Init curses */ 282 initscr(); /* Init curses */
@@ -336,7 +341,7 @@ void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x)
336 newl = 1; 341 newl = 1;
337 word = tempstr; 342 word = tempstr;
338 while (word && *word) { 343 while (word && *word) {
339 sp = index(word, ' '); 344 sp = strchr(word, ' ');
340 if (sp) 345 if (sp)
341 *sp++ = 0; 346 *sp++ = 0;
342 347
@@ -348,7 +353,7 @@ void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x)
348 if (wlen > room || 353 if (wlen > room ||
349 (newl && wlen < 4 && sp 354 (newl && wlen < 4 && sp
350 && wlen + 1 + strlen(sp) > room 355 && wlen + 1 + strlen(sp) > room
351 && (!(sp2 = index(sp, ' ')) 356 && (!(sp2 = strchr(sp, ' '))
352 || wlen + 1 + (sp2 - sp) > room))) { 357 || wlen + 1 + (sp2 - sp) > room))) {
353 cur_y++; 358 cur_y++;
354 cur_x = x; 359 cur_x = x;
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 3f9a1321b3e6..d0e4fa594fc7 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -26,7 +26,6 @@
26#include "lkc.h" 26#include "lkc.h"
27#include "lxdialog/dialog.h" 27#include "lxdialog/dialog.h"
28 28
29static char menu_backtitle[128];
30static const char mconf_readme[] = N_( 29static const char mconf_readme[] = N_(
31"Overview\n" 30"Overview\n"
32"--------\n" 31"--------\n"
@@ -271,7 +270,6 @@ search_help[] = N_(
271 " USB$ => find all CONFIG_ symbols ending with USB\n" 270 " USB$ => find all CONFIG_ symbols ending with USB\n"
272 "\n"); 271 "\n");
273 272
274static char filename[PATH_MAX+1] = ".config";
275static int indent; 273static int indent;
276static struct termios ios_org; 274static struct termios ios_org;
277static int rows = 0, cols = 0; 275static int rows = 0, cols = 0;
@@ -395,6 +393,28 @@ static struct gstr get_relations_str(struct symbol **sym_arr)
395 return res; 393 return res;
396} 394}
397 395
396static char filename[PATH_MAX+1];
397static void set_config_filename(const char *config_filename)
398{
399 static char menu_backtitle[PATH_MAX+128];
400 int size;
401 struct symbol *sym;
402
403 sym = sym_lookup("KERNELVERSION", 0);
404 sym_calc_value(sym);
405 size = snprintf(menu_backtitle, sizeof(menu_backtitle),
406 _("%s - Linux Kernel v%s Configuration"),
407 config_filename, sym_get_string_value(sym));
408 if (size >= sizeof(menu_backtitle))
409 menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
410 set_dialog_backtitle(menu_backtitle);
411
412 size = snprintf(filename, sizeof(filename), "%s", config_filename);
413 if (size >= sizeof(filename))
414 filename[sizeof(filename)-1] = '\0';
415}
416
417
398static void search_conf(void) 418static void search_conf(void)
399{ 419{
400 struct symbol **sym_arr; 420 struct symbol **sym_arr;
@@ -816,8 +836,10 @@ static void conf_load(void)
816 case 0: 836 case 0:
817 if (!dialog_input_result[0]) 837 if (!dialog_input_result[0])
818 return; 838 return;
819 if (!conf_read(dialog_input_result)) 839 if (!conf_read(dialog_input_result)) {
840 set_config_filename(dialog_input_result);
820 return; 841 return;
842 }
821 show_textbox(NULL, _("File does not exist!"), 5, 38); 843 show_textbox(NULL, _("File does not exist!"), 5, 38);
822 break; 844 break;
823 case 1: 845 case 1:
@@ -840,8 +862,10 @@ static void conf_save(void)
840 case 0: 862 case 0:
841 if (!dialog_input_result[0]) 863 if (!dialog_input_result[0])
842 return; 864 return;
843 if (!conf_write(dialog_input_result)) 865 if (!conf_write(dialog_input_result)) {
866 set_config_filename(dialog_input_result);
844 return; 867 return;
868 }
845 show_textbox(NULL, _("Can't create file! Probably a nonexistent directory."), 5, 60); 869 show_textbox(NULL, _("Can't create file! Probably a nonexistent directory."), 5, 60);
846 break; 870 break;
847 case 1: 871 case 1:
@@ -860,7 +884,6 @@ static void conf_cleanup(void)
860 884
861int main(int ac, char **av) 885int main(int ac, char **av)
862{ 886{
863 struct symbol *sym;
864 char *mode; 887 char *mode;
865 int res; 888 int res;
866 889
@@ -871,11 +894,6 @@ int main(int ac, char **av)
871 conf_parse(av[1]); 894 conf_parse(av[1]);
872 conf_read(NULL); 895 conf_read(NULL);
873 896
874 sym = sym_lookup("KERNELVERSION", 0);
875 sym_calc_value(sym);
876 sprintf(menu_backtitle, _("Linux Kernel v%s Configuration"),
877 sym_get_string_value(sym));
878
879 mode = getenv("MENUCONFIG_MODE"); 897 mode = getenv("MENUCONFIG_MODE");
880 if (mode) { 898 if (mode) {
881 if (!strcasecmp(mode, "single_menu")) 899 if (!strcasecmp(mode, "single_menu"))
@@ -886,7 +904,8 @@ int main(int ac, char **av)
886 atexit(conf_cleanup); 904 atexit(conf_cleanup);
887 init_wsize(); 905 init_wsize();
888 reset_dialog(); 906 reset_dialog();
889 init_dialog(menu_backtitle); 907 init_dialog(NULL);
908 set_config_filename(conf_get_configname());
890 do { 909 do {
891 conf(&rootmenu); 910 conf(&rootmenu);
892 dialog_clear(); 911 dialog_clear();
@@ -903,7 +922,7 @@ int main(int ac, char **av)
903 922
904 switch (res) { 923 switch (res) {
905 case 0: 924 case 0:
906 if (conf_write(NULL)) { 925 if (conf_write(filename)) {
907 fprintf(stderr, _("\n\n" 926 fprintf(stderr, _("\n\n"
908 "Error during writing of the kernel configuration.\n" 927 "Error during writing of the kernel configuration.\n"
909 "Your kernel configuration changes were NOT saved." 928 "Your kernel configuration changes were NOT saved."
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index c86c27f2c761..f14aeac67d4f 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -203,7 +203,7 @@ void sym_check_prop(struct symbol *sym)
203 else if (sym2->type == S_UNKNOWN) 203 else if (sym2->type == S_UNKNOWN)
204 prop_warn(prop, 204 prop_warn(prop,
205 "'select' used by config symbol '%s' " 205 "'select' used by config symbol '%s' "
206 "refer to undefined symbol '%s'", 206 "refers to undefined symbol '%s'",
207 sym->name, sym2->name); 207 sym->name, sym2->name);
208 else if (sym2->type != S_BOOLEAN && sym2->type != S_TRISTATE) 208 else if (sym2->type != S_BOOLEAN && sym2->type != S_TRISTATE)
209 prop_warn(prop, 209 prop_warn(prop,
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 512c2f5c341d..f2a23a9c3938 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1182,7 +1182,7 @@ void ConfigInfoView::contentsContextMenuEvent(QContextMenuEvent *e)
1182 Parent::contentsContextMenuEvent(e); 1182 Parent::contentsContextMenuEvent(e);
1183} 1183}
1184 1184
1185ConfigSearchWindow::ConfigSearchWindow(QWidget* parent, const char *name) 1185ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *name)
1186 : Parent(parent, name), result(NULL) 1186 : Parent(parent, name), result(NULL)
1187{ 1187{
1188 setCaption("Search Config"); 1188 setCaption("Search Config");
@@ -1206,6 +1206,9 @@ ConfigSearchWindow::ConfigSearchWindow(QWidget* parent, const char *name)
1206 info = new ConfigInfoView(split, name); 1206 info = new ConfigInfoView(split, name);
1207 connect(list->list, SIGNAL(menuChanged(struct menu *)), 1207 connect(list->list, SIGNAL(menuChanged(struct menu *)),
1208 info, SLOT(setInfo(struct menu *))); 1208 info, SLOT(setInfo(struct menu *)));
1209 connect(list->list, SIGNAL(menuChanged(struct menu *)),
1210 parent, SLOT(setMenuLink(struct menu *)));
1211
1209 layout1->addWidget(split); 1212 layout1->addWidget(split);
1210 1213
1211 if (name) { 1214 if (name) {
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 6fc1c5f14425..b3b5657b6b35 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -279,7 +279,7 @@ class ConfigSearchWindow : public QDialog {
279 Q_OBJECT 279 Q_OBJECT
280 typedef class QDialog Parent; 280 typedef class QDialog Parent;
281public: 281public:
282 ConfigSearchWindow(QWidget* parent, const char *name = 0); 282 ConfigSearchWindow(ConfigMainWindow* parent, const char *name = 0);
283 283
284public slots: 284public slots:
285 void saveSettings(void); 285 void saveSettings(void);
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 8f06c474d800..c35dcc5d6189 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -786,13 +786,15 @@ static struct symbol *sym_check_expr_deps(struct expr *e)
786 return NULL; 786 return NULL;
787} 787}
788 788
789/* return NULL when dependencies are OK */
789struct symbol *sym_check_deps(struct symbol *sym) 790struct symbol *sym_check_deps(struct symbol *sym)
790{ 791{
791 struct symbol *sym2; 792 struct symbol *sym2;
792 struct property *prop; 793 struct property *prop;
793 794
794 if (sym->flags & SYMBOL_CHECK) { 795 if (sym->flags & SYMBOL_CHECK) {
795 printf("Warning! Found recursive dependency: %s", sym->name); 796 fprintf(stderr, "%s:%d:error: found recursive dependency: %s",
797 sym->prop->file->name, sym->prop->lineno, sym->name);
796 return sym; 798 return sym;
797 } 799 }
798 if (sym->flags & SYMBOL_CHECKED) 800 if (sym->flags & SYMBOL_CHECKED)
@@ -816,13 +818,8 @@ struct symbol *sym_check_deps(struct symbol *sym)
816 goto out; 818 goto out;
817 } 819 }
818out: 820out:
819 if (sym2) { 821 if (sym2)
820 printf(" %s", sym->name); 822 fprintf(stderr, " -> %s%s", sym->name, sym2 == sym? "\n": "");
821 if (sym2 == sym) {
822 printf("\n");
823 sym2 = NULL;
824 }
825 }
826 sym->flags &= ~SYMBOL_CHECK; 823 sym->flags &= ~SYMBOL_CHECK;
827 return sym2; 824 return sym2;
828} 825}
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index cfa46077c6b4..187d38ccadd5 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -265,7 +265,7 @@ FILE *zconf_fopen(const char *name)
265 FILE *f; 265 FILE *f;
266 266
267 f = fopen(name, "r"); 267 f = fopen(name, "r");
268 if (!f && name[0] != '/') { 268 if (!f && name != NULL && name[0] != '/') {
269 env = getenv(SRCTREE); 269 env = getenv(SRCTREE);
270 if (env) { 270 if (env) {
271 sprintf(fullname, "%s/%s", env, name); 271 sprintf(fullname, "%s/%s", env, name);
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped
index d777fe85627f..9a06b6771eee 100644
--- a/scripts/kconfig/zconf.tab.c_shipped
+++ b/scripts/kconfig/zconf.tab.c_shipped
@@ -2132,9 +2132,11 @@ void conf_parse(const char *name)
2132 } 2132 }
2133 menu_finalize(&rootmenu); 2133 menu_finalize(&rootmenu);
2134 for_all_symbols(i, sym) { 2134 for_all_symbols(i, sym) {
2135 sym_check_deps(sym); 2135 if (sym_check_deps(sym))
2136 zconfnerrs++;
2136 } 2137 }
2137 2138 if (zconfnerrs)
2139 exit(1);
2138 sym_set_change_count(1); 2140 sym_set_change_count(1);
2139} 2141}
2140 2142
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 04a5864c03b1..92eb02bdf9c5 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -501,9 +501,11 @@ void conf_parse(const char *name)
501 } 501 }
502 menu_finalize(&rootmenu); 502 menu_finalize(&rootmenu);
503 for_all_symbols(i, sym) { 503 for_all_symbols(i, sym) {
504 sym_check_deps(sym); 504 if (sym_check_deps(sym))
505 zconfnerrs++;
505 } 506 }
506 507 if (zconfnerrs)
508 exit(1);
507 sym_set_change_count(1); 509 sym_set_change_count(1);
508} 510}
509 511
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index 82d0af46f0ef..a8740df07b09 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -18,19 +18,32 @@ fi
18# Do not expand names 18# Do not expand names
19set -f 19set -f
20 20
21if [ -r .version ]; then 21# Fix the language to get consistent output
22 VERSION=`cat .version` 22LC_ALL=C
23export LC_ALL
24
25if [ -z "$KBUILD_BUILD_VERSION" ]; then
26 if [ -r .version ]; then
27 VERSION=`cat .version`
28 else
29 VERSION=0
30 echo 0 > .version
31 fi
23else 32else
24 VERSION=0 33 VERSION=$KBUILD_BUILD_VERSION
25 echo 0 > .version
26fi 34fi
27 35
36if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then
37 TIMESTAMP=`date`
38else
39 TIMESTAMP=$KBUILD_BUILD_TIMESTAMP
40fi
28 41
29UTS_VERSION="#$VERSION" 42UTS_VERSION="#$VERSION"
30CONFIG_FLAGS="" 43CONFIG_FLAGS=""
31if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi 44if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
32if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi 45if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
33UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS `LC_ALL=C LANG=C date`" 46UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP"
34 47
35# Truncate to maximum length 48# Truncate to maximum length
36 49
@@ -46,7 +59,7 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/"
46 59
47 echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\" 60 echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\"
48 61
49 echo \#define LINUX_COMPILE_TIME \"`LC_ALL=C LANG=C date +%T`\" 62 echo \#define LINUX_COMPILE_TIME \"`date +%T`\"
50 echo \#define LINUX_COMPILE_BY \"`whoami`\" 63 echo \#define LINUX_COMPILE_BY \"`whoami`\"
51 echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" 64 echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\"
52 65
@@ -58,7 +71,7 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/"
58 echo \#define LINUX_COMPILE_DOMAIN 71 echo \#define LINUX_COMPILE_DOMAIN
59 fi 72 fi
60 73
61 echo \#define LINUX_COMPILER \"`LC_ALL=C LANG=C $CC -v 2>&1 | tail -n 1`\" 74 echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\"
62) > .tmpcompile 75) > .tmpcompile
63 76
64# Only replace the real compile.h if the new one is different, 77# Only replace the real compile.h if the new one is different,
diff --git a/scripts/mkuboot.sh b/scripts/mkuboot.sh
index 4b06c5eea728..2e3d3cd916b8 100755
--- a/scripts/mkuboot.sh
+++ b/scripts/mkuboot.sh
@@ -4,7 +4,7 @@
4# Build U-Boot image when `mkimage' tool is available. 4# Build U-Boot image when `mkimage' tool is available.
5# 5#
6 6
7MKIMAGE=$(type -path ${CROSS_COMPILE}mkimage) 7MKIMAGE=$(type -path "${CROSS_COMPILE}mkimage")
8 8
9if [ -z "${MKIMAGE}" ]; then 9if [ -z "${MKIMAGE}" ]; then
10 MKIMAGE=$(type -path mkimage) 10 MKIMAGE=$(type -path mkimage)
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index b2f73ffb40bd..ed1244dd58d0 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -37,7 +37,6 @@ typedef unsigned char __u8;
37 * even potentially has different endianness and word sizes, since 37 * even potentially has different endianness and word sizes, since
38 * we handle those differences explicitly below */ 38 * we handle those differences explicitly below */
39#include "../../include/linux/mod_devicetable.h" 39#include "../../include/linux/mod_devicetable.h"
40#include "../../include/linux/input.h"
41 40
42#define ADD(str, sep, cond, field) \ 41#define ADD(str, sep, cond, field) \
43do { \ 42do { \
@@ -416,31 +415,33 @@ static int do_input_entry(const char *filename, struct input_device_id *id,
416 415
417 sprintf(alias + strlen(alias), "-e*"); 416 sprintf(alias + strlen(alias), "-e*");
418 if (id->flags & INPUT_DEVICE_ID_MATCH_EVBIT) 417 if (id->flags & INPUT_DEVICE_ID_MATCH_EVBIT)
419 do_input(alias, id->evbit, 0, EV_MAX); 418 do_input(alias, id->evbit, 0, INPUT_DEVICE_ID_EV_MAX);
420 sprintf(alias + strlen(alias), "k*"); 419 sprintf(alias + strlen(alias), "k*");
421 if (id->flags & INPUT_DEVICE_ID_MATCH_KEYBIT) 420 if (id->flags & INPUT_DEVICE_ID_MATCH_KEYBIT)
422 do_input(alias, id->keybit, KEY_MIN_INTERESTING, KEY_MAX); 421 do_input(alias, id->keybit,
422 INPUT_DEVICE_ID_KEY_MIN_INTERESTING,
423 INPUT_DEVICE_ID_KEY_MAX);
423 sprintf(alias + strlen(alias), "r*"); 424 sprintf(alias + strlen(alias), "r*");
424 if (id->flags & INPUT_DEVICE_ID_MATCH_RELBIT) 425 if (id->flags & INPUT_DEVICE_ID_MATCH_RELBIT)
425 do_input(alias, id->relbit, 0, REL_MAX); 426 do_input(alias, id->relbit, 0, INPUT_DEVICE_ID_REL_MAX);
426 sprintf(alias + strlen(alias), "a*"); 427 sprintf(alias + strlen(alias), "a*");
427 if (id->flags & INPUT_DEVICE_ID_MATCH_ABSBIT) 428 if (id->flags & INPUT_DEVICE_ID_MATCH_ABSBIT)
428 do_input(alias, id->absbit, 0, ABS_MAX); 429 do_input(alias, id->absbit, 0, INPUT_DEVICE_ID_ABS_MAX);
429 sprintf(alias + strlen(alias), "m*"); 430 sprintf(alias + strlen(alias), "m*");
430 if (id->flags & INPUT_DEVICE_ID_MATCH_MSCIT) 431 if (id->flags & INPUT_DEVICE_ID_MATCH_MSCIT)
431 do_input(alias, id->mscbit, 0, MSC_MAX); 432 do_input(alias, id->mscbit, 0, INPUT_DEVICE_ID_MSC_MAX);
432 sprintf(alias + strlen(alias), "l*"); 433 sprintf(alias + strlen(alias), "l*");
433 if (id->flags & INPUT_DEVICE_ID_MATCH_LEDBIT) 434 if (id->flags & INPUT_DEVICE_ID_MATCH_LEDBIT)
434 do_input(alias, id->ledbit, 0, LED_MAX); 435 do_input(alias, id->ledbit, 0, INPUT_DEVICE_ID_LED_MAX);
435 sprintf(alias + strlen(alias), "s*"); 436 sprintf(alias + strlen(alias), "s*");
436 if (id->flags & INPUT_DEVICE_ID_MATCH_SNDBIT) 437 if (id->flags & INPUT_DEVICE_ID_MATCH_SNDBIT)
437 do_input(alias, id->sndbit, 0, SND_MAX); 438 do_input(alias, id->sndbit, 0, INPUT_DEVICE_ID_SND_MAX);
438 sprintf(alias + strlen(alias), "f*"); 439 sprintf(alias + strlen(alias), "f*");
439 if (id->flags & INPUT_DEVICE_ID_MATCH_FFBIT) 440 if (id->flags & INPUT_DEVICE_ID_MATCH_FFBIT)
440 do_input(alias, id->ffbit, 0, FF_MAX); 441 do_input(alias, id->ffbit, 0, INPUT_DEVICE_ID_FF_MAX);
441 sprintf(alias + strlen(alias), "w*"); 442 sprintf(alias + strlen(alias), "w*");
442 if (id->flags & INPUT_DEVICE_ID_MATCH_SWBIT) 443 if (id->flags & INPUT_DEVICE_ID_MATCH_SWBIT)
443 do_input(alias, id->swbit, 0, SW_MAX); 444 do_input(alias, id->swbit, 0, INPUT_DEVICE_ID_SW_MAX);
444 return 1; 445 return 1;
445} 446}
446 447
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 78d659cbb36a..4ab36de45aa2 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -55,6 +55,17 @@ void warn(const char *fmt, ...)
55 va_end(arglist); 55 va_end(arglist);
56} 56}
57 57
58void merror(const char *fmt, ...)
59{
60 va_list arglist;
61
62 fprintf(stderr, "ERROR: ");
63
64 va_start(arglist, fmt);
65 vfprintf(stderr, fmt, arglist);
66 va_end(arglist);
67}
68
58static int is_vmlinux(const char *modname) 69static int is_vmlinux(const char *modname)
59{ 70{
60 const char *myname; 71 const char *myname;
@@ -333,10 +344,10 @@ void release_file(void *file, unsigned long size)
333 munmap(file, size); 344 munmap(file, size);
334} 345}
335 346
336static void parse_elf(struct elf_info *info, const char *filename) 347static int parse_elf(struct elf_info *info, const char *filename)
337{ 348{
338 unsigned int i; 349 unsigned int i;
339 Elf_Ehdr *hdr = info->hdr; 350 Elf_Ehdr *hdr;
340 Elf_Shdr *sechdrs; 351 Elf_Shdr *sechdrs;
341 Elf_Sym *sym; 352 Elf_Sym *sym;
342 353
@@ -346,9 +357,18 @@ static void parse_elf(struct elf_info *info, const char *filename)
346 exit(1); 357 exit(1);
347 } 358 }
348 info->hdr = hdr; 359 info->hdr = hdr;
349 if (info->size < sizeof(*hdr)) 360 if (info->size < sizeof(*hdr)) {
350 goto truncated; 361 /* file too small, assume this is an empty .o file */
351 362 return 0;
363 }
364 /* Is this a valid ELF file? */
365 if ((hdr->e_ident[EI_MAG0] != ELFMAG0) ||
366 (hdr->e_ident[EI_MAG1] != ELFMAG1) ||
367 (hdr->e_ident[EI_MAG2] != ELFMAG2) ||
368 (hdr->e_ident[EI_MAG3] != ELFMAG3)) {
369 /* Not an ELF file - silently ignore it */
370 return 0;
371 }
352 /* Fix endianness in ELF header */ 372 /* Fix endianness in ELF header */
353 hdr->e_shoff = TO_NATIVE(hdr->e_shoff); 373 hdr->e_shoff = TO_NATIVE(hdr->e_shoff);
354 hdr->e_shstrndx = TO_NATIVE(hdr->e_shstrndx); 374 hdr->e_shstrndx = TO_NATIVE(hdr->e_shstrndx);
@@ -371,8 +391,10 @@ static void parse_elf(struct elf_info *info, const char *filename)
371 = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; 391 = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
372 const char *secname; 392 const char *secname;
373 393
374 if (sechdrs[i].sh_offset > info->size) 394 if (sechdrs[i].sh_offset > info->size) {
375 goto truncated; 395 fatal("%s is truncated. sechdrs[i].sh_offset=%u > sizeof(*hrd)=%ul\n", filename, (unsigned int)sechdrs[i].sh_offset, sizeof(*hdr));
396 return 0;
397 }
376 secname = secstrings + sechdrs[i].sh_name; 398 secname = secstrings + sechdrs[i].sh_name;
377 if (strcmp(secname, ".modinfo") == 0) { 399 if (strcmp(secname, ".modinfo") == 0) {
378 info->modinfo = (void *)hdr + sechdrs[i].sh_offset; 400 info->modinfo = (void *)hdr + sechdrs[i].sh_offset;
@@ -407,10 +429,7 @@ static void parse_elf(struct elf_info *info, const char *filename)
407 sym->st_value = TO_NATIVE(sym->st_value); 429 sym->st_value = TO_NATIVE(sym->st_value);
408 sym->st_size = TO_NATIVE(sym->st_size); 430 sym->st_size = TO_NATIVE(sym->st_size);
409 } 431 }
410 return; 432 return 1;
411
412 truncated:
413 fatal("%s is truncated.\n", filename);
414} 433}
415 434
416static void parse_elf_finish(struct elf_info *info) 435static void parse_elf_finish(struct elf_info *info)
@@ -581,9 +600,17 @@ static int strrcmp(const char *s, const char *sub)
581 * the pattern is identified by: 600 * the pattern is identified by:
582 * tosec = .init.text | .exit.text | .init.data 601 * tosec = .init.text | .exit.text | .init.data
583 * fromsec = .data 602 * fromsec = .data
584 * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one 603 * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console
585 * 604 *
586 * Pattern 3: 605 * Pattern 3:
606 * Whitelist all references from .pci_fixup* section to .init.text
607 * This is part of the PCI init when built-in
608 *
609 * Pattern 4:
610 * Whitelist all refereces from .text.head to .init.data
611 * Whitelist all refereces from .text.head to .init.text
612 *
613 * Pattern 5:
587 * Some symbols belong to init section but still it is ok to reference 614 * Some symbols belong to init section but still it is ok to reference
588 * these from non-init sections as these symbols don't have any memory 615 * these from non-init sections as these symbols don't have any memory
589 * allocated for them and symbol address and value are same. So even 616 * allocated for them and symbol address and value are same. So even
@@ -591,6 +618,30 @@ static int strrcmp(const char *s, const char *sub)
591 * For ex. symbols marking the init section boundaries. 618 * For ex. symbols marking the init section boundaries.
592 * This pattern is identified by 619 * This pattern is identified by
593 * refsymname = __init_begin, _sinittext, _einittext 620 * refsymname = __init_begin, _sinittext, _einittext
621 *
622 * Pattern 6:
623 * During the early init phase we have references from .init.text to
624 * .text we have an intended section mismatch - do not warn about it.
625 * See kernel_init() in init/main.c
626 * tosec = .init.text
627 * fromsec = .text
628 * atsym = kernel_init
629 *
630 * Pattern 7:
631 * Logos used in drivers/video/logo reside in __initdata but the
632 * funtion that references them are EXPORT_SYMBOL() so cannot be
633 * marker __init. So we whitelist them here.
634 * The pattern is:
635 * tosec = .init.data
636 * fromsec = .text*
637 * refsymname = logo_
638 *
639 * Pattern 8:
640 * Symbols contained in .paravirtprobe may safely reference .init.text.
641 * The pattern is:
642 * tosec = .init.text
643 * fromsec = .paravirtprobe
644 *
594 **/ 645 **/
595static int secref_whitelist(const char *modname, const char *tosec, 646static int secref_whitelist(const char *modname, const char *tosec,
596 const char *fromsec, const char *atsym, 647 const char *fromsec, const char *atsym,
@@ -642,25 +693,39 @@ static int secref_whitelist(const char *modname, const char *tosec,
642 if (f1 && f2) 693 if (f1 && f2)
643 return 1; 694 return 1;
644 695
645 /* Whitelist all references from .pci_fixup section if vmlinux 696 /* Check for pattern 3 */
646 * Whitelist all refereces from .text.head to .init.data if vmlinux 697 if ((strncmp(fromsec, ".pci_fixup", strlen(".pci_fixup")) == 0) &&
647 * Whitelist all refereces from .text.head to .init.text if vmlinux 698 (strcmp(tosec, ".init.text") == 0))
648 */ 699 return 1;
649 if (is_vmlinux(modname)) { 700
650 if ((strcmp(fromsec, ".pci_fixup") == 0) && 701 /* Check for pattern 4 */
651 (strcmp(tosec, ".init.text") == 0)) 702 if ((strcmp(fromsec, ".text.head") == 0) &&
703 ((strcmp(tosec, ".init.data") == 0) ||
704 (strcmp(tosec, ".init.text") == 0)))
705 return 1;
706
707 /* Check for pattern 5 */
708 for (s = pat3refsym; *s; s++)
709 if (strcmp(refsymname, *s) == 0)
710 return 1;
711
712 /* Check for pattern 6 */
713 if ((strcmp(tosec, ".init.text") == 0) &&
714 (strcmp(fromsec, ".text") == 0) &&
715 (strcmp(refsymname, "kernel_init") == 0))
652 return 1; 716 return 1;
653 717
654 if ((strcmp(fromsec, ".text.head") == 0) && 718 /* Check for pattern 7 */
655 ((strcmp(tosec, ".init.data") == 0) || 719 if ((strcmp(tosec, ".init.data") == 0) &&
656 (strcmp(tosec, ".init.text") == 0))) 720 (strncmp(fromsec, ".text", strlen(".text")) == 0) &&
721 (strncmp(refsymname, "logo_", strlen("logo_")) == 0))
722 return 1;
723
724 /* Check for pattern 8 */
725 if ((strcmp(tosec, ".init.text") == 0) &&
726 (strcmp(fromsec, ".paravirtprobe") == 0))
657 return 1; 727 return 1;
658 728
659 /* Check for pattern 3 */
660 for (s = pat3refsym; *s; s++)
661 if (strcmp(refsymname, *s) == 0)
662 return 1;
663 }
664 return 0; 729 return 0;
665} 730}
666 731
@@ -1090,7 +1155,8 @@ static void read_symbols(char *modname)
1090 struct elf_info info = { }; 1155 struct elf_info info = { };
1091 Elf_Sym *sym; 1156 Elf_Sym *sym;
1092 1157
1093 parse_elf(&info, modname); 1158 if (!parse_elf(&info, modname))
1159 return;
1094 1160
1095 mod = new_module(modname); 1161 mod = new_module(modname);
1096 1162
@@ -1265,9 +1331,14 @@ static int add_versions(struct buffer *b, struct module *mod)
1265 exp = find_symbol(s->name); 1331 exp = find_symbol(s->name);
1266 if (!exp || exp->module == mod) { 1332 if (!exp || exp->module == mod) {
1267 if (have_vmlinux && !s->weak) { 1333 if (have_vmlinux && !s->weak) {
1268 warn("\"%s\" [%s.ko] undefined!\n", 1334 if (warn_unresolved) {
1269 s->name, mod->name); 1335 warn("\"%s\" [%s.ko] undefined!\n",
1270 err = warn_unresolved ? 0 : 1; 1336 s->name, mod->name);
1337 } else {
1338 merror("\"%s\" [%s.ko] undefined!\n",
1339 s->name, mod->name);
1340 err = 1;
1341 }
1271 } 1342 }
1272 continue; 1343 continue;
1273 } 1344 }
@@ -1318,6 +1389,7 @@ static void add_depends(struct buffer *b, struct module *mod,
1318 buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n"); 1389 buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n");
1319 buf_printf(b, "\"depends="); 1390 buf_printf(b, "\"depends=");
1320 for (s = mod->unres; s; s = s->next) { 1391 for (s = mod->unres; s; s = s->next) {
1392 const char *p;
1321 if (!s->module) 1393 if (!s->module)
1322 continue; 1394 continue;
1323 1395
@@ -1325,8 +1397,11 @@ static void add_depends(struct buffer *b, struct module *mod,
1325 continue; 1397 continue;
1326 1398
1327 s->module->seen = 1; 1399 s->module->seen = 1;
1328 buf_printf(b, "%s%s", first ? "" : ",", 1400 if ((p = strrchr(s->module->name, '/')) != NULL)
1329 strrchr(s->module->name, '/') + 1); 1401 p++;
1402 else
1403 p = s->module->name;
1404 buf_printf(b, "%s%s", first ? "" : ",", p);
1330 first = 0; 1405 first = 0;
1331 } 1406 }
1332 buf_printf(b, "\";\n"); 1407 buf_printf(b, "\";\n");
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
index d398c61e55ef..0858caa9c03f 100644
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -145,3 +145,4 @@ void release_file(void *file, unsigned long size);
145 145
146void fatal(const char *fmt, ...); 146void fatal(const char *fmt, ...);
147void warn(const char *fmt, ...); 147void warn(const char *fmt, ...);
148void merror(const char *fmt, ...);
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c
index 8a2875689e4d..6873d5af80d5 100644
--- a/scripts/mod/sumversion.c
+++ b/scripts/mod/sumversion.c
@@ -397,10 +397,9 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
397 (int) strlen(basename) - 2, basename); 397 (int) strlen(basename) - 2, basename);
398 398
399 file = grab_file(filelist, &len); 399 file = grab_file(filelist, &len);
400 if (!file) { 400 if (!file)
401 warn("could not find versions for %s\n", filelist); 401 /* not a module or .mod file missing - ignore */
402 return; 402 return;
403 }
404 403
405 sources = strchr(file, '\n'); 404 sources = strchr(file, '\n');
406 if (!sources) { 405 if (!sources) {