Skip to content

Commit

Permalink
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…mmarek/kbuild

Pull misc kbuild updates from Michal Marek:
 - deb-pkg:
     + module signing fix
     + dtb files are added to the package
     + do not require `hostname -f` to work during build
     + make deb-pkg generates a source package, bindeb-pkg has been
       added to only generate the binary package
 - rpm-pkg packages /lib/modules as well
 - new coccinelle patch and updates to existing ones
 - new stackusage & stackdelta script to collect and compare stack usage
   info (using gcc's -fstack-usage)
 - make tags understands trace_*_rcuidle() macros
 - .gitignore updates, misc cleanups

* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: (27 commits)
  deb-pkg: add source package
  package/Makefile: move source tar creation to a function
  scripts: add stackdelta script
  kbuild: remove *.su files generated by -fstack-usage
  .gitignore: add *.su pattern
  scripts: add stackusage script
  kbuild: avoid listing /lib/modules in kernel spec file
  fallback to hostname in scripts/package/builddeb
  coccinelle: api: extend spatch for dropping unnecessary owner
  deb-pkg: simplify directory creation
  scripts/tags.sh: Include trace_*_rcuidle() in tags
  scripts/package/Makefile: rpmbuild is needed for rpm targets
  Kbuild: Add ID files to .gitignore
  gitignore: Add MIPS vmlinux.32 to the list
  coccinelle: simple_return: Add a blank line
  coccinelle: irqf_oneshot.cocci: Improve the generated commit log
  coccinelle: api: add vma_pages.cocci
  scripts/coccinelle/misc/irqf_oneshot.cocci: Fix grammar
  scripts/coccinelle/misc/semicolon.cocci: Use imperative mood
  coccinelle: simple_open: Use imperative mood
  ...
  • Loading branch information
torvalds committed Sep 8, 2015
2 parents 605e971 + 3716001 commit d9241b2
Show file tree
Hide file tree
Showing 17 changed files with 345 additions and 61 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
modules.builtin
Module.symvers
*.dwo
*.su

#
# Top-level generic files
Expand All @@ -44,6 +45,7 @@ Module.symvers
/TAGS
/linux
/vmlinux
/vmlinux.32
/vmlinux-gdb.py
/vmlinuz
/System.map
Expand Down Expand Up @@ -89,6 +91,9 @@ GRTAGS
GSYMS
GTAGS

# id-utils files
ID

*.orig
*~
\#*#
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,7 @@ clean: $(clean-dirs)
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
-o -name '*.ko.*' \
-o -name '*.dwo' \
-o -name '*.su' \
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-o -name '*.symtypes' -o -name 'modules.order' \
-o -name modules.builtin -o -name '.tmp_*.o.*' \
Expand Down
73 changes: 73 additions & 0 deletions scripts/coccinelle/api/platform_no_drv_owner.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ virtual org
virtual report

@match1@
declarer name module_i2c_driver;
declarer name module_platform_driver;
declarer name module_platform_driver_probe;
identifier __driver;
@@
(
module_i2c_driver(__driver);
|
module_platform_driver(__driver);
|
module_platform_driver_probe(__driver, ...);
Expand All @@ -28,6 +31,15 @@ identifier match1.__driver;
}
};

@fix1_i2c depends on match1 && patch && !context && !org && !report@
identifier match1.__driver;
@@
static struct i2c_driver __driver = {
.driver = {
- .owner = THIS_MODULE,
}
};

@match2@
identifier __driver;
@@
Expand All @@ -37,6 +49,8 @@ identifier __driver;
platform_driver_probe(&__driver, ...)
|
platform_create_bundle(&__driver, ...)
|
i2c_add_driver(&__driver)
)

@fix2 depends on match2 && patch && !context && !org && !report@
Expand All @@ -48,6 +62,15 @@ identifier match2.__driver;
}
};

@fix2_i2c depends on match2 && patch && !context && !org && !report@
identifier match2.__driver;
@@
static struct i2c_driver __driver = {
.driver = {
- .owner = THIS_MODULE,
}
};

// ----------------------------------------------------------------------------

@fix1_context depends on match1 && !patch && (context || org || report)@
Expand All @@ -61,6 +84,17 @@ position j0;
}
};

@fix1_i2c_context depends on match1 && !patch && (context || org || report)@
identifier match1.__driver;
position j0;
@@

static struct i2c_driver __driver = {
.driver = {
* .owner@j0 = THIS_MODULE,
}
};

@fix2_context depends on match2 && !patch && (context || org || report)@
identifier match2.__driver;
position j0;
Expand All @@ -72,6 +106,17 @@ position j0;
}
};

@fix2_i2c_context depends on match2 && !patch && (context || org || report)@
identifier match2.__driver;
position j0;
@@

