imgtools/buildrom/tools/buildrom.pm
changeset 712 df89378e9223
parent 697 818fe0ed324b
child 713 7b7f0409fc00
equal deleted inserted replaced
697:818fe0ed324b 712:df89378e9223
   640 							{
   640 							{
   641 								print "Warning: interpretsis is not ready on linux.\n";
   641 								print "Warning: interpretsis is not ready on linux.\n";
   642 							}	
   642 							}	
   643 						}
   643 						}
   644 	
   644 	
   645 						# create an oby file by traversing through upated prototype data drive directory.
   645 						# create an oby file by traversing through upated prototype data drive directory. 
   646 						&datadriveimage::dumpDatadriveObydata( $proDataDriveDirloc,$datadriveobyfile,$size,\@nonsisFilelist,
   646 						&datadriveimage::dumpDatadriveObydata( $proDataDriveDirloc,$datadriveobyfile,$size,\@nonsisFilelist,
   647 											\@renameList,\@aliaslist,\@hideList,\@sisobydata,\@datadrivedata,$opt_k,$opt_v );
   647 											\@renameList,\@aliaslist,\@hideList,\@sisobydata,\@datadrivedata,$opt_k,$opt_v );
   648 						#reset sisfilepresent flag to zero;
   648 						#reset sisfilepresent flag to zero;
   649 						$sisfilepresent =0;
   649 						$sisfilepresent =0;
   650 					}
   650 					}
   839 		    $tmpBldRomOpts{"BUILD_DIR"} = "udeb";
   839 		    $tmpBldRomOpts{"BUILD_DIR"} = "udeb";
   840 		}
   840 		}
   841 		#Set specific platform supplied from the command option 
   841 		#Set specific platform supplied from the command option 
   842 		elsif($arg =~ /^-D_PLAT=(.*)/)
   842 		elsif($arg =~ /^-D_PLAT=(.*)/)
   843 		{
   843 		{
   844 		    $tmpBldRomOpts{"ABI_DIR"} = $1;
   844 		    $tmpBldRomOpts{"ABI_DIR"} = $1; 
       
   845 			
   845 		}
   846 		}
   846 		# Check for a Feature Variant
   847 		# Check for a Feature Variant
   847 		elsif ($arg =~ /^-DFEATUREVARIANT=(.*)/)
   848 		elsif ($arg =~ /^-DFEATUREVARIANT=(.*)/)
   848 		{
   849 		{
   849 			my $varname = $1;
   850 			my $varname = $1;
  1221 					$ZDirloc .= "\/"; 
  1222 					$ZDirloc .= "\/"; 
  1222 				}
  1223 				}
  1223 				if( $ZDirloc !~ m/:/)
  1224 				if( $ZDirloc !~ m/:/)
  1224 				{
  1225 				{
  1225 					print "drive letter not specified\n";
  1226 					print "drive letter not specified\n";
  1226 					$ZDirloc = $thisdir.$ZDirloc;
  1227 					my $dir = $thisdir ;
       
  1228 					my $file = $ZDirloc ;
       
  1229 					while( $file =~ /^(\.+\/)(.+)/) {
       
  1230 						$file = $2 ; 
       
  1231 						if( $1 eq "../" ) {
       
  1232 							if($dir =~ /(.*[\\\/])([^\\\/]+[\\\/]$)/) {
       
  1233 								$dir = $1 ; 
       
  1234 							} 
       
  1235 						}
       
  1236 					}
       
  1237 					$ZDirloc = $dir.$file;
  1227 				}
  1238 				}
  1228 				print "Z Drive directory location = $ZDirloc\n";
  1239 				print "Z Drive directory location = $ZDirloc\n";
  1229 				#set the location of Z Drive directory.
  1240 				#set the location of Z Drive directory.
  1230 				$ZDirloc .= "zdrive";
  1241 				$ZDirloc .= "zdrive";
  1231 			}
  1242 			}
  3314 		#
  3325 		#
  3315 		elsif ($line =~ /(\S+)\s*=\s*"?(\S+[\/\\]\S+)"?/)
  3326 		elsif ($line =~ /(\S+)\s*=\s*"?(\S+[\/\\]\S+)"?/)
  3316 		{
  3327 		{
  3317 			my $what = $1;
  3328 			my $what = $1;
  3318 			my $filename = $2;
  3329 			my $filename = $2;
  3319 			if ($line =~ /(\S+)\s*=\s*"([^"]+)"/)
  3330 			if ($line =~ /(\S+)\s*=\s*"([^"]+)"/){
  3320 			{
       
  3321 				$filename = $2;
  3331 				$filename = $2;
  3322 			}
  3332 			}
  3323 			my $normedFilename = &get_versionedname($filename);
       
  3324 
       
  3325 			# find all the alternative file locations
       
  3326 			my @alternatives = fallback($normedFilename);
       
  3327 			# test the original location first
       
  3328 			unshift(@alternatives, $normedFilename);
       
  3329 
       
  3330 			# choose the first file location that actually exists
       
  3331 			my $fileExists = 0;
  3333 			my $fileExists = 0;
  3332 			foreach my $altFile (@alternatives)
  3334 			my $normedFilename = &get_versionedname($filename) ;
  3333 			{
  3335 			my @alternatives = ();
  3334 			    my $tmpPath;
  3336 			if( $what =~ /data$/i ) {				
  3335 			    my $tmpFile;
  3337 				if(-e $normedFilename) {
  3336 				if($altFile =~ /"?(.*[\/\\]arm\w+_?\w+)[\/\\]([^"]+)/i)
  3338 					$fileExists = $normedFilename ;
  3337 				{
  3339 				} 
  3338 					$tmpPath = $1;
  3340 				else {
  3339 					$tmpFile = $2;
  3341 					if($normedFilename =~ /^\s*"?([\\\/]?)([^"]+)"?/i) {
  3340 				}
  3342 						if($1) {
  3341 				$tmpPath .= "\.$varname";
  3343 							$normedFilename = $epocroot.$2 ; 
       
  3344 						}
       
  3345 						else {
       
  3346 							$normedFilename = $2 ; 
       
  3347 						}
       
  3348 						
       
  3349 						$fileExists = $normedFilename if(-e $normedFilename);
       
  3350 					}
       
  3351 					 
       
  3352 				}
       
  3353 				push @alternatives, $normedFilename; 
       
  3354 			}
       
  3355 			else { 
       
  3356 				# find all the alternative file locations
       
  3357 				@alternatives = fallback($normedFilename);
       
  3358 				# test the original location first
       
  3359 				unshift(@alternatives, $normedFilename);				 
       
  3360 
       
  3361 				# choose the first file location that actually exists
  3342 				
  3362 				
  3343 				if (-e $tmpPath ."\/$tmpFile"){
  3363 				foreach my $altFile (@alternatives) { 
  3344                   # SBSv2 variant binary exists
  3364 					my $tmpFile = "";
  3345 				  $fileExists = $tmpPath . "\/$tmpFile";
  3365 					
  3346 				}
  3366 					next if($altFile eq "");
  3347 				else {
  3367 					if($altFile =~/^\s*"?([\\\/]?)([^"]+)"?/i ) {
  3348                   # SBSv1 variant binary or invariant binary
  3368 						if($1) {
  3349 				  $fileExists = get_BVbinname($altFile, $varname);
  3369 							$altFile = $epocroot.$2 ; 
  3350 				}
  3370 						}
  3351 				last if $fileExists;
  3371 						else {
       
  3372 							$altFile = $2 ;
       
  3373 						}
       
  3374 					}
       
  3375 					
       
  3376 					if($altFile =~ /(.*[\/\\]arm\w+_?\w+)[\/\\](.+)/i) {						 
       
  3377 						$tmpFile = $1."\.$varname\/".$2;
       
  3378 					}
       
  3379 					else {
       
  3380 						$tmpFile = $altFile;
       
  3381 					}					
       
  3382 					 
       
  3383 					if (-e $tmpFile){
       
  3384 						# SBSv2 variant binary exists
       
  3385 						$fileExists = $tmpFile;
       
  3386 					}
       
  3387 					else {
       
  3388 						# SBSv1 variant binary or invariant binary
       
  3389 						$fileExists = get_BVbinname($altFile, $varname);
       
  3390 					} 
       
  3391 					last if $fileExists;
       
  3392 					 
       
  3393 				}
  3352 			}
  3394 			}
  3353 			
  3395 			
  3354 			# edit the OBY line to use the actual file name which we found.
  3396 			# edit the OBY line to use the actual file name which we found.
  3355 			# (maybe) warn if an alternative to the original was selected.
  3397 			# (maybe) warn if an alternative to the original was selected.
  3356 			if ($fileExists)
  3398 			if ($fileExists)