aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2002-10-08 21:33:51 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2002-10-08 21:33:51 +0000
commitadb058b0debef0363b7a47dabff7ec212b90bd30 (patch)
treedd9a22268ce6b33873e21d69d5c067a24e8029ef /examples
parenta39342b13183d9a940cc905595eedad140bd3a10 (diff)
downloadbusybox-w32-adb058b0debef0363b7a47dabff7ec212b90bd30.tar.gz
busybox-w32-adb058b0debef0363b7a47dabff7ec212b90bd30.tar.bz2
busybox-w32-adb058b0debef0363b7a47dabff7ec212b90bd30.zip
Fixed the script. It always put output to 'stdout' and never to
the 'modules.dep' file.
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/depmod.pl46
1 files changed, 28 insertions, 18 deletions
diff --git a/examples/depmod.pl b/examples/depmod.pl
index e65f07b68..1bb02defa 100755
--- a/examples/depmod.pl
+++ b/examples/depmod.pl
@@ -3,6 +3,7 @@
3# Copyright (c) 2001 David Schleef <ds@schleef.org> 3# Copyright (c) 2001 David Schleef <ds@schleef.org>
4# Copyright (c) 2001 Erik Andersen <andersen@lineo.com> 4# Copyright (c) 2001 Erik Andersen <andersen@lineo.com>
5# Copyright (c) 2001 Stuart Hughes <stuarth@lineo.com> 5# Copyright (c) 2001 Stuart Hughes <stuarth@lineo.com>
6# Copyright (c) 2002 Steven J. Hill <shill@broadcom.com>
6# This program is free software; you can redistribute it and/or modify it 7# This program is free software; you can redistribute it and/or modify it
7# under the same terms as Perl itself. 8# under the same terms as Perl itself.
8 9
@@ -18,7 +19,7 @@ use File::Find;
18my $basedir=""; 19my $basedir="";
19my $kernel; 20my $kernel;
20my $kernelsyms; 21my $kernelsyms;
21my $stdout=1; 22my $stdout=0;
22my $verbose=0; 23my $verbose=0;
23 24
24 25
@@ -38,13 +39,13 @@ GetOptions(
38 39
39if (defined $opt{help}) { 40if (defined $opt{help}) {
40 print 41 print
41 "$0 [OPTION]... [basedir]\n", 42 " $0 [OPTION]... [basedir]\n",
42 "\t-h --help\t\tShow this help screen\n", 43 " -h --help\t\tShow this help screen\n",
43 "\t-b --basedir\t\tModules base directory (defaults to /lib/modules)\n", 44 " -b --basedir\tModules base directory (defaults to /lib/modules)\n",
44 "\t-k --kernel\t\tKernel binary for the target\n", 45 " -k --kernel\tKernel binary for the target\n",
45 "\t-F --kernelsyms\t\tKernel symbol file\n", 46 " -F --kernelsyms\tKernel symbol file\n",
46 "\t-n --stdout\t\tWrite to stdout instead of modules.dep\n", 47 " -n --stdout\tWrite to stdout instead of <basedir>/modules.dep\n",
47 "\t-v --verbose\t\tPrint out lots of debugging stuff\n", 48 " -v --verbose\tPrint out lots of debugging stuff\n",
48 ; 49 ;
49 exit 1; 50 exit 1;
50} 51}
@@ -55,6 +56,7 @@ if($basedir !~ m-/lib/modules-) {
55 56
56# Find the list of .o files living under $basedir 57# Find the list of .o files living under $basedir
57#if ($verbose) { printf "Locating all modules\n"; } 58#if ($verbose) { printf "Locating all modules\n"; }
59my($ofile) = "";
58my($file) = ""; 60my($file) = "";
59my(@liblist) = (); 61my(@liblist) = ();
60find sub { 62find sub {
@@ -127,16 +129,24 @@ foreach $module (keys %$dep) {
127} 129}
128 130
129# resolve the dependancies for each module 131# resolve the dependancies for each module
130foreach $module ( keys %$mod ) { 132if ($stdout == 1) {
131 print "$module:\t"; 133 foreach $module ( keys %$mod ) {
132 @sorted = sort bydep keys %{$mod->{$module}}; 134 print "$module:\t";
133 print join(" \\\n\t",@sorted); 135 @sorted = sort bydep keys %{$mod->{$module}};
134# foreach $m (@sorted ) { 136 print join(" \\\n\t",@sorted);
135# print "\t$m\n"; 137 print "\n\n";
136# } 138 }
137 print "\n\n"; 139} else {
140 open(OFILE, ">$basedir/modules.dep");
141 foreach $module ( keys %$mod ) {
142 print OFILE "$module:\t";
143 @sorted = sort bydep keys %{$mod->{$module}};
144 print OFILE join(" \\\n\t",@sorted);
145 print OFILE "\n\n";
146 }
138} 147}
139 148
149
140sub bydep 150sub bydep
141{ 151{
142 foreach my $f ( keys %{$mod->{$b}} ) { 152 foreach my $f ( keys %{$mod->{$b}} ) {
@@ -158,7 +168,7 @@ depmod.pl - a cross platform script to generate kernel module dependency
158 168
159=head1 SYNOPSIS 169=head1 SYNOPSIS
160 170
161depmod.pl [OPTION]... [FILE]... 171depmod.pl [OPTION]... [basedir]...
162 172
163Example: 173Example:
164 174
@@ -223,5 +233,5 @@ David Schleef <ds@schleef.org>
223 233
224=cut 234=cut
225 235
226# $Id: depmod.pl,v 1.1 2001/07/30 19:32:03 andersen Exp $ 236# $Id: depmod.pl,v 1.2 2002/10/08 21:33:51 sjhill Exp $
227 237