imgtools/romtools/maksym/maksymrofs.pl
changeset 714 e5a58c351011
parent 654 7c11c3d8d025
equal deleted inserted replaced
713:7b7f0409fc00 714:e5a58c351011
    13 #
    13 #
    14 # Description: 
    14 # Description: 
    15 # Produces symbolic information given a ROFS log file and .map files for relevant binary files
    15 # Produces symbolic information given a ROFS log file and .map files for relevant binary files
    16 #
    16 #
    17 
    17 
    18 shift @ARGV;
    18 require 5.003_07;
    19 my $logfile = shift @ARGV;
    19 no strict 'vars';
    20 my $command = "rofsbuild -loginput=$logfile";
    20 use English;
    21 system ($command);
    21 use FindBin;		# for FindBin::Bin
       
    22 
       
    23 # Version
       
    24 my $MajorVersion = 1;
       
    25 my $MinorVersion = 1;
       
    26 my $PatchVersion = 0;
       
    27 
       
    28 # Globals
       
    29 my $maksym = "";
       
    30 my $rofsbuild;
       
    31 my $debug = 0;
       
    32 
       
    33 &args;
       
    34 &main;
    22 exit 0;
    35 exit 0;
       
    36 
       
    37 #
       
    38 # main
       
    39 #
       
    40 sub main()
       
    41 {
       
    42 	my $symbolfile = $rofsbuild;
       
    43   	$symbolfile =~ s/\.log$/\.symbol/i;
       
    44   	my @cmdres = `rofsbuild -loginput=$rofsbuild`;
       
    45   	print "@cmdres\n";
       
    46 	if(($maksym ne "") && ($maksym ne $symbolfile))
       
    47  	{
       
    48 	 	rename($symbolfile, $maksym);
       
    49   	}
       
    50 }
       
    51 #
       
    52 # args - get command line args
       
    53 #
       
    54 sub args
       
    55 {
       
    56 	my $arg;
       
    57 	my @args;
       
    58 	my $flag;
       
    59 
       
    60 	&help if (!@ARGV);
       
    61 
       
    62 	while (@ARGV) 
       
    63 	{
       
    64 		$arg = shift @ARGV;
       
    65 
       
    66 		if ($arg=~/^[\-](\S*)$/) 
       
    67 		{
       
    68 			$flag=$1;
       
    69 
       
    70 			if ($flag=~/^[\?h]$/i) 
       
    71 			{
       
    72 				&help;
       
    73 			}
       
    74 			elsif ($flag=~/^d$/i) 
       
    75 			{
       
    76 				$debug = 1;
       
    77 			}
       
    78 		       	else 
       
    79 			{
       
    80 				print "\nERROR: Unknown flag \"-$flag\"\n";
       
    81 				&usage;
       
    82 				exit 1;
       
    83 			}
       
    84 		}
       
    85 		else 
       
    86 		{
       
    87 			push @args,$arg;
       
    88 		}
       
    89 	}
       
    90 
       
    91 	if (@args)
       
    92 	{
       
    93 		$rofsbuild = shift @args;
       
    94 		if (@args) 
       
    95 		{
       
    96 			$maksym = shift @args;
       
    97 			if (@args) 
       
    98 			{
       
    99 				print "\nERROR: Incorrect argument(s) \"@args\"\n";
       
   100 				&usage;
       
   101 				exit 1;
       
   102 			}
       
   103 		}
       
   104 	}
       
   105 }
       
   106 
       
   107 sub help ()
       
   108 {
       
   109 	my $build;
       
   110 
       
   111 	print "\nmaksymrofs - Produce symbolic information given a ROFS image V${MajorVersion}.${MinorVersion}.${PatchVersion}\n";
       
   112 	&usage;
       
   113 	exit 0;
       
   114 }
       
   115 
       
   116 sub usage ()
       
   117 {
       
   118     print <<EOF
       
   119 
       
   120 Usage:
       
   121   maksymrofs <logfile> [<outfile>]
       
   122 
       
   123 Where:
       
   124   <logfile>   Log file from rofsbuild tool.
       
   125   <outfile>   Output file. Defaults to imagename.symbol.
       
   126 EOF
       
   127     ;
       
   128     exit 0;
       
   129 }