imgtools/buildrom/tools/datadriveimage.pm
changeset 626 ac03b93ca9c4
parent 607 378360dbbdba
child 647 53d1ab72f5bc
equal deleted inserted replaced
625:a1925fb7753a 626:ac03b93ca9c4
   361 }
   361 }
   362 
   362 
   363 # invoke the INTERPRETSIS tool with appropriate parameters.
   363 # invoke the INTERPRETSIS tool with appropriate parameters.
   364 sub invokeInterpretsis
   364 sub invokeInterpretsis
   365 {
   365 {
   366 	my($sisFileArray,$dataDrivePath,$verboseOpt,$zDrivePath,$parafile,$keepgoingOpt,$interpretsisOptList) = @_;
   366 	my($sisFileArray,$dataDrivePath,$verboseOpt,$zDrivePath,$parafile,$keepgoingOpt,$interpretsisOptList,$outputdir) = @_;
   367 	my $sisfile = ""; 
   367 	my $sisfile = ""; 
   368 	# default system drive letter is specified since interpretsis doesnt allow overloading of options unless default 
   368 	# default system drive letter is specified since interpretsis doesnt allow overloading of options unless default 
   369 	# options are specified.
   369 	# options are specified.
   370 	my $basicOption = "-d C: ";	# default system drive letter
   370 	my $basicOption = "-d C: ";	# default system drive letter
   371 	my $command = "interpretsis ";
   371 	my $command = "interpretsis ";
   377 	if( $dataDrivePath =~ m/ /)
   377 	if( $dataDrivePath =~ m/ /)
   378 	{
   378 	{
   379 		$dataDrivePath = '"'.$dataDrivePath.'"';
   379 		$dataDrivePath = '"'.$dataDrivePath.'"';
   380 	}
   380 	}
   381 
   381 
       
   382 	my $currentdir=cwd;
       
   383 	$currentdir=~s-\\-\/-go;
       
   384 	$currentdir.= "\/" unless $currentdir =~ /\/$/;
       
   385 	$currentdir =~ s-\/-\\-g if (&is_windows);
       
   386 	my $drive = "";
       
   387 	$drive = $1 if ($currentdir =~ /^(.:)/);
       
   388 
   382 	# find out size of the array
   389 	# find out size of the array
   383 	my $sisarraysize = scalar(@$sisFileArray);
   390 	my $sisarraysize = scalar(@$sisFileArray);
   384 	for( my $i=0; $i<$sisarraysize; $i++ )
   391 	for( my $i=0; $i<$sisarraysize; $i++ )
   385 	{
   392 	{
       
   393 		my $tempsisfile = pop(@$sisFileArray);
       
   394 		if ($tempsisfile =~ /^[\\\/]/)
       
   395 		{
       
   396 			$tempsisfile = $drive.$tempsisfile;
       
   397 		}elsif ($tempsisfile !~ /^.:/)
       
   398 		{
       
   399 			$tempsisfile = $currentdir.$tempsisfile;
       
   400 		}
       
   401 		
   386 		if($sisfile ne "")
   402 		if($sisfile ne "")
   387 		{
   403 		{
   388 			$sisfile = pop(@$sisFileArray).",".$sisfile;
   404 			$sisfile = $tempsisfile.",".$sisfile;
   389 		}
   405 		}
   390 		else
   406 		else
   391 		{
   407 		{
   392 			$sisfile = pop(@$sisFileArray);
   408 			$sisfile = $tempsisfile;
   393 		}
   409 		}
   394 	}
   410 	}
   395 
   411 
   396 	# check whether the directory exists or not 
   412 	# check whether the directory exists or not 
   397 	if( -d $zDrivePath )
   413 	if( -d $zDrivePath )
   419 	}
   435 	}
   420 	# else invoke the INTERPRETSIS with default parameter file with "-p" option. 
   436 	# else invoke the INTERPRETSIS with default parameter file with "-p" option. 
   421 	else
   437 	else
   422 	{
   438 	{
   423 		# Truncate and open the parameter file for writing..
   439 		# Truncate and open the parameter file for writing..
   424 		open( OPTDATA, "> parameterfile.txt" )  or die "can't open parameterfile.txt";
   440 		$parafile = $outputdir."parameterfile.txt";
       
   441 		open( OPTDATA, "> $parafile" )  or die "can't open $parafile";
   425 		print OPTDATA $basicOption."\n";
   442 		print OPTDATA $basicOption."\n";
   426 		close( OPTDATA );
   443 		close( OPTDATA );
   427 		$command .= "-p parameterfile.txt ";
   444 		$command .= "-p $parafile ";
   428 	}
   445 	}
   429 
   446 
   430 	if( $interpretsisOptList )
   447 	if( $interpretsisOptList )
   431 	{
   448 	{
   432 		# find out size of the array
   449 		# find out size of the array
   435 		{
   452 		{
   436 			$command .= $$interpretsisOptList[$i]." ";
   453 			$command .= $$interpretsisOptList[$i]." ";
   437 		}
   454 		}
   438 	}
   455 	}
   439 	
   456 	
       
   457 	print "* Changing to $outputdir\n" if ( $verboseOpt );
       
   458 	chdir "$outputdir";
       
   459 	
   440 	print "* Executing $command\n" if ( $verboseOpt );
   460 	print "* Executing $command\n" if ( $verboseOpt );
   441 	system ( $command );
   461 	system ( $command );
   442 
   462 
   443 	if ($? != 0)
   463 	if ($? != 0)
   444 	{
   464 	{
   445 		&datadriveimage::reportError("* ERROR: INTERPRETSIS failed",$keepgoingOpt);
   465 		&datadriveimage::reportError("* ERROR: INTERPRETSIS failed",$keepgoingOpt);
   446 	}
   466 	}
       
   467 	
       
   468 	print "* Changing back to $currentdir\n" if ( $verboseOpt );
       
   469 	chdir "$currentdir";
   447 }
   470 }
   448 
   471 
   449 # invoke the READIMAGE tool with appropriate parameters.
   472 # invoke the READIMAGE tool with appropriate parameters.
   450 sub invokeReadImage
   473 sub invokeReadImage
   451 {
   474 {