Skip to content

Commit d9241b2

Browse files
committed
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 ...
2 parents 605e971 + 3716001 commit d9241b2

17 files changed

+345
-61
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
modules.builtin
3737
Module.symvers
3838
*.dwo
39+
*.su
3940

4041
#
4142
# Top-level generic files
@@ -44,6 +45,7 @@ Module.symvers
4445
/TAGS
4546
/linux
4647
/vmlinux
48+
/vmlinux.32
4749
/vmlinux-gdb.py
4850
/vmlinuz
4951
/System.map
@@ -89,6 +91,9 @@ GRTAGS
8991
GSYMS
9092
GTAGS
9193

94+
# id-utils files
95+
ID
96+
9297
*.orig
9398
*~
9499
\#*#

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,7 @@ clean: $(clean-dirs)
14251425
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
14261426
-o -name '*.ko.*' \
14271427
-o -name '*.dwo' \
1428+
-o -name '*.su' \
14281429
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
14291430
-o -name '*.symtypes' -o -name 'modules.order' \
14301431
-o -name modules.builtin -o -name '.tmp_*.o.*' \

scripts/coccinelle/api/platform_no_drv_owner.cocci

+73
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ virtual org
99
virtual report
1010

1111
@match1@
12+
declarer name module_i2c_driver;
1213
declarer name module_platform_driver;
1314
declarer name module_platform_driver_probe;
1415
identifier __driver;
1516
@@
1617
(
18+
module_i2c_driver(__driver);
19+
|
1720
module_platform_driver(__driver);
1821
|
1922
module_platform_driver_probe(__driver, ...);
@@ -28,6 +31,15 @@ identifier match1.__driver;
2831
}
2932
};
3033

34+
@fix1_i2c depends on match1 && patch && !context && !org && !report@
35+
identifier match1.__driver;
36+
@@
37+
static struct i2c_driver __driver = {
38+
.driver = {
39+
- .owner = THIS_MODULE,
40+
}
41+
};
42+
3143
@match2@
3244
identifier __driver;
3345
@@
@@ -37,6 +49,8 @@ identifier __driver;
3749
platform_driver_probe(&__driver, ...)
3850
|
3951
platform_create_bundle(&__driver, ...)
52+
|
53+
i2c_add_driver(&__driver)
4054
)
4155

4256
@fix2 depends on match2 && patch && !context && !org && !report@
@@ -48,6 +62,15 @@ identifier match2.__driver;
4862
}
4963
};
5064

65+
@fix2_i2c depends on match2 && patch && !context && !org && !report@
66+
identifier match2.__driver;
67+
@@
68+
static struct i2c_driver __driver = {
69+
.driver = {
70+
- .owner = THIS_MODULE,
71+
}
72+
};
73+
5174
// ----------------------------------------------------------------------------
5275

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

87+
@fix1_i2c_context depends on match1 && !patch && (context || org || report)@
88+
identifier match1.__driver;
89+
position j0;
90+
@@
91+
92+
static struct i2c_driver __driver = {
93+
.driver = {
94+
* .owner@j0 = THIS_MODULE,
95+
}
96+
};
97+
6498
@fix2_context depends on match2 && !patch && (context || org || report)@
6599
identifier match2.__driver;
66100
position j0;
@@ -72,6 +106,17 @@ position j0;
72106
}
73107
};
74108

109+
@fix2_i2c_context depends on match2 && !patch && (context || org || report)@
110+
identifier match2.__driver;
111+
position j0;
112+
@@
113+
114+
static struct i2c_driver __driver = {
115+
.driver = {
116+
* .owner@j0 = THIS_MODULE,
117+
}
118+
};
119+
75120
// ----------------------------------------------------------------------------
76121