static struct i2c_driver __driver = {
.driver = {
* .owner@j0 = THIS_MODULE,
}
};

// ----------------------------------------------------------------------------

@script:python fix1_org depends on org@
Expand All @@ -81,13 +126,27 @@ j0 << fix1_context.j0;
msg = "No need to set .owner here. The core will do it."
coccilib.org.print_todo(j0[0], msg)
@script:python fix1_i2c_org depends on org@
j0 << fix1_i2c_context.j0;
@@
msg = "No need to set .owner here. The core will do it."
coccilib.org.print_todo(j0[0], msg)
@script:python fix2_org depends on org@
j0 << fix2_context.j0;
@@
msg = "No need to set .owner here. The core will do it."
coccilib.org.print_todo(j0[0], msg)
@script:python fix2_i2c_org depends on org@
j0 << fix2_i2c_context.j0;
@@
msg = "No need to set .owner here. The core will do it."
coccilib.org.print_todo(j0[0], msg)
// ----------------------------------------------------------------------------
@script:python fix1_report depends on report@
Expand All @@ -97,10 +156,24 @@ j0 << fix1_context.j0;
msg = "No need to set .owner here. The core will do it."
coccilib.report.print_report(j0[0], msg)
@script:python fix1_i2c_report depends on report@
j0 << fix1_i2c_context.j0;
@@
msg = "No need to set .owner here. The core will do it."
coccilib.report.print_report(j0[0], msg)
@script:python fix2_report depends on report@
j0 << fix2_context.j0;
@@
msg = "No need to set .owner here. The core will do it."
coccilib.report.print_report(j0[0], msg)
@script:python fix2_i2c_report depends on report@
j0 << fix2_i2c_context.j0;
@@
msg = "No need to set .owner here. The core will do it."
coccilib.report.print_report(j0[0], msg)
2 changes: 1 addition & 1 deletion scripts/coccinelle/api/pm_runtime.cocci
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// Make sure pm_runtime_* calls does not use unnecessary IS_ERR_VALUE
//
///
// Keywords: pm_runtime
// Confidence: Medium
// Copyright (C) 2013 Texas Instruments Incorporated - GPLv2.
Expand Down
4 changes: 2 additions & 2 deletions scripts/coccinelle/api/simple_open.cocci
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// This removes an open coded simple_open() function
/// and replaces file operations references to the function
/// Remove an open coded simple_open() function
/// and replace file operations references to the function
/// with simple_open() instead.
///
// Confidence: High
Expand Down
60 changes: 60 additions & 0 deletions scripts/coccinelle/api/vma_pages.cocci
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
///
/// Use vma_pages function on vma object instead of explicit computation.
///
// Confidence: High
// Keywords: vma_pages vma
// Comment: Based on resource_size.cocci

virtual context
virtual patch
virtual org
virtual report

//----------------------------------------------------------
// For context mode
//----------------------------------------------------------

@r_context depends on context && !patch && !org && !report@
struct vm_area_struct *vma;
@@

* (vma->vm_end - vma->vm_start) >> PAGE_SHIFT

//----------------------------------------------------------
// For patch mode
//----------------------------------------------------------

@r_patch depends on !context && patch && !org && !report@
struct vm_area_struct *vma;
@@

- ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT)
+ vma_pages(vma)

//----------------------------------------------------------
// For org mode
//----------------------------------------------------------

@r_org depends on !context && !patch && (org || report)@
struct vm_area_struct *vma;
position p;
@@

(vma->vm_end@p - vma->vm_start) >> PAGE_SHIFT

