From 987d0c8e9ded8d43843d602b6ab890d14745690f Mon Sep 17 00:00:00 2001 From: Kirill Tkhai Date: Sat, 23 Mar 2013 14:58:20 +0400 Subject: scripts/tags.sh: Add magic for OFFSET and DEFINE Add rules for definitions which is generally used in asm-offsets files. Signed-off-by: Kirill V Tkhai CC: Michal Marek CC: Andrew Morton Signed-off-by: Michal Marek --- scripts/tags.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts') 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() --regex-c='/DEFINE_PER_CPU_SHARED_ALIGNED\(([^,]*,\s*)(\w*).*\)/\2/v/' \ --regex-c='/DECLARE_WAIT_QUEUE_HEAD\((\w*)/\1/v/' \ --regex-c='/DECLARE_(TASKLET|WORK|DELAYED_WORK)\((\w*)/\2/v/' \ - --regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/' + --regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/' \ + --regex-c='/(^\s)OFFSET\((\w*)/\2/v/' \ + --regex-c='/(^\s)DEFINE\((\w*)/\2/v/' all_kconfigs | xargs $1 -a \ --langdef=kconfig --language-force=kconfig \ -- cgit v1.2.3 From 4c6e00cffcd478a369b6fd0ba61f5b0f9643ff43 Mon Sep 17 00:00:00 2001 From: Bin Wang Date: Mon, 25 Feb 2013 11:05:24 +0800 Subject: scripts/package/Makefile: compare objtree with srctree instead of test KBUILD_OUTPUT KBUILD_OUTPUT is always empty here, so it is useless to test it. But while use O=.., objtree and srctree will be different. I compare them instead. Signed-off-by: Bin Wang Signed-off-by: Michal Marek --- scripts/package/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 87bf08076b11..d7b328595a7e 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -36,7 +36,7 @@ $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile $(CONFIG_SHELL) $(MKSPEC) > $@ rpm-pkg rpm: $(objtree)/kernel.spec FORCE - @if test -n "$(KBUILD_OUTPUT)"; then \ + @if test "$(objtree)" != "$(srctree)"; then \ echo "Building source + binary RPM is not possible outside the"; \ echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \ echo "binrpm-pkg target instead."; \ -- cgit v1.2.3 From 35d88a38710583f3b5afc3255d7bc190a50e1af7 Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Sat, 2 Mar 2013 22:36:25 +0100 Subject: Coccinelle: Restore coccicheck verbosity in ONLINE mode (C=1 or C=2) A recent patch have introduce the VERBOSE variable and comments now depend on it. However, the message printed for each cocci file such not be printed when the ONLINE mode is active, whatever is the value of VERBOSE. Signed-off-by: Nicolas Palix Signed-off-by: Michal Marek --- scripts/coccicheck | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/coccicheck b/scripts/coccicheck index 85d31899ad98..7f0d6a6c5000 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck @@ -72,7 +72,7 @@ coccinelle () { # # $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null - if [ $VERBOSE -ne 0 ] ; then + if [ $VERBOSE -ne 0 -a $ONLINE -eq 0 ] ; then FILE=`echo $COCCI | sed "s|$srctree/||"` -- cgit v1.2.3 From 9e395550779efa07ee00809a041534b9641fb7a7 Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Sat, 2 Mar 2013 22:36:26 +0100 Subject: Coccinelle: Cleanup the setting of the FLAGS and OPTIONS variables The FLAGS variable is factorized independently of the ONLINE mode. The OPTIONS variable is now based on LINUXINCLUDE and explicit includes are thus removed. The format of the -I option differs between gcc and spatch. The COCCIINCLUDE is used to adapt the format. This rewritting needs bash. Signed-off-by: Nicolas Palix Signed-off-by: Michal Marek --- scripts/coccicheck | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'scripts') diff --git a/scripts/coccicheck b/scripts/coccicheck index 7f0d6a6c5000..cdde8e0670aa 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash SPATCH="`which ${SPATCH:=spatch}`" @@ -11,24 +11,25 @@ else VERBOSE=0 fi +FLAGS="-very_quiet" + +# spatch only allows include directories with the syntax "-I include" +# while gcc also allows "-Iinclude" and "-include include" +COCCIINCLUDE=${LINUXINCLUDE//-I/-I } +COCCIINCLUDE=${COCCIINCLUDE//-include/-I} + if [ "$C" = "1" -o "$C" = "2" ]; then ONLINE=1 -# This requires Coccinelle >= 0.2.3 -# FLAGS="-ignore_unknown_options -very_quiet" -# OPTIONS=$* - -# Workaround for Coccinelle < 0.2.3 - FLAGS="-I $srctree/include -very_quiet" - shift $(( $# - 1 )) - OPTIONS=$1 + # Take only the last argument, which is the C file to test + shift $(( $# - 1 )) + OPTIONS="$COCCIINCLUDE $1" else ONLINE=0 - FLAGS="-very_quiet" if [ "$KBUILD_EXTMOD" = "" ] ; then - OPTIONS="-dir $srctree" + OPTIONS="-dir $srctree $COCCIINCLUDE" else - OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree -I $srctree/include -I $KBUILD_EXTMOD/include" + OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree $COCCIINCLUDE" fi fi -- cgit v1.2.3 From ed621cc4a5f6fd41cf02b2408273474d46ac4cac Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Sat, 2 Mar 2013 22:36:27 +0100 Subject: Coccinelle: Add support to the SPFLAGS variable The SPFLAGS variable allows to pass additional options to spatch, e.g. -use_glimpse. Signed-off-by: Nicolas Palix Signed-off-by: Michal Marek --- scripts/coccicheck | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/coccicheck b/scripts/coccicheck index cdde8e0670aa..6d492c096ade 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck @@ -11,7 +11,7 @@ else VERBOSE=0 fi -FLAGS="-very_quiet" +FLAGS="$SPFLAGS -very_quiet" # spatch only allows include directories with the syntax "-I include" # while gcc also allows "-Iinclude" and "-include include" -- cgit v1.2.3 From bad6a4092e7f87c5310ff342bc0d766a44bcf8fa Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Sat, 2 Mar 2013 22:36:28 +0100 Subject: Coccinelle: Fix patch output when coccicheck is used with M= and C= When the M variable is used, the -patch option should be given to spatch. This patch fixes the case where C is used. Signed-off-by: Nicolas Palix Signed-off-by: Michal Marek --- scripts/coccicheck | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/coccicheck b/scripts/coccicheck index 6d492c096ade..06fcb3333247 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck @@ -29,10 +29,14 @@ else if [ "$KBUILD_EXTMOD" = "" ] ; then OPTIONS="-dir $srctree $COCCIINCLUDE" else - OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree $COCCIINCLUDE" + OPTIONS="-dir $KBUILD_EXTMOD $COCCIINCLUDE" fi fi +if [ "$KBUILD_EXTMOD" != "" ] ; then + OPTIONS="-patch $srctree $OPTIONS" +fi + if [ ! -x "$SPATCH" ]; then echo 'spatch is part of the Coccinelle project and is available at http://coccinelle.lip6.fr/' exit 1 -- cgit v1.2.3 From 6bc6c9409de03987736df58c411c3aa7b5aed051 Mon Sep 17 00:00:00 2001 From: Borislav Petkov Date: Wed, 6 Mar 2013 09:05:47 +0100 Subject: buildtar: Add ARCH to the archive name When dealing with multiple sub-arches (like 32- and 64-bit on x86, for example) generating a bunch of kernel tar archives with the same name but for different sub-arches could get confusing and error-prone. Also, the build process could overwrite otherwise unrelated builds and you probably don't want that. So, add the architecture to the archive name for more clarity and less shoot-yourself-in-the-foot practices. Signed-off-by: Borislav Petkov Signed-off-by: Michal Marek --- scripts/package/buildtar | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') 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 # Some variables and settings used throughout the script # tmpdir="${objtree}/tar-install" -tarball="${objtree}/linux-${KERNELRELEASE}.tar" +tarball="${objtree}/linux-${KERNELRELEASE}-${ARCH}.tar" # -- cgit v1.2.3 From 6615d6c322a364be45324f553db57545a3b2e95f Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Fri, 12 Apr 2013 14:12:50 +0200 Subject: rpm-pkg: Do not package the whole source directory The source tree can contain lots of uninteresting data like tag or cscope files, packaging which slows down make rpm needlessly. It can also break the build, if the tree contains an unrelated file named *.spec. The downside of this change is that new subdirectories have to be added to the KBUILD_ALLDIRS variable in the top-level Makefile. The upside is that the behavior is more predictable. Signed-off-by: Michal Marek --- scripts/package/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/package/Makefile b/scripts/package/Makefile index d7b328595a7e..b70b33e67f34 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -27,6 +27,10 @@ RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ # Remove hyphens since they have special meaning in RPM filenames KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE)) +# Include only those top-level files that are needed by make, plus the GPL copy +TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \ + Kbuild Kconfig COPYING $(wildcard localversion*) +TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT)) MKSPEC := $(srctree)/scripts/package/mkspec PREV := set -e; cd -P ..; @@ -45,7 +49,7 @@ rpm-pkg rpm: $(objtree)/kernel.spec FORCE $(MAKE) clean $(PREV) ln -sf $(srctree) $(KERNELPATH) $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion - $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. + $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(TAR_CONTENT) $(PREV) rm $(KERNELPATH) rm -f $(objtree)/.scmversion set -e; \ -- cgit v1.2.3 From 403d3cc47307c78597d75e420f091cf4a2e7a56a Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Fri, 12 Apr 2013 14:22:46 +0200 Subject: rpm-pkg: Do not write to the parent directory Now that we only package explicitly listed files to the tarball, there is no need to abuse the parent directory. Signed-off-by: Michal Marek --- scripts/package/Makefile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/package/Makefile b/scripts/package/Makefile index b70b33e67f34..ab203c29991a 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -32,7 +32,6 @@ TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \ Kbuild Kconfig COPYING $(wildcard localversion*) TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT)) MKSPEC := $(srctree)/scripts/package/mkspec -PREV := set -e; cd -P ..; # rpm-pkg # --------------------------------------------------------------------------- @@ -47,18 +46,17 @@ rpm-pkg rpm: $(objtree)/kernel.spec FORCE false; \ fi $(MAKE) clean - $(PREV) ln -sf $(srctree) $(KERNELPATH) + ln -sf $(srctree) $(KERNELPATH) $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion - $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(TAR_CONTENT) - $(PREV) rm $(KERNELPATH) + tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(TAR_CONTENT) + rm $(KERNELPATH) rm -f $(objtree)/.scmversion set -e; \ $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version set -e; \ mv -f $(objtree)/.tmp_version $(objtree)/.version - - $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz - rm ../$(KERNELPATH).tar.gz + $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz + rm $(KERNELPATH).tar.gz clean-files := $(objtree)/kernel.spec -- cgit v1.2.3 From 6501320311664e11ad5489fedb17ea1f817c2617 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Sat, 13 Apr 2013 21:21:15 +0200 Subject: rpm-pkg: Always regenerate the specfile The *pkg targets are always run, so it makes no sense to cache the generated specfile. This also fixes build errors when the specfile becomes out of date, without the Makefile noticing it: $ make rpm works $ echo yadadada >localversion-test $ make rpm fails, because kernel.spec assumes the old kernel release string Signed-off-by: Michal Marek --- scripts/package/Makefile | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'scripts') diff --git a/scripts/package/Makefile b/scripts/package/Makefile index ab203c29991a..08e4e2fdf8c0 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -35,10 +35,7 @@ MKSPEC := $(srctree)/scripts/package/mkspec # rpm-pkg # --------------------------------------------------------------------------- -$(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile - $(CONFIG_SHELL) $(MKSPEC) > $@ - -rpm-pkg rpm: $(objtree)/kernel.spec FORCE +rpm-pkg rpm: FORCE @if test "$(objtree)" != "$(srctree)"; then \ echo "Building source + binary RPM is not possible outside the"; \ echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \ @@ -47,6 +44,7 @@ rpm-pkg rpm: $(objtree)/kernel.spec FORCE fi $(MAKE) clean ln -sf $(srctree) $(KERNELPATH) + $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(TAR_CONTENT) rm $(KERNELPATH) @@ -56,17 +54,13 @@ rpm-pkg rpm: $(objtree)/kernel.spec FORCE set -e; \ mv -f $(objtree)/.tmp_version $(objtree)/.version $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz - rm $(KERNELPATH).tar.gz - -clean-files := $(objtree)/kernel.spec + rm $(KERNELPATH).tar.gz kernel.spec # binrpm-pkg # --------------------------------------------------------------------------- -$(objtree)/binkernel.spec: $(MKSPEC) $(srctree)/Makefile - $(CONFIG_SHELL) $(MKSPEC) prebuilt > $@ - -binrpm-pkg: $(objtree)/binkernel.spec FORCE +binrpm-pkg: FORCE $(MAKE) KBUILD_SRC= + $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec set -e; \ $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version set -e; \ @@ -74,8 +68,7 @@ binrpm-pkg: $(objtree)/binkernel.spec FORCE $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \ $(UTS_MACHINE) -bb $< - -clean-files += $(objtree)/binkernel.spec + rm binkernel.spec # Deb target # --------------------------------------------------------------------------- -- cgit v1.2.3 From a0f9c6f202962d4ca8150730e55bc34021dfebcc Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Mon, 15 Apr 2013 22:13:08 +0200 Subject: rpm-pkg: Remove pointless set -e statements Signed-off-by: Michal Marek --- scripts/package/Makefile | 4 ---- 1 file changed, 4 deletions(-) (limited to 'scripts') diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 08e4e2fdf8c0..84a406070f6f 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -49,9 +49,7 @@ rpm-pkg rpm: FORCE tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(TAR_CONTENT) rm $(KERNELPATH) rm -f $(objtree)/.scmversion - set -e; \ $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version - set -e; \ mv -f $(objtree)/.tmp_version $(objtree)/.version $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz rm $(KERNELPATH).tar.gz kernel.spec @@ -61,9 +59,7 @@ rpm-pkg rpm: FORCE binrpm-pkg: FORCE $(MAKE) KBUILD_SRC= $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec - set -e; \ $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version - set -e; \ mv -f $(objtree)/.tmp_version $(objtree)/.version $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \ -- cgit v1.2.3