aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-27 12:59:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-27 12:59:59 -0400
commit6948385cbd83201fb933125c1a578b29b456605d (patch)
treefd08f30c84d02cfb1ad696d04605565974fae7be
parent7a76d89232f20411f32e7a79ccc1e2f95e9f826b (diff)
parent56b2f0706d82535fd8d85503f2dcc0be40c8e55d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next: (25 commits) setlocalversion: do not describe if there is nothing to describe kconfig: fix typos: "Suport" -> "Support" kconfig: make defconfig is no longer chatty kconfig: make oldconfig is now less chatty kconfig: speed up all*config + randconfig kconfig: set all new symbols automatically kconfig: add diffconfig utility kbuild: remove Module.markers during mrproper kbuild: sparse needs CF not CHECKFLAGS kernel-doc: handle/strip __init vmlinux.lds: move __attribute__((__cold__)) functions back into final .text section init: fix URL of "The GNU Accounting Utilities" kbuild: add arch/$ARCH/include to search path kbuild: asm symlink support for arch/$ARCH/include kbuild: support arch/$ARCH/include for tags, cscope kbuild: prepare headers_* for arch/$ARCH/include kbuild: install all headers when arch is changed kbuild: make clean removes *.o.* as well kbuild: optimize headers_* targets kbuild: only one call for include/ in make headers_* ...
-rw-r--r--Documentation/sparse.txt8
-rw-r--r--Kbuild3
-rw-r--r--Makefile115
-rw-r--r--drivers/misc/Kconfig2
-rw-r--r--include/Kbuild5
-rw-r--r--include/asm-generic/vmlinux.lds.h4
-rw-r--r--init/Kconfig4
-rw-r--r--scripts/Makefile.headersinst230
-rwxr-xr-xscripts/diffconfig129
-rwxr-xr-xscripts/hdrcheck.sh10
-rwxr-xr-xscripts/headers.sh41
-rw-r--r--scripts/headers_check.pl56
-rw-r--r--scripts/headers_install.pl45
-rw-r--r--scripts/kconfig/conf.c161
-rw-r--r--scripts/kconfig/confdata.c70
-rw-r--r--scripts/kconfig/lkc.h9
-rwxr-xr-xscripts/kernel-doc1
-rwxr-xr-xscripts/setlocalversion4
18 files changed, 574 insertions, 323 deletions
diff --git a/Documentation/sparse.txt b/Documentation/sparse.txt
index 1a3bdc27d95e..42f43fa59f24 100644
--- a/Documentation/sparse.txt
+++ b/Documentation/sparse.txt
@@ -73,10 +73,10 @@ recompiled, or use "make C=2" to run sparse on the files whether they need to
73be recompiled or not. The latter is a fast way to check the whole tree if you 73be recompiled or not. The latter is a fast way to check the whole tree if you
74have already built it. 74have already built it.
75 75
76The optional make variable CHECKFLAGS can be used to pass arguments to sparse. 76The optional make variable CF can be used to pass arguments to sparse. The
77The build system passes -Wbitwise to sparse automatically. To perform 77build system passes -Wbitwise to sparse automatically. To perform endianness
78endianness checks, you may define __CHECK_ENDIAN__: 78checks, you may define __CHECK_ENDIAN__:
79 79
80 make C=2 CHECKFLAGS="-D__CHECK_ENDIAN__" 80 make C=2 CF="-D__CHECK_ENDIAN__"
81 81
82These checks are disabled by default as they generate a host of warnings. 82These checks are disabled by default as they generate a host of warnings.
diff --git a/Kbuild b/Kbuild
index e750e9c3fe59..f056b4feee51 100644
--- a/Kbuild
+++ b/Kbuild
@@ -43,7 +43,7 @@ $(obj)/$(bounds-file): kernel/bounds.s Kbuild
43# 2) Generate asm-offsets.h 43# 2) Generate asm-offsets.h
44# 44#
45 45
46offsets-file := include/asm-$(SRCARCH)/asm-offsets.h 46offsets-file := include/asm/asm-offsets.h
47 47
48always += $(offsets-file) 48always += $(offsets-file)
49targets += $(offsets-file) 49targets += $(offsets-file)
@@ -81,7 +81,6 @@ arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
81 $(call if_changed_dep,cc_s_c) 81 $(call if_changed_dep,cc_s_c)
82 82
83$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild 83$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild
84 $(Q)mkdir -p $(dir $@)
85 $(call cmd,offsets) 84 $(call cmd,offsets)
86 85
87##### 86#####
diff --git a/Makefile b/Makefile
index 3cad7db5eba7..40f24810116c 100644
--- a/Makefile
+++ b/Makefile
@@ -205,6 +205,9 @@ ifeq ($(ARCH),x86_64)
205 SRCARCH := x86 205 SRCARCH := x86
206endif 206endif
207 207
208# Where to locate arch specific headers
209hdr-arch := $(SRCARCH)
210
208KCONFIG_CONFIG ?= .config 211KCONFIG_CONFIG ?= .config
209 212
210# SHELL used by kbuild 213# SHELL used by kbuild
@@ -326,7 +329,8 @@ AFLAGS_KERNEL =
326# Needed to be compatible with the O= option 329# Needed to be compatible with the O= option
327LINUXINCLUDE := -Iinclude \ 330LINUXINCLUDE := -Iinclude \
328 $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \ 331 $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
329 -include include/linux/autoconf.h 332 -I$(srctree)/arch/$(hdr-arch)/include \
333 -include include/linux/autoconf.h
330 334
331KBUILD_CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) 335KBUILD_CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
332 336
@@ -922,7 +926,9 @@ ifneq ($(KBUILD_SRC),)
922 /bin/false; \ 926 /bin/false; \
923 fi; 927 fi;
924 $(Q)if [ ! -d include2 ]; then mkdir -p include2; fi; 928 $(Q)if [ ! -d include2 ]; then mkdir -p include2; fi;
925 $(Q)ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm 929 $(Q)if [ -e $(srctree)/include/asm-$(SRCARCH)/system.h ]; then \
930 ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \
931 fi
926endif 932endif
927 933
928# prepare2 creates a makefile if using a separate output directory 934# prepare2 creates a makefile if using a separate output directory
@@ -948,22 +954,34 @@ export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
948 954
949# The asm symlink changes when $(ARCH) changes. 955# The asm symlink changes when $(ARCH) changes.
950# Detect this and ask user to run make mrproper 956# Detect this and ask user to run make mrproper
951 957define check-symlink
952include/asm: FORCE 958 set -e; \
953 $(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \ 959 if [ -L include/asm ]; then \
954 if [ -L include/asm ]; then \ 960 asmlink=`readlink include/asm | cut -d '-' -f 2`; \
955 if [ "$$asmlink" != "$(SRCARCH)" ]; then \ 961 if [ "$$asmlink" != "$(SRCARCH)" ]; then \
956 echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \ 962 echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
957 echo " set ARCH or save .config and run 'make mrproper' to fix it"; \ 963 echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
958 exit 1; \ 964 exit 1; \
959 fi; \ 965 fi; \
960 else \
961 echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
962 if [ ! -d include ]; then \
963 mkdir -p include; \
964 fi; \
965 ln -fsn asm-$(SRCARCH) $@; \
966 fi 966 fi
967endef
968
969# We create the target directory of the symlink if it does
970# not exist so the test in chack-symlink works and we have a
971# directory for generated filesas used by some architectures.
972define create-symlink
973 if [ ! -L include/asm ]; then \
974 echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
975 if [ ! -d include/asm-$(SRCARCH) ]; then \
976 mkdir -p include/asm-$(SRCARCH); \
977 fi; \
978 ln -fsn asm-$(SRCARCH) $@; \
979 fi
980endef
981
982include/asm: FORCE
983 $(Q)$(check-symlink)
984 $(Q)$(create-symlink)
967 985
968# Generate some files 986# Generate some files
969# --------------------------------------------------------------------------- 987# ---------------------------------------------------------------------------
@@ -1010,36 +1028,43 @@ firmware_install: FORCE
1010 1028
1011# --------------------------------------------------------------------------- 1029# ---------------------------------------------------------------------------
1012# Kernel headers 1030# Kernel headers
1013INSTALL_HDR_PATH=$(objtree)/usr
1014export INSTALL_HDR_PATH
1015 1031
1016HDRFILTER=generic i386 x86_64 1032#Default location for installed headers
1017HDRARCHES=$(filter-out $(HDRFILTER),$(patsubst $(srctree)/include/asm-%/Kbuild,%,$(wildcard $(srctree)/include/asm-*/Kbuild))) 1033export INSTALL_HDR_PATH = $(objtree)/usr
1018 1034
1019PHONY += headers_install_all 1035hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
1020headers_install_all: include/linux/version.h scripts_basic FORCE 1036# Find out where the Kbuild file is located to support
1037# arch/$(ARCH)/include/asm
1038hdr-dir = $(strip \
1039 $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild), \
1040 arch/$(hdr-arch)/include/asm, include/asm-$(hdr-arch)))
1041
1042# If we do an all arch process set dst to asm-$(hdr-arch)
1043hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
1044
1045PHONY += __headers
1046__headers: include/linux/version.h scripts_basic FORCE
1021 $(Q)$(MAKE) $(build)=scripts scripts/unifdef 1047 $(Q)$(MAKE) $(build)=scripts scripts/unifdef
1022 $(Q)for arch in $(HDRARCHES); do \ 1048
1023 $(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch ;\ 1049PHONY += headers_install_all
1024 done 1050headers_install_all:
1051 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh install
1025 1052
1026PHONY += headers_install 1053PHONY += headers_install
1027headers_install: include/linux/version.h scripts_basic FORCE 1054headers_install: __headers
1028 @if [ ! -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \ 1055 $(if $(wildcard $(srctree)/$(hdr-dir)/Kbuild),, \
1029 echo '*** Error: Headers not exportable for this architecture ($(SRCARCH))'; \ 1056 $(error Headers not exportable for the $(SRCARCH) architecture))
1030 exit 1 ; fi 1057 $(Q)$(MAKE) $(hdr-inst)=include
1031 $(Q)$(MAKE) $(build)=scripts scripts/unifdef 1058 $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst)
1032 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst ARCH=$(SRCARCH) obj=include
1033 1059
1034PHONY += headers_check_all 1060PHONY += headers_check_all
1035headers_check_all: headers_install_all 1061headers_check_all: headers_install_all
1036 $(Q)for arch in $(HDRARCHES); do \ 1062 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh check
1037 $(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch HDRCHECK=1 ;\
1038 done
1039 1063
1040PHONY += headers_check 1064PHONY += headers_check
1041headers_check: headers_install 1065headers_check: headers_install
1042 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst ARCH=$(SRCARCH) obj=include HDRCHECK=1 1066 $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
1067 $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst) HDRCHECK=1
1043 1068
1044# --------------------------------------------------------------------------- 1069# ---------------------------------------------------------------------------
1045# Modules 1070# Modules
@@ -1131,7 +1156,7 @@ MRPROPER_FILES += .config .config.old include/asm .version .old_version \
1131 include/linux/autoconf.h include/linux/version.h \ 1156 include/linux/autoconf.h include/linux/version.h \
1132 include/linux/utsrelease.h \ 1157 include/linux/utsrelease.h \
1133 include/linux/bounds.h include/asm*/asm-offsets.h \ 1158 include/linux/bounds.h include/asm*/asm-offsets.h \
1134 Module.symvers tags TAGS cscope* 1159 Module.symvers Module.markers tags TAGS cscope*
1135 1160
1136# clean - Delete most, but leave enough to build external modules 1161# clean - Delete most, but leave enough to build external modules
1137# 1162#
@@ -1150,7 +1175,7 @@ clean: archclean $(clean-dirs)
1150 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ 1175 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
1151 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ 1176 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
1152 -o -name '*.symtypes' -o -name 'modules.order' \ 1177 -o -name '*.symtypes' -o -name 'modules.order' \
1153 -o -name 'Module.markers' \) \ 1178 -o -name 'Module.markers' -o -name '.tmp_*.o.*' \) \
1154 -type f -print | xargs rm -f 1179 -type f -print | xargs rm -f
1155 1180
1156# mrproper - Delete all generated files, including .config 1181# mrproper - Delete all generated files, including .config
@@ -1224,21 +1249,17 @@ help:
1224 @echo ' cscope - Generate cscope index' 1249 @echo ' cscope - Generate cscope index'
1225 @echo ' kernelrelease - Output the release version string' 1250 @echo ' kernelrelease - Output the release version string'
1226 @echo ' kernelversion - Output the version stored in Makefile' 1251 @echo ' kernelversion - Output the version stored in Makefile'
1227 @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \ 1252 @echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
1228 echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
1229 echo ' (default: $(INSTALL_HDR_PATH))'; \ 1253 echo ' (default: $(INSTALL_HDR_PATH))'; \
1230 fi 1254 echo ''
1231 @echo ''
1232 @echo 'Static analysers' 1255 @echo 'Static analysers'
1233 @echo ' checkstack - Generate a list of stack hogs' 1256 @echo ' checkstack - Generate a list of stack hogs'
1234 @echo ' namespacecheck - Name space analysis on compiled kernel' 1257 @echo ' namespacecheck - Name space analysis on compiled kernel'
1235 @echo ' versioncheck - Sanity check on version.h usage' 1258 @echo ' versioncheck - Sanity check on version.h usage'
1236 @echo ' includecheck - Check for duplicate included header files' 1259 @echo ' includecheck - Check for duplicate included header files'
1237 @echo ' export_report - List the usages of all exported symbols' 1260 @echo ' export_report - List the usages of all exported symbols'
1238 @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \ 1261 @echo ' headers_check - Sanity check on exported headers'; \
1239 echo ' headers_check - Sanity check on exported headers'; \ 1262 echo ''
1240 fi
1241 @echo ''
1242 @echo 'Kernel packaging:' 1263 @echo 'Kernel packaging:'
1243 @$(MAKE) $(build)=$(package-dir) help 1264 @$(MAKE) $(build)=$(package-dir) help
1244 @echo '' 1265 @echo ''
@@ -1411,7 +1432,11 @@ define find-sources
1411 \( -name config -o -name 'asm-*' \) -prune \ 1432 \( -name config -o -name 'asm-*' \) -prune \
1412 -o -name $1 -print; \ 1433 -o -name $1 -print; \
1413 for arch in $(ALLINCLUDE_ARCHS) ; do \ 1434 for arch in $(ALLINCLUDE_ARCHS) ; do \
1414 find $(__srctree)include/asm-$${arch} $(RCS_FIND_IGNORE) \ 1435 test -e $(__srctree)include/asm-$${arch} && \
1436 find $(__srctree)include/asm-$${arch} $(RCS_FIND_IGNORE) \
1437 -name $1 -print; \
1438 test -e $(__srctree)arch/$${arch}/include/asm && \
1439 find $(__srctree)arch/$${arch}/include/asm $(RCS_FIND_IGNORE) \
1415 -name $1 -print; \ 1440 -name $1 -print; \
1416 done ; \ 1441 done ; \
1417 find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ 1442 find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 321eb9134635..f5ade1904aad 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -360,7 +360,7 @@ config THINKPAD_ACPI_VIDEO
360 If you are not sure, say Y here. 360 If you are not sure, say Y here.
361 361
362config THINKPAD_ACPI_HOTKEY_POLL 362config THINKPAD_ACPI_HOTKEY_POLL
363 bool "Suport NVRAM polling for hot keys" 363 bool "Support NVRAM polling for hot keys"
364 depends on THINKPAD_ACPI 364 depends on THINKPAD_ACPI
365 default y 365 default y
366 ---help--- 366 ---help---
diff --git a/include/Kbuild b/include/Kbuild
index bdca155028ec..d8c3e3cbf416 100644
--- a/include/Kbuild
+++ b/include/Kbuild
@@ -1,3 +1,6 @@
1# Top-level Makefile calls into asm-$(ARCH)
2# List only non-arch directories below
3
1header-y += asm-generic/ 4header-y += asm-generic/
2header-y += linux/ 5header-y += linux/
3header-y += sound/ 6header-y += sound/
@@ -5,5 +8,3 @@ header-y += mtd/
5header-y += rdma/ 8header-y += rdma/
6header-y += video/ 9header-y += video/
7header-y += drm/ 10header-y += drm/
8
9header-y += asm-$(ARCH)/
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 9cd44b162ba1..6d88a923c945 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -221,6 +221,7 @@
221 * during second ld run in second ld pass when generating System.map */ 221 * during second ld run in second ld pass when generating System.map */
222#define TEXT_TEXT \ 222#define TEXT_TEXT \
223 ALIGN_FUNCTION(); \ 223 ALIGN_FUNCTION(); \
224 *(.text.hot) \
224 *(.text) \ 225 *(.text) \
225 *(.ref.text) \ 226 *(.ref.text) \
226 *(.text.init.refok) \ 227 *(.text.init.refok) \
@@ -230,7 +231,8 @@
230 CPU_KEEP(init.text) \ 231 CPU_KEEP(init.text) \
231 CPU_KEEP(exit.text) \ 232 CPU_KEEP(exit.text) \
232 MEM_KEEP(init.text) \ 233 MEM_KEEP(init.text) \
233 MEM_KEEP(exit.text) 234 MEM_KEEP(exit.text) \
235 *(.text.unlikely)
234 236
235 237
236/* sched.text is aling to function alignment to secure we have same 238/* sched.text is aling to function alignment to secure we have same
diff --git a/init/Kconfig b/init/Kconfig
index a50bdfed2df7..43d6989c275f 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -171,7 +171,7 @@ config BSD_PROCESS_ACCT_V3
171 process and it's parent. Note that this file format is incompatible 171 process and it's parent. Note that this file format is incompatible
172 with previous v0/v1/v2 file formats, so you will need updated tools 172 with previous v0/v1/v2 file formats, so you will need updated tools
173 for processing it. A preliminary version of these tools is available 173 for processing it. A preliminary version of these tools is available
174 at <http://www.physik3.uni-rostock.de/tim/kernel/utils/acct/>. 174 at <http://www.gnu.org/software/acct/>.
175 175
176config TASKSTATS 176config TASKSTATS
177 bool "Export task/process statistics through netlink (EXPERIMENTAL)" 177 bool "Export task/process statistics through netlink (EXPERIMENTAL)"
@@ -486,7 +486,7 @@ config PID_NS
486 default n 486 default n
487 depends on NAMESPACES && EXPERIMENTAL 487 depends on NAMESPACES && EXPERIMENTAL
488 help 488 help
489 Suport process id namespaces. This allows having multiple 489 Support process id namespaces. This allows having multiple
490 process with the same pid as long as they are in different 490 process with the same pid as long as they are in different
491 pid namespaces. This is a building block of containers. 491 pid namespaces. This is a building block of containers.
492 492
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
10UNIFDEF := 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
13HDRSED := 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
26ifeq (,$(patsubst include/asm/%,,$(obj)/)) 14kbuild-file := $(srctree)/$(obj)/Kbuild
27# For producing the generated stuff in include/asm for biarch builds, include 15include $(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...).
32GENASM := 1
33archasm := $(subst include/asm,asm-$(ARCH),$(obj))
34altarchasm := $(subst include/asm,asm-$(ALTARCH),$(obj))
35KBUILDFILES := $(wildcard $(srctree)/include/$(archasm)/Kbuild $(srctree)/include/$(altarchasm)/Kbuild)
36else
37KBUILDFILES := $(srctree)/$(obj)/Kbuild
38endif
39 16
40include $(KBUILDFILES) 17include scripts/Kbuild.include
41 18
42include scripts/Kbuild.include 19install := $(INSTALL_HDR_PATH)/$(_dst)
43 20
44# If this is include/asm-$(ARCH) and there's no $(ALTARCH), then 21header-y := $(sort $(header-y) $(unifdef-y))
45# override $(_dst) so that we install to include/asm directly. 22subdirs := $(patsubst %/,%,$(filter %/, $(header-y)))
46# Unless $(BIASMDIR) is set, in which case we're probably doing 23header-y := $(filter-out %/, $(header-y))
47# a 'headers_install_all' build and we should keep the -$(ARCH)
48# in the directory name.
49ifeq ($(obj)$(ALTARCH),include/asm-$(ARCH)$(BIASMDIR))
50 _dst := include/asm
51endif
52 24
53header-y := $(sort $(header-y)) 25# files used to track state of install/check
54unifdef-y := $(sort $(unifdef-y)) 26install-file := $(install)/.install
55subdir-y := $(patsubst %/,%,$(filter %/, $(header-y))) 27check-file := $(install)/.check
56header-y := $(filter-out %/, $(header-y))
57header-y := $(filter-out $(unifdef-y),$(header-y))
58 28
59# stamp files for header checks 29# all headers files for this dir
60check-y := $(patsubst %,.check.%,$(header-y) $(unifdef-y) $(objhdr-y)) 30all-files := $(header-y) $(objhdr-y)
31input-files := $(addprefix $(srctree)/$(obj)/,$(header-y)) \
32 $(addprefix $(objtree)/$(obj)/,$(objhdr-y))
33output-files := $(addprefix $(install)/, $(all-files))
61 34
62# Work out what needs to be removed 35# Work out what needs to be removed
63oldheaders := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/*.h)) 36oldheaders := $(patsubst $(install)/%,%,$(wildcard $(install)/*.h))
64unwanted := $(filter-out $(header-y) $(unifdef-y) $(objhdr-y),$(oldheaders)) 37unwanted := $(filter-out $(all-files),$(oldheaders))
65 38
66oldcheckstamps := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/.check.*.h)) 39# Prefix unwanted with full paths to $(INSTALL_HDR_PATH)
67unwanted += $(filter-out $(check-y),$(oldcheckstamps)) 40unwanted-file := $(addprefix $(install)/, $(unwanted))
68 41
69# Prefix them all with full paths to $(INSTALL_HDR_PATH) 42printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
70header-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(header-y))
71unifdef-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(unifdef-y))
72objhdr-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(objhdr-y))
73check-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(check-y))
74 43
44quiet_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
76ifdef ALTARCH 51quiet_cmd_remove = REMOVE $(unwanted)
77ifeq ($(obj),include/asm-$(ARCH)) 52 cmd_remove = rm -f $(unwanted-file)
78altarch-y := altarch-dir
79endif
80endif
81 53
82# Make the definitions visible for recursive make invocations 54quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files)
83export ALTARCH 55 cmd_check = $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH) \
84export ARCHDEF 56 $(addprefix $(install)/, $(all-files)); \
85export ALTARCHDEF 57 touch $@
86
87quiet_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
91quiet_cmd_headers_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
92 cmd_headers_install = $(HDRSED) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \
93 > $@
94
95quiet_cmd_unifdef = UNIFDEF $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
96 cmd_unifdef = $(UNIFDEF) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \
97 | $(HDRSED) > $@ || :
98
99quiet_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
103quiet_cmd_remove = REMOVE $(_dst)/$@
104 cmd_remove = rm -f $(INSTALL_HDR_PATH)/$(_dst)/$@
105
106quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
107 cmd_mkdir = mkdir -p $@
108
109quiet_cmd_gen = GEN $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
110 cmd_gen = \
111FNAME=$(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$@); \
112STUBDEF=__ASM_STUB_`echo $$FNAME | tr a-z.- A-Z__`; \
113(echo "/* File autogenerated by 'make headers_install' */" ; \
114echo "\#ifndef $$STUBDEF" ; \
115echo "\#define $$STUBDEF" ; \
116echo "\# if $(ARCHDEF)" ; \
117if [ -r $(subst /$(_dst)/,/include/$(archasm)/,$@) ]; then \
118 echo "\# include <$(archasm)/$$FNAME>" ; \
119else \
120 echo "\# error $(archasm)/$$FNAME does not exist in" \
121 "the $(ARCH) architecture" ; \
122fi ; \
123echo "\# elif $(ALTARCHDEF)" ; \
124if [ -r $(subst /$(_dst)/,/include/$(altarchasm)/,$@) ]; then \
125 echo "\# include <$(altarchasm)/$$FNAME>" ; \
126else \
127 echo "\# error $(altarchasm)/$$FNAME does not exist in" \
128 "the $(ALTARCH) architecture" ; \
129fi ; \
130echo "\# else" ; \
131echo "\# warning This machine appears to be" \
132 "neither $(ARCH) nor $(ALTARCH)." ; \
133echo "\# endif" ; \
134echo "\#endif /* $$STUBDEF */" ; \
135) > $@
136
137.PHONY: __headersinst __headerscheck
138
139ifdef 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)
147include /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
152else 59PHONY += __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) 61ifndef 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
166ifdef GENASM 66targets += $(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
170else 72else
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) 76targets += $(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)
179endif
180endif 80endif
181 81
182hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj 82# Recursion
83hdr-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 88targets := $(wildcard $(sort $(targets)))
185# All the files in the normal arch dir must be created first, since we test 89cmd_files := $(wildcard \
186# for their existence. 90 $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
187altarch-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 92ifneq ($(cmd_files),)
192.PHONY: $(subdir-y) 93 include $(cmd_files)
193$(subdir-y): 94endif
194 $(Q)$(MAKE) $(hdrinst)=$(obj)/$@ dst=$(_dst)/$@ rel=../$(rel) 95
96.PHONY: $(PHONY)
97PHONY += FORCE
98FORCE: ;
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
10import sys, os
11
12def usage():
13 print """Usage: diffconfig [-h] [-m] [<config1> <config2>]
14
15Diffconfig is a simple utility for comparing two .config files.
16Using standard diff to compare .config files often includes extraneous and
17distracting information. This utility produces sorted output with only the
18changes in configuration values between the two files.
19
20Added and removed items are shown with a leading plus or minus, respectively.
21Changed items show the old and new values on a single line.
22
23If -m is specified, then output will be in "merge" style, which has the
24changed and new values in kernel config option format.
25
26If no config files are specified, .config and .config.old are used.
27
28Example 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
40def 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
51def 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
68def 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
129main()
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
3for 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
8done
9# FIXME: List dependencies into $3
10touch $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
5set -e
6
7do_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
19drop="generic um ppc sparc64 cris"
20
21archs=$(ls ${srctree}/arch)
22
23for 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
39done
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
19use strict;
20use warnings;
21
22my ($dir, $arch, @files) = @ARGV;
23
24my $ret = 0;
25my $line;
26my $lineno = 0;
27my $filename;
28
29foreach 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}
39exit $ret;
40
41sub 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
19use strict;
20use warnings;
21
22my ($readdir, $installdir, $arch, @files) = @ARGV;
23
24my $unifdef = "scripts/unifdef -U__KERNEL__";
25
26foreach 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}
45exit 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)
76static int conf_askvalue(struct symbol *sym, const char *def) 76static 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
430static 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
439static 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
455static 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
497int main(int ac, char **av) 467int 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 }
627skip_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
817void 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
45enum 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);
69char *conf_get_default_confname(void); 77char *conf_get_default_confname(void);
70void sym_set_change_count(int count); 78void sym_set_change_count(int count);
71void sym_add_change_count(int count); 79void sym_add_change_count(int count);
80void conf_set_all_new_symbols(enum conf_def_mode mode);
72 81
73/* kconfig_load.c */ 82/* kconfig_load.c */
74void kconfig_load(void); 83void 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
12if head=`git rev-parse --verify HEAD 2>/dev/null`; then 12if 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?