diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-08 17:23:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-08 17:23:13 -0400 |
commit | d9241b22b58e012f26dd2244508d9f4837402af0 (patch) | |
tree | e8359d16b76e0c109d4bbaccf093765c373d9f24 | |
parent | 605e9710fb5fef0dd2bb49d7b75e46601df62112 (diff) | |
parent | 3716001bcb7f5822382ac1f2f54226b87312cc6b (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-- | .gitignore | 5 | ||||
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | scripts/coccinelle/api/platform_no_drv_owner.cocci | 73 | ||||
-rw-r--r-- | scripts/coccinelle/api/pm_runtime.cocci | 2 | ||||
-rw-r--r-- | scripts/coccinelle/api/simple_open.cocci | 4 | ||||
-rw-r--r-- | scripts/coccinelle/api/vma_pages.cocci | 60 | ||||
-rw-r--r-- | scripts/coccinelle/misc/ifaddr.cocci | 3 | ||||
-rw-r--r-- | scripts/coccinelle/misc/irqf_oneshot.cocci | 7 | ||||
-rw-r--r-- | scripts/coccinelle/misc/returnvar.cocci | 2 | ||||
-rw-r--r-- | scripts/coccinelle/misc/semicolon.cocci | 2 | ||||
-rw-r--r-- | scripts/coccinelle/misc/simple_return.cocci | 2 | ||||
-rw-r--r-- | scripts/package/Makefile | 54 | ||||
-rwxr-xr-x | scripts/package/builddeb | 90 | ||||
-rwxr-xr-x | scripts/package/mkspec | 5 | ||||
-rwxr-xr-x | scripts/stackdelta | 59 | ||||
-rwxr-xr-x | scripts/stackusage | 33 | ||||
-rwxr-xr-x | scripts/tags.sh | 4 |
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 @@ | |||
36 | modules.builtin | 36 | modules.builtin |
37 | Module.symvers | 37 | Module.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 | |||
89 | GSYMS | 91 | GSYMS |
90 | GTAGS | 92 | GTAGS |
91 | 93 | ||
94 | # id-utils files | ||
95 | ID | ||
96 | |||
92 | *.orig | 97 | *.orig |
93 | *~ | 98 | *~ |
94 | \#*# | 99 | \#*# |
@@ -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 | |||
9 | virtual report | 9 | virtual report |
10 | 10 | ||
11 | @match1@ | 11 | @match1@ |
12 | declarer name module_i2c_driver; | ||
12 | declarer name module_platform_driver; | 13 | declarer name module_platform_driver; |
13 | declarer name module_platform_driver_probe; | 14 | declarer name module_platform_driver_probe; |
14 | identifier __driver; | 15 | identifier __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@ | ||
35 | identifier match1.__driver; | ||
36 | @@ | ||
37 | static struct i2c_driver __driver = { | ||
38 | .driver = { | ||
39 | - .owner = THIS_MODULE, | ||
40 | } | ||
41 | }; | ||
42 | |||
31 | @match2@ | 43 | @match2@ |
32 | identifier __driver; | 44 | identifier __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@ | ||
66 | identifier 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)@ | ||
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 | |||
64 | @fix2_context depends on match2 && !patch && (context || org || report)@ | 98 | @fix2_context depends on match2 && !patch && (context || org || report)@ |
65 | identifier match2.__driver; | 99 | identifier match2.__driver; |
66 | position j0; | 100 | position j0; |
@@ -72,6 +106,17 @@ position j0; | |||
72 | } | 106 | } |
73 | }; | 107 | }; |
74 | 108 | ||
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 | |||
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; | |||
81 | msg = "No need to set .owner here. The core will do it." | 126 | msg = "No need to set .owner here. The core will do it." |
82 | coccilib.org.print_todo(j0[0], msg) | 127 | coccilib.org.print_todo(j0[0], msg) |
83 | 128 | ||
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 | |||
84 | @script:python fix2_org depends on org@ | 136 | @script:python fix2_org depends on org@ |
85 | j0 << fix2_context.j0; | 137 | j0 << fix2_context.j0; |
86 | @@ | 138 | @@ |
@@ -88,6 +140,13 @@ j0 << fix2_context.j0; | |||
88 | msg = "No need to set .owner here. The core will do it." | 140 | msg = "No need to set .owner here. The core will do it." |
89 | coccilib.org.print_todo(j0[0], msg) | 141 | coccilib.org.print_todo(j0[0], msg) |
90 | 142 | ||
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 | |||
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; | |||
97 | msg = "No need to set .owner here. The core will do it." | 156 | msg = "No need to set .owner here. The core will do it." |
98 | coccilib.report.print_report(j0[0], msg) | 157 | coccilib.report.print_report(j0[0], msg) |
99 | 158 | ||
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 | |||
100 | @script:python fix2_report depends on report@ | 166 | @script:python fix2_report depends on report@ |
101 | j0 << fix2_context.j0; | 167 | j0 << fix2_context.j0; |
102 | @@ | 168 | @@ |
@@ -104,3 +170,10 @@ j0 << fix2_context.j0; | |||
104 | msg = "No need to set .owner here. The core will do it." | 170 | msg = "No need to set .owner here. The core will do it." |
105 | coccilib.report.print_report(j0[0], msg) | 171 | coccilib.report.print_report(j0[0], msg) |
106 | 172 | ||
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 | |||
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 | |||
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) | ||
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 | ||
25 | RPM := $(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 |
29 | KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE)) | 25 | KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE)) |
26 | KDEB_SOURCENAME ?= linux-$(KERNELRELEASE) | ||
27 | export 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 |
31 | TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \ | 29 | TAR_CONTENT := $(KBUILD_ALLDIRS) .config .scmversion Makefile \ |
32 | Kbuild Kconfig COPYING $(wildcard localversion*) | 30 | Kbuild Kconfig COPYING $(wildcard localversion*) |
33 | TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT)) | ||
34 | MKSPEC := $(srctree)/scripts/package/mkspec | 31 | MKSPEC := $(srctree)/scripts/package/mkspec |
35 | 32 | ||
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 | |||
36 | # rpm-pkg | 47 | # rpm-pkg |
37 | # --------------------------------------------------------------------------- | 48 | # --------------------------------------------------------------------------- |
38 | rpm-pkg rpm: FORCE | 49 | 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 | ||
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 | ||
89 | deb-pkg: FORCE | 90 | 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 | ||
90 | $(MAKE) KBUILD_SRC= | 97 | $(MAKE) KBUILD_SRC= |
91 | $(call cmd,builddeb) | 98 | +$(call cmd,builddeb) |
92 | 99 | ||
93 | clean-dirs += $(objtree)/debian/ | 100 | clean-dirs += $(objtree)/debian/ |
94 | 101 | ||
@@ -133,8 +140,9 @@ perf-%pkg: FORCE | |||
133 | # --------------------------------------------------------------------------- | 140 | # --------------------------------------------------------------------------- |
134 | help: FORCE | 141 | help: 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 | |||
15 | create_package() { | 15 | create_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 | |||
35 | set_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 | |||
76 | else | 79 | else |
77 | packageversion=$version-$revision | 80 | packageversion=$version-$revision |
78 | fi | 81 | fi |
82 | sourcename=$KDEB_SOURCENAME | ||
79 | tmpdir="$objtree/debian/tmp" | 83 | tmpdir="$objtree/debian/tmp" |
80 | fwdir="$objtree/debian/fwtmp" | 84 | fwdir="$objtree/debian/fwtmp" |
81 | kernel_headers_dir="$objtree/debian/hdrtmp" | 85 | kernel_headers_dir="$objtree/debian/hdrtmp" |
@@ -86,6 +90,9 @@ fwpackagename=linux-firmware-image-$version | |||
86 | kernel_headers_packagename=linux-headers-$version | 90 | kernel_headers_packagename=linux-headers-$version |
87 | libc_headers_packagename=linux-libc-dev | 91 | libc_headers_packagename=linux-libc-dev |
88 | dbg_packagename=$packagename-dbg | 92 | dbg_packagename=$packagename-dbg |
93 | debarch= | ||
94 | forcearch= | ||
95 | set_debarch | ||
89 | 96 | ||
90 | if [ "$ARCH" = "um" ] ; then | 97 | if [ "$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 |
111 | rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" | 118 | rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" |
112 | mkdir -m 755 -p "$tmpdir/DEBIAN" | 119 | mkdir -m 755 -p "$tmpdir/DEBIAN" |
113 | mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" | 120 | mkdir -p "$tmpdir/lib" "$tmpdir/boot" |
114 | mkdir -m 755 -p "$fwdir/DEBIAN" | 121 | mkdir -p "$fwdir/lib/firmware/$version/" |
115 | mkdir -p "$fwdir/lib/firmware/$version/" "$fwdir/usr/share/doc/$fwpackagename" | ||
116 | mkdir -m 755 -p "$libc_headers_dir/DEBIAN" | ||
117 | mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" | ||
118 | mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" | ||
119 | mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename" | ||
120 | mkdir -p "$kernel_headers_dir/lib/modules/$version/" | 122 | mkdir -p "$kernel_headers_dir/lib/modules/$version/" |
121 | if [ "$ARCH" = "um" ] ; then | ||
122 | mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" | ||
123 | fi | ||
124 | if [ -n "$BUILD_DEBUG" ] ; then | ||
125 | mkdir -p "$dbg_dir/usr/share/doc/$dbg_packagename" | ||
126 | mkdir -m 755 -p "$dbg_dir/DEBIAN" | ||
127 | fi | ||
128 | 123 | ||
129 | # Build and install the kernel | 124 | # Build and install the kernel |
130 | if [ "$ARCH" = "um" ] ; then | 125 | if [ "$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" |
144 | fi | 140 | fi |
145 | 141 | ||
142 | if 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 | ||
147 | fi | ||
148 | |||
146 | if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then | 149 | if 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 |
166 | fi | 175 | fi |
167 | 176 | ||
@@ -206,7 +215,7 @@ if [ -n "$DEBEMAIL" ]; then | |||
206 | elif [ -n "$EMAIL" ]; then | 215 | elif [ -n "$EMAIL" ]; then |
207 | email=$EMAIL | 216 | email=$EMAIL |
208 | else | 217 | else |
209 | email=$(id -nu)@$(hostname -f) | 218 | email=$(id -nu)@$(hostname -f 2>/dev/null || hostname) |
210 | fi | 219 | fi |
211 | if [ -n "$DEBFULLNAME" ]; then | 220 | if [ -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 |
232 | cat <<EOF > debian/changelog | 241 | cat <<EOF > debian/changelog |
233 | linux-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 | |||
257 | License version 2 can be found in \`/usr/share/common-licenses/GPL-2'. | 266 | License version 2 can be found in \`/usr/share/common-licenses/GPL-2'. |
258 | EOF | 267 | EOF |
259 | 268 | ||
269 | |||
270 | build_depends="bc, kmod, cpio " | ||
271 | |||
260 | # Generate a control file | 272 | # Generate a control file |
261 | cat <<EOF > debian/control | 273 | cat <<EOF > debian/control |
262 | Source: linux-upstream | 274 | Source: $sourcename |
263 | Section: kernel | 275 | Section: kernel |
264 | Priority: optional | 276 | Priority: optional |
265 | Maintainer: $maintainer | 277 | Maintainer: $maintainer |
278 | Build-Depends: $build_depends | ||
266 | Standards-Version: 3.8.4 | 279 | Standards-Version: 3.8.4 |
267 | Homepage: http://www.kernel.org/ | 280 | Homepage: http://www.kernel.org/ |
268 | EOF | 281 | EOF |
@@ -383,4 +396,33 @@ EOF | |||
383 | create_package "$dbg_packagename" "$dbg_dir" | 396 | create_package "$dbg_packagename" "$dbg_dir" |
384 | fi | 397 | fi |
385 | 398 | ||
399 | if [ "x$1" = "xdeb-pkg" ] | ||
400 | then | ||
401 | cat <<EOF > debian/rules | ||
402 | #!/usr/bin/make -f | ||
403 | |||
404 | build: | ||
405 | \$(MAKE) | ||
406 | |||
407 | binary-arch: | ||
408 | \$(MAKE) KDEB_SOURCENAME=${sourcename} KDEB_PKGVERSION=${packageversion} bindeb-pkg | ||
409 | |||
410 | clean: | ||
411 | rm -rf debian/*tmp | ||
412 | mv debian/ debian.backup # debian/ might be cleaned away | ||
413 | \$(MAKE) clean | ||
414 | mv debian.backup debian | ||
415 | |||
416 | binary: binary-arch | ||
417 | EOF | ||
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 | ||
424 | else | ||
425 | dpkg-genchanges -b > ../${sourcename}_${packageversion}_${debarch}.changes | ||
426 | fi | ||
427 | |||
386 | exit 0 | 428 | exit 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" | |||
111 | echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" | 111 | echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" |
112 | 112 | ||
113 | echo "%ifnarch ppc64" | 113 | echo "%ifnarch ppc64" |
114 | echo 'cp vmlinux vmlinux.orig' | 114 | echo 'bzip2 -9 --keep vmlinux' |
115 | echo 'bzip2 -9 vmlinux' | ||
116 | echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2" | 115 | echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2" |
117 | echo 'mv vmlinux.orig vmlinux' | ||
118 | echo "%endif" | 116 | echo "%endif" |
119 | 117 | ||
120 | if ! $PREBUILT; then | 118 | if ! $PREBUILT; then |
@@ -142,7 +140,6 @@ echo "fi" | |||
142 | echo "" | 140 | echo "" |
143 | echo "%files" | 141 | echo "%files" |
144 | echo '%defattr (-, root, root)' | 142 | echo '%defattr (-, root, root)' |
145 | echo "%dir /lib/modules" | ||
146 | echo "/lib/modules/$KERNELRELEASE" | 143 | echo "/lib/modules/$KERNELRELEASE" |
147 | echo "%exclude /lib/modules/$KERNELRELEASE/build" | 144 | echo "%exclude /lib/modules/$KERNELRELEASE/build" |
148 | echo "%exclude /lib/modules/$KERNELRELEASE/source" | 145 | echo "%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 | |||
17 | sub 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 | |||
49 | my $old = read_stack_usage_file($ARGV[0]); | ||
50 | my $new = read_stack_usage_file($ARGV[1]); | ||
51 | my @common = sort grep {exists $new->{$_}} keys %$old; | ||
52 | for (@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 | |||
3 | outfile="" | ||
4 | now=`date +%s` | ||
5 | |||
6 | while [ $# -gt 0 ] | ||
7 | do | ||
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 | ||
17 | done | ||
18 | |||
19 | if [ -z "$outfile" ] | ||
20 | then | ||
21 | outfile=`mktemp --tmpdir stackusage.$$.XXXX` | ||
22 | fi | ||
23 | |||
24 | KCFLAGS="${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. | ||
28 | find . -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 | |||
33 | echo "$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/' \ |