.gitignore: ignore Module.symvers in all directories

When using `make M=/path/to/driver modules` to build a module, file
Module.symvers will be created in that directory, so it's better to
ignore it in all directories.

Slightly reordered, let specific file names behind general ones.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Kyungsik Lee <kyungsik.lee@lge.com>
Cc: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/tags.sh: add pattern for DEFINE_HASHTABLE

Signed-off-by: Jianyu Zhan <nasa4836@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: move extra gcc checks to scripts/Makefile.extrawarn

W=... provides extra gcc checks.

Having such code in scripts/Makefile.build results in the same flags
being added to KBUILD_CFLAGS multiple times becuase
scripts/Makefile.build is invoked every time Kbuild descends into
the subdirectories.

Since the top Makefile is already too cluttered, this commit moves
all of extra gcc check stuff to a new file scripts/Makefile.extrawarn,
which is included from the top Makefile.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
CC: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/tags.sh: ignore code of user space tools

User space code in tools/ often reuses names of kernel constructions,
this confuses navigation in the normal kernel code. Let's fix this mess.

Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
builddeb: use $OBJCOPY variable instead of objcopy

In cross-build environment, we expect to use the cross-compiler objcopy
instead of the host objcopy.

It fixes following build failures:
objcopy --only-keep-debug lib/modules/3.14/kernel/net/ipv6/xfrm6_mode_tunnel.ko /srv/build/linux/debian/dbgtmp/usr/lib/debug/lib/modules/3.14/kernel/net/ipv6/xfrm6_mode_tunnel.ko
objcopy: Unable to recognise the format of the input file `lib/modules/3.14/kernel/net/ipv6/xfrm6_mode_tunnel.ko'

Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
Cc: stable <stable@vger.kernel.org> # 3.12+
Fixes: 810e843746b7 ('deb-pkg: split debug symbols in their own package')
Reviewed-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Michal Marek <mmarek@suse.cz>
builddeb: add arm64 in the supported architectures

Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
Reviewed-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: support simultaneous "make %config" and "make all"

Kbuild is supposed to support mixed targets. (%config and build targets)

But "make all" did nothing if it was run with configuration targets.
For example,

  $ LANG=C make defconfig all
    HOSTCC  scripts/basic/fixdep
    HOSTCC  scripts/kconfig/conf.o
    SHIPPED scripts/kconfig/zconf.tab.c
    SHIPPED scripts/kconfig/zconf.lex.c
    SHIPPED scripts/kconfig/zconf.hash.c
    HOSTCC  scripts/kconfig/zconf.tab.o
    HOSTLD  scripts/kconfig/conf
  *** Default configuration is based on 'x86_64_defconfig'
  #
  # configuration written to .config
  #
  make: Nothing to be done for `all'.

This commits allows "make %config all" and makes sure
mixed targets are built one by one in the given order.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Michal Marek <mmarek@suse.cz>
CC: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: trivial - remove trailing spaces

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: trivial - fix comment block indent

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/tags.sh: add regular expression replacement pattern for memcg

Currently, while using ctags to read code, we would get stumbled on
PageCgroup* symbols: no definition found. And it is quite dull to
manually dig it out.

This patch adds regular expression replacement pattern for such symbols,
like what have done for the PageXXX flag. It will teach ctags to find
out the definition for us.

Signed-off-by: Jianyu Zhan <nasa4836@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
firmware: Simplify directory creation

When building the firmware blobs, use a simple loop to create
directories in $(objtree), like in Makefile.build. This simplifies the
rules and also makes it possible to set $(objtree) to '.' later. Before
this change, a dependency on $(objtree)/<dir> would be satisfied by
<dir> in $(srctree).

When installing the firmware blobs, call mkdir like in Makefile.modinst.

Cc: David Woodhouse <dwmw2@infradead.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
firmware: Use $(quote) in the Makefile

The literal " confuses syntax highlighting in vim.

Cc: David Woodhouse <dwmw2@infradead.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: Use relative path for $(objtree)

The main Makefile sets its working directory to the object tree and
never changes it again. Therefore, we can use '.' instead of the
absolute path. The only case where we need the absolute path is when
creating the 'build' symlink in /lib/modules.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: Use relative path when building in the source tree

When not using O=, $(srctree) refers to the same directory as
$(objtree), so we can set it to '.' as well. This makes the default
include path more compact and results in more readable messages from the
compiler. The only case where we need the absolute path is when creating
the 'source' symlink in /lib/modules.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: Use relative path when building in a subdir of the source tree

When doing make O=<subdir>, use '..' to refer to the source tree. This
allows for more readable compiler messages, and, more importantly, it
sets the VPATH to '..', so filenames in WARN_ON() etc. will be shorter.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
um: Fix for relative objtree when generating x86 headers