77122
@script:python fix1_org depends on org@
@@ -81,13 +126,27 @@ j0 << fix1_context.j0;
81126
msg = "No need to set .owner here. The core will do it."
82127
coccilib.org.print_todo(j0[0], msg)
83128
129+
@script:python fix1_i2c_org depends on org@
130+
j0 << fix1_i2c_context.j0;
131+
@@
132+
133+
msg = "No need to set .owner here. The core will do it."
134+
coccilib.org.print_todo(j0[0], msg)
135+
84136
@script:python fix2_org depends on org@
85137
j0 << fix2_context.j0;
86138
@@
87139
88140
msg = "No need to set .owner here. The core will do it."
89141
coccilib.org.print_todo(j0[0], msg)
90142
143+
@script:python fix2_i2c_org depends on org@
144+
j0 << fix2_i2c_context.j0;
145+
@@
146+
147+
msg = "No need to set .owner here. The core will do it."
148+
coccilib.org.print_todo(j0[0], msg)
149+
91150
// ----------------------------------------------------------------------------
92151
93152
@script:python fix1_report depends on report@
@@ -97,10 +156,24 @@ j0 << fix1_context.j0;
97156
msg = "No need to set .owner here. The core will do it."
98157
coccilib.report.print_report(j0[0], msg)
99158
159+
@script:python fix1_i2c_report depends on report@
160+
j0 << fix1_i2c_context.j0;
161+
@@
162+
163+
msg = "No need to set .owner here. The core will do it."
164+
coccilib.report.print_report(j0[0], msg)
165+
100166
@script:python fix2_report depends on report@
101167
j0 << fix2_context.j0;
102168
@@
103169
104170
msg = "No need to set .owner here. The core will do it."
105171
coccilib.report.print_report(j0[0], msg)
106172
173+
@script:python fix2_i2c_report depends on report@
174+
j0 << fix2_i2c_context.j0;
175+
@@
176+
177+
msg = "No need to set .owner here. The core will do it."
178+
coccilib.report.print_report(j0[0], msg)
179+

scripts/coccinelle/api/pm_runtime.cocci

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// Make sure pm_runtime_* calls does not use unnecessary IS_ERR_VALUE
2-
//
2+
///
33
// Keywords: pm_runtime
44
// Confidence: Medium
55
// Copyright (C) 2013 Texas Instruments Incorporated - GPLv2.

scripts/coccinelle/api/simple_open.cocci

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/// This removes an open coded simple_open() function
2-
/// and replaces file operations references to the function
1+
/// Remove an open coded simple_open() function
2+
/// and replace file operations references to the function
33
/// with simple_open() instead.
44
///
55
// Confidence: High
+60
Original file line numberDiff line numberDiff line change
@@ -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+
8+
virtual context
9+
virtual patch
10+
virtual org
11+
virtual report
12+
13+
//----------------------------------------------------------
14+
// For context mode
15+
//----------------------------------------------------------
16+
17+
@r_context depends on context && !patch && !org && !report@
18+
struct 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@
28+
struct 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)@
39+
struct vm_area_struct *vma;
40+
position p;
41+
@@
42+
43+
(vma->vm_end@p - vma->vm_start) >> PAGE_SHIFT
44+
45+
@script:python depends on report@
46+
p << r_org.p;
47+
x << r_org.vma;
48+
@@
49+
50+
msg="WARNING: Consider using vma_pages helper on %s" % (x)
51+
coccilib.report.print_report(p[0], msg)
52+
53+
@script:python depends on org@
54+
p << r_org.p;
55+
x << r_org.vma;
56+
@@
57+
58+
msg="WARNING: Consider using vma_pages helper on %s" % (x)
59+
msg_safe=msg.replace("[","@(").replace("]",")")
60+
coccilib.org.print_todo(p[0], msg_safe)

scripts/coccinelle/misc/ifaddr.cocci

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
/// the address of a variable or field is non-zero is likely always to bo
2-
/// non-zero
1+
/// The address of a variable or field is likely always to be non-zero.
32
///
43
// Confidence: High
54
// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.

scripts/coccinelle/misc/irqf_oneshot.cocci

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
/// Make sure threaded IRQs without a primary handler are always request with
2-
/// IRQF_ONESHOT
1+
/// Since commit 1c6c69525b40 ("genirq: Reject bogus threaded irq requests")
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.
36
///
47
//
58
// Confidence: Good

scripts/coccinelle/misc/returnvar.cocci

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
///
2-
/// Removes unneeded variable used to store return value.
2+
/// Remove unneeded variable used to store return value.
33
///
44
// Confidence: Moderate
55
// Copyright: (C) 2012 Peter Senna Tschudin, INRIA/LIP6. GPLv2.

scripts/coccinelle/misc/semicolon.cocci

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
///
2-
/// Removes unneeded semicolon.
2+
/// Remove unneeded semicolon.
33
///
44
// Confidence: Moderate
55
// Copyright: (C) 2012 Peter Senna Tschudin, INRIA/LIP6. GPLv2.

