From 177525d26e31806d71653f74bbec13574b97892c Mon Sep 17 00:00:00 2001 From: Andreas Mohr Date: Sun, 3 Apr 2011 20:58:28 +0200 Subject: eradicate bashisms in scripts/patch-kernel Silence a remaining annoying (or worse, irritating - "is my entire patched tree broken now!?") bashism-related message that occurs when /bin/sh is configured to instead deploy dash, a POSIX-compliant shell, as is the pretty much standard case on e.g. Debian. Current kernel version is 2.6.38 ( Flesh-Eating Bats with Fangs) ===> linux-2.6.38.patch-kernel_test/scripts/patch-kernel: line 253: [: =: unary operator expected <=== cannot find patch file: patch-2.6.39 Signed-off-by: Andreas Mohr Signed-off-by: Michal Marek --- scripts/patch-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/patch-kernel b/scripts/patch-kernel index 46a59cae3a0a..20fb25c23382 100755 --- a/scripts/patch-kernel +++ b/scripts/patch-kernel @@ -250,7 +250,7 @@ while : # incrementing SUBLEVEL (s in v.p.s) do CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" EXTRAVER= - if [ $STOPFULLVERSION = $CURRENTFULLVERSION ]; then + if [ x$STOPFULLVERSION = x$CURRENTFULLVERSION ]; then echo "Stopping at $CURRENTFULLVERSION base as requested." break fi -- cgit v1.2.3 From 6088e9ffa29a92e7b80fdba44929f3225c4c0357 Mon Sep 17 00:00:00 2001 From: Peter Foley Date: Tue, 26 Apr 2011 19:07:56 -0400 Subject: kbuild: don't warn about include/linux/version.h not including itself This patch makes checkversion.pl not warn that include/linux/version.h dosen't include itself. Signed-off-by: Peter Foley [mmarek: simplified to use 'next if' syntax] Signed-off-by: Michal Marek --- scripts/checkversion.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/checkversion.pl b/scripts/checkversion.pl index b444e89a0095..5e490a8ceca5 100755 --- a/scripts/checkversion.pl +++ b/scripts/checkversion.pl @@ -12,6 +12,7 @@ $| = 1; my $debugging; foreach my $file (@ARGV) { + next if $file =~ "include/linux/version\.h"; # Open this file. open( my $f, '<', $file ) or die "Can't open $file: $!\n"; -- cgit v1.2.3 From 279f3dd3569d08226f8b8e41704d65e8b679d3d7 Mon Sep 17 00:00:00 2001 From: Peter Foley Date: Tue, 26 Apr 2011 17:15:01 -0400 Subject: kbuild: add targets to PHONY This patch adds some targets to PHONY so they are built even if a file with the same name exists. Signed-off-by: Peter Foley Signed-off-by: Michal Marek --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index ba7a55ccd890..02134de65acf 100644 --- a/Makefile +++ b/Makefile @@ -1392,6 +1392,8 @@ tags TAGS cscope gtags: FORCE # Scripts to check various things for consistency # --------------------------------------------------------------------------- +PHONY += includecheck versioncheck coccicheck namespacecheck export_report + includecheck: find * $(RCS_FIND_IGNORE) \ -name '*.[hcS]' -type f -print | sort \ -- cgit v1.2.3 From 9663d9890d80408c4a5c8280c5db775fbe082203 Mon Sep 17 00:00:00 2001 From: Peter Foley Date: Tue, 26 Apr 2011 17:17:11 -0400 Subject: kbuild: make headerdep work in KBUILD_OUTDIR This patch fixes the headerdep target so it works when make is invoked in KBUILD_OUTDIR. Signed-off-by: Peter Foley Signed-off-by: Michal Marek --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 02134de65acf..6b21de15c82e 100644 --- a/Makefile +++ b/Makefile @@ -991,7 +991,8 @@ include/generated/utsrelease.h: include/config/kernel.release FORCE PHONY += headerdep headerdep: - $(Q)find include/ -name '*.h' | xargs --max-args 1 scripts/headerdep.pl + $(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \ + $(srctree)/scripts/headerdep.pl -I$(srctree)/include # --------------------------------------------------------------------------- -- cgit v1.2.3 From 436f876ccb4eac8ae53a101852824977a0f344eb Mon Sep 17 00:00:00 2001 From: Peter Foley Date: Tue, 26 Apr 2011 17:18:29 -0400 Subject: kbuild: make includecheck work in KBUILD_OUTDIR This patch fixes the includecheck target so it works when make is invoked in KBUILD_OUTDIR. Signed-off-by: Peter Foley Signed-off-by: Michal Marek --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6b21de15c82e..9b6610e005aa 100644 --- a/Makefile +++ b/Makefile @@ -1396,7 +1396,7 @@ tags TAGS cscope gtags: FORCE PHONY += includecheck versioncheck coccicheck namespacecheck export_report includecheck: - find * $(RCS_FIND_IGNORE) \ + find $(srctree)/* $(RCS_FIND_IGNORE) \ -name '*.[hcS]' -type f -print | sort \ | xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl -- cgit v1.2.3 From 2ee2d29289951b4cb7578d75f199e4aa4084fe6f Mon Sep 17 00:00:00 2001 From: Peter Foley Date: Tue, 26 Apr 2011 17:19:28 -0400 Subject: kbuild: make versioncheck work in KBUILD_OUTDIR This patch fixes the versioncheck target so it works when make is invoked in KBUILD_OUTDIR. Signed-off-by: Peter Foley Signed-off-by: Michal Marek --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9b6610e005aa..bfe3e36c2c43 100644 --- a/Makefile +++ b/Makefile @@ -1401,7 +1401,7 @@ includecheck: | xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl versioncheck: - find * $(RCS_FIND_IGNORE) \ + find $(srctree)/* $(RCS_FIND_IGNORE) \ -name '*.[hcS]' -type f -print | sort \ | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl -- cgit v1.2.3 From de7b0b4110795be914e6cafdfec4276b2618cc78 Mon Sep 17 00:00:00 2001 From: Jim Cromie Date: Mon, 23 May 2011 12:44:55 -0600 Subject: export_report: do collectcfiles work in perl itself Avoid spawning a shell pipeline doing cat, grep, sed, and do it all inside perl. The <*.c> globbing construct works at least as far back as 5.8.9 Note that this is not just an optimization; the sed command in the pipeline was unterminated, due to lack of escape on the end-of-line (\$) in the regex, resulting in this: $ perl ../linux-2.6/scripts/export_report.pl > /dev/null sed: -e expression #1, char 5: unterminated `s' command sh: .mod.c/: not found Comments on an earlier patch sought an all-perl implementation. Signed-off-by: Jim Cromie cc: Michal Marek , cc: linux-kbuild@vger.kernel.org cc: Arnaud Lacombe lacombar@gmail.com cc: Stephen Hemminger shemminger@vyatta.com Signed-off-by: Michal Marek --- scripts/export_report.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/export_report.pl b/scripts/export_report.pl index 04dce7c15f83..f97899c87923 100644 --- a/scripts/export_report.pl +++ b/scripts/export_report.pl @@ -49,8 +49,14 @@ sub usage { } sub collectcfiles { - my @file - = `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko$/.mod.c/`; + my @file; + while (<.tmp_versions/*.mod>) { + open my $fh, '<', $_ or die "cannot open $_: $!\n"; + push (@file, + grep s/\.ko/.mod.c/, # change the suffix + grep m/.+\.ko/, # find the .ko path + <$fh>); # lines in opened file + } chomp @file; return @file; } -- cgit v1.2.3 From bdabc7a345db97b3839c2c3deef40023cf8017ef Mon Sep 17 00:00:00 2001 From: Jim Cromie Date: Mon, 23 May 2011 12:44:56 -0600 Subject: export_report: sort SECTION 2 output Sort SECTION 2 modules by name. Within those module listings, sort the symbol providers by name, and remove the count, as it is misleading; its the kernel-wide count of uses of that symbol, not the count pertaining to the module being outlined. (this can be seen by grepping the output for a single symbol). The count is still used to sort the symbols. Signed-off-by: Jim Cromie Signed-off-by: Michal Marek --- scripts/export_report.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/export_report.pl b/scripts/export_report.pl index f97899c87923..48398a19fbbc 100644 --- a/scripts/export_report.pl +++ b/scripts/export_report.pl @@ -25,11 +25,12 @@ sub alphabetically { sub print_depends_on { my ($href) = @_; print "\n"; - while (my ($mod, $list) = each %$href) { + for my $mod (sort keys %$href) { + my $list = $href->{$mod}; print "\t$mod:\n"; foreach my $sym (sort numerically @{$list}) { my ($symbol, $no) = split /\s+/, $sym; - printf("\t\t%-25s\t%-25d\n", $symbol, $no); + printf("\t\t%-25s\n", $symbol); } print "\n"; } @@ -166,7 +167,8 @@ modules. Each module lists the modules, and the symbols from that module that it uses. Each listed symbol reports the number of modules using it\n"); print "~"x80 , "\n"; -while (my ($thismod, $list) = each %MODULE) { +for my $thismod (sort keys %MODULE) { + my $list = $MODULE{$thismod}; my %depends; $thismod =~ s/\.mod\.c/.ko/; print "\t\t\t$thismod\n"; -- cgit v1.2.3 From ca995cbf77f3df599b7e751c2d08d90787c65c45 Mon Sep 17 00:00:00 2001 From: Jim Cromie Date: Mon, 23 May 2011 12:44:57 -0600 Subject: export_report: use warn() to issue WARNING, so they go to stderr Also count CONFIG_MODVERSIONS warnings, and print a NOTE at start of SECTION 2 if any were issued. Section 2 will be empty if the build is lacking this CONFIG_ item, and user may have missed the warnings, as they're off screen. Signed-off-by: Jim Cromie Signed-off-by: Michal Marek --- scripts/export_report.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/export_report.pl b/scripts/export_report.pl index 48398a19fbbc..8f79b701de87 100644 --- a/scripts/export_report.pl +++ b/scripts/export_report.pl @@ -102,6 +102,8 @@ close($module_symvers); # # collect the usage count of each symbol. # +my $modversion_warnings = 0; + foreach my $thismod (@allcfiles) { my $module; @@ -132,7 +134,8 @@ foreach my $thismod (@allcfiles) { } } if ($state != 2) { - print "WARNING:$thismod is not built with CONFIG_MODVERSION enabled\n"; + warn "WARNING:$thismod is not built with CONFIG_MODVERSIONS enabled\n"; + $modversion_warnings++; } close($module); } @@ -166,6 +169,9 @@ printf("SECTION 2:\n\tThis section reports export-symbol-usage of in-kernel modules. Each module lists the modules, and the symbols from that module that it uses. Each listed symbol reports the number of modules using it\n"); +print "\nNOTE: Got $modversion_warnings CONFIG_MODVERSIONS warnings\n\n" + if $modversion_warnings; + print "~"x80 , "\n"; for my $thismod (sort keys %MODULE) { my $list = $MODULE{$thismod}; -- cgit v1.2.3