In an O= build, rely on the generated Makefile to call the main Makefile
properly. When building in the source tree, we do not need to specify
the -C and O= either. This fixes the problem when $(objtree) is a
relative path and the -C changes the directory.

Reported-by: Richard Weinberger <richard.weinberger@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/tags.sh: ignore symlink'ed source files

Since commit 22d651dcef536c75f75537290bf3da5038e68b6b ('selftests/powerpc:
Import Anton's memcpy / copy_tofrom_user tests'), some source files in the
tree appear as symlink.
Until commit 8c38a5328af8080bc69a25b3e4e144b03eeea95e ('scripts/tags.sh:
ignore code of user space tools'), those symlinks made cscope report some
warnings:

    $ make ALLSOURCE_ARCHS=all O=./obj-cscope/ cscope
      GEN     cscope
    cscope: cannot find
file .../tools/testing/selftests/powerpc/copyloops/copyuser_power7.S
    cscope: cannot find
file .../tools/testing/selftests/powerpc/copyloops/memcpy_64.S
    cscope: cannot find
file .../tools/testing/selftests/powerpc/copyloops/memcpy_power7.S
    cscope: cannot find
file .../tools/testing/selftests/powerpc/copyloops/copyuser_64.S

In order to prevent the same kind of warnings to be triggered by future
addition of symlinks, the best option is to ignore all symlinks when
building the file list to be processed by cscope (and other tools
supported by scripts/tags.sh).

Ignoring symlinks won't hide source files from cscope (and others) as the
target of these symlinks already appear somewhere else in the tree, and,
as such, should be processed by cscope (or others).

Note that, cscope, when used with -R option to make it find the files to
process by itself, already skip symlinks: it's not expected that cscope
access source files through symlink.

On top of commit 8c38a5328af8080bc69a25b3e4e144b03eeea95e ('scripts/tags.sh:
ignore code of user space tools'), scripts/tags.sh output from
"make cscope tags TAGS" is the same with and without this patch: it doesn't
seems to introduce any regression (on Fedora 20).

Link: http://lkml.kernel.org/r/1396530975.4361.28.camel@localhost.localdomain
Link: http://mid.gmane.org/534312F8.5090609@t-online.de
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Anton Blanchard <anton@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Hans-Bernhard Bröker <broeker@users.sourceforge.net>,
Cc: Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>,
Cc: Neil Horman <nhorman@users.sourceforge.net>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Gerhard Sittig <gsi@denx.de>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: do not add "selinux" to subdir- twice

scripts/Makefile adds "selinux" to subdir-y or subdir- twice.

  subdir-$(CONFIG_MODVERSIONS) += genksyms
  subdir-y                     += mod
  subdir-$(CONFIG_SECURITY_SELINUX) += selinux    <--- here
  subdir-$(CONFIG_DTC)         += dtc

  # Let clean descend into subdirs
  subdir- += basic kconfig package selinux        <--- again

The latter is redundant.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Makefile: Fix unrecognized cross-compiler command line options

On architectures that setup CROSS_COMPILE in their arch/*/Makefile
(arc, blackfin, m68k, mips, parisc, score, sh, tile, unicore32, xtensa),
cc-option and cc-disable-warning may check against the wrong compiler,
causing errors like

    cc1: error: unrecognized command line option "-Wno-maybe-uninitialized"

if the host gcc supports a compiler option, while the cross compiler
doesn't support that option.

Move all logic using cc-option or cc-disable-warning below the inclusion
of the arch's Makefile to fix this.

Introduced by
  - commit e74fc973b6e531fef1fce8b101ffff05ecfb774c ("Turn off
    -Wmaybe-uninitialized when building with -Os"),
  - commit 61163efae02040f66a95c8ed17f4407951ba58fa ("kbuild: LLVMLinux:
    Add Kbuild support for building kernel with Clang").

As -Wno-maybe-uninitialized requires a quite recent gcc (gcc 4.6.3 on
Ubuntu 12.04 LTS doesn't support it), this only showed up recently (gcc
4.8.2 on Ubuntu 14.04 LTS does support it).

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
coccinelle: Check for missing NULL terminators in of_device_id tables

Failure to terminate an of_device_id table can lead to confusing
failures depending on where the compiler places the array. Add a
check to make sure these tables are terminated. Thanks to Mitchel
Humpherys for coming up with the pattern initially.

Cc: Mitchel Humpherys <mitchelh@codeaurora.org>
Cc: Gilles Muller <Gilles.Muller@lip6.fr>
Cc: Nicolas Palix <nicolas.palix@imag.fr>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>