aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-09-08 17:23:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-08 17:23:13 -0400
commitd9241b22b58e012f26dd2244508d9f4837402af0 (patch)
treee8359d16b76e0c109d4bbaccf093765c373d9f24
parent605e9710fb5fef0dd2bb49d7b75e46601df62112 (diff)
parent3716001bcb7f5822382ac1f2f54226b87312cc6b (diff)
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/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 ...
-rw-r--r--.gitignore5
-rw-r--r--Makefile1
-rw-r--r--scripts/coccinelle/api/platform_no_drv_owner.cocci73
-rw-r--r--scripts/coccinelle/api/pm_runtime.cocci2
-rw-r--r--scripts/coccinelle/api/simple_open.cocci4
-rw-r--r--scripts/coccinelle/api/vma_pages.cocci60
-rw-r--r--scripts/coccinelle/misc/ifaddr.cocci3
-rw-r--r--scripts/coccinelle/misc/irqf_oneshot.cocci7
-rw-r--r--scripts/coccinelle/misc/returnvar.cocci2
-rw-r--r--scripts/coccinelle/misc/semicolon.cocci2
-rw-r--r--scripts/coccinelle/misc/simple_return.cocci2
-rw-r--r--scripts/package/Makefile54
-rwxr-xr-xscripts/package/builddeb90
-rwxr-xr-xscripts/package/mkspec5
-rwxr-xr-xscripts/stackdelta59
-rwxr-xr-xscripts/stackusage33
-rwxr-xr-xscripts/tags.sh4
17 files changed, 345 insertions, 61 deletions
diff --git a/.gitignore b/.gitignore
index 17fa24dd7e46..fd3a35592543 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,6 +36,7 @@
36modules.builtin 36modules.builtin
37Module.symvers 37Module.symvers
38*.dwo 38*.dwo
39*.su
39 40
40# 41#
41# Top-level generic files 42# Top-level generic files
@@ -44,6 +45,7 @@ Module.symvers
44/TAGS 45/TAGS
45/linux 46/linux
46/vmlinux 47/vmlinux
48/vmlinux.32
47/vmlinux-gdb.py 49/vmlinux-gdb.py
48/vmlinuz 50/vmlinuz
49/System.map 51/System.map
@@ -89,6 +91,9 @@ GRTAGS
89GSYMS 91GSYMS
90GTAGS 92GTAGS
91 93
94# id-utils files
95ID
96
92*.orig 97*.orig
93*~ 98*~
94\#*# 99\#*#
diff --git a/Makefile b/Makefile
index 5461920ab02d..f2d27061e5f7 100644
--- a/Makefile
+++ b/Makefile
@@ -1425,6 +1425,7 @@ clean: $(clean-dirs)
1425 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ 1425 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
1426 -o -name '*.ko.*' \ 1426 -o -name '*.ko.*' \
1427 -o -name '*.dwo' \ 1427 -o -name '*.dwo' \
1428 -o -name '*.su' \
1428 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ 1429 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
1429 -o -name '*.symtypes' -o -name 'modules.order' \ 1430 -o -name '*.symtypes' -o -name 'modules.order' \
1430 -o -name modules.builtin -o -name '.tmp_*.o.*' \ 1431 -o -name modules.builtin -o -name '.tmp_*.o.*' \
diff --git a/scripts/coccinelle/api/platform_no_drv_owner.cocci b/scripts/coccinelle/api/platform_no_drv_owner.cocci
index e065b9e714fc..c5e3f73f2054 100644
--- a/scripts/coccinelle/api/platform_no_drv_owner.cocci
+++ b/scripts/coccinelle/api/platform_no_drv_owner.cocci
@@ -9,11 +9,14 @@ virtual org
9virtual report 9virtual report
10 10
11@match1@ 11@match1@
12declarer name module_i2c_driver;
12declarer name module_platform_driver; 13declarer name module_platform_driver;
13declarer name module_platform_driver_probe; 14declarer name module_platform_driver_probe;
14identifier __driver; 15identifier __driver;
15@@ 16@@
16( 17(
18 module_i2c_driver(__driver);
19|
17 module_platform_driver(__driver); 20 module_platform_driver(__driver);
18| 21|
19 module_platform_driver_probe(__driver, ...); 22 module_platform_driver_probe(__driver, ...);
@@ -28,6 +31,15 @@ identifier match1.__driver;
28 } 31 }
29 }; 32 };
30 33
34@fix1_i2c depends on match1 && patch && !context && !org && !report@
35identifier match1.__driver;
36@@
37 static struct i2c_driver __driver = {
38 .driver = {
39- .owner = THIS_MODULE,
40 }
41 };
42
31@match2@ 43@match2@
32identifier __driver; 44identifier __driver;
33@@ 45@@
@@ -37,6 +49,8 @@ identifier __driver;
37 platform_driver_probe(&__driver, ...) 49 platform_driver_probe(&__driver, ...)
38| 50|
39 platform_create_bundle(&__driver, ...) 51 platform_create_bundle(&__driver, ...)
52|
53 i2c_add_driver(&__driver)
40) 54)
41 55
42@fix2 depends on match2 && patch && !context && !org && !report@ 56@fix2 depends on match2 && patch && !context && !org && !report@
@@ -48,6 +62,15 @@ identifier match2.__driver;
48 } 62 }
49 }; 63 };
50 64
65@fix2_i2c depends on match2 && patch && !context && !org && !report@
66identifier match2.__driver;
67@@
68 static struct i2c_driver __driver = {
69 .driver = {
70- .owner = THIS_MODULE,
71 }
72 };
73
51// ---------------------------------------------------------------------------- 74// ----------------------------------------------------------------------------
52 75
53@fix1_context depends on match1 && !patch && (context || org || report)@ 76@fix1_context depends on match1 && !patch && (context || org || report)@
@@ -61,6 +84,17 @@ position j0;
61 } 84 }
62 }; 85 };
63 86
87@fix1_i2c_context depends on match1 && !patch && (context || org || report)@
88identifier match1.__driver;
89position j0;
90@@
91
92 static struct i2c_driver __driver = {
93 .driver = {
94* .owner@j0 = THIS_MODULE,
95 }
96 };
97
64@fix2_context depends on match2 && !patch && (context || org || report)@ 98@fix2_context depends on match2 && !patch && (context || org || report)@
65identifier match2.__driver; 99identifier match2.__driver;
66position j0; 100position j0;
@@ -72,6 +106,17 @@ position j0;
72 } 106 }
73 }; 107 };
74 108
109@fix2_i2c_context depends on match2 && !patch && (context || org || report)@
110identifier match2.__driver;
111position j0;
112@@
113
114 static struct i2c_driver __driver = {
115 .driver = {
116* .owner@j0 = THIS_MODULE,
117 }
118 };
119
75// ---------------------------------------------------------------------------- 120// ----------------------------------------------------------------------------
76 121
77@script:python fix1_org depends on org@ 122@script:python fix1_org depends on org@
@@ -81,6 +126,13 @@ j0 << fix1_context.j0;
81msg = "No need to set .owner here. The core will do it." 126msg = "No need to set .owner here. The core will do it."
82coccilib.org.print_todo(j0[0], msg) 127coccilib.org.print_todo(j0[0], msg)
83 128
129@script:python fix1_i2c_org depends on org@
130j0 << fix1_i2c_context.j0;
131@@
132
133msg = "No need to set .owner here. The core will do it."
134coccilib.org.print_todo(j0[0], msg)
135
84@script:python fix2_org depends on org@ 136@script:python fix2_org depends on org@
85j0 << fix2_context.j0; 137j0 << fix2_context.j0;
86@@ 138@@
@@ -88,6 +140,13 @@ j0 << fix2_context.j0;
88msg = "No need to set .owner here. The core will do it." 140msg = "No need to set .owner here. The core will do it."
89coccilib.org.print_todo(j0[0], msg) 141coccilib.org.print_todo(j0[0], msg)
90 142
143@script:python fix2_i2c_org depends on org@
144j0 << fix2_i2c_context.j0;
145@@
146
147msg = "No need to set .owner here. The core will do it."
148coccilib.org.print_todo(j0[0], msg)
149
91// ---------------------------------------------------------------------------- 150// ----------------------------------------------------------------------------
92 151
93@script:python fix1_report depends on report@ 152@script:python fix1_report depends on report@
@@ -97,6 +156,13 @@ j0 << fix1_context.j0;
97msg = "No need to set .owner here. The core will do it." 156msg = "No need to set .owner here. The core will do it."
98coccilib.report.print_report(j0[0], msg) 157coccilib.report.print_report(j0[0], msg)
99 158
159@script:python fix1_i2c_report depends on report@
160j0 << fix1_i2c_context.j0;
161@@
162
163msg = "No need to set .owner here. The core will do it."
164coccilib.report.print_report(j0[0], msg)
165
100@script:python fix2_report depends on report@ 166@script:python fix2_report depends on report@
101j0 << fix2_context.j0; 167j0 << fix2_context.j0;
102@@ 168@@
@@ -104,3 +170,10 @@ j0 << fix2_context.j0;
104msg = "No need to set .owner here. The core will do it." 170msg = "No need to set .owner here. The core will do it."
105coccilib.report.print_report(j0[0], msg) 171coccilib.report.print_report(j0[0], msg)
106 172
173@script:python fix2_i2c_report depends on report@
174j0 << fix2_i2c_context.j0;
175@@
176
177msg = "No need to set .owner here. The core will do it."
178coccilib.report.print_report(j0[0], msg)
179
diff --git a/scripts/coccinelle/api/pm_runtime.cocci b/scripts/coccinelle/api/pm_runtime.cocci
index f01789e967ec..b7042d074078 100644
--- a/scripts/coccinelle/api/pm_runtime.cocci
+++ b/scripts/coccinelle/api/pm_runtime.cocci
@@ -1,5 +1,5 @@
1/// Make sure pm_runtime_* calls does not use unnecessary IS_ERR_VALUE 1/// Make sure pm_runtime_* calls does not use unnecessary IS_ERR_VALUE
2// 2///
3// Keywords: pm_runtime 3// Keywords: pm_runtime
4// Confidence: Medium 4// Confidence: Medium
5// Copyright (C) 2013 Texas Instruments Incorporated - GPLv2. 5// Copyright (C) 2013 Texas Instruments Incorporated - GPLv2.
diff --git a/scripts/coccinelle/api/simple_open.cocci b/scripts/coccinelle/api/simple_open.cocci
index b67e174f3d95..bd1a2a4ee106 100644
--- a/scripts/coccinelle/api/simple_open.cocci
+++ b/scripts/coccinelle/api/simple_open.cocci
@@ -1,5 +1,5 @@
1/// This removes an open coded simple_open() function 1/// Remove an open coded simple_open() function
2/// and replaces file operations references to the function 2/// and replace file operations references to the function
3/// with simple_open() instead. 3/// with simple_open() instead.
4/// 4///
5// Confidence: High 5// Confidence: High
diff --git a/scripts/coccinelle/api/vma_pages.cocci b/scripts/coccinelle/api/vma_pages.cocci
new file mode 100644
index 000000000000..3e52e11ea1dc
--- /dev/null
+++ b/scripts/coccinelle/api/vma_pages.cocci
@@ -0,0 +1,60 @@
1///
2/// Use vma_pages function on vma object instead of explicit computation.
3///
4// Confidence: High
5// Keywords: vma_pages vma
6// Comment: Based on resource_size.cocci
7
8virtual context
9virtual patch
10virtual org
11virtual report
12
13//----------------------------------------------------------
14// For context mode
15//----------------------------------------------------------
16
17@r_context depends on context && !patch && !org && !report@
18struct vm_area_struct *vma;
19@@
20
21* (vma->vm_end - vma->vm_start) >> PAGE_SHIFT
22
23//----------------------------------------------------------
24// For patch mode
25//----------------------------------------------------------
26
27@r_patch depends on !context && patch && !org && !report@
28struct vm_area_struct *vma;
29@@
30
31- ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT)
32+ vma_pages(vma)
33
34//----------------------------------------------------------
35// For org mode
36//----------------------------------------------------------
37
38@r_org depends on !context && !patch && (org || report)@
39struct vm_area_struct *vma;
40position p;
41@@
42
43 (vma->vm_end@p - vma->vm_start) >> PAGE_SHIFT
44
45@script:python depends on report@
46p << r_org.p;
47x << r_org.vma;
48@@
49
50msg="WARNING: Consider using vma_pages helper on %s" % (x)
51coccilib.report.print_report(p[0], msg)
52
53@script:python depends on org@
54p << r_org.p;
55x << r_org.vma;
56@@
57
58msg="WARNING: Consider using vma_pages helper on %s" % (x)
59msg_safe=msg.replace("[","@(").replace("]",")")
60coccilib.org.print_todo(p[0], msg_safe)
diff --git a/scripts/coccinelle/misc/ifaddr.cocci b/scripts/coccinelle/misc/ifaddr.cocci
index 8aebd1875e75..c2663c677ac1 100644
--- a/scripts/coccinelle/misc/ifaddr.cocci
+++ b/scripts/coccinelle/misc/ifaddr.cocci
@@ -1,5 +1,4 @@
1/// the address of a variable or field is non-zero is likely always to bo 1/// The address of a variable or field is likely always to be non-zero.
2/// non-zero
3/// 2///
4// Confidence: High 3// Confidence: High
5// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. 4// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci
index a24a754ae1d7..b421150a2eff 100644
--- a/scripts/coccinelle/misc/irqf_oneshot.cocci
+++ b/scripts/coccinelle/misc/irqf_oneshot.cocci
@@ -1,5 +1,8 @@
1/// Make sure threaded IRQs without a primary handler are always request with 1/// Since commit 1c6c69525b40 ("genirq: Reject bogus threaded irq requests")
2/// IRQF_ONESHOT 2/// threaded IRQs without a primary handler need to be requested with
3/// IRQF_ONESHOT, otherwise the request will fail.
4///
5/// So pass the IRQF_ONESHOT flag in this case.
3/// 6///
4// 7//
5// Confidence: Good 8// Confidence: Good
diff --git a/scripts/coccinelle/misc/returnvar.cocci b/scripts/coccinelle/misc/returnvar.cocci
index 605955a91c44..d8286ef5307f 100644
--- a/scripts/coccinelle/misc/returnvar.cocci
+++ b/scripts/coccinelle/misc/returnvar.cocci
@@ -1,5 +1,5 @@
1/// 1///
2/// Removes unneeded variable used to store return value. 2/// Remove unneeded variable used to store return value.
3/// 3///
4// Confidence: Moderate 4// Confidence: Moderate
5// Copyright: (C) 2012 Peter Senna Tschudin, INRIA/LIP6. GPLv2. 5// Copyright: (C) 2012 Peter Senna Tschudin, INRIA/LIP6. GPLv2.
diff --git a/scripts/coccinelle/misc/semicolon.cocci b/scripts/coccinelle/misc/semicolon.cocci
index a47eba2edc9e..6740c659a2b3 100644
--- a/scripts/coccinelle/misc/semicolon.cocci
+++ b/scripts/coccinelle/misc/semicolon.cocci
@@ -1,5 +1,5 @@
1/// 1///
2/// Removes unneeded semicolon. 2/// Remove unneeded semicolon.
3/// 3///
4// Confidence: Moderate 4// Confidence: Moderate
5// Copyright: (C) 2012 Peter Senna Tschudin, INRIA/LIP6. GPLv2. 5// Copyright: (C) 2012 Peter Senna Tschudin, INRIA/LIP6. GPLv2.
diff --git a/scripts/coccinelle/misc/simple_return.cocci b/scripts/coccinelle/misc/simple_return.cocci
index 47f7084b6360..e8b6313b116f 100644
--- a/scripts/coccinelle/misc/simple_return.cocci
+++ b/scripts/coccinelle/misc/simple_return.cocci
@@ -1,6 +1,6 @@
1/// Simplify a trivial if-return sequence. Possibly combine with a 1/// Simplify a trivial if-return sequence. Possibly combine with a
2/// preceding function call. 2/// preceding function call.
3// 3///
4// Confidence: High 4// Confidence: High
5// Copyright: (C) 2014 Julia Lawall, INRIA/LIP6. GPLv2. 5// Copyright: (C) 2014 Julia Lawall, INRIA/LIP6. GPLv2.
6// Copyright: (C) 2014 Gilles Muller, INRIA/LiP6. GPLv2. 6// Copyright: (C) 2014 Gilles Muller, INRIA/LiP6. GPLv2.
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 99ca6e76eb0a..1aca224e8597 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -21,37 +21,38 @@
21# Note that the rpm-pkg target cannot be used with KBUILD_OUTPUT, 21# Note that the rpm-pkg target cannot be used with KBUILD_OUTPUT,
22# but the binrpm-pkg target can; for some reason O= gets ignored. 22# but the binrpm-pkg target can; for some reason O= gets ignored.
23 23
24# Do we have rpmbuild, otherwise fall back to the older rpm
25RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
26 else echo rpm; fi)
27
28# Remove hyphens since they have special meaning in RPM filenames 24# Remove hyphens since they have special meaning in RPM filenames
29KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE)) 25KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
26KDEB_SOURCENAME ?= linux-$(KERNELRELEASE)
27export KDEB_SOURCENAME
30# Include only those top-level files that are needed by make, plus the GPL copy 28# Include only those top-level files that are needed by make, plus the GPL copy
31TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \ 29TAR_CONTENT := $(KBUILD_ALLDIRS) .config .scmversion Makefile \
32 Kbuild Kconfig COPYING $(wildcard localversion*) 30 Kbuild Kconfig COPYING $(wildcard localversion*)
33TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT))
34MKSPEC := $(srctree)/scripts/package/mkspec 31MKSPEC := $(srctree)/scripts/package/mkspec
35 32
33quiet_cmd_src_tar = TAR $(2).tar.gz
34 cmd_src_tar = \
35if test "$(objtree)" != "$(srctree)"; then \
36 echo "Building source tarball is not possible outside the"; \
37 echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
38 echo "binrpm-pkg or bindeb-pkg target instead."; \
39 false; \
40fi ; \
41$(srctree)/scripts/setlocalversion --save-scmversion; \
42ln -sf $(srctree) $(2); \
43tar -cz $(RCS_TAR_IGNORE) -f $(2).tar.gz \
44 $(addprefix $(2)/,$(TAR_CONTENT) $(3)); \
45rm -f $(2) $(objtree)/.scmversion
46
36# rpm-pkg 47# rpm-pkg
37# --------------------------------------------------------------------------- 48# ---------------------------------------------------------------------------
38rpm-pkg rpm: FORCE 49rpm-pkg rpm: FORCE
39 @if test "$(objtree)" != "$(srctree)"; then \
40 echo "Building source + binary RPM is not possible outside the"; \
41 echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
42 echo "binrpm-pkg target instead."; \
43 false; \
44 fi
45 $(MAKE) clean 50 $(MAKE) clean
46 ln -sf $(srctree) $(KERNELPATH)
47 $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec 51 $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
48 $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion 52 $(call cmd,src_tar,$(KERNELPATH),kernel.spec)
49 tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(TAR_CONTENT)
50 rm $(KERNELPATH)
51 rm -f $(objtree)/.scmversion
52 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version 53 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
53 mv -f $(objtree)/.tmp_version $(objtree)/.version 54 mv -f $(objtree)/.tmp_version $(objtree)/.version
54 $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz 55 rpmbuild --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz
55 rm $(KERNELPATH).tar.gz kernel.spec 56 rm $(KERNELPATH).tar.gz kernel.spec
56 57
57# binrpm-pkg 58# binrpm-pkg
@@ -62,7 +63,7 @@ binrpm-pkg: FORCE
62 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version 63 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
63 mv -f $(objtree)/.tmp_version $(objtree)/.version 64 mv -f $(objtree)/.tmp_version $(objtree)/.version
64 65
65 $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \ 66 rpmbuild --define "_builddir $(objtree)" --target \
66 $(UTS_MACHINE) -bb $(objtree)/binkernel.spec 67 $(UTS_MACHINE) -bb $(objtree)/binkernel.spec
67 rm binkernel.spec 68 rm binkernel.spec
68 69
@@ -84,11 +85,17 @@ quiet_cmd_builddeb = BUILDDEB
84 } && \ 85 } && \
85 \ 86 \
86 $$KBUILD_PKG_ROOTCMD $(CONFIG_SHELL) \ 87 $$KBUILD_PKG_ROOTCMD $(CONFIG_SHELL) \
87 $(srctree)/scripts/package/builddeb 88 $(srctree)/scripts/package/builddeb $@
88 89
89deb-pkg: FORCE 90deb-pkg: FORCE
91 $(MAKE) clean
92 $(call cmd,src_tar,$(KDEB_SOURCENAME))
93 $(MAKE) KBUILD_SRC=
94 +$(call cmd,builddeb)
95
96bindeb-pkg: FORCE
90 $(MAKE) KBUILD_SRC= 97 $(MAKE) KBUILD_SRC=
91 $(call cmd,builddeb) 98 +$(call cmd,builddeb)
92 99
93clean-dirs += $(objtree)/debian/ 100clean-dirs += $(objtree)/debian/
94 101
@@ -133,8 +140,9 @@ perf-%pkg: FORCE
133# --------------------------------------------------------------------------- 140# ---------------------------------------------------------------------------
134help: FORCE 141help: FORCE
135 @echo ' rpm-pkg - Build both source and binary RPM kernel packages' 142 @echo ' rpm-pkg - Build both source and binary RPM kernel packages'
136 @echo ' binrpm-pkg - Build only the binary kernel package' 143 @echo ' binrpm-pkg - Build only the binary kernel RPM package'
137 @echo ' deb-pkg - Build the kernel as a deb package' 144 @echo ' deb-pkg - Build both source and binary deb kernel packages'
145 @echo ' bindeb-pkg - Build only the binary kernel deb package'
138 @echo ' tar-pkg - Build the kernel as an uncompressed tarball' 146 @echo ' tar-pkg - Build the kernel as an uncompressed tarball'
139 @echo ' targz-pkg - Build the kernel as a gzip compressed tarball' 147 @echo ' targz-pkg - Build the kernel as a gzip compressed tarball'
140 @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball' 148 @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 88dbf23b6970..0cd46e129920 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -15,6 +15,8 @@ set -e
15create_package() { 15create_package() {
16 local pname="$1" pdir="$2" 16 local pname="$1" pdir="$2"
17 17
18 mkdir -m 755 -p "$pdir/DEBIAN"
19 mkdir -p "$pdir/usr/share/doc/$pname"
18 cp debian/copyright "$pdir/usr/share/doc/$pname/" 20 cp debian/copyright "$pdir/usr/share/doc/$pname/"
19 cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian" 21 cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian"
20 gzip -9 "$pdir/usr/share/doc/$pname/changelog.Debian" 22 gzip -9 "$pdir/usr/share/doc/$pname/changelog.Debian"
@@ -25,8 +27,13 @@ create_package() {
25 chown -R root:root "$pdir" 27 chown -R root:root "$pdir"
26 chmod -R go-w "$pdir" 28 chmod -R go-w "$pdir"
27 29
30 # Create the package
31 dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch}" -p$pname -P"$pdir"
32 dpkg --build "$pdir" ..
33}
34
35set_debarch() {
28 # Attempt to find the correct Debian architecture 36 # Attempt to find the correct Debian architecture
29 local forcearch="" debarch=""
30 case "$UTS_MACHINE" in 37 case "$UTS_MACHINE" in
31 i386|ia64|alpha) 38 i386|ia64|alpha)
32 debarch="$UTS_MACHINE" ;; 39 debarch="$UTS_MACHINE" ;;
@@ -47,6 +54,7 @@ create_package() {
47 arm*) 54 arm*)
48 debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el || true) ;; 55 debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el || true) ;;
49 *) 56 *)
57 debarch=$(dpkg --print-architecture)
50 echo "" >&2 58 echo "" >&2
51 echo "** ** ** WARNING ** ** **" >&2 59 echo "** ** ** WARNING ** ** **" >&2
52 echo "" >&2 60 echo "" >&2
@@ -59,13 +67,8 @@ create_package() {
59 if [ -n "$KBUILD_DEBARCH" ] ; then 67 if [ -n "$KBUILD_DEBARCH" ] ; then
60 debarch="$KBUILD_DEBARCH" 68 debarch="$KBUILD_DEBARCH"
61 fi 69 fi
62 if [ -n "$debarch" ] ; then 70 forcearch="-DArchitecture=$debarch"
63 forcearch="-DArchitecture=$debarch"
64 fi
65 71
66 # Create the package
67 dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir"
68 dpkg --build "$pdir" ..
69} 72}
70 73
71# Some variables and settings used throughout the script 74# Some variables and settings used throughout the script
@@ -76,6 +79,7 @@ if [ -n "$KDEB_PKGVERSION" ]; then
76else 79else
77 packageversion=$version-$revision 80 packageversion=$version-$revision
78fi 81fi
82sourcename=$KDEB_SOURCENAME
79tmpdir="$objtree/debian/tmp" 83tmpdir="$objtree/debian/tmp"
80fwdir="$objtree/debian/fwtmp" 84fwdir="$objtree/debian/fwtmp"
81kernel_headers_dir="$objtree/debian/hdrtmp" 85kernel_headers_dir="$objtree/debian/hdrtmp"
@@ -86,6 +90,9 @@ fwpackagename=linux-firmware-image-$version
86kernel_headers_packagename=linux-headers-$version 90kernel_headers_packagename=linux-headers-$version
87libc_headers_packagename=linux-libc-dev 91libc_headers_packagename=linux-libc-dev
88dbg_packagename=$packagename-dbg 92dbg_packagename=$packagename-dbg
93debarch=
94forcearch=
95set_debarch
89 96
90if [ "$ARCH" = "um" ] ; then 97if [ "$ARCH" = "um" ] ; then
91 packagename=user-mode-linux-$version 98 packagename=user-mode-linux-$version
@@ -110,24 +117,13 @@ BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
110# Setup the directory structure 117# Setup the directory structure
111rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" 118rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir"
112mkdir -m 755 -p "$tmpdir/DEBIAN" 119mkdir -m 755 -p "$tmpdir/DEBIAN"
113mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" 120mkdir -p "$tmpdir/lib" "$tmpdir/boot"
114mkdir -m 755 -p "$fwdir/DEBIAN" 121mkdir -p "$fwdir/lib/firmware/$version/"
115mkdir -p "$fwdir/lib/firmware/$version/" "$fwdir/usr/share/doc/$fwpackagename"
116mkdir -m 755 -p "$libc_headers_dir/DEBIAN"
117mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename"
118mkdir -m 755 -p "$kernel_headers_dir/DEBIAN"
119mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename"
120mkdir -p "$kernel_headers_dir/lib/modules/$version/" 122mkdir -p "$kernel_headers_dir/lib/modules/$version/"
121if [ "$ARCH" = "um" ] ; then
122 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin"
123fi
124if [ -n "$BUILD_DEBUG" ] ; then
125 mkdir -p "$dbg_dir/usr/share/doc/$dbg_packagename"
126 mkdir -m 755 -p "$dbg_dir/DEBIAN"
127fi
128 123
129# Build and install the kernel 124# Build and install the kernel
130if [ "$ARCH" = "um" ] ; then 125if [ "$ARCH" = "um" ] ; then
126 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" "$tmpdir/usr/share/doc/$packagename"
131 $MAKE linux 127 $MAKE linux
132 cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map" 128 cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
133 cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config" 129 cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"
@@ -143,6 +139,13 @@ else
143 cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/$installed_image_path" 139 cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/$installed_image_path"
144fi 140fi
145 141
142if grep -q "^CONFIG_OF=y" $KCONFIG_CONFIG ; then
143 # Only some architectures with OF support have this target
144 if grep -q dtbs_install "${srctree}/arch/$SRCARCH/Makefile"; then
145 $MAKE KBUILD_SRC= INSTALL_DTBS_PATH="$tmpdir/usr/lib/$packagename" dtbs_install
146 fi
147fi
148
146if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then 149if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
147 INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install 150 INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install
148 rm -f "$tmpdir/lib/modules/$version/build" 151 rm -f "$tmpdir/lib/modules/$version/build"
@@ -162,6 +165,12 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
162 # then add a link to those 165 # then add a link to those
163 $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $tmpdir/$module 166 $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $tmpdir/$module
164 done 167 done
168
169 # resign stripped modules
170 MODULE_SIG_ALL="$(grep -s '^CONFIG_MODULE_SIG_ALL=y' $KCONFIG_CONFIG || true)"
171 if [ -n "$MODULE_SIG_ALL" ]; then
172 INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_sign
173 fi
165 fi 174 fi
166fi 175fi
167 176
@@ -206,7 +215,7 @@ if [ -n "$DEBEMAIL" ]; then
206elif [ -n "$EMAIL" ]; then 215elif [ -n "$EMAIL" ]; then
207 email=$EMAIL 216 email=$EMAIL
208else 217else
209 email=$(id -nu)@$(hostname -f) 218 email=$(id -nu)@$(hostname -f 2>/dev/null || hostname)
210fi 219fi
211if [ -n "$DEBFULLNAME" ]; then 220if [ -n "$DEBFULLNAME" ]; then
212 name=$DEBFULLNAME 221 name=$DEBFULLNAME
@@ -230,7 +239,7 @@ fi
230 239
231# Generate a simple changelog template 240# Generate a simple changelog template
232cat <<EOF > debian/changelog 241cat <<EOF > debian/changelog
233linux-upstream ($packageversion) $distribution; urgency=low 242$sourcename ($packageversion) $distribution; urgency=low
234 243
235 * Custom built Linux kernel. 244 * Custom built Linux kernel.
236 245
@@ -257,12 +266,16 @@ On Debian GNU/Linux systems, the complete text of the GNU General Public
257License version 2 can be found in \`/usr/share/common-licenses/GPL-2'. 266License version 2 can be found in \`/usr/share/common-licenses/GPL-2'.
258EOF 267EOF
259 268
269
270build_depends="bc, kmod, cpio "
271
260# Generate a control file 272# Generate a control file
261cat <<EOF > debian/control 273cat <<EOF > debian/control
262Source: linux-upstream 274Source: $sourcename
263Section: kernel 275Section: kernel
264Priority: optional 276Priority: optional
265Maintainer: $maintainer 277Maintainer: $maintainer
278Build-Depends: $build_depends
266Standards-Version: 3.8.4 279Standards-Version: 3.8.4
267Homepage: http://www.kernel.org/ 280Homepage: http://www.kernel.org/
268EOF 281EOF
@@ -383,4 +396,33 @@ EOF
383 create_package "$dbg_packagename" "$dbg_dir" 396 create_package "$dbg_packagename" "$dbg_dir"
384fi 397fi
385 398
399if [ "x$1" = "xdeb-pkg" ]
400then
401 cat <<EOF > debian/rules
402#!/usr/bin/make -f
403
404build:
405 \$(MAKE)
406
407binary-arch:
408 \$(MAKE) KDEB_SOURCENAME=${sourcename} KDEB_PKGVERSION=${packageversion} bindeb-pkg
409
410clean:
411 rm -rf debian/*tmp
412 mv debian/ debian.backup # debian/ might be cleaned away
413 \$(MAKE) clean
414 mv debian.backup debian
415
416binary: binary-arch
417EOF
418 mv ${sourcename}.tar.gz ../${sourcename}_${version}.orig.tar.gz
419 tar caf ../${sourcename}_${packageversion}.debian.tar.gz debian/{copyright,rules,changelog,control}
420 dpkg-source -cdebian/control -ldebian/changelog --format="3.0 (custom)" --target-format="3.0 (quilt)" \
421 -b / ../${sourcename}_${version}.orig.tar.gz ../${sourcename}_${packageversion}.debian.tar.gz
422 mv ${sourcename}_${packageversion}*dsc ..
423 dpkg-genchanges > ../${sourcename}_${packageversion}_${debarch}.changes
424else
425 dpkg-genchanges -b > ../${sourcename}_${packageversion}_${debarch}.changes
426fi
427
386exit 0 428exit 0
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index d9ab94b17de0..71004daefe31 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -111,10 +111,8 @@ echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE"
111echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" 111echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE"
112 112
113echo "%ifnarch ppc64" 113echo "%ifnarch ppc64"
114echo 'cp vmlinux vmlinux.orig' 114echo 'bzip2 -9 --keep vmlinux'
115echo 'bzip2 -9 vmlinux'
116echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2" 115echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2"
117echo 'mv vmlinux.orig vmlinux'
118echo "%endif" 116echo "%endif"
119 117
120if ! $PREBUILT; then 118if ! $PREBUILT; then
@@ -142,7 +140,6 @@ echo "fi"
142echo "" 140echo ""
143echo "%files" 141echo "%files"
144echo '%defattr (-, root, root)' 142echo '%defattr (-, root, root)'
145echo "%dir /lib/modules"
146echo "/lib/modules/$KERNELRELEASE" 143echo "/lib/modules/$KERNELRELEASE"
147echo "%exclude /lib/modules/$KERNELRELEASE/build" 144echo "%exclude /lib/modules/$KERNELRELEASE/build"
148echo "%exclude /lib/modules/$KERNELRELEASE/source" 145echo "%exclude /lib/modules/$KERNELRELEASE/source"
diff --git a/scripts/stackdelta b/scripts/stackdelta
new file mode 100755
index 000000000000..48eabf2f48f8
--- /dev/null
+++ b/scripts/stackdelta
@@ -0,0 +1,59 @@
1#!/usr/bin/perl
2
3# Read two files produced by the stackusage script, and show the
4# delta between them.
5#
6# Currently, only shows changes for functions listed in both files. We
7# could add an option to show also functions which have vanished or
8# appeared (which would often be due to gcc making other inlining
9# decisions).
10#
11# Another possible option would be a minimum absolute value for the
12# delta.
13#
14# A third possibility is for sorting by delta, but that can be
15# achieved by piping to sort -k5,5g.
16
17sub read_stack_usage_file {
18 my %su;
19 my $f = shift;
20 open(my $fh, '<', $f)
21 or die "cannot open $f: $!";
22 while (<$fh>) {
23 chomp;
24 my ($file, $func, $size, $type) = split;
25 # Old versions of gcc (at least 4.7) have an annoying quirk in
26 # that a (static) function whose name has been changed into
27 # for example ext4_find_unwritten_pgoff.isra.11 will show up
28 # in the .su file with a name of just "11". Since such a
29 # numeric suffix is likely to change across different
30 # commits/compilers/.configs or whatever else we're trying to
31 # tweak, we can't really track those functions, so we just
32 # silently skip them.
33 #
34 # Newer gcc (at least 5.0) report the full name, so again,
35 # since the suffix is likely to change, we strip it.
36 next if $func =~ m/^[0-9]+$/;
37 $func =~ s/\..*$//;
38 # Line numbers are likely to change; strip those.
39 $file =~ s/:[0-9]+$//;
40 $su{"${file}\t${func}"} = {size => $size, type => $type};
41 }
42 close($fh);
43 return \%su;
44}
45
46@ARGV == 2
47 or die "usage: $0 <old> <new>";
48
49my $old = read_stack_usage_file($ARGV[0]);
50my $new = read_stack_usage_file($ARGV[1]);
51my @common = sort grep {exists $new->{$_}} keys %$old;
52for (@common) {
53 my $x = $old->{$_}{size};
54 my $y = $new->{$_}{size};
55 my $delta = $y - $x;
56 if ($delta) {
57 printf "%s\t%d\t%d\t%+d\n", $_, $x, $y, $delta;
58 }
59}
diff --git a/scripts/stackusage b/scripts/stackusage
new file mode 100755
index 000000000000..8cf26640ef8a
--- /dev/null
+++ b/scripts/stackusage
@@ -0,0 +1,33 @@
1#!/bin/sh
2
3outfile=""
4now=`date +%s`
5
6while [ $# -gt 0 ]
7do
8 case "$1" in
9 -o)
10 outfile="$2"
11 shift 2;;
12 -h)
13 echo "usage: $0 [-o outfile] <make options/args>"
14 exit 0;;
15 *) break;;
16 esac
17done
18
19if [ -z "$outfile" ]
20then
21 outfile=`mktemp --tmpdir stackusage.$$.XXXX`
22fi
23
24KCFLAGS="${KCFLAGS} -fstack-usage" make "$@"
25
26# Prepend directory name to file names, remove column information,
27# make file:line/function/size/type properly tab-separated.
28find . -name '*.su' -newermt "@${now}" -print | \
29 xargs perl -MFile::Basename -pe \
30 '$d = dirname($ARGV); s#([^:]+:[0-9]+):[0-9]+:#$d/$1\t#;' | \
31 sort -k3,3nr > "${outfile}"
32
33echo "$0: output written to ${outfile}"
diff --git a/scripts/tags.sh b/scripts/tags.sh
index c0a932dff329..8e5aee6d9da2 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -170,7 +170,9 @@ exuberant()
170 --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' \ 170 --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' \
171 --regex-c='/^COMPAT_SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/compat_sys_\1/' \ 171 --regex-c='/^COMPAT_SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/compat_sys_\1/' \
172 --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \ 172 --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \
173 --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1_rcuidle/' \
173 --regex-c++='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1/' \ 174 --regex-c++='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1/' \
175 --regex-c++='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1_rcuidle/' \
174 --regex-c++='/PAGEFLAG\(([^,)]*).*/Page\1/' \ 176 --regex-c++='/PAGEFLAG\(([^,)]*).*/Page\1/' \
175 --regex-c++='/PAGEFLAG\(([^,)]*).*/SetPage\1/' \ 177 --regex-c++='/PAGEFLAG\(([^,)]*).*/SetPage\1/' \
176 --regex-c++='/PAGEFLAG\(([^,)]*).*/ClearPage\1/' \ 178 --regex-c++='/PAGEFLAG\(([^,)]*).*/ClearPage\1/' \
@@ -233,7 +235,9 @@ emacs()
233 --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \ 235 --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \
234 --regex='/^COMPAT_SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/compat_sys_\1/' \ 236 --regex='/^COMPAT_SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/compat_sys_\1/' \
235 --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \ 237 --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \
238 --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1_rcuidle/' \
236 --regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/' \ 239 --regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/' \
240 --regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1_rcuidle/' \
237 --regex='/PAGEFLAG(\([^,)]*\).*/Page\1/' \ 241 --regex='/PAGEFLAG(\([^,)]*\).*/Page\1/' \
238 --regex='/PAGEFLAG(\([^,)]*\).*/SetPage\1/' \ 242 --regex='/PAGEFLAG(\([^,)]*\).*/SetPage\1/' \
239 --regex='/PAGEFLAG(\([^,)]*\).*/ClearPage\1/' \ 243 --regex='/PAGEFLAG(\([^,)]*\).*/ClearPage\1/' \