Fixed the script. It always put output to 'stdout' and never to

the 'modules.dep' file.
This commit is contained in:
"Steven J. Hill" 2002-10-08 21:33:51 +00:00
parent a39342b131
commit adb058b0de

View File

@ -3,6 +3,7 @@
# Copyright (c) 2001 David Schleef <ds@schleef.org> # Copyright (c) 2001 David Schleef <ds@schleef.org>
# Copyright (c) 2001 Erik Andersen <andersen@lineo.com> # Copyright (c) 2001 Erik Andersen <andersen@lineo.com>
# Copyright (c) 2001 Stuart Hughes <stuarth@lineo.com> # Copyright (c) 2001 Stuart Hughes <stuarth@lineo.com>
# Copyright (c) 2002 Steven J. Hill <shill@broadcom.com>
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself. # under the same terms as Perl itself.
@ -18,7 +19,7 @@ use File::Find;
my $basedir=""; my $basedir="";
my $kernel; my $kernel;
my $kernelsyms; my $kernelsyms;
my $stdout=1; my $stdout=0;
my $verbose=0; my $verbose=0;
@ -39,12 +40,12 @@ GetOptions(
if (defined $opt{help}) { if (defined $opt{help}) {
print print
" $0 [OPTION]... [basedir]\n", " $0 [OPTION]... [basedir]\n",
"\t-h --help\t\tShow this help screen\n", " -h --help\t\tShow this help screen\n",
"\t-b --basedir\t\tModules base directory (defaults to /lib/modules)\n", " -b --basedir\tModules base directory (defaults to /lib/modules)\n",
"\t-k --kernel\t\tKernel binary for the target\n", " -k --kernel\tKernel binary for the target\n",
"\t-F --kernelsyms\t\tKernel symbol file\n", " -F --kernelsyms\tKernel symbol file\n",
"\t-n --stdout\t\tWrite to stdout instead of modules.dep\n", " -n --stdout\tWrite to stdout instead of <basedir>/modules.dep\n",
"\t-v --verbose\t\tPrint out lots of debugging stuff\n", " -v --verbose\tPrint out lots of debugging stuff\n",
; ;
exit 1; exit 1;
} }
@ -55,6 +56,7 @@ if($basedir !~ m-/lib/modules-) {
# Find the list of .o files living under $basedir # Find the list of .o files living under $basedir
#if ($verbose) { printf "Locating all modules\n"; } #if ($verbose) { printf "Locating all modules\n"; }
my($ofile) = "";
my($file) = ""; my($file) = "";
my(@liblist) = (); my(@liblist) = ();
find sub { find sub {
@ -127,15 +129,23 @@ foreach $module (keys %$dep) {
} }
# resolve the dependancies for each module # resolve the dependancies for each module
if ($stdout == 1) {
foreach $module ( keys %$mod ) { foreach $module ( keys %$mod ) {
print "$module:\t"; print "$module:\t";
@sorted = sort bydep keys %{$mod->{$module}}; @sorted = sort bydep keys %{$mod->{$module}};
print join(" \\\n\t",@sorted); print join(" \\\n\t",@sorted);
# foreach $m (@sorted ) {
# print "\t$m\n";
# }
print "\n\n"; print "\n\n";
} }
} else {
open(OFILE, ">$basedir/modules.dep");
foreach $module ( keys %$mod ) {
print OFILE "$module:\t";
@sorted = sort bydep keys %{$mod->{$module}};
print OFILE join(" \\\n\t",@sorted);
print OFILE "\n\n";
}
}
sub bydep sub bydep
{ {
@ -158,7 +168,7 @@ depmod.pl - a cross platform script to generate kernel module dependency
=head1 SYNOPSIS =head1 SYNOPSIS
depmod.pl [OPTION]... [FILE]... depmod.pl [OPTION]... [basedir]...
Example: Example:
@ -223,5 +233,5 @@ David Schleef <ds@schleef.org>
=cut =cut
# $Id: depmod.pl,v 1.1 2001/07/30 19:32:03 andersen Exp $ # $Id: depmod.pl,v 1.2 2002/10/08 21:33:51 sjhill Exp $