aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/coccinelle.txt11
-rw-r--r--Documentation/kbuild/makefiles.txt5
-rw-r--r--Makefile2
-rwxr-xr-xscripts/coccicheck31
-rw-r--r--scripts/package/Makefile39
-rw-r--r--scripts/package/buildtar2
-rwxr-xr-xscripts/tags.sh4
7 files changed, 52 insertions, 42 deletions
diff --git a/Documentation/coccinelle.txt b/Documentation/coccinelle.txt
index dffa2d620d6d..18de78599dd4 100644
--- a/Documentation/coccinelle.txt
+++ b/Documentation/coccinelle.txt
@@ -114,7 +114,7 @@ To apply Coccinelle to a specific directory, M= can be used.
114For example, to check drivers/net/wireless/ one may write: 114For example, to check drivers/net/wireless/ one may write:
115 115
116 make coccicheck M=drivers/net/wireless/ 116 make coccicheck M=drivers/net/wireless/
117 117
118To apply Coccinelle on a file basis, instead of a directory basis, the 118To apply Coccinelle on a file basis, instead of a directory basis, the
119following command may be used: 119following command may be used:
120 120
@@ -134,6 +134,15 @@ MODE variable explained above.
134In this mode, there is no information about semantic patches 134In this mode, there is no information about semantic patches
135displayed, and no commit message proposed. 135displayed, and no commit message proposed.
136 136
137 Additional flags
138~~~~~~~~~~~~~~~~~~
139
140Additional flags can be passed to spatch through the SPFLAGS
141variable.
142
143 make SPFLAGS=--use_glimpse coccicheck
144
145See spatch --help to learn more about spatch options.
137 146
138 Proposing new semantic patches 147 Proposing new semantic patches
139~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index 5836294fdbf7..d567a7cc552b 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -921,8 +921,9 @@ When kbuild executes, the following steps are followed (roughly):
921 Often, the KBUILD_CFLAGS variable depends on the configuration. 921 Often, the KBUILD_CFLAGS variable depends on the configuration.
922 922
923 Example: 923 Example:
924 #arch/x86/Makefile 924 #arch/x86/boot/compressed/Makefile
925 cflags-$(CONFIG_M386) += -march=i386 925 cflags-$(CONFIG_X86_32) := -march=i386
926 cflags-$(CONFIG_X86_64) := -mcmodel=small
926 KBUILD_CFLAGS += $(cflags-y) 927 KBUILD_CFLAGS += $(cflags-y)
927 928
928 Many arch Makefiles dynamically run the target C compiler to 929 Many arch Makefiles dynamically run the target C compiler to
diff --git a/Makefile b/Makefile
index 878d7aa3d2dd..a3a834b11a97 100644
--- a/Makefile
+++ b/Makefile
@@ -757,6 +757,8 @@ export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)
757export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y) 757export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y)
758export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds 758export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
759export LDFLAGS_vmlinux 759export LDFLAGS_vmlinux
760# used by scripts/pacmage/Makefile
761export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools virt)
760 762
761vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) 763vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN)
762 764
diff --git a/scripts/coccicheck b/scripts/coccicheck
index 85d31899ad98..06fcb3333247 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -1,4 +1,4 @@
1#!/bin/sh 1#!/bin/bash
2 2
3SPATCH="`which ${SPATCH:=spatch}`" 3SPATCH="`which ${SPATCH:=spatch}`"
4 4
@@ -11,27 +11,32 @@ else
11 VERBOSE=0 11 VERBOSE=0
12fi 12fi
13 13
14FLAGS="$SPFLAGS -very_quiet"
15
16# spatch only allows include directories with the syntax "-I include"
17# while gcc also allows "-Iinclude" and "-include include"
18COCCIINCLUDE=${LINUXINCLUDE//-I/-I }
19COCCIINCLUDE=${COCCIINCLUDE//-include/-I}
20
14if [ "$C" = "1" -o "$C" = "2" ]; then 21if [ "$C" = "1" -o "$C" = "2" ]; then
15 ONLINE=1 22 ONLINE=1
16 23
17# This requires Coccinelle >= 0.2.3 24 # Take only the last argument, which is the C file to test
18# FLAGS="-ignore_unknown_options -very_quiet" 25 shift $(( $# - 1 ))
19# OPTIONS=$* 26 OPTIONS="$COCCIINCLUDE $1"
20
21# Workaround for Coccinelle < 0.2.3
22 FLAGS="-I $srctree/include -very_quiet"
23 shift $(( $# - 1 ))
24 OPTIONS=$1
25else 27else
26 ONLINE=0 28 ONLINE=0
27 FLAGS="-very_quiet"
28 if [ "$KBUILD_EXTMOD" = "" ] ; then 29 if [ "$KBUILD_EXTMOD" = "" ] ; then
29 OPTIONS="-dir $srctree" 30 OPTIONS="-dir $srctree $COCCIINCLUDE"
30 else 31 else
31 OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree -I $srctree/include -I $KBUILD_EXTMOD/include" 32 OPTIONS="-dir $KBUILD_EXTMOD $COCCIINCLUDE"
32 fi 33 fi
33fi 34fi
34 35
36if [ "$KBUILD_EXTMOD" != "" ] ; then
37 OPTIONS="-patch $srctree $OPTIONS"
38fi
39
35if [ ! -x "$SPATCH" ]; then 40if [ ! -x "$SPATCH" ]; then
36 echo 'spatch is part of the Coccinelle project and is available at http://coccinelle.lip6.fr/' 41 echo 'spatch is part of the Coccinelle project and is available at http://coccinelle.lip6.fr/'
37 exit 1 42 exit 1
@@ -72,7 +77,7 @@ coccinelle () {
72# 77#
73# $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null 78# $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null
74 79
75 if [ $VERBOSE -ne 0 ] ; then 80 if [ $VERBOSE -ne 0 -a $ONLINE -eq 0 ] ; then
76 81
77 FILE=`echo $COCCI | sed "s|$srctree/||"` 82 FILE=`echo $COCCI | sed "s|$srctree/||"`
78 83
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 87bf08076b11..84a406070f6f 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -27,53 +27,44 @@ RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
27 27
28# Remove hyphens since they have special meaning in RPM filenames 28# Remove hyphens since they have special meaning in RPM filenames
29KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE)) 29KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
30# Include only those top-level files that are needed by make, plus the GPL copy
31TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \
32 Kbuild Kconfig COPYING $(wildcard localversion*)
33TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT))
30MKSPEC := $(srctree)/scripts/package/mkspec 34MKSPEC := $(srctree)/scripts/package/mkspec
31PREV := set -e; cd -P ..;
32 35
33# rpm-pkg 36# rpm-pkg
34# --------------------------------------------------------------------------- 37# ---------------------------------------------------------------------------
35$(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile 38rpm-pkg rpm: FORCE
36 $(CONFIG_SHELL) $(MKSPEC) > $@ 39 @if test "$(objtree)" != "$(srctree)"; then \
37
38rpm-pkg rpm: $(objtree)/kernel.spec FORCE
39 @if test -n "$(KBUILD_OUTPUT)"; then \
40 echo "Building source + binary RPM is not possible outside the"; \ 40 echo "Building source + binary RPM is not possible outside the"; \
41 echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \ 41 echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
42 echo "binrpm-pkg target instead."; \ 42 echo "binrpm-pkg target instead."; \
43 false; \ 43 false; \
44 fi 44 fi
45 $(MAKE) clean 45 $(MAKE) clean
46 $(PREV) ln -sf $(srctree) $(KERNELPATH) 46 ln -sf $(srctree) $(KERNELPATH)
47 $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
47 $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion 48 $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion
48 $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. 49 tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(TAR_CONTENT)
49 $(PREV) rm $(KERNELPATH) 50 rm $(KERNELPATH)
50 rm -f $(objtree)/.scmversion 51 rm -f $(objtree)/.scmversion
51 set -e; \
52 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version 52 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
53 set -e; \
54 mv -f $(objtree)/.tmp_version $(objtree)/.version 53 mv -f $(objtree)/.tmp_version $(objtree)/.version
55 54 $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz
56 $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz 55 rm $(KERNELPATH).tar.gz kernel.spec
57 rm ../$(KERNELPATH).tar.gz
58
59clean-files := $(objtree)/kernel.spec
60 56
61# binrpm-pkg 57# binrpm-pkg
62# --------------------------------------------------------------------------- 58# ---------------------------------------------------------------------------
63$(objtree)/binkernel.spec: $(MKSPEC) $(srctree)/Makefile 59binrpm-pkg: FORCE
64 $(CONFIG_SHELL) $(MKSPEC) prebuilt > $@
65
66binrpm-pkg: $(objtree)/binkernel.spec FORCE
67 $(MAKE) KBUILD_SRC= 60 $(MAKE) KBUILD_SRC=
68 set -e; \ 61 $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec
69 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version 62 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
70 set -e; \
71 mv -f $(objtree)/.tmp_version $(objtree)/.version 63 mv -f $(objtree)/.tmp_version $(objtree)/.version
72 64
73 $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \ 65 $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \
74 $(UTS_MACHINE) -bb $< 66 $(UTS_MACHINE) -bb $<
75 67 rm binkernel.spec
76clean-files += $(objtree)/binkernel.spec
77 68
78# Deb target 69# Deb target
79# --------------------------------------------------------------------------- 70# ---------------------------------------------------------------------------
diff --git a/scripts/package/buildtar b/scripts/package/buildtar
index 62d8234f8787..cdd9bb909bcd 100644
--- a/scripts/package/buildtar
+++ b/scripts/package/buildtar
@@ -16,7 +16,7 @@ set -e
16# Some variables and settings used throughout the script 16# Some variables and settings used throughout the script
17# 17#
18tmpdir="${objtree}/tar-install" 18tmpdir="${objtree}/tar-install"
19tarball="${objtree}/linux-${KERNELRELEASE}.tar" 19tarball="${objtree}/linux-${KERNELRELEASE}-${ARCH}.tar"
20 20
21 21
22# 22#
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 26a87e68afed..74f02e4dddd2 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -199,7 +199,9 @@ exuberant()
199 --regex-c='/DEFINE_PER_CPU_SHARED_ALIGNED\(([^,]*,\s*)(\w*).*\)/\2/v/' \ 199 --regex-c='/DEFINE_PER_CPU_SHARED_ALIGNED\(([^,]*,\s*)(\w*).*\)/\2/v/' \
200 --regex-c='/DECLARE_WAIT_QUEUE_HEAD\((\w*)/\1/v/' \ 200 --regex-c='/DECLARE_WAIT_QUEUE_HEAD\((\w*)/\1/v/' \
201 --regex-c='/DECLARE_(TASKLET|WORK|DELAYED_WORK)\((\w*)/\2/v/' \ 201 --regex-c='/DECLARE_(TASKLET|WORK|DELAYED_WORK)\((\w*)/\2/v/' \
202 --regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/' 202 --regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/' \
203 --regex-c='/(^\s)OFFSET\((\w*)/\2/v/' \
204 --regex-c='/(^\s)DEFINE\((\w*)/\2/v/'
203 205
204 all_kconfigs | xargs $1 -a \ 206 all_kconfigs | xargs $1 -a \
205 --langdef=kconfig --language-force=kconfig \ 207 --langdef=kconfig --language-force=kconfig \