@script:python depends on report@
p << r_org.p;
x << r_org.vma;
@@
msg="WARNING: Consider using vma_pages helper on %s" % (x)
coccilib.report.print_report(p[0], msg)
@script:python depends on org@
p << r_org.p;
x << r_org.vma;
@@
msg="WARNING: Consider using vma_pages helper on %s" % (x)
msg_safe=msg.replace("[","@(").replace("]",")")
coccilib.org.print_todo(p[0], msg_safe)
3 changes: 1 addition & 2 deletions scripts/coccinelle/misc/ifaddr.cocci
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// the address of a variable or field is non-zero is likely always to bo
/// non-zero
/// The address of a variable or field is likely always to be non-zero.
///
// Confidence: High
// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
Expand Down
7 changes: 5 additions & 2 deletions scripts/coccinelle/misc/irqf_oneshot.cocci
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/// Make sure threaded IRQs without a primary handler are always request with
/// IRQF_ONESHOT
/// Since commit 1c6c69525b40 ("genirq: Reject bogus threaded irq requests")
/// threaded IRQs without a primary handler need to be requested with
/// IRQF_ONESHOT, otherwise the request will fail.
///
/// So pass the IRQF_ONESHOT flag in this case.
///
//
// Confidence: Good
Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/misc/returnvar.cocci
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///
/// Removes unneeded variable used to store return value.
/// Remove unneeded variable used to store return value.
///
// Confidence: Moderate
// Copyright: (C) 2012 Peter Senna Tschudin, INRIA/LIP6. GPLv2.
Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/misc/semicolon.cocci
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///
/// Removes unneeded semicolon.
/// Remove unneeded semicolon.
///
// Confidence: Moderate
// Copyright: (C) 2012 Peter Senna Tschudin, INRIA/LIP6. GPLv2.
Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/misc/simple_return.cocci
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// Simplify a trivial if-return sequence. Possibly combine with a
/// preceding function call.
//
///
// Confidence: High
// Copyright: (C) 2014 Julia Lawall, INRIA/LIP6. GPLv2.
// Copyright: (C) 2014 Gilles Muller, INRIA/LiP6. GPLv2.
Expand Down
54 changes: 31 additions & 23 deletions scripts/package/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,38 @@
# Note that the rpm-pkg target cannot be used with KBUILD_OUTPUT,
# but the binrpm-pkg target can; for some reason O= gets ignored.

# Do we have rpmbuild, otherwise fall back to the older rpm
RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
else echo rpm; fi)

# Remove hyphens since they have special meaning in RPM filenames
KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
KDEB_SOURCENAME ?= linux-$(KERNELRELEASE)
export KDEB_SOURCENAME
# Include only those top-level files that are needed by make, plus the GPL copy
TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \
TAR_CONTENT := $(KBUILD_ALLDIRS) .config .scmversion Makefile \
Kbuild Kconfig COPYING $(wildcard localversion*)
TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT))
MKSPEC := $(srctree)/scripts/package/mkspec

quiet_cmd_src_tar = TAR $(2).tar.gz
cmd_src_tar = \
if test "$(objtree)" != "$(srctree)"; then \
echo "Building source tarball is not possible outside the"; \
echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
echo "binrpm-pkg or bindeb-pkg target instead."; \
false; \
fi ; \
$(srctree)/scripts/setlocalversion --save-scmversion; \
ln -sf $(srctree) $(2); \
tar -cz $(RCS_TAR_IGNORE) -f $(2).tar.gz \
$(addprefix $(2)/,$(TAR_CONTENT) $(3)); \
rm -f $(2) $(objtree)/.scmversion

# rpm-pkg
# ---------------------------------------------------------------------------
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
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)
rm -f $(objtree)/.scmversion
$(call cmd,src_tar,$(KERNELPATH),kernel.spec)
$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
mv -f $(objtree)/.tmp_version $(objtree)/.version
$(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz
rpmbuild --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz
rm $(KERNELPATH).tar.gz kernel.spec

# binrpm-pkg
Expand All @@ -62,7 +63,7 @@ binrpm-pkg: FORCE
$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
mv -f $(objtree)/.tmp_version $(objtree)/.version

$(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \
rpmbuild --define "_builddir $(objtree)" --target \
$(UTS_MACHINE) -bb $(objtree)/binkernel.spec
rm binkernel.spec

Expand All @@ -84,11 +85,17 @@ quiet_cmd_builddeb = BUILDDEB
} && \
\
$$KBUILD_PKG_ROOTCMD $(CONFIG_SHELL) \
$(srctree)/scripts/package/builddeb
$(srctree)/scripts/package/builddeb $@

deb-pkg: FORCE
$(MAKE) clean
$(call cmd,src_tar,$(KDEB_SOURCENAME))
$(MAKE) KBUILD_SRC=
+$(call cmd,builddeb)

bindeb-pkg: FORCE
$(MAKE) KBUILD_SRC=
$(call cmd,builddeb)
+$(call cmd,builddeb)

clean-dirs += $(objtree)/debian/

Expand Down Expand Up @@ -133,8 +140,9 @@ perf-%pkg: FORCE
# ---------------------------------------------------------------------------
help: FORCE
@echo ' rpm-pkg - Build both source and binary RPM kernel packages'
@echo ' binrpm-pkg - Build only the binary kernel package'
@echo ' deb-pkg - Build the kernel as a deb package'
@echo ' binrpm-pkg - Build only the binary kernel RPM package'
@echo ' deb-pkg - Build both source and binary deb kernel packages'
@echo ' bindeb-pkg - Build only the binary kernel deb package'
@echo ' tar-pkg - Build the kernel as an uncompressed tarball'
@echo ' targz-pkg - Build the kernel as a gzip compressed tarball'
@echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'
Expand Down
Loading

0 comments on commit d9241b2

Please sign in to comment.