aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-11-10 03:10:44 -0500
committerIngo Molnar <mingo@elte.hu>2008-11-10 03:10:44 -0500
commita5a64498c194c82ecad3a2d67cff6231cda8d3dd (patch)
tree723d5d81419f9960b8d30ed9a2ece8a58d6c4328 /scripts
parentbb93d802ae5c1949977cc6da247b218240677f11 (diff)
parentf7160c7573615ec82c691e294cf80d920b5d588d (diff)
Merge commit 'v2.6.28-rc4' into timers/rtc
Conflicts: drivers/rtc/rtc-cmos.c
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.build13
-rw-r--r--scripts/Makefile.modpost2
-rw-r--r--scripts/basic/.gitignore2
-rw-r--r--scripts/bootgraph.pl39
-rwxr-xr-xscripts/checkpatch.pl2
-rwxr-xr-xscripts/checkstack.pl4
-rwxr-xr-xscripts/checksyscalls.sh6
-rw-r--r--scripts/headers_check.pl10
-rw-r--r--scripts/headers_install.pl17
-rw-r--r--scripts/kconfig/Makefile4
-rw-r--r--scripts/kconfig/confdata.c3
-rwxr-xr-xscripts/kernel-doc6
-rw-r--r--scripts/mod/sumversion.c12
-rw-r--r--scripts/package/builddeb24
-rwxr-xr-xscripts/package/mkspec5
-rwxr-xr-xscripts/recordmcount.pl415
-rwxr-xr-xscripts/setlocalversion6
17 files changed, 524 insertions, 46 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 277cfe0b7100..468fbc9016c7 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -198,10 +198,23 @@ cmd_modversions = \
198 fi; 198 fi;
199endif 199endif
200 200
201ifdef CONFIG_64BIT
202arch_bits = 64
203else
204arch_bits = 32
205endif
206
207ifdef CONFIG_FTRACE_MCOUNT_RECORD
208cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl \
209 "$(ARCH)" "$(arch_bits)" "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" \
210 "$(NM)" "$(RM)" "$(MV)" "$(@)";
211endif
212
201define rule_cc_o_c 213define rule_cc_o_c
202 $(call echo-cmd,checksrc) $(cmd_checksrc) \ 214 $(call echo-cmd,checksrc) $(cmd_checksrc) \
203 $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ 215 $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \
204 $(cmd_modversions) \ 216 $(cmd_modversions) \
217 $(cmd_record_mcount) \
205 scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ 218 scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \
206 $(dot-target).tmp; \ 219 $(dot-target).tmp; \
207 rm -f $(depfile); \ 220 rm -f $(depfile); \
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 9ee9783aea57..f4053dc7b5d6 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -82,7 +82,7 @@ modpost = scripts/mod/modpost \
82 $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \ 82 $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \
83 $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ 83 $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
84 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ 84 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
85 $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(EXTRA_SYMBOLS))) \ 85 $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \
86 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ 86 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
87 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ 87 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
88 $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \ 88 $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \
diff --git a/scripts/basic/.gitignore b/scripts/basic/.gitignore
index 7304e19782c7..bf8b199ec598 100644
--- a/scripts/basic/.gitignore
+++ b/scripts/basic/.gitignore
@@ -1,3 +1,3 @@
1hash
1fixdep 2fixdep
2split-include
3docproc 3docproc
diff --git a/scripts/bootgraph.pl b/scripts/bootgraph.pl
index 2243353fe55d..d2c61efc216f 100644
--- a/scripts/bootgraph.pl
+++ b/scripts/bootgraph.pl
@@ -37,13 +37,16 @@
37# dmesg | perl scripts/bootgraph.pl > output.svg 37# dmesg | perl scripts/bootgraph.pl > output.svg
38# 38#
39 39
40my @rows; 40use strict;
41my %start, %end, %row; 41
42my %start;
43my %end;
42my $done = 0; 44my $done = 0;
43my $rowcount = 0;
44my $maxtime = 0; 45my $maxtime = 0;
45my $firsttime = 100; 46my $firsttime = 100;
46my $count = 0; 47my $count = 0;
48my %pids;
49
47while (<>) { 50while (<>) {
48 my $line = $_; 51 my $line = $_;
49 if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_]+)\+/) { 52 if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_]+)\+/) {
@@ -54,14 +57,8 @@ while (<>) {
54 $firsttime = $1; 57 $firsttime = $1;
55 } 58 }
56 } 59 }
57 $row{$func} = 1;
58 if ($line =~ /\@ ([0-9]+)/) { 60 if ($line =~ /\@ ([0-9]+)/) {
59 my $pid = $1; 61 $pids{$func} = $1;
60 if (!defined($rows[$pid])) {
61 $rowcount = $rowcount + 1;
62 $rows[$pid] = $rowcount;
63 }
64 $row{$func} = $rows[$pid];
65 } 62 }
66 $count = $count + 1; 63 $count = $count + 1;
67 } 64 }
@@ -109,17 +106,27 @@ $styles[11] = "fill:rgb(128,255,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(
109my $mult = 950.0 / ($maxtime - $firsttime); 106my $mult = 950.0 / ($maxtime - $firsttime);
110my $threshold = ($maxtime - $firsttime) / 60.0; 107my $threshold = ($maxtime - $firsttime) / 60.0;
111my $stylecounter = 0; 108my $stylecounter = 0;
112while (($key,$value) = each %start) { 109my %rows;
110my $rowscount = 1;
111my @initcalls = sort { $start{$a} <=> $start{$b} } keys(%start);
112my $key;
113foreach $key (@initcalls) {
113 my $duration = $end{$key} - $start{$key}; 114 my $duration = $end{$key} - $start{$key};
114 115
115 if ($duration >= $threshold) { 116 if ($duration >= $threshold) {
116 my $s, $s2, $e, $y; 117 my ($s, $s2, $e, $w, $y, $y2, $style);
117 $s = ($value - $firsttime) * $mult; 118 my $pid = $pids{$key};
119
120 if (!defined($rows{$pid})) {
121 $rows{$pid} = $rowscount;
122 $rowscount = $rowscount + 1;
123 }
124 $s = ($start{$key} - $firsttime) * $mult;
118 $s2 = $s + 6; 125 $s2 = $s + 6;
119 $e = ($end{$key} - $firsttime) * $mult; 126 $e = ($end{$key} - $firsttime) * $mult;
120 $w = $e - $s; 127 $w = $e - $s;
121 128
122 $y = $row{$key} * 150; 129 $y = $rows{$pid} * 150;
123 $y2 = $y + 4; 130 $y2 = $y + 4;
124 131
125 $style = $styles[$stylecounter]; 132 $style = $styles[$stylecounter];
@@ -138,9 +145,9 @@ while (($key,$value) = each %start) {
138my $time = $firsttime; 145my $time = $firsttime;
139my $step = ($maxtime - $firsttime) / 15; 146my $step = ($maxtime - $firsttime) / 15;
140while ($time < $maxtime) { 147while ($time < $maxtime) {
141 my $s2 = ($time - $firsttime) * $mult; 148 my $s3 = ($time - $firsttime) * $mult;
142 my $tm = int($time * 100) / 100.0; 149 my $tm = int($time * 100) / 100.0;
143 print "<text transform=\"translate($s2,89) rotate(90)\">$tm</text>\n"; 150 print "<text transform=\"translate($s3,89) rotate(90)\">$tm</text>\n";
144 $time = $time + $step; 151 $time = $time + $step;
145} 152}
146 153
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e30bac141b21..f88bb3e21cda 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1,5 +1,5 @@
1#!/usr/bin/perl -w 1#!/usr/bin/perl -w
2# (c) 2001, Dave Jones. <davej@codemonkey.org.uk> (the file handling bit) 2# (c) 2001, Dave Jones. <davej@redhat.com> (the file handling bit)
3# (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit) 3# (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit)
4# (c) 2007, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite, etc) 4# (c) 2007, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite, etc)
5# Licensed under the terms of the GNU GPL License version 2 5# Licensed under the terms of the GNU GPL License version 2
diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index f7e8e93ff30d..14ee68e991dd 100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
@@ -14,6 +14,7 @@
14# M68k port by Geert Uytterhoeven and Andreas Schwab 14# M68k port by Geert Uytterhoeven and Andreas Schwab
15# AVR32 port by Haavard Skinnemoen <hskinnemoen@atmel.com> 15# AVR32 port by Haavard Skinnemoen <hskinnemoen@atmel.com>
16# PARISC port by Kyle McMartin <kyle@parisc-linux.org> 16# PARISC port by Kyle McMartin <kyle@parisc-linux.org>
17# sparc port by Martin Habets <errandir_news@mph.eclipse.co.uk>
17# 18#
18# Usage: 19# Usage:
19# objdump -d vmlinux | scripts/checkstack.pl [arch] 20# objdump -d vmlinux | scripts/checkstack.pl [arch]
@@ -94,6 +95,9 @@ my (@stack, $re, $dre, $x, $xs);
94 } elsif ($arch =~ /^blackfin$/) { 95 } elsif ($arch =~ /^blackfin$/) {
95 # 0: 00 e8 38 01 LINK 0x4e0; 96 # 0: 00 e8 38 01 LINK 0x4e0;
96 $re = qr/.*[[:space:]]LINK[[:space:]]*(0x$x{1,8})/o; 97 $re = qr/.*[[:space:]]LINK[[:space:]]*(0x$x{1,8})/o;
98 } elsif ($arch eq 'sparc' || $arch eq 'sparc64') {
99 # f0019d10: 9d e3 bf 90 save %sp, -112, %sp
100 $re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;
97 } else { 101 } else {
98 print("wrong or unknown architecture \"$arch\"\n"); 102 print("wrong or unknown architecture \"$arch\"\n");
99 exit 103 exit
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index 366f8c7f62bf..60d00d1c4eee 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -113,11 +113,11 @@ EOF
113} 113}
114 114
115syscall_list() { 115syscall_list() {
116sed -n -e '/^\#define/ { s/[^_]*__NR_\([^[:space:]]*\).*/\ 116sed -n -e '/^\#define/ s/[^_]*__NR_\([^[:space:]]*\).*/\
117\#if !defined \(__NR_\1\) \&\& !defined \(__IGNORE_\1\)\ 117\#if !defined \(__NR_\1\) \&\& !defined \(__IGNORE_\1\)\
118\#warning syscall \1 not implemented\ 118\#warning syscall \1 not implemented\
119\#endif/p }' $1 119\#endif/p' $1
120} 120}
121 121
122(ignore_list && syscall_list ${srctree}/include/asm-x86/unistd_32.h) | \ 122(ignore_list && syscall_list ${srctree}/arch/x86/include/asm/unistd_32.h) | \
123$* -E -x c - > /dev/null 123$* -E -x c - > /dev/null
diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl
index 15d53a6b1a1f..488a3b1f760f 100644
--- a/scripts/headers_check.pl
+++ b/scripts/headers_check.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl 1#!/usr/bin/perl -w
2# 2#
3# headers_check.pl execute a number of trivial consistency checks 3# headers_check.pl execute a number of trivial consistency checks
4# 4#
@@ -17,7 +17,6 @@
17# 2) TODO: check for leaked CONFIG_ symbols 17# 2) TODO: check for leaked CONFIG_ symbols
18 18
19use strict; 19use strict;
20use warnings;
21 20
22my ($dir, $arch, @files) = @ARGV; 21my ($dir, $arch, @files) = @ARGV;
23 22
@@ -27,14 +26,15 @@ my $lineno = 0;
27my $filename; 26my $filename;
28 27
29foreach my $file (@files) { 28foreach my $file (@files) {
29 local *FH;
30 $filename = $file; 30 $filename = $file;
31 open(my $fh, '<', "$filename") or die "$filename: $!\n"; 31 open(FH, "<$filename") or die "$filename: $!\n";
32 $lineno = 0; 32 $lineno = 0;
33 while ($line = <$fh>) { 33 while ($line = <FH>) {
34 $lineno++; 34 $lineno++;
35 check_include(); 35 check_include();
36 } 36 }
37 close $fh; 37 close FH;
38} 38}
39exit $ret; 39exit $ret;
40 40
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
index 68591cd08731..7d2b4146e02f 100644
--- a/scripts/headers_install.pl
+++ b/scripts/headers_install.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl 1#!/usr/bin/perl -w
2# 2#
3# headers_install prepare the listed header files for use in 3# headers_install prepare the listed header files for use in
4# user space and copy the files to their destination. 4# user space and copy the files to their destination.
@@ -17,28 +17,29 @@
17# 3) Drop all sections defined out by __KERNEL__ (using unifdef) 17# 3) Drop all sections defined out by __KERNEL__ (using unifdef)
18 18
19use strict; 19use strict;
20use warnings;
21 20
22my ($readdir, $installdir, $arch, @files) = @ARGV; 21my ($readdir, $installdir, $arch, @files) = @ARGV;
23 22
24my $unifdef = "scripts/unifdef -U__KERNEL__"; 23my $unifdef = "scripts/unifdef -U__KERNEL__";
25 24
26foreach my $file (@files) { 25foreach my $file (@files) {
26 local *INFILE;
27 local *OUTFILE;
27 my $tmpfile = "$installdir/$file.tmp"; 28 my $tmpfile = "$installdir/$file.tmp";
28 open(my $infile, '<', "$readdir/$file") 29 open(INFILE, "<$readdir/$file")
29 or die "$readdir/$file: $!\n"; 30 or die "$readdir/$file: $!\n";
30 open(my $outfile, '>', "$tmpfile") or die "$tmpfile: $!\n"; 31 open(OUTFILE, ">$tmpfile") or die "$tmpfile: $!\n";
31 while (my $line = <$infile>) { 32 while (my $line = <INFILE>) {
32 $line =~ s/([\s(])__user\s/$1/g; 33 $line =~ s/([\s(])__user\s/$1/g;
33 $line =~ s/([\s(])__force\s/$1/g; 34 $line =~ s/([\s(])__force\s/$1/g;
34 $line =~ s/([\s(])__iomem\s/$1/g; 35 $line =~ s/([\s(])__iomem\s/$1/g;
35 $line =~ s/\s__attribute_const__\s/ /g; 36 $line =~ s/\s__attribute_const__\s/ /g;
36 $line =~ s/\s__attribute_const__$//g; 37 $line =~ s/\s__attribute_const__$//g;
37 $line =~ s/^#include <linux\/compiler.h>//; 38 $line =~ s/^#include <linux\/compiler.h>//;
38 printf $outfile "%s", $line; 39 printf OUTFILE "%s", $line;
39 } 40 }
40 close $outfile; 41 close OUTFILE;
41 close $infile; 42 close INFILE;
42 system $unifdef . " $tmpfile > $installdir/$file"; 43 system $unifdef . " $tmpfile > $installdir/$file";
43 unlink $tmpfile; 44 unlink $tmpfile;
44} 45}
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index fa1a7d565903..fa8c2dd9c983 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -4,7 +4,11 @@
4 4
5PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config 5PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
6 6
7ifdef KBUILD_KCONFIG
8Kconfig := $(KBUILD_KCONFIG)
9else
7Kconfig := arch/$(SRCARCH)/Kconfig 10Kconfig := arch/$(SRCARCH)/Kconfig
11endif
8 12
9xconfig: $(obj)/qconf 13xconfig: $(obj)/qconf
10 $< $(Kconfig) 14 $< $(Kconfig)
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index b91cf241a539..830d9eae11f9 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -852,8 +852,7 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
852 852
853 } 853 }
854 854
855 if (modules_sym) 855 sym_clear_all_valid();
856 sym_calc_value(modules_sym);
857 856
858 if (mode != def_random) 857 if (mode != def_random)
859 return; 858 return;
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 44ee94d2ab76..a53e2fc8dfb5 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1648,7 +1648,7 @@ sub dump_function($$) {
1648 $prototype =~ s/^noinline +//; 1648 $prototype =~ s/^noinline +//;
1649 $prototype =~ s/__devinit +//; 1649 $prototype =~ s/__devinit +//;
1650 $prototype =~ s/__init +//; 1650 $prototype =~ s/__init +//;
1651 $prototype =~ s/^#define\s+//; #ak added 1651 $prototype =~ s/^#\s*define\s+//; #ak added
1652 $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; 1652 $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//;
1653 1653
1654 # Yes, this truly is vile. We are looking for: 1654 # Yes, this truly is vile. We are looking for:
@@ -1764,13 +1764,13 @@ sub process_state3_function($$) {
1764 1764
1765 $x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line 1765 $x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line
1766 1766
1767 if ($x =~ m#\s*/\*\s+MACDOC\s*#io || ($x =~ /^#/ && $x !~ /^#define/)) { 1767 if ($x =~ m#\s*/\*\s+MACDOC\s*#io || ($x =~ /^#/ && $x !~ /^#\s*define/)) {
1768 # do nothing 1768 # do nothing
1769 } 1769 }
1770 elsif ($x =~ /([^\{]*)/) { 1770 elsif ($x =~ /([^\{]*)/) {
1771 $prototype .= $1; 1771 $prototype .= $1;
1772 } 1772 }
1773 if (($x =~ /\{/) || ($x =~ /\#define/) || ($x =~ /;/)) { 1773 if (($x =~ /\{/) || ($x =~ /\#\s*define/) || ($x =~ /;/)) {
1774 $prototype =~ s@/\*.*?\*/@@gos; # strip comments. 1774 $prototype =~ s@/\*.*?\*/@@gos; # strip comments.
1775 $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's. 1775 $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's.
1776 $prototype =~ s@^\s+@@gos; # strip leading spaces 1776 $prototype =~ s@^\s+@@gos; # strip leading spaces
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c
index d9cc6901d680..aadc5223dcdb 100644
--- a/scripts/mod/sumversion.c
+++ b/scripts/mod/sumversion.c
@@ -290,6 +290,15 @@ static int parse_file(const char *fname, struct md4_ctx *md)
290 release_file(file, len); 290 release_file(file, len);
291 return 1; 291 return 1;
292} 292}
293/* Check whether the file is a static library or not */
294static int is_static_library(const char *objfile)
295{
296 int len = strlen(objfile);
297 if (objfile[len - 2] == '.' && objfile[len - 1] == 'a')
298 return 1;
299 else
300 return 0;
301}
293 302
294/* We have dir/file.o. Open dir/.file.o.cmd, look for deps_ line to 303/* We have dir/file.o. Open dir/.file.o.cmd, look for deps_ line to
295 * figure out source file. */ 304 * figure out source file. */
@@ -420,7 +429,8 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
420 while ((fname = strsep(&sources, " ")) != NULL) { 429 while ((fname = strsep(&sources, " ")) != NULL) {
421 if (!*fname) 430 if (!*fname)
422 continue; 431 continue;
423 if (!parse_source_files(fname, &md)) 432 if (!(is_static_library(fname)) &&
433 !parse_source_files(fname, &md))
424 goto release; 434 goto release;
425 } 435 }
426 436
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index ba6bf5d5abf9..1264b8e2829d 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -15,15 +15,18 @@ set -e
15version=$KERNELRELEASE 15version=$KERNELRELEASE
16revision=`cat .version` 16revision=`cat .version`
17tmpdir="$objtree/debian/tmp" 17tmpdir="$objtree/debian/tmp"
18fwdir="$objtree/debian/fwtmp"
18packagename=linux-$version 19packagename=linux-$version
20fwpackagename=linux-firmware-image
19 21
20if [ "$ARCH" == "um" ] ; then 22if [ "$ARCH" == "um" ] ; then
21 packagename=user-mode-linux-$version 23 packagename=user-mode-linux-$version
22fi 24fi
23 25
24# Setup the directory structure 26# Setup the directory structure
25rm -rf "$tmpdir" 27rm -rf "$tmpdir" "$fwdir"
26mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" 28mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot"
29mkdir -p "$fwdir/DEBIAN" "$fwdir/lib"
27if [ "$ARCH" == "um" ] ; then 30if [ "$ARCH" == "um" ] ; then
28 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/share/doc/$packagename" "$tmpdir/usr/bin" 31 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/share/doc/$packagename" "$tmpdir/usr/bin"
29fi 32fi
@@ -107,6 +110,7 @@ Standards-Version: 3.6.1
107 110
108Package: $packagename 111Package: $packagename
109Provides: kernel-image-$version, linux-image-$version 112Provides: kernel-image-$version, linux-image-$version
113Suggests: $fwpackagename
110Architecture: any 114Architecture: any
111Description: Linux kernel, version $version 115Description: Linux kernel, version $version
112 This package contains the Linux kernel, modules and corresponding other 116 This package contains the Linux kernel, modules and corresponding other
@@ -118,8 +122,24 @@ fi
118chown -R root:root "$tmpdir" 122chown -R root:root "$tmpdir"
119chmod -R go-w "$tmpdir" 123chmod -R go-w "$tmpdir"
120 124
125# Do we have firmware? Move it out of the way and build it into a package.
126if [ -e "$tmpdir/lib/firmware" ]; then
127 mv "$tmpdir/lib/firmware" "$fwdir/lib/"
128
129 cat <<EOF >> debian/control
130
131Package: $fwpackagename
132Architecture: all
133Description: Linux kernel firmware, version $version
134 This package contains firmware from the Linux kernel, version $version
135EOF
136
137 dpkg-gencontrol -isp -p$fwpackagename -P"$fwdir"
138 dpkg --build "$fwdir" ..
139fi
140
121# Perform the final magic 141# Perform the final magic
122dpkg-gencontrol -isp 142dpkg-gencontrol -isp -p$packagename
123dpkg --build "$tmpdir" .. 143dpkg --build "$tmpdir" ..
124 144
125exit 0 145exit 0
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index ffd61fe0c1ad..2500886fb90a 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -57,15 +57,17 @@ fi
57echo "%build" 57echo "%build"
58 58
59if ! $PREBUILT; then 59if ! $PREBUILT; then
60echo "make clean && make %{_smp_mflags}" 60echo "make clean && make %{?_smp_mflags}"
61echo "" 61echo ""
62fi 62fi
63 63
64echo "%install" 64echo "%install"
65echo "%ifarch ia64" 65echo "%ifarch ia64"
66echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules' 66echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
67echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
67echo "%else" 68echo "%else"
68echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules' 69echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
70echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
69echo "%endif" 71echo "%endif"
70 72
71echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install' 73echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install'
@@ -92,5 +94,6 @@ echo "%files"
92echo '%defattr (-, root, root)' 94echo '%defattr (-, root, root)'
93echo "%dir /lib/modules" 95echo "%dir /lib/modules"
94echo "/lib/modules/$KERNELRELEASE" 96echo "/lib/modules/$KERNELRELEASE"
97echo "/lib/firmware"
95echo "/boot/*" 98echo "/boot/*"
96echo "" 99echo ""
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
new file mode 100755
index 000000000000..6b9fe3eb8360
--- /dev/null
+++ b/scripts/recordmcount.pl
@@ -0,0 +1,415 @@
1#!/usr/bin/perl -w
2# (c) 2008, Steven Rostedt <srostedt@redhat.com>
3# Licensed under the terms of the GNU GPL License version 2
4#
5# recordmcount.pl - makes a section called __mcount_loc that holds
6# all the offsets to the calls to mcount.
7#
8#
9# What we want to end up with is a section in vmlinux called
10# __mcount_loc that contains a list of pointers to all the
11# call sites in the kernel that call mcount. Later on boot up, the kernel
12# will read this list, save the locations and turn them into nops.
13# When tracing or profiling is later enabled, these locations will then
14# be converted back to pointers to some function.
15#
16# This is no easy feat. This script is called just after the original
17# object is compiled and before it is linked.
18#
19# The references to the call sites are offsets from the section of text
20# that the call site is in. Hence, all functions in a section that
21# has a call site to mcount, will have the offset from the beginning of
22# the section and not the beginning of the function.
23#
24# The trick is to find a way to record the beginning of the section.
25# The way we do this is to look at the first function in the section
26# which will also be the location of that section after final link.
27# e.g.
28#
29# .section ".text.sched"
30# .globl my_func
31# my_func:
32# [...]
33# call mcount (offset: 0x5)
34# [...]
35# ret
36# other_func:
37# [...]
38# call mcount (offset: 0x1b)
39# [...]
40#
41# Both relocation offsets for the mcounts in the above example will be
42# offset from .text.sched. If we make another file called tmp.s with:
43#
44# .section __mcount_loc
45# .quad my_func + 0x5
46# .quad my_func + 0x1b
47#
48# We can then compile this tmp.s into tmp.o, and link it to the original
49# object.
50#
51# But this gets hard if my_func is not globl (a static function).
52# In such a case we have:
53#
54# .section ".text.sched"
55# my_func:
56# [...]
57# call mcount (offset: 0x5)
58# [...]
59# ret
60# .globl my_func
61# other_func:
62# [...]
63# call mcount (offset: 0x1b)
64# [...]
65#
66# If we make the tmp.s the same as above, when we link together with
67# the original object, we will end up with two symbols for my_func:
68# one local, one global. After final compile, we will end up with
69# an undefined reference to my_func.
70#
71# Since local objects can reference local variables, we need to find
72# a way to make tmp.o reference the local objects of the original object
73# file after it is linked together. To do this, we convert the my_func
74# into a global symbol before linking tmp.o. Then after we link tmp.o
75# we will only have a single symbol for my_func that is global.
76# We can convert my_func back into a local symbol and we are done.
77#
78# Here are the steps we take:
79#
80# 1) Record all the local symbols by using 'nm'
81# 2) Use objdump to find all the call site offsets and sections for
82# mcount.
83# 3) Compile the list into its own object.
84# 4) Do we have to deal with local functions? If not, go to step 8.
85# 5) Make an object that converts these local functions to global symbols
86# with objcopy.
87# 6) Link together this new object with the list object.
88# 7) Convert the local functions back to local symbols and rename
89# the result as the original object.
90# End.
91# 8) Link the object with the list object.
92# 9) Move the result back to the original object.
93# End.
94#
95
96use strict;
97
98my $P = $0;
99$P =~ s@.*/@@g;
100
101my $V = '0.1';
102
103if ($#ARGV < 6) {
104 print "usage: $P arch objdump objcopy cc ld nm rm mv inputfile\n";
105 print "version: $V\n";
106 exit(1);
107}
108
109my ($arch, $bits, $objdump, $objcopy, $cc,
110 $ld, $nm, $rm, $mv, $inputfile) = @ARGV;
111
112# Acceptable sections to record.
113my %text_sections = (
114 ".text" => 1,
115);
116
117$objdump = "objdump" if ((length $objdump) == 0);
118$objcopy = "objcopy" if ((length $objcopy) == 0);
119$cc = "gcc" if ((length $cc) == 0);
120$ld = "ld" if ((length $ld) == 0);
121$nm = "nm" if ((length $nm) == 0);
122$rm = "rm" if ((length $rm) == 0);
123$mv = "mv" if ((length $mv) == 0);
124
125#print STDERR "running: $P '$arch' '$objdump' '$objcopy' '$cc' '$ld' " .
126# "'$nm' '$rm' '$mv' '$inputfile'\n";
127
128my %locals; # List of local (static) functions
129my %weak; # List of weak functions
130my %convert; # List of local functions used that needs conversion
131
132my $type;
133my $section_regex; # Find the start of a section
134my $function_regex; # Find the name of a function
135 # (return offset and func name)
136my $mcount_regex; # Find the call site to mcount (return offset)
137
138if ($arch eq "x86") {
139 if ($bits == 64) {
140 $arch = "x86_64";
141 } else {
142 $arch = "i386";
143 }
144}
145
146if ($arch eq "x86_64") {
147 $section_regex = "Disassembly of section\\s+(\\S+):";
148 $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:";
149 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$";
150 $type = ".quad";
151
152 # force flags for this arch
153 $ld .= " -m elf_x86_64";
154 $objdump .= " -M x86-64";
155 $objcopy .= " -O elf64-x86-64";
156 $cc .= " -m64";
157
158} elsif ($arch eq "i386") {
159 $section_regex = "Disassembly of section\\s+(\\S+):";
160 $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:";
161 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$";
162 $type = ".long";
163
164 # force flags for this arch
165 $ld .= " -m elf_i386";
166 $objdump .= " -M i386";
167 $objcopy .= " -O elf32-i386";
168 $cc .= " -m32";
169
170} else {
171 die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD";
172}
173
174my $text_found = 0;
175my $read_function = 0;
176my $opened = 0;
177my $mcount_section = "__mcount_loc";
178
179my $dirname;
180my $filename;
181my $prefix;
182my $ext;
183
184if ($inputfile =~ m,^(.*)/([^/]*)$,) {
185 $dirname = $1;
186 $filename = $2;
187} else {
188 $dirname = ".";
189 $filename = $inputfile;
190}
191
192if ($filename =~ m,^(.*)(\.\S),) {
193 $prefix = $1;
194 $ext = $2;
195} else {
196 $prefix = $filename;
197 $ext = "";
198}
199
200my $mcount_s = $dirname . "/.tmp_mc_" . $prefix . ".s";
201my $mcount_o = $dirname . "/.tmp_mc_" . $prefix . ".o";
202
203#
204# --globalize-symbols came out in 2.17, we must test the version
205# of objcopy, and if it is less than 2.17, then we can not
206# record local functions.
207my $use_locals = 01;
208my $local_warn_once = 0;
209my $found_version = 0;
210
211open (IN, "$objcopy --version |") || die "error running $objcopy";
212while (<IN>) {
213 if (/objcopy.*\s(\d+)\.(\d+)/) {
214 my $major = $1;
215 my $minor = $2;
216
217 $found_version = 1;
218 if ($major < 2 ||
219 ($major == 2 && $minor < 17)) {
220 $use_locals = 0;
221 }
222 last;
223 }
224}
225close (IN);
226
227if (!$found_version) {
228 print STDERR "WARNING: could not find objcopy version.\n" .
229 "\tDisabling local function references.\n";
230}
231
232
233#
234# Step 1: find all the local (static functions) and weak symbols.
235# 't' is local, 'w/W' is weak (we never use a weak function)
236#
237open (IN, "$nm $inputfile|") || die "error running $nm";
238while (<IN>) {
239 if (/^[0-9a-fA-F]+\s+t\s+(\S+)/) {
240 $locals{$1} = 1;
241 } elsif (/^[0-9a-fA-F]+\s+([wW])\s+(\S+)/) {
242 $weak{$2} = $1;
243 }
244}
245close(IN);
246
247my @offsets; # Array of offsets of mcount callers
248my $ref_func; # reference function to use for offsets
249my $offset = 0; # offset of ref_func to section beginning
250
251##
252# update_funcs - print out the current mcount callers
253#
254# Go through the list of offsets to callers and write them to
255# the output file in a format that can be read by an assembler.
256#
257sub update_funcs
258{
259 return if ($#offsets < 0);
260
261 defined($ref_func) || die "No function to reference";
262
263 # A section only had a weak function, to represent it.
264 # Unfortunately, a weak function may be overwritten by another
265 # function of the same name, making all these offsets incorrect.
266 # To be safe, we simply print a warning and bail.
267 if (defined $weak{$ref_func}) {
268 print STDERR
269 "$inputfile: WARNING: referencing weak function" .
270 " $ref_func for mcount\n";
271 return;
272 }
273
274 # is this function static? If so, note this fact.
275 if (defined $locals{$ref_func}) {
276
277 # only use locals if objcopy supports globalize-symbols
278 if (!$use_locals) {
279 return;
280 }
281 $convert{$ref_func} = 1;
282 }
283
284 # Loop through all the mcount caller offsets and print a reference
285 # to the caller based from the ref_func.
286 for (my $i=0; $i <= $#offsets; $i++) {
287 if (!$opened) {
288 open(FILE, ">$mcount_s") || die "can't create $mcount_s\n";
289 $opened = 1;
290 print FILE "\t.section $mcount_section,\"a\",\@progbits\n";
291 }
292 printf FILE "\t%s %s + %d\n", $type, $ref_func, $offsets[$i] - $offset;
293 }
294}
295
296#
297# Step 2: find the sections and mcount call sites
298#
299open(IN, "$objdump -dr $inputfile|") || die "error running $objdump";
300
301my $text;
302
303while (<IN>) {
304 # is it a section?
305 if (/$section_regex/) {
306
307 # Only record text sections that we know are safe
308 if (defined($text_sections{$1})) {
309 $read_function = 1;
310 } else {
311 $read_function = 0;
312 }
313 # print out any recorded offsets
314 update_funcs() if ($text_found);
315
316 # reset all markers and arrays
317 $text_found = 0;
318 undef($ref_func);
319 undef(@offsets);
320
321 # section found, now is this a start of a function?
322 } elsif ($read_function && /$function_regex/) {
323 $text_found = 1;
324 $offset = hex $1;
325 $text = $2;
326
327 # if this is either a local function or a weak function
328 # keep looking for functions that are global that
329 # we can use safely.
330 if (!defined($locals{$text}) && !defined($weak{$text})) {
331 $ref_func = $text;
332 $read_function = 0;
333 } else {
334 # if we already have a function, and this is weak, skip it
335 if (!defined($ref_func) || !defined($weak{$text})) {
336 $ref_func = $text;
337 }
338 }
339 }
340
341 # is this a call site to mcount? If so, record it to print later
342 if ($text_found && /$mcount_regex/) {
343 $offsets[$#offsets + 1] = hex $1;
344 }
345}
346
347# dump out anymore offsets that may have been found
348update_funcs() if ($text_found);
349
350# If we did not find any mcount callers, we are done (do nothing).
351if (!$opened) {
352 exit(0);
353}
354
355close(FILE);
356
357#
358# Step 3: Compile the file that holds the list of call sites to mcount.
359#
360`$cc -o $mcount_o -c $mcount_s`;
361
362my @converts = keys %convert;
363
364#
365# Step 4: Do we have sections that started with local functions?
366#
367if ($#converts >= 0) {
368 my $globallist = "";
369 my $locallist = "";
370
371 foreach my $con (@converts) {
372 $globallist .= " --globalize-symbol $con";
373 $locallist .= " --localize-symbol $con";
374 }
375
376 my $globalobj = $dirname . "/.tmp_gl_" . $filename;
377 my $globalmix = $dirname . "/.tmp_mx_" . $filename;
378
379 #
380 # Step 5: set up each local function as a global
381 #
382 `$objcopy $globallist $inputfile $globalobj`;
383
384 #
385 # Step 6: Link the global version to our list.
386 #
387 `$ld -r $globalobj $mcount_o -o $globalmix`;
388
389 #
390 # Step 7: Convert the local functions back into local symbols
391 #
392 `$objcopy $locallist $globalmix $inputfile`;
393
394 # Remove the temp files
395 `$rm $globalobj $globalmix`;
396
397} else {
398
399 my $mix = $dirname . "/.tmp_mx_" . $filename;
400
401 #
402 # Step 8: Link the object with our list of call sites object.
403 #
404 `$ld -r $inputfile $mcount_o -o $mix`;
405
406 #
407 # Step 9: Move the result back to the original object.
408 #
409 `$mv $mix $inputfile`;
410}
411
412# Clean up the temp files
413`$rm $mcount_o $mcount_s`;
414
415exit(0);
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 83b75126c9f7..72d233528ade 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -9,11 +9,13 @@ usage() {
9cd "${1:-.}" || usage 9cd "${1:-.}" || usage
10 10
11# Check for git and a git repo. 11# Check for git and a git repo.
12if head=`git rev-parse --verify HEAD 2>/dev/null`; then 12if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
13 # Do we have an untagged version? 13 # Do we have an untagged version?
14 if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then 14 if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
15 if tag=`git describe 2>/dev/null`; then 15 if tag=`git describe 2>/dev/null`; then
16 echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' 16 echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
17 else
18 printf '%s%s' -g $head
17 fi 19 fi
18 fi 20 fi
19 21
@@ -55,7 +57,7 @@ if rev=`svn info 2>/dev/null | grep '^Revision'`; then
55 57
56 # Are there uncommitted changes? 58 # Are there uncommitted changes?
57 if [ $changes != 0 ]; then 59 if [ $changes != 0 ]; then
58 printf -- '-svn%s%s%s' "$rev" -dirty "$changes" 60 printf -- '-svn%s%s' "$rev" -dirty
59 else 61 else
60 printf -- '-svn%s' "$rev" 62 printf -- '-svn%s' "$rev"
61 fi 63 fi