diff options
author | David S. Miller <davem@davemloft.net> | 2008-07-27 19:51:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-27 19:51:21 -0400 |
commit | 281c7413ed914623d3245299a4761b6b27ab9fdb (patch) | |
tree | 182b5222a7ad4b77c32f7845ea777ca665d7def2 /scripts | |
parent | 2ab61b01110aa04cd853c619a74881e3225a5e24 (diff) | |
parent | c9272c4f9fbe2087beb3392f526dc5b19efaa56b (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.headersinst | 230 | ||||
-rwxr-xr-x | scripts/diffconfig | 129 | ||||
-rwxr-xr-x | scripts/hdrcheck.sh | 10 | ||||
-rwxr-xr-x | scripts/headers.sh | 41 | ||||
-rw-r--r-- | scripts/headers_check.pl | 56 | ||||
-rw-r--r-- | scripts/headers_install.pl | 45 | ||||
-rw-r--r-- | scripts/kconfig/conf.c | 161 | ||||
-rw-r--r-- | scripts/kconfig/confdata.c | 70 | ||||
-rw-r--r-- | scripts/kconfig/lkc.h | 9 | ||||
-rwxr-xr-x | scripts/kernel-doc | 1 | ||||
-rwxr-xr-x | scripts/setlocalversion | 4 |
11 files changed, 490 insertions, 266 deletions
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 53dae3eb3d1f..612dc13ddd85 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst | |||
@@ -1,194 +1,98 @@ | |||
1 | # ========================================================================== | 1 | # ========================================================================== |
2 | # Installing headers | 2 | # Installing headers |
3 | # | 3 | # |
4 | # header-y files will be installed verbatim | 4 | # header-y - list files to be installed. They are preprocessed |
5 | # unifdef-y are the files where unifdef will be run before installing files | 5 | # to remove __KERNEL__ section of the file |
6 | # objhdr-y are generated files that will be installed verbatim | 6 | # unifdef-y - Same as header-y. Obsolete |
7 | # objhdr-y - Same as header-y but for generated files | ||
7 | # | 8 | # |
8 | # ========================================================================== | 9 | # ========================================================================== |
9 | 10 | ||
10 | UNIFDEF := scripts/unifdef -U__KERNEL__ | 11 | # called may set destination dir (when installing to asm/) |
11 | |||
12 | # Eliminate the contents of (and inclusions of) compiler.h | ||
13 | HDRSED := sed -e "s/ inline / __inline__ /g" \ | ||
14 | -e "s/[[:space:]]__user[[:space:]]\{1,\}/ /g" \ | ||
15 | -e "s/(__user[[:space:]]\{1,\}/ (/g" \ | ||
16 | -e "s/[[:space:]]__force[[:space:]]\{1,\}/ /g" \ | ||
17 | -e "s/(__force[[:space:]]\{1,\}/ (/g" \ | ||
18 | -e "s/[[:space:]]__iomem[[:space:]]\{1,\}/ /g" \ | ||
19 | -e "s/(__iomem[[:space:]]\{1,\}/ (/g" \ | ||
20 | -e "s/[[:space:]]__attribute_const__[[:space:]]\{1,\}/\ /g" \ | ||
21 | -e "s/[[:space:]]__attribute_const__$$//" \ | ||
22 | -e "/^\#include <linux\/compiler.h>/d" | ||
23 | |||
24 | _dst := $(if $(dst),$(dst),$(obj)) | 12 | _dst := $(if $(dst),$(dst),$(obj)) |
25 | 13 | ||
26 | ifeq (,$(patsubst include/asm/%,,$(obj)/)) | 14 | kbuild-file := $(srctree)/$(obj)/Kbuild |
27 | # For producing the generated stuff in include/asm for biarch builds, include | 15 | include $(kbuild-file) |
28 | # both sets of Kbuild files; we'll generate anything which is mentioned in | ||
29 | # _either_ arch, and recurse into subdirectories which are mentioned in either | ||
30 | # arch. Since some directories may exist in one but not the other, we must | ||
31 | # use $(wildcard...). | ||
32 | GENASM := 1 | ||
33 | archasm := $(subst include/asm,asm-$(ARCH),$(obj)) | ||
34 | altarchasm := $(subst include/asm,asm-$(ALTARCH),$(obj)) | ||
35 | KBUILDFILES := $(wildcard $(srctree)/include/$(archasm)/Kbuild $(srctree)/include/$(altarchasm)/Kbuild) | ||
36 | else | ||
37 | KBUILDFILES := $(srctree)/$(obj)/Kbuild | ||
38 | endif | ||
39 | 16 | ||
40 | include $(KBUILDFILES) | 17 | include scripts/Kbuild.include |
41 | 18 | ||
42 | include scripts/Kbuild.include | 19 | install := $(INSTALL_HDR_PATH)/$(_dst) |
43 | 20 | ||
44 | # If this is include/asm-$(ARCH) and there's no $(ALTARCH), then | 21 | header-y := $(sort $(header-y) $(unifdef-y)) |
45 | # override $(_dst) so that we install to include/asm directly. | 22 | subdirs := $(patsubst %/,%,$(filter %/, $(header-y))) |
46 | # Unless $(BIASMDIR) is set, in which case we're probably doing | 23 | header-y := $(filter-out %/, $(header-y)) |
47 | # a 'headers_install_all' build and we should keep the -$(ARCH) | ||
48 | # in the directory name. | ||
49 | ifeq ($(obj)$(ALTARCH),include/asm-$(ARCH)$(BIASMDIR)) | ||
50 | _dst := include/asm | ||
51 | endif | ||
52 | 24 | ||
53 | header-y := $(sort $(header-y)) | 25 | # files used to track state of install/check |
54 | unifdef-y := $(sort $(unifdef-y)) | 26 | install-file := $(install)/.install |
55 | subdir-y := $(patsubst %/,%,$(filter %/, $(header-y))) | 27 | check-file := $(install)/.check |
56 | header-y := $(filter-out %/, $(header-y)) | ||
57 | header-y := $(filter-out $(unifdef-y),$(header-y)) | ||
58 | 28 | ||
59 | # stamp files for header checks | 29 | # all headers files for this dir |
60 | check-y := $(patsubst %,.check.%,$(header-y) $(unifdef-y) $(objhdr-y)) | 30 | all-files := $(header-y) $(objhdr-y) |
31 | input-files := $(addprefix $(srctree)/$(obj)/,$(header-y)) \ | ||
32 | $(addprefix $(objtree)/$(obj)/,$(objhdr-y)) | ||
33 | output-files := $(addprefix $(install)/, $(all-files)) | ||
61 | 34 | ||
62 | # Work out what needs to be removed | 35 | # Work out what needs to be removed |
63 | oldheaders := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/*.h)) | 36 | oldheaders := $(patsubst $(install)/%,%,$(wildcard $(install)/*.h)) |
64 | unwanted := $(filter-out $(header-y) $(unifdef-y) $(objhdr-y),$(oldheaders)) | 37 | unwanted := $(filter-out $(all-files),$(oldheaders)) |
65 | 38 | ||
66 | oldcheckstamps := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/.check.*.h)) | 39 | # Prefix unwanted with full paths to $(INSTALL_HDR_PATH) |
67 | unwanted += $(filter-out $(check-y),$(oldcheckstamps)) | 40 | unwanted-file := $(addprefix $(install)/, $(unwanted)) |
68 | 41 | ||
69 | # Prefix them all with full paths to $(INSTALL_HDR_PATH) | 42 | printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) |
70 | header-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(header-y)) | ||
71 | unifdef-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(unifdef-y)) | ||
72 | objhdr-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(objhdr-y)) | ||
73 | check-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(check-y)) | ||
74 | 43 | ||
44 | quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ | ||
45 | file$(if $(word 2, $(all-files)),s)) | ||
46 | cmd_install = \ | ||
47 | $(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(header-y); \ | ||
48 | $(PERL) $< $(objtree)/$(obj) $(install) $(SRCARCH) $(objhdr-y); \ | ||
49 | touch $@ | ||
75 | 50 | ||
76 | ifdef ALTARCH | 51 | quiet_cmd_remove = REMOVE $(unwanted) |
77 | ifeq ($(obj),include/asm-$(ARCH)) | 52 | cmd_remove = rm -f $(unwanted-file) |
78 | altarch-y := altarch-dir | ||
79 | endif | ||
80 | endif | ||
81 | 53 | ||
82 | # Make the definitions visible for recursive make invocations | 54 | quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files) |
83 | export ALTARCH | 55 | cmd_check = $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH) \ |
84 | export ARCHDEF | 56 | $(addprefix $(install)/, $(all-files)); \ |
85 | export ALTARCHDEF | 57 | touch $@ |
86 | |||
87 | quiet_cmd_o_hdr_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) | ||
88 | cmd_o_hdr_install = cp $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(objtree)/$(obj)/%,$@) \ | ||
89 | $(INSTALL_HDR_PATH)/$(_dst) | ||
90 | |||
91 | quiet_cmd_headers_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) | ||
92 | cmd_headers_install = $(HDRSED) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \ | ||
93 | > $@ | ||
94 | |||
95 | quiet_cmd_unifdef = UNIFDEF $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) | ||
96 | cmd_unifdef = $(UNIFDEF) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \ | ||
97 | | $(HDRSED) > $@ || : | ||
98 | |||
99 | quiet_cmd_check = CHECK $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/.check.%,$(_dst)/%,$@) | ||
100 | cmd_check = $(CONFIG_SHELL) $(srctree)/scripts/hdrcheck.sh \ | ||
101 | $(INSTALL_HDR_PATH)/include $(subst /.check.,/,$@) $@ | ||
102 | |||
103 | quiet_cmd_remove = REMOVE $(_dst)/$@ | ||
104 | cmd_remove = rm -f $(INSTALL_HDR_PATH)/$(_dst)/$@ | ||
105 | |||
106 | quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) | ||
107 | cmd_mkdir = mkdir -p $@ | ||
108 | |||
109 | quiet_cmd_gen = GEN $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) | ||
110 | cmd_gen = \ | ||
111 | FNAME=$(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$@); \ | ||
112 | STUBDEF=__ASM_STUB_`echo $$FNAME | tr a-z.- A-Z__`; \ | ||
113 | (echo "/* File autogenerated by 'make headers_install' */" ; \ | ||
114 | echo "\#ifndef $$STUBDEF" ; \ | ||
115 | echo "\#define $$STUBDEF" ; \ | ||
116 | echo "\# if $(ARCHDEF)" ; \ | ||
117 | if [ -r $(subst /$(_dst)/,/include/$(archasm)/,$@) ]; then \ | ||
118 | echo "\# include <$(archasm)/$$FNAME>" ; \ | ||
119 | else \ | ||
120 | echo "\# error $(archasm)/$$FNAME does not exist in" \ | ||
121 | "the $(ARCH) architecture" ; \ | ||
122 | fi ; \ | ||
123 | echo "\# elif $(ALTARCHDEF)" ; \ | ||
124 | if [ -r $(subst /$(_dst)/,/include/$(altarchasm)/,$@) ]; then \ | ||
125 | echo "\# include <$(altarchasm)/$$FNAME>" ; \ | ||
126 | else \ | ||
127 | echo "\# error $(altarchasm)/$$FNAME does not exist in" \ | ||
128 | "the $(ALTARCH) architecture" ; \ | ||
129 | fi ; \ | ||
130 | echo "\# else" ; \ | ||
131 | echo "\# warning This machine appears to be" \ | ||
132 | "neither $(ARCH) nor $(ALTARCH)." ; \ | ||
133 | echo "\# endif" ; \ | ||
134 | echo "\#endif /* $$STUBDEF */" ; \ | ||
135 | ) > $@ | ||
136 | |||
137 | .PHONY: __headersinst __headerscheck | ||
138 | |||
139 | ifdef HDRCHECK | ||
140 | __headerscheck: $(subdir-y) $(check-y) | ||
141 | @true | ||
142 | |||
143 | $(check-y) : $(INSTALL_HDR_PATH)/$(_dst)/.check.%.h : $(INSTALL_HDR_PATH)/$(_dst)/%.h | ||
144 | $(call cmd,check) | ||
145 | |||
146 | # Other dependencies for $(check-y) | ||
147 | include /dev/null $(wildcard $(check-y)) | ||
148 | |||
149 | # ... but leave $(check-y) as .PHONY for now until those deps are actually correct. | ||
150 | .PHONY: $(check-y) | ||
151 | 58 | ||
152 | else | 59 | PHONY += __headersinst __headerscheck |
153 | # Rules for installing headers | ||
154 | __headersinst: $(subdir-y) $(header-y) $(unifdef-y) $(altarch-y) $(objhdr-y) | ||
155 | @true | ||
156 | 60 | ||
157 | $(objhdr-y) $(subdir-y) $(header-y) $(unifdef-y): | $(INSTALL_HDR_PATH)/$(_dst) $(unwanted) | 61 | ifndef HDRCHECK |
158 | 62 | # Rules for installing headers | |
159 | $(INSTALL_HDR_PATH)/$(_dst): | 63 | __headersinst: $(subdirs) $(install-file) |
160 | $(call cmd,mkdir) | 64 | @: |
161 | |||
162 | .PHONY: $(unwanted) | ||
163 | $(unwanted): | ||
164 | $(call cmd,remove) | ||
165 | 65 | ||
166 | ifdef GENASM | 66 | targets += $(install-file) |
167 | $(objhdr-y) $(header-y) $(unifdef-y): $(KBUILDFILES) | 67 | $(install-file): scripts/headers_install.pl $(input-files) FORCE |
168 | $(call cmd,gen) | 68 | $(if $(unwanted),$(call cmd,remove),) |
69 | $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@))) | ||
70 | $(call if_changed,install) | ||
169 | 71 | ||
170 | else | 72 | else |
171 | $(objhdr-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(objtree)/$(obj)/%.h $(KBUILDFILES) | 73 | __headerscheck: $(subdirs) $(check-file) |
172 | $(call cmd,o_hdr_install) | 74 | @: |
173 | 75 | ||
174 | $(header-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES) | 76 | targets += $(check-file) |
175 | $(call cmd,headers_install) | 77 | $(check-file): scripts/headers_check.pl $(output-files) FORCE |
78 | $(call if_changed,check) | ||
176 | 79 | ||
177 | $(unifdef-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES) | ||
178 | $(call cmd,unifdef) | ||
179 | endif | ||
180 | endif | 80 | endif |
181 | 81 | ||
182 | hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj | 82 | # Recursion |
83 | hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj | ||
84 | .PHONY: $(subdirs) | ||
85 | $(subdirs): | ||
86 | $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@ | ||
183 | 87 | ||
184 | .PHONY: altarch-dir | 88 | targets := $(wildcard $(sort $(targets))) |
185 | # All the files in the normal arch dir must be created first, since we test | 89 | cmd_files := $(wildcard \ |
186 | # for their existence. | 90 | $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) |
187 | altarch-dir: $(subdir-y) $(header-y) $(unifdef-y) $(objhdr-y) | ||
188 | $(Q)$(MAKE) $(hdrinst)=include/asm-$(ALTARCH) dst=include/asm-$(ALTARCH) | ||
189 | $(Q)$(MAKE) $(hdrinst)=include/asm dst=include/asm$(BIASMDIR) | ||
190 | 91 | ||
191 | # Recursion | 92 | ifneq ($(cmd_files),) |
192 | .PHONY: $(subdir-y) | 93 | include $(cmd_files) |
193 | $(subdir-y): | 94 | endif |
194 | $(Q)$(MAKE) $(hdrinst)=$(obj)/$@ dst=$(_dst)/$@ rel=../$(rel) | 95 | |
96 | .PHONY: $(PHONY) | ||
97 | PHONY += FORCE | ||
98 | FORCE: ; | ||
diff --git a/scripts/diffconfig b/scripts/diffconfig new file mode 100755 index 000000000000..b91f3e34d44d --- /dev/null +++ b/scripts/diffconfig | |||
@@ -0,0 +1,129 @@ | |||
1 | #!/usr/bin/python | ||
2 | # | ||
3 | # diffconfig - a tool to compare .config files. | ||
4 | # | ||
5 | # originally written in 2006 by Matt Mackall | ||
6 | # (at least, this was in his bloatwatch source code) | ||
7 | # last worked on 2008 by Tim Bird | ||
8 | # | ||
9 | |||
10 | import sys, os | ||
11 | |||
12 | def usage(): | ||
13 | print """Usage: diffconfig [-h] [-m] [<config1> <config2>] | ||
14 | |||
15 | Diffconfig is a simple utility for comparing two .config files. | ||
16 | Using standard diff to compare .config files often includes extraneous and | ||
17 | distracting information. This utility produces sorted output with only the | ||
18 | changes in configuration values between the two files. | ||
19 | |||
20 | Added and removed items are shown with a leading plus or minus, respectively. | ||
21 | Changed items show the old and new values on a single line. | ||
22 | |||
23 | If -m is specified, then output will be in "merge" style, which has the | ||
24 | changed and new values in kernel config option format. | ||
25 | |||
26 | If no config files are specified, .config and .config.old are used. | ||
27 | |||
28 | Example usage: | ||
29 | $ diffconfig .config config-with-some-changes | ||
30 | -EXT2_FS_XATTR n | ||
31 | -EXT2_FS_XIP n | ||
32 | CRAMFS n -> y | ||
33 | EXT2_FS y -> n | ||
34 | LOG_BUF_SHIFT 14 -> 16 | ||
35 | PRINTK_TIME n -> y | ||
36 | """ | ||
37 | sys.exit(0) | ||
38 | |||
39 | # returns a dictionary of name/value pairs for config items in the file | ||
40 | def readconfig(config_file): | ||
41 | d = {} | ||
42 | for line in config_file: | ||
43 | line = line[:-1] | ||
44 | if line[:7] == "CONFIG_": | ||
45 | name, val = line[7:].split("=", 1) | ||
46 | d[name] = val | ||
47 | if line[-11:] == " is not set": | ||
48 | d[line[9:-11]] = "n" | ||
49 | return d | ||
50 | |||
51 | def print_config(op, config, value, new_value): | ||
52 | global merge_style | ||
53 | |||
54 | if merge_style: | ||
55 | if new_value: | ||
56 | if new_value=="n": | ||
57 | print "# CONFIG_%s is not set" % config | ||
58 | else: | ||
59 | print "CONFIG_%s=%s" % (config, new_value) | ||
60 | else: | ||
61 | if op=="-": | ||
62 | print "-%s %s" % (config, value) | ||
63 | elif op=="+": | ||
64 | print "+%s %s" % (config, new_value) | ||
65 | else: | ||
66 | print " %s %s -> %s" % (config, value, new_value) | ||
67 | |||
68 | def main(): | ||
69 | global merge_style | ||
70 | |||
71 | # parse command line args | ||
72 | if ("-h" in sys.argv or "--help" in sys.argv): | ||
73 | usage() | ||
74 | |||
75 | merge_style = 0 | ||
76 | if "-m" in sys.argv: | ||
77 | merge_style = 1 | ||
78 | sys.argv.remove("-m") | ||
79 | |||
80 | argc = len(sys.argv) | ||
81 | if not (argc==1 or argc == 3): | ||
82 | print "Error: incorrect number of arguments or unrecognized option" | ||
83 | usage() | ||
84 | |||
85 | if argc == 1: | ||
86 | # if no filenames given, assume .config and .config.old | ||
87 | build_dir="" | ||
88 | if os.environ.has_key("KBUILD_OUTPUT"): | ||
89 | build_dir = os.environ["KBUILD_OUTPUT"]+"/" | ||
90 | |||
91 | configa_filename = build_dir + ".config.old" | ||
92 | configb_filename = build_dir + ".config" | ||
93 | else: | ||
94 | configa_filename = sys.argv[1] | ||
95 | configb_filename = sys.argv[2] | ||
96 | |||
97 | a = readconfig(file(configa_filename)) | ||
98 | b = readconfig(file(configb_filename)) | ||
99 | |||
100 | # print items in a but not b (accumulate, sort and print) | ||
101 | old = [] | ||
102 | for config in a: | ||
103 | if config not in b: | ||
104 | old.append(config) | ||
105 | old.sort() | ||
106 | for config in old: | ||
107 | print_config("-", config, a[config], None) | ||
108 | del a[config] | ||
109 | |||
110 | # print items that changed (accumulate, sort, and print) | ||
111 | changed = [] | ||
112 | for config in a: | ||
113 | if a[config] != b[config]: | ||
114 | changed.append(config) | ||
115 | else: | ||
116 | del b[config] | ||
117 | changed.sort() | ||
118 | for config in changed: | ||
119 | print_config("->", config, a[config], b[config]) | ||
120 | del b[config] | ||
121 | |||
122 | # now print items in b but not in a | ||
123 | # (items from b that were in a were removed above) | ||
124 | new = b.keys() | ||
125 | new.sort() | ||
126 | for config in new: | ||
127 | print_config("+", config, None, b[config]) | ||
128 | |||
129 | main() | ||
diff --git a/scripts/hdrcheck.sh b/scripts/hdrcheck.sh deleted file mode 100755 index 31598584f871..000000000000 --- a/scripts/hdrcheck.sh +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | for FILE in `grep '^[ \t]*#[ \t]*include[ \t]*<' $2 | cut -f2 -d\< | cut -f1 -d\> | egrep ^linux\|^asm` ; do | ||
4 | if [ ! -r $1/$FILE ]; then | ||
5 | echo $2 requires $FILE, which does not exist in exported headers | ||
6 | exit 1 | ||
7 | fi | ||
8 | done | ||
9 | # FIXME: List dependencies into $3 | ||
10 | touch $3 | ||
diff --git a/scripts/headers.sh b/scripts/headers.sh new file mode 100755 index 000000000000..d33426f866db --- /dev/null +++ b/scripts/headers.sh | |||
@@ -0,0 +1,41 @@ | |||
1 | #!/bin/sh | ||
2 | # Run headers_$1 command for all suitable architectures | ||
3 | |||
4 | # Stop on error | ||
5 | set -e | ||
6 | |||
7 | do_command() | ||
8 | { | ||
9 | if [ -f ${srctree}/arch/$2/include/asm/Kbuild ]; then | ||
10 | make ARCH=$2 KBUILD_HEADERS=$1 headers_$1 | ||
11 | elif [ -f ${srctree}/include/asm-$2/Kbuild ]; then | ||
12 | make ARCH=$2 KBUILD_HEADERS=$1 headers_$1 | ||
13 | else | ||
14 | printf "Ignoring arch: %s\n" ${arch} | ||
15 | fi | ||
16 | } | ||
17 | |||
18 | # Do not try this architecture | ||
19 | drop="generic um ppc sparc64 cris" | ||
20 | |||
21 | archs=$(ls ${srctree}/arch) | ||
22 | |||
23 | for arch in ${archs}; do | ||
24 | case ${arch} in | ||
25 | um) # no userspace export | ||
26 | ;; | ||
27 | ppc) # headers exported by powerpc | ||
28 | ;; | ||
29 | sparc64) # headers exported by sparc | ||
30 | ;; | ||
31 | cris) # headers export are known broken | ||
32 | ;; | ||
33 | *) | ||
34 | if [ -d ${srctree}/arch/${arch} ]; then | ||
35 | do_command $1 ${arch} | ||
36 | fi | ||
37 | ;; | ||
38 | esac | ||
39 | done | ||
40 | |||
41 | |||
diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl new file mode 100644 index 000000000000..15d53a6b1a1f --- /dev/null +++ b/scripts/headers_check.pl | |||
@@ -0,0 +1,56 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # | ||
3 | # headers_check.pl execute a number of trivial consistency checks | ||
4 | # | ||
5 | # Usage: headers_check.pl dir [files...] | ||
6 | # dir: dir to look for included files | ||
7 | # arch: architecture | ||
8 | # files: list of files to check | ||
9 | # | ||
10 | # The script reads the supplied files line by line and: | ||
11 | # | ||
12 | # 1) for each include statement it checks if the | ||
13 | # included file actually exists. | ||
14 | # Only include files located in asm* and linux* are checked. | ||
15 | # The rest are assumed to be system include files. | ||
16 | # | ||
17 | # 2) TODO: check for leaked CONFIG_ symbols | ||
18 | |||
19 | use strict; | ||
20 | use warnings; | ||
21 | |||
22 | my ($dir, $arch, @files) = @ARGV; | ||
23 | |||
24 | my $ret = 0; | ||
25 | my $line; | ||
26 | my $lineno = 0; | ||
27 | my $filename; | ||
28 | |||
29 | foreach my $file (@files) { | ||
30 | $filename = $file; | ||
31 | open(my $fh, '<', "$filename") or die "$filename: $!\n"; | ||
32 | $lineno = 0; | ||
33 | while ($line = <$fh>) { | ||
34 | $lineno++; | ||
35 | check_include(); | ||
36 | } | ||
37 | close $fh; | ||
38 | } | ||
39 | exit $ret; | ||
40 | |||
41 | sub check_include | ||
42 | { | ||
43 | if ($line =~ m/^\s*#\s*include\s+<((asm|linux).*)>/) { | ||
44 | my $inc = $1; | ||
45 | my $found; | ||
46 | $found = stat($dir . "/" . $inc); | ||
47 | if (!$found) { | ||
48 | $inc =~ s#asm/#asm-$arch/#; | ||
49 | $found = stat($dir . "/" . $inc); | ||
50 | } | ||
51 | if (!$found) { | ||
52 | printf STDERR "$filename:$lineno: included file '$inc' is not exported\n"; | ||
53 | $ret = 1; | ||
54 | } | ||
55 | } | ||
56 | } | ||
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl new file mode 100644 index 000000000000..68591cd08731 --- /dev/null +++ b/scripts/headers_install.pl | |||
@@ -0,0 +1,45 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # | ||
3 | # headers_install prepare the listed header files for use in | ||
4 | # user space and copy the files to their destination. | ||
5 | # | ||
6 | # Usage: headers_install.pl readdir installdir arch [files...] | ||
7 | # readdir: dir to open files | ||
8 | # installdir: dir to install the files | ||
9 | # arch: current architecture | ||
10 | # arch is used to force a reinstallation when the arch | ||
11 | # changes because kbuild then detect a command line change. | ||
12 | # files: list of files to check | ||
13 | # | ||
14 | # Step in preparation for users space: | ||
15 | # 1) Drop all use of compiler.h definitions | ||
16 | # 2) Drop include of compiler.h | ||
17 | # 3) Drop all sections defined out by __KERNEL__ (using unifdef) | ||
18 | |||
19 | use strict; | ||
20 | use warnings; | ||
21 | |||
22 | my ($readdir, $installdir, $arch, @files) = @ARGV; | ||
23 | |||
24 | my $unifdef = "scripts/unifdef -U__KERNEL__"; | ||
25 | |||
26 | foreach my $file (@files) { | ||
27 | my $tmpfile = "$installdir/$file.tmp"; | ||
28 | open(my $infile, '<', "$readdir/$file") | ||
29 | or die "$readdir/$file: $!\n"; | ||
30 | open(my $outfile, '>', "$tmpfile") or die "$tmpfile: $!\n"; | ||
31 | while (my $line = <$infile>) { | ||
32 | $line =~ s/([\s(])__user\s/$1/g; | ||
33 | $line =~ s/([\s(])__force\s/$1/g; | ||
34 | $line =~ s/([\s(])__iomem\s/$1/g; | ||
35 | $line =~ s/\s__attribute_const__\s/ /g; | ||
36 | $line =~ s/\s__attribute_const__$//g; | ||
37 | $line =~ s/^#include <linux\/compiler.h>//; | ||
38 | printf $outfile "%s", $line; | ||
39 | } | ||
40 | close $outfile; | ||
41 | close $infile; | ||
42 | system $unifdef . " $tmpfile > $installdir/$file"; | ||
43 | unlink $tmpfile; | ||
44 | } | ||
45 | exit 0; | ||
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index fda63136ae68..9fba838c7069 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -76,7 +76,6 @@ static void check_stdin(void) | |||
76 | static int conf_askvalue(struct symbol *sym, const char *def) | 76 | static int conf_askvalue(struct symbol *sym, const char *def) |
77 | { | 77 | { |
78 | enum symbol_type type = sym_get_type(sym); | 78 | enum symbol_type type = sym_get_type(sym); |
79 | tristate val; | ||
80 | 79 | ||
81 | if (!sym_has_value(sym)) | 80 | if (!sym_has_value(sym)) |
82 | printf(_("(NEW) ")); | 81 | printf(_("(NEW) ")); |
@@ -92,15 +91,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
92 | } | 91 | } |
93 | 92 | ||
94 | switch (input_mode) { | 93 | switch (input_mode) { |
95 | case set_no: | ||
96 | case set_mod: | ||
97 | case set_yes: | ||
98 | case set_random: | ||
99 | if (sym_has_value(sym)) { | ||
100 | printf("%s\n", def); | ||
101 | return 0; | ||
102 | } | ||
103 | break; | ||
104 | case ask_new: | 94 | case ask_new: |
105 | case ask_silent: | 95 | case ask_silent: |
106 | if (sym_has_value(sym)) { | 96 | if (sym_has_value(sym)) { |
@@ -112,9 +102,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
112 | fflush(stdout); | 102 | fflush(stdout); |
113 | fgets(line, 128, stdin); | 103 | fgets(line, 128, stdin); |
114 | return 1; | 104 | return 1; |
115 | case set_default: | ||
116 | printf("%s\n", def); | ||
117 | return 1; | ||
118 | default: | 105 | default: |
119 | break; | 106 | break; |
120 | } | 107 | } |
@@ -128,52 +115,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
128 | default: | 115 | default: |
129 | ; | 116 | ; |
130 | } | 117 | } |
131 | switch (input_mode) { | ||
132 | case set_yes: | ||
133 | if (sym_tristate_within_range(sym, yes)) { | ||
134 | line[0] = 'y'; | ||
135 | line[1] = '\n'; | ||
136 | line[2] = 0; | ||
137 | break; | ||
138 | } | ||
139 | case set_mod: | ||
140 | if (type == S_TRISTATE) { | ||
141 | if (sym_tristate_within_range(sym, mod)) { | ||
142 | line[0] = 'm'; | ||
143 | line[1] = '\n'; | ||
144 | line[2] = 0; | ||
145 | break; | ||
146 | } | ||
147 | } else { | ||
148 | if (sym_tristate_within_range(sym, yes)) { | ||
149 | line[0] = 'y'; | ||
150 | line[1] = '\n'; | ||
151 | line[2] = 0; | ||
152 | break; | ||
153 | } | ||
154 | } | ||
155 | case set_no: | ||
156 | if (sym_tristate_within_range(sym, no)) { | ||
157 | line[0] = 'n'; | ||
158 | line[1] = '\n'; | ||
159 | line[2] = 0; | ||
160 | break; | ||
161 | } | ||
162 | case set_random: | ||
163 | do { | ||
164 | val = (tristate)(rand() % 3); | ||
165 | } while (!sym_tristate_within_range(sym, val)); | ||
166 | switch (val) { | ||
167 | case no: line[0] = 'n'; break; | ||
168 | case mod: line[0] = 'm'; break; | ||
169 | case yes: line[0] = 'y'; break; | ||
170 | } | ||
171 | line[1] = '\n'; | ||
172 | line[2] = 0; | ||
173 | break; | ||
174 | default: | ||
175 | break; | ||
176 | } | ||
177 | printf("%s", line); | 118 | printf("%s", line); |
178 | return 1; | 119 | return 1; |
179 | } | 120 | } |
@@ -374,15 +315,7 @@ static int conf_choice(struct menu *menu) | |||
374 | else | 315 | else |
375 | continue; | 316 | continue; |
376 | break; | 317 | break; |
377 | case set_random: | 318 | default: |
378 | if (is_new) | ||
379 | def = (rand() % cnt) + 1; | ||
380 | case set_default: | ||
381 | case set_yes: | ||
382 | case set_mod: | ||
383 | case set_no: | ||
384 | cnt = def; | ||
385 | printf("%d\n", cnt); | ||
386 | break; | 319 | break; |
387 | } | 320 | } |
388 | 321 | ||
@@ -494,6 +427,43 @@ static void check_conf(struct menu *menu) | |||
494 | check_conf(child); | 427 | check_conf(child); |
495 | } | 428 | } |
496 | 429 | ||
430 | static void conf_do_update(void) | ||
431 | { | ||
432 | /* Update until a loop caused no more changes */ | ||
433 | do { | ||
434 | conf_cnt = 0; | ||
435 | check_conf(&rootmenu); | ||
436 | } while (conf_cnt); | ||
437 | } | ||
438 | |||
439 | static int conf_silent_update(void) | ||
440 | { | ||
441 | const char *name; | ||
442 | |||
443 | if (conf_get_changed()) { | ||
444 | name = getenv("KCONFIG_NOSILENTUPDATE"); | ||
445 | if (name && *name) { | ||
446 | fprintf(stderr, | ||
447 | _("\n*** Kernel configuration requires explicit update.\n\n")); | ||
448 | return 1; | ||
449 | } | ||
450 | conf_do_update(); | ||
451 | } | ||
452 | return 0; | ||
453 | } | ||
454 | |||
455 | static int conf_update(void) | ||
456 | { | ||
457 | rootEntry = &rootmenu; | ||
458 | conf(&rootmenu); | ||
459 | if (input_mode == ask_all) { | ||
460 | input_mode = ask_silent; | ||
461 | valid_stdin = 1; | ||
462 | } | ||
463 | conf_do_update(); | ||
464 | return 0; | ||
465 | } | ||
466 | |||
497 | int main(int ac, char **av) | 467 | int main(int ac, char **av) |
498 | { | 468 | { |
499 | int opt; | 469 | int opt; |
@@ -599,36 +569,43 @@ int main(int ac, char **av) | |||
599 | default: | 569 | default: |
600 | break; | 570 | break; |
601 | } | 571 | } |
572 | switch (input_mode) { | ||
573 | case set_no: | ||
574 | conf_set_all_new_symbols(def_no); | ||
575 | break; | ||
576 | case set_yes: | ||
577 | conf_set_all_new_symbols(def_yes); | ||
578 | break; | ||
579 | case set_mod: | ||
580 | conf_set_all_new_symbols(def_mod); | ||
581 | break; | ||
582 | case set_random: | ||
583 | conf_set_all_new_symbols(def_random); | ||
584 | break; | ||
585 | case set_default: | ||
586 | conf_set_all_new_symbols(def_default); | ||
587 | break; | ||
588 | case ask_silent: | ||
589 | case ask_new: | ||
590 | if (conf_silent_update()) | ||
591 | exit(1); | ||
592 | break; | ||
593 | case ask_all: | ||
594 | if (conf_update()) | ||
595 | exit(1); | ||
596 | break; | ||
597 | } | ||
602 | 598 | ||
603 | if (input_mode != ask_silent) { | 599 | if (conf_get_changed() && conf_write(NULL)) { |
604 | rootEntry = &rootmenu; | ||
605 | conf(&rootmenu); | ||
606 | if (input_mode == ask_all) { | ||
607 | input_mode = ask_silent; | ||
608 | valid_stdin = 1; | ||
609 | } | ||
610 | } else if (conf_get_changed()) { | ||
611 | name = getenv("KCONFIG_NOSILENTUPDATE"); | ||
612 | if (name && *name) { | ||
613 | fprintf(stderr, _("\n*** Kernel configuration requires explicit update.\n\n")); | ||
614 | return 1; | ||
615 | } | ||
616 | } else | ||
617 | goto skip_check; | ||
618 | |||
619 | do { | ||
620 | conf_cnt = 0; | ||
621 | check_conf(&rootmenu); | ||
622 | } while (conf_cnt); | ||
623 | if (conf_write(NULL)) { | ||
624 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | 600 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); |
625 | return 1; | 601 | exit(1); |
626 | } | 602 | } |
627 | skip_check: | 603 | /* ask_silent is used during the build so we shall update autoconf. |
604 | * All other commands are only used to generate a config. | ||
605 | */ | ||
628 | if (input_mode == ask_silent && conf_write_autoconf()) { | 606 | if (input_mode == ask_silent && conf_write_autoconf()) { |
629 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | 607 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); |
630 | return 1; | 608 | return 1; |
631 | } | 609 | } |
632 | |||
633 | return 0; | 610 | return 0; |
634 | } | 611 | } |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index ee5fe943d58d..07597611cc50 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -812,3 +812,73 @@ void conf_set_changed_callback(void (*fn)(void)) | |||
812 | { | 812 | { |
813 | conf_changed_callback = fn; | 813 | conf_changed_callback = fn; |
814 | } | 814 | } |
815 | |||
816 | |||
817 | void conf_set_all_new_symbols(enum conf_def_mode mode) | ||
818 | { | ||
819 | struct symbol *sym, *csym; | ||
820 | struct property *prop; | ||
821 | struct expr *e; | ||
822 | int i, cnt, def; | ||
823 | |||
824 | for_all_symbols(i, sym) { | ||
825 | if (sym_has_value(sym)) | ||
826 | continue; | ||
827 | switch (sym_get_type(sym)) { | ||
828 | case S_BOOLEAN: | ||
829 | case S_TRISTATE: | ||
830 | switch (mode) { | ||
831 | case def_yes: | ||
832 | sym->def[S_DEF_USER].tri = yes; | ||
833 | break; | ||
834 | case def_mod: | ||
835 | sym->def[S_DEF_USER].tri = mod; | ||
836 | break; | ||
837 | case def_no: | ||
838 | sym->def[S_DEF_USER].tri = no; | ||
839 | break; | ||
840 | case def_random: | ||
841 | sym->def[S_DEF_USER].tri = (tristate)(rand() % 3); | ||
842 | break; | ||
843 | default: | ||
844 | continue; | ||
845 | } | ||
846 | if (!sym_is_choice(sym) || mode != def_random) | ||
847 | sym->flags |= SYMBOL_DEF_USER; | ||
848 | break; | ||
849 | default: | ||
850 | break; | ||
851 | } | ||
852 | |||
853 | } | ||
854 | |||
855 | if (modules_sym) | ||
856 | sym_calc_value(modules_sym); | ||
857 | |||
858 | if (mode != def_random) | ||
859 | return; | ||
860 | |||
861 | for_all_symbols(i, csym) { | ||
862 | if (sym_has_value(csym) || !sym_is_choice(csym)) | ||
863 | continue; | ||
864 | |||
865 | sym_calc_value(csym); | ||
866 | prop = sym_get_choice_prop(csym); | ||
867 | def = -1; | ||
868 | while (1) { | ||
869 | cnt = 0; | ||
870 | expr_list_for_each_sym(prop->expr, e, sym) { | ||
871 | if (sym->visible == no) | ||
872 | continue; | ||
873 | if (def == cnt++) { | ||
874 | csym->def[S_DEF_USER].val = sym; | ||
875 | break; | ||
876 | } | ||
877 | } | ||
878 | if (def >= 0 || cnt < 2) | ||
879 | break; | ||
880 | def = (rand() % cnt) + 1; | ||
881 | } | ||
882 | csym->flags |= SYMBOL_DEF_USER; | ||
883 | } | ||
884 | } | ||
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 96521cb087ec..4a9af6f7886b 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h | |||
@@ -42,6 +42,14 @@ extern "C" { | |||
42 | #define TF_PARAM 0x0002 | 42 | #define TF_PARAM 0x0002 |
43 | #define TF_OPTION 0x0004 | 43 | #define TF_OPTION 0x0004 |
44 | 44 | ||
45 | enum conf_def_mode { | ||
46 | def_default, | ||
47 | def_yes, | ||
48 | def_mod, | ||
49 | def_no, | ||
50 | def_random | ||
51 | }; | ||
52 | |||
45 | #define T_OPT_MODULES 1 | 53 | #define T_OPT_MODULES 1 |
46 | #define T_OPT_DEFCONFIG_LIST 2 | 54 | #define T_OPT_DEFCONFIG_LIST 2 |
47 | #define T_OPT_ENV 3 | 55 | #define T_OPT_ENV 3 |
@@ -69,6 +77,7 @@ const char *conf_get_configname(void); | |||
69 | char *conf_get_default_confname(void); | 77 | char *conf_get_default_confname(void); |
70 | void sym_set_change_count(int count); | 78 | void sym_set_change_count(int count); |
71 | void sym_add_change_count(int count); | 79 | void sym_add_change_count(int count); |
80 | void conf_set_all_new_symbols(enum conf_def_mode mode); | ||
72 | 81 | ||
73 | /* kconfig_load.c */ | 82 | /* kconfig_load.c */ |
74 | void kconfig_load(void); | 83 | void kconfig_load(void); |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 88e3934a8b8c..d8f77e26081c 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -1643,6 +1643,7 @@ sub dump_function($$) { | |||
1643 | $prototype =~ s/^__always_inline +//; | 1643 | $prototype =~ s/^__always_inline +//; |
1644 | $prototype =~ s/^noinline +//; | 1644 | $prototype =~ s/^noinline +//; |
1645 | $prototype =~ s/__devinit +//; | 1645 | $prototype =~ s/__devinit +//; |
1646 | $prototype =~ s/__init +//; | ||
1646 | $prototype =~ s/^#define\s+//; #ak added | 1647 | $prototype =~ s/^#define\s+//; #ak added |
1647 | $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; | 1648 | $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; |
1648 | 1649 | ||
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 1c1bdaf7348a..83b75126c9f7 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
@@ -12,7 +12,9 @@ cd "${1:-.}" || usage | |||
12 | if head=`git rev-parse --verify HEAD 2>/dev/null`; then | 12 | if head=`git rev-parse --verify HEAD 2>/dev/null`; then |
13 | # Do we have an untagged version? | 13 | # Do we have an untagged version? |
14 | if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then | 14 | if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then |
15 | git describe | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' | 15 | if tag=`git describe 2>/dev/null`; then |
16 | echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' | ||
17 | fi | ||
16 | fi | 18 | fi |
17 | 19 | ||
18 | # Are there uncommitted changes? | 20 | # Are there uncommitted changes? |