Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull misc kbuild updates from Michal Marek: "Non-critical kbuild changes: - make coccicheck improvements, but no new semantic patches this time - make rpm improvements - make tar-pkg change to include the architecture in the filename. This is a deliberate incompatibility, but nobody has complained so far and it is useful if you build for different architectures. It also matches what the deb-pkg and rpm-pkg targets produce. - kbuild documentation fix" * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: rpm-pkg: Remove pointless set -e statements rpm-pkg: Always regenerate the specfile rpm-pkg: Do not write to the parent directory rpm-pkg: Do not package the whole source directory buildtar: Add ARCH to the archive name Coccinelle: Fix patch output when coccicheck is used with M= and C= Coccinelle: Add support to the SPFLAGS variable Coccinelle: Cleanup the setting of the FLAGS and OPTIONS variables Coccinelle: Restore coccicheck verbosity in ONLINE mode (C=1 or C=2) scripts/package/Makefile: compare objtree with srctree instead of test KBUILD_OUTPUT doc: change example to existing Makefile fragment scripts/tags.sh: Add magic for OFFSET and DEFINE
This commit is contained in:
Коммит
b9e306e07e
|
@ -134,6 +134,15 @@ MODE variable explained above.
|
|||
In this mode, there is no information about semantic patches
|
||||
displayed, and no commit message proposed.
|
||||
|
||||
Additional flags
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Additional flags can be passed to spatch through the SPFLAGS
|
||||
variable.
|
||||
|
||||
make SPFLAGS=--use_glimpse coccicheck
|
||||
|
||||
See spatch --help to learn more about spatch options.
|
||||
|
||||
Proposing new semantic patches
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -921,8 +921,9 @@ When kbuild executes, the following steps are followed (roughly):
|
|||
Often, the KBUILD_CFLAGS variable depends on the configuration.
|
||||
|
||||
Example:
|
||||
#arch/x86/Makefile
|
||||
cflags-$(CONFIG_M386) += -march=i386
|
||||
#arch/x86/boot/compressed/Makefile
|
||||
cflags-$(CONFIG_X86_32) := -march=i386
|
||||
cflags-$(CONFIG_X86_64) := -mcmodel=small
|
||||
KBUILD_CFLAGS += $(cflags-y)
|
||||
|
||||
Many arch Makefiles dynamically run the target C compiler to
|
||||
|
|
2
Makefile
2
Makefile
|
@ -757,6 +757,8 @@ export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)
|
|||
export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y)
|
||||
export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
|
||||
export LDFLAGS_vmlinux
|
||||
# used by scripts/pacmage/Makefile
|
||||
export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools virt)
|
||||
|
||||
vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
SPATCH="`which ${SPATCH:=spatch}`"
|
||||
|
||||
|
@ -11,27 +11,32 @@ else
|
|||
VERBOSE=0
|
||||
fi
|
||||
|
||||
FLAGS="$SPFLAGS -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"
|
||||
# Take only the last argument, which is the C file to test
|
||||
shift $(( $# - 1 ))
|
||||
OPTIONS=$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 $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
|
||||
|
@ -72,7 +77,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/||"`
|
||||
|
||||
|
|
|
@ -27,53 +27,44 @@ 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 ..;
|
||||
|
||||
# rpm-pkg
|
||||
# ---------------------------------------------------------------------------
|
||||
$(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile
|
||||
$(CONFIG_SHELL) $(MKSPEC) > $@
|
||||
|
||||
rpm-pkg rpm: $(objtree)/kernel.spec FORCE
|
||||
@if test -n "$(KBUILD_OUTPUT)"; then \
|
||||
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"; \
|
||||
echo "binrpm-pkg target instead."; \
|
||||
false; \
|
||||
fi
|
||||
$(MAKE) clean
|
||||
$(PREV) ln -sf $(srctree) $(KERNELPATH)
|
||||
ln -sf $(srctree) $(KERNELPATH)
|
||||
$(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
|
||||
$(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion
|
||||
$(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/.
|
||||
$(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
|
||||
|
||||
clean-files := $(objtree)/kernel.spec
|
||||
$(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz
|
||||
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=
|
||||
set -e; \
|
||||
$(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec
|
||||
$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
|
||||
set -e; \
|
||||
mv -f $(objtree)/.tmp_version $(objtree)/.version
|
||||
|
||||
$(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \
|
||||
$(UTS_MACHINE) -bb $<
|
||||
|
||||
clean-files += $(objtree)/binkernel.spec
|
||||
rm binkernel.spec
|
||||
|
||||
# Deb target
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -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 \
|
||||
|
|
Загрузка…
Ссылка в новой задаче