scripts/coccinelle/misc/simple_return.cocci

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// Simplify a trivial if-return sequence. Possibly combine with a
22
/// preceding function call.
3-
//
3+
///
44
// Confidence: High
55
// Copyright: (C) 2014 Julia Lawall, INRIA/LIP6. GPLv2.
66
// Copyright: (C) 2014 Gilles Muller, INRIA/LiP6. GPLv2.

scripts/package/Makefile

+31-23
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,38 @@
2121
# Note that the rpm-pkg target cannot be used with KBUILD_OUTPUT,
2222
# but the binrpm-pkg target can; for some reason O= gets ignored.
2323

24-
# Do we have rpmbuild, otherwise fall back to the older rpm
25-
RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
26-
else echo rpm; fi)
27-
2824
# Remove hyphens since they have special meaning in RPM filenames
2925
KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
26+
KDEB_SOURCENAME ?= linux-$(KERNELRELEASE)
27+
export KDEB_SOURCENAME
3028
# Include only those top-level files that are needed by make, plus the GPL copy
31-
TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \
29+
TAR_CONTENT := $(KBUILD_ALLDIRS) .config .scmversion Makefile \
3230
Kbuild Kconfig COPYING $(wildcard localversion*)
33-
TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT))
3431
MKSPEC := $(srctree)/scripts/package/mkspec
3532

33+
quiet_cmd_src_tar = TAR $(2).tar.gz
34+
cmd_src_tar = \
35+
if 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; \
40+
fi ; \
41+
$(srctree)/scripts/setlocalversion --save-scmversion; \
42+
ln -sf $(srctree) $(2); \
43+
tar -cz $(RCS_TAR_IGNORE) -f $(2).tar.gz \
44+
$(addprefix $(2)/,$(TAR_CONTENT) $(3)); \
45+
rm -f $(2) $(objtree)/.scmversion
46+
3647
# rpm-pkg
3748
# ---------------------------------------------------------------------------
3849
rpm-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
4550
$(MAKE) clean
46-
ln -sf $(srctree) $(KERNELPATH)
4751
$(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
48-
$(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion
49-
tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(TAR_CONTENT)
50-
rm $(KERNELPATH)
51-
rm -f $(objtree)/.scmversion
52+
$(call cmd,src_tar,$(KERNELPATH),kernel.spec)
5253
$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
5354
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
5556
rm $(KERNELPATH).tar.gz kernel.spec
5657

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

65-
$(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \
66+
rpmbuild --define "_builddir $(objtree)" --target \
6667
$(UTS_MACHINE) -bb $(objtree)/binkernel.spec
6768
rm binkernel.spec
6869

@@ -84,11 +85,17 @@ quiet_cmd_builddeb = BUILDDEB
8485
} && \
8586
\
8687
$$KBUILD_PKG_ROOTCMD $(CONFIG_SHELL) \
87-
$(srctree)/scripts/package/builddeb
88+
$(srctree)/scripts/package/builddeb $@
8889

8990
deb-pkg: FORCE
91+
$(MAKE) clean
92+
$(call cmd,src_tar,$(KDEB_SOURCENAME))
93+
$(MAKE) KBUILD_SRC=
94+
+$(call cmd,builddeb)
95+
96+
bindeb-pkg: FORCE
9097
$(MAKE) KBUILD_SRC=
91-
$(call cmd,builddeb)
98+
+$(call cmd,builddeb)
9299

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

@@ -133,8 +140,9 @@ perf-%pkg: FORCE
133140
# ---------------------------------------------------------------------------
134141
help: FORCE
135142
@echo ' rpm-pkg - Build both source and binary RPM kernel packages'
136-
@echo ' binrpm-pkg - Build only the binary kernel package'
137-
@echo ' deb-pkg - Build the kernel as a deb package'
143+
@echo ' binrpm-pkg - Build only the binary kernel RPM package'
144+
@echo ' deb-pkg - Build both source and binary deb kernel packages'
145+
@echo ' bindeb-pkg - Build only the binary kernel deb package'
138146
@echo ' tar-pkg - Build the kernel as an uncompressed tarball'
139147
@echo ' targz-pkg - Build the kernel as a gzip compressed tarball'
140148
@echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'

0 commit comments

Comments
 (0)