equal
deleted
inserted
replaced
47 "noheader", |
47 "noheader", |
48 "kerneltrace=s", |
48 "kerneltrace=s", |
49 "rombuilder=s", |
49 "rombuilder=s", |
50 "define=s@", |
50 "define=s@", |
51 "rofsbuilder=s", |
51 "rofsbuilder=s", |
52 "compress", |
52 "compress" |
53 ); |
53 ); |
54 |
54 |
55 my (@assps, @builds, %variants, @templates, %flags, %insts, %zip, %builder); |
55 my (@assps, @builds, %variants, @templates, %flags, %insts, %zip, %builder); |
56 my $main; |
56 my $main; |
57 my $kmain; |
57 my $kmain; |
126 $Epoc32Path = $toroot; |
126 $Epoc32Path = $toroot; |
127 $Epoc32Path =~ s/\\$//; |
127 $Epoc32Path =~ s/\\$//; |
128 $Epoc32Path .= $EpocRoot . "epoc32"; |
128 $Epoc32Path .= $EpocRoot . "epoc32"; |
129 $toolpath = "$Epoc32Path\\tools\\"; |
129 $toolpath = "$Epoc32Path\\tools\\"; |
130 push @INC, $toolpath; |
130 push @INC, $toolpath; |
131 $BasePath = $toroot . $e32path; |
131 $BasePath = $toroot; |
|
132 $BasePath =~ s/\\$/$e32path\\/; |
132 } |
133 } |
133 |
134 |
134 use E32Plat; |
135 use E32Plat; |
135 { |
136 { |
136 Plat_Init($toolpath); |
137 Plat_Init($toolpath); |
318 $ret = system($cppcmd); |
319 $ret = system($cppcmd); |
319 die "ERROR EXECUTING CPP\n" if $ret; |
320 die "ERROR EXECUTING CPP\n" if $ret; |
320 |
321 |
321 # Zap any ## marks REMS or blank lines |
322 # Zap any ## marks REMS or blank lines |
322 |
323 |
|
324 print "Cleaning up rom2.tmp to make rom3.tmp\n" if $debug; |
323 cleanup("rom2.tmp", "rom3.tmp", $k); |
325 cleanup("rom2.tmp", "rom3.tmp", $k); |
324 |
326 |
325 # scan tmp file and generate auxiliary files, if required |
327 # scan tmp file and generate auxiliary files, if required |
326 open TMP, "rom3.tmp" or die("Can't open rom3.tmp\n"); |
328 open TMP, "rom3.tmp" or die("Can't open rom3.tmp\n"); |
327 my $line; |
329 my $line; |
331 genfile("paged"); } |
333 genfile("paged"); } |
332 if ($line=~/\s*gentestnonpaged/i) { |
334 if ($line=~/\s*gentestnonpaged/i) { |
333 genfile("nonpaged"); } |
335 genfile("nonpaged"); } |
334 } |
336 } |
335 |
337 |
|
338 print "Parsing PatchData to make rom4.tmp\n" if $debug; |
336 parsePatchData("rom3.tmp", "rom4.tmp"); |
339 parsePatchData("rom3.tmp", "rom4.tmp"); |
337 |
340 |
338 # break down the oby file into rom, rofs and extensions oby files |
341 # break down the oby file into rom, rofs and extensions oby files |
339 |
342 |
340 my $oby_index =0; |
343 my $oby_index =0; |
341 my $dumpfile="rom.oby"; |
344 my $dumpfile="rom.oby"; |
342 my $rofs=0; |
345 my $rofs=0; |
|
346 my $smr=0; |
343 my $extension=0; |
347 my $extension=0; |
344 my $corerofsname=""; |
348 my $corerofsname=""; |
|
349 my $smrname=""; |
345 open DUMPFILE, ">$dumpfile" or die("Can't create $dumpfile\n"); |
350 open DUMPFILE, ">$dumpfile" or die("Can't create $dumpfile\n"); |
346 my $line; |
351 my $line; |
347 open TMP, "rom4.tmp" or die("Can't open rom4.tmp\n"); |
352 open TMP, "rom4.tmp" or die("Can't open rom4.tmp\n"); |
348 while ($line=<TMP>) |
353 while ($line=<TMP>) |
349 { |
354 { |
358 my $dumpfile="rofs".$rofs.".oby"; |
363 my $dumpfile="rofs".$rofs.".oby"; |
359 $rofs++; |
364 $rofs++; |
360 open DUMPFILE, ">$dumpfile" or (close TMP and die("Can't create $dumpfile\n")); |
365 open DUMPFILE, ">$dumpfile" or (close TMP and die("Can't create $dumpfile\n")); |
361 } |
366 } |
362 |
367 |
|
368 if ($line=~/^\s*imagename/i) |
|
369 { |
|
370 close DUMPFILE; # close rom.oby or previous rofs#/extension#.oby |
|
371 $smrname=$line; |
|
372 $smrname =~ s/imagename\s*=\s*//i; # save smr name |
|
373 $smrname =~ s/\s*$//g; # remove trailing \n |
|
374 unlink $smrname || print "unable to delete $smrname"; |
|
375 my $dumpfile="smr".$smr.".oby"; |
|
376 $smr++; |
|
377 open DUMPFILE, ">$dumpfile" or (close TMP and die("Can't create $dumpfile\n")); |
|
378 } |
|
379 |
363 if ($line=~/^\s*coreimage/i) |
380 if ($line=~/^\s*coreimage/i) |
364 { |
381 { |
365 close DUMPFILE; # close rofs.oby |
382 close DUMPFILE; # close rofs.oby |
366 if ($oby_index ne 1) { |
383 if ($oby_index ne 1) { |
367 close TMP; |
384 close TMP; |
490 { |
507 { |
491 print "$rofsbuilder $image returned $?\n"; |
508 print "$rofsbuilder $image returned $?\n"; |
492 $rerrors++; |
509 $rerrors++; |
493 } |
510 } |
494 rename "rofsbuild.log", "extension$i.log" |
511 rename "rofsbuild.log", "extension$i.log" |
|
512 } |
|
513 } |
|
514 |
|
515 if ($smr) { |
|
516 $rofsbuilder = $opts{'rofsbuilder'}; |
|
517 $rofsbuilder = "rofsbuild" unless ($rofsbuilder); |
|
518 for(my $i=0;$i<$smr;++$i) { |
|
519 print "Executing $rofsbuilder on smr partition\n" if !$quiet; |
|
520 my $image="smr".$i.".oby"; |
|
521 system("$rofsbuilder -smr=$image"); |
|
522 if ($? != 0) |
|
523 { |
|
524 print "$rofsbuilder -smr=$image returned $?\n"; |
|
525 $rerrors++; |
|
526 } |
|
527 rename "rofsbuild.log", "smr$i.log" |
495 } |
528 } |
496 } |
529 } |
497 |
530 |
498 if ($nerrors) { |
531 if ($nerrors) { |
499 print "\n\n Errors found during $builder!!\n\nLeaving tmp files\n"; |
532 print "\n\n Errors found during $builder!!\n\nLeaving tmp files\n"; |
779 if ($1 !~ /(\S+)\s*@\s*(\S+)\s+(\S+)\s*$/) |
812 if ($1 !~ /(\S+)\s*@\s*(\S+)\s+(\S+)\s*$/) |
780 { |
813 { |
781 die "Bad patchdata command: $line\n"; |
814 die "Bad patchdata command: $line\n"; |
782 } |
815 } |
783 |
816 |
|
817 print "Handling $line\n" if $debug; |
|
818 |
784 my ($file, $symbol, $value) = (lc $1, $2, $3); |
819 my ($file, $symbol, $value) = (lc $1, $2, $3); |
785 my ($srcFile, $destFile) = lookupFileInfo($infile, $file); |
820 my ($srcFile, $destFile) = lookupFileInfo($infile, $file); |
786 my ($index, $elementSize) = (undef, undef); |
821 my ($index, $elementSize) = (undef, undef); |
787 if ($symbol =~ s/:(\d+)\[(\d+)\]$//) |
822 if ($symbol =~ s/:(\d+)\[(\d+)\]$//) |
788 { |
823 { |
790 $index = hex($index) if $index =~ /^0x/i; |
825 $index = hex($index) if $index =~ /^0x/i; |
791 } |
826 } |
792 |
827 |
793 if ($srcFile =~ /\\armv5(smp)?\\/i) |
828 if ($srcFile =~ /\\armv5(smp)?\\/i) |
794 { |
829 { |
|
830 print "..looking up $symbol in $srcFile.map\n" if $debug; |
795 my ($symbolAddr, $symbolSize) = lookupSymbolInfo("$srcFile.map", $symbol); |
831 my ($symbolAddr, $symbolSize) = lookupSymbolInfo("$srcFile.map", $symbol); |
796 |
832 |
797 my $max; |
833 my $max; |
798 if (defined($index)) |
834 if (defined($index)) |
799 { |
835 { |
831 $value &= $max; |
867 $value &= $max; |
832 } |
868 } |
833 $value = sprintf("0x%08x", $value); |
869 $value = sprintf("0x%08x", $value); |
834 |
870 |
835 $line = "patchdata $destFile addr $symbolAddr $symbolSize $value\n"; |
871 $line = "patchdata $destFile addr $symbolAddr $symbolSize $value\n"; |
|
872 print ".. new line is $line\n" if $debug; |
836 } |
873 } |
837 else |
874 else |
838 { |
875 { |
839 $line = ""; |
876 $line = ""; |
840 } |
877 } |