Pull rom.pl updates into rom_sbs.pl. to complete the fix for bug 3358
authorWilliam Roberts <williamr@symbian.org>
Fri, 23 Jul 2010 10:28:58 +0100
changeset 224 da1922ac85fb
parent 217 96e53742b989
child 227 e4a1175ecbc0
Pull rom.pl updates into rom_sbs.pl. to complete the fix for bug 3358
kernel/eka/rombuild/rom_sbs.pl
--- a/kernel/eka/rombuild/rom_sbs.pl	Wed Jul 21 14:14:06 2010 +0100
+++ b/kernel/eka/rombuild/rom_sbs.pl	Fri Jul 23 10:28:58 2010 +0100
@@ -49,7 +49,7 @@
 						 "rombuilder=s",
 						 "define=s@",
 						 "rofsbuilder=s",
-						 "compress",
+						 "compress"
 						 );
 
 my (@assps, @builds, %variants, @templates, %flags, %insts, %zip, %builder);
@@ -128,7 +128,8 @@
 	$Epoc32Path .= $EpocRoot . "epoc32";
 	$toolpath = "$Epoc32Path\\tools\\";
 	push @INC, $toolpath;
-	$BasePath = $toroot . $e32path;
+	$BasePath = $toroot;
+	$BasePath =~ s/\\$/$e32path\\/;
 }
 
 use E32Plat;
@@ -320,6 +321,7 @@
 
 # Zap any ## marks REMS or blank lines
 
+print "Cleaning up rom2.tmp to make rom3.tmp\n" if $debug;
 cleanup("rom2.tmp", "rom3.tmp", $k);
 
 # scan tmp file and generate auxiliary files, if required
@@ -333,6 +335,7 @@
 		genfile("nonpaged");	}
 	}
 
+print "Parsing PatchData to make rom4.tmp\n" if $debug;
 parsePatchData("rom3.tmp", "rom4.tmp");
 
 # break down the oby file into rom, rofs and extensions oby files
@@ -340,8 +343,10 @@
 my $oby_index =0;
 my $dumpfile="rom.oby";
 my $rofs=0;
+my $smr=0;
 my $extension=0;
 my $corerofsname="";
+my $smrname="";
 open DUMPFILE, ">$dumpfile" or die("Can't create $dumpfile\n");
 my $line;
 open TMP, "rom4.tmp" or die("Can't open rom4.tmp\n");
@@ -360,6 +365,18 @@
 		open DUMPFILE, ">$dumpfile" or (close TMP and die("Can't create $dumpfile\n"));
 		}
 
+	if ($line=~/^\s*imagename/i)
+		{
+		close DUMPFILE;							# close rom.oby or previous rofs#/extension#.oby
+		$smrname=$line;
+		$smrname =~ s/imagename\s*=\s*//i;		# save smr name
+		$smrname =~ s/\s*$//g; 			# remove trailing \n
+		unlink $smrname || print "unable to delete $smrname";
+		my $dumpfile="smr".$smr.".oby";
+		$smr++;
+		open DUMPFILE, ">$dumpfile" or (close TMP and die("Can't create $dumpfile\n"));
+		}
+
 	if ($line=~/^\s*coreimage/i)
 		{
 		close DUMPFILE;							# close rofs.oby
@@ -495,6 +512,22 @@
 		}
 }
 
+if ($smr) {
+	$rofsbuilder = $opts{'rofsbuilder'};
+	$rofsbuilder = "rofsbuild" unless ($rofsbuilder);
+	for(my $i=0;$i<$smr;++$i) {
+		print "Executing $rofsbuilder on smr partition\n" if !$quiet;
+		my $image="smr".$i.".oby";
+		system("$rofsbuilder -smr=$image");
+		if ($? != 0)
+			{
+			print "$rofsbuilder -smr=$image returned $?\n";
+			$rerrors++;
+			}
+		rename "rofsbuild.log", "smr$i.log"
+		}
+}
+
 if ($nerrors) {
 	print "\n\n Errors found during $builder!!\n\nLeaving tmp files\n";
 } elsif ($nwarnings) {
@@ -781,6 +814,8 @@
 				die "Bad patchdata command: $line\n";
 			}
 
+			print "Handling $line\n" if $debug;
+
 			my ($file, $symbol, $value) = (lc $1, $2, $3);
 			my ($srcFile, $destFile) = lookupFileInfo($infile, $file);
 			my ($index, $elementSize) = (undef, undef);
@@ -792,6 +827,7 @@
 
 			if ($srcFile =~ /\\armv5(smp)?\\/i)
 			{
+				print "..looking up $symbol in $srcFile.map\n" if $debug;
 				my ($symbolAddr, $symbolSize) = lookupSymbolInfo("$srcFile.map", $symbol);
 
 				my $max;
@@ -833,6 +869,7 @@
 				$value = sprintf("0x%08x", $value);
 
 				$line = "patchdata $destFile addr $symbolAddr $symbolSize $value\n";
+				print ".. new line is $line\n" if $debug;
 			}
 			else
 			{