# HG changeset patch # User kelvzhu # Date 1290480443 -28800 # Node ID 341ab25bc4ef199fff2692b25f03518f0b8c335f # Parent 37ee82a83d43725c95619ab24a800e91d13af304# Parent 170c8b3057689bbe3c55762842e9ac4cb1e6dbd5 merge from SF diff -r 37ee82a83d43 -r 341ab25bc4ef bintools/elftools/elftran/elf_reloc.cpp --- a/bintools/elftools/elftran/elf_reloc.cpp Fri Nov 12 14:49:36 2010 +0000 +++ b/bintools/elftools/elftran/elf_reloc.cpp Tue Nov 23 10:47:23 2010 +0800 @@ -128,7 +128,7 @@ checkreloc(aElfFile, *data, codeRelocs[i]->r_offset); //*data=FixAddress(aElfFile, *data, codeRelocs[i]); } -// fix defect + for (TInt j=0; jr_offset); diff -r 37ee82a83d43 -r 341ab25bc4ef bintools/evalid/EvalidCompare.pm --- a/bintools/evalid/EvalidCompare.pm Fri Nov 12 14:49:36 2010 +0000 +++ b/bintools/evalid/EvalidCompare.pm Tue Nov 23 10:47:23 2010 +0800 @@ -62,7 +62,8 @@ 'Unknown library' => 'identical', 'chm file' => 'chm_file', 'Header file' => 'header', - 'Distribution Policy' => 'distpol' + 'Distribution Policy' => 'distpol', + 'Rofs image' => 'img' ); @@ -83,7 +84,8 @@ ignore => {filter => \&FilterAll}, chm_file => {expandor => 'hh -decompile %TEMPDIR% %FILE%', rawretry => 1}, header => {filter => \&FilterCVSTags}, - distpol => {filter => \&DistributionPolicyFilter} + distpol => {filter => \&DistributionPolicyFilter}, + img => {expandor => 'readimage -z %TEMPDIR% %FILE%', rawretry => 1} ); @@ -93,6 +95,7 @@ my $log; my $verbose; +my $keepgoing; my $toRoot; my $dumpDir; @@ -108,6 +111,8 @@ my $file2 = shift; $verbose = defined($_[0]) ? shift : 0; $log = defined($_[0]) ? shift : *STDOUT; + $keepgoing = defined($_[0]) ? shift : 0; + # Try binary compare first (to keep semantics the same as evalid)... if (DoCompareFiles($file1, $file2, 'unknown format')) { return 1,'identical'; @@ -354,6 +359,11 @@ return "chm file"; } + if ($typeBuf =~/^(ROFS|ROFx)/) { + # img file + return "Rofs image"; + } + if ($file =~ m/\.(iby|h|hby|hrh|oby|rsg|cpp)$/i) { return "Header file"; } @@ -811,34 +821,62 @@ }, $tempdir2; #Work out the if the two file lists are different + my @tmpfiles; foreach my $file (sort keys %iFileList1) { if (! defined $iFileList2{$file}) { # If the filename does not exist in the second filelist the compressed files cannot be the same. print ($log "Did not find $file in $file2\n") if ($verbose); - return 0; + if(!$keepgoing){ + return 0; + }else{ + push @tmpfiles, $file; + } } else { delete $iFileList2{$file} } } + foreach my $file (@tmpfiles) + { + delete $iFileList1{$file}; + } # There are extra files in the second compressed file therefore the compressed files cannot be the same. if (scalar(keys %iFileList2) > 0) { print ($log "$file2 contained more files than $file1\n") if ($verbose); - return 0; + if (!$keepgoing){ + return 0; + }else{ + foreach my $file (sort keys %iFileList2){ + print ($log "Dig not find $file in $file1\n") if ($verbose); + } + } } print($log "Comparing content\n") if ($verbose); #filelist1 and filelist2 contain all the same filenames, now compare the contents of each file - my $same = -1; # Variable to store collated result of comparison, assume an error + my $same = 1; # Variable to store collated result of comparison, assume an error foreach my $file (keys %iFileList1) { - my $type; - ($same, $type) = CompareFiles($tempdir1.$file,$tempdir2.$file, $verbose, $log); + my $tmpsame; + my $type; + ($tmpsame, $type) = CompareFiles($tempdir1.$file,$tempdir2.$file, $verbose, $log, $keepgoing); print ($log "Comparing $tempdir1.$file against $tempdir2.$file\n") if ($verbose); - last if ($same == 0); # do not bother comparing more files if one of the expanded files is different. + if (!$keepgoing){ + if ($tmpsame == 0){ # do not bother comparing more files if one of the expanded files is different. + $same = 0; + last; + } + }else{ + if ($tmpsame == 0){ + print ($log "Failed\n\n") if ($verbose); + $same = 0; + }else{ + print ($log "OK\n\n") if ($verbose); + } + } } #Cleanup the temporary directories diff -r 37ee82a83d43 -r 341ab25bc4ef bintools/evalid/EvalidCompare.pm.bak --- a/bintools/evalid/EvalidCompare.pm.bak Fri Nov 12 14:49:36 2010 +0000 +++ b/bintools/evalid/EvalidCompare.pm.bak Tue Nov 23 10:47:23 2010 +0800 @@ -62,7 +62,8 @@ 'Unknown library' => 'identical', 'chm file' => 'chm_file', 'Header file' => 'header', - 'Distribution Policy' => 'distpol' + 'Distribution Policy' => 'distpol', + 'Rofs image' => 'img' ); @@ -83,7 +84,8 @@ ignore => {filter => \&FilterAll}, chm_file => {expandor => 'hh -decompile %TEMPDIR% %FILE%', rawretry => 1}, header => {filter => \&FilterCVSTags}, - distpol => {filter => \&DistributionPolicyFilter} + distpol => {filter => \&DistributionPolicyFilter}, + img => {expandor => 'readimage -z %TEMPDIR% %FILE%', rawretry => 1} ); @@ -93,6 +95,7 @@ my $log; my $verbose; +my $keepgoing; my $toRoot; my $dumpDir; @@ -108,6 +111,8 @@ my $file2 = shift; $verbose = defined($_[0]) ? shift : 0; $log = defined($_[0]) ? shift : *STDOUT; + $keepgoing = defined($_[0]) ? shift : 0; + # Try binary compare first (to keep semantics the same as evalid)... if (DoCompareFiles($file1, $file2, 'unknown format')) { return 1,'identical'; @@ -240,7 +245,7 @@ open (FILE, $file) or die "Error: Couldn't open \"$file\" for reading: $!\n"; binmode (FILE); - while ($typeBuf =~ /^.{48}([0-9 ]{9})\x60\x0A(......)/s) { + while ($typeBuf =~ /^.{48}([0-9 ]{9}).\x60\x0A(......)/s) { # $1 is the size of the archive member, $2 is first 6 bytes of the file # There may be several different sorts of file in the archive, and we # need to scan through until we find a type we recognize: @@ -354,6 +359,11 @@ return "chm file"; } + if ($typeBuf =~/^(ROFS|ROFx)/) { + # img file + return "Rofs image"; + } + if ($file =~ m/\.(iby|h|hby|hrh|oby|rsg|cpp)$/i) { return "Header file"; } @@ -811,34 +821,62 @@ }, $tempdir2; #Work out the if the two file lists are different + my @tmpfiles; foreach my $file (sort keys %iFileList1) { if (! defined $iFileList2{$file}) { # If the filename does not exist in the second filelist the compressed files cannot be the same. print ($log "Did not find $file in $file2\n") if ($verbose); - return 0; + if(!$keepgoing){ + return 0; + }else{ + push @tmpfiles, $file; + } } else { delete $iFileList2{$file} } } + foreach my $file (@tmpfiles) + { + delete $iFileList1{$file}; + } # There are extra files in the second compressed file therefore the compressed files cannot be the same. if (scalar(keys %iFileList2) > 0) { print ($log "$file2 contained more files than $file1\n") if ($verbose); - return 0; + if (!$keepgoing){ + return 0; + }else{ + foreach my $file (sort keys %iFileList2){ + print ($log "Dig not find $file in $file1\n") if ($verbose); + } + } } print($log "Comparing content\n") if ($verbose); #filelist1 and filelist2 contain all the same filenames, now compare the contents of each file - my $same = -1; # Variable to store collated result of comparison, assume an error + my $same = 1; # Variable to store collated result of comparison, assume an error foreach my $file (keys %iFileList1) { - my $type; - ($same, $type) = CompareFiles($tempdir1.$file,$tempdir2.$file, $verbose, $log); - print ($log "Comparing $tempdir1.$file against $tempdir2.$file\n") if ($verbose); - last if ($same == 0); # do not bother comparing more files if one of the expanded files is different. + my $tmpsame; + my $type; + ($tmpsame, $type) = CompareFiles($tempdir1.$file,$tempdir2.$file, $verbose, $log, $keepgoing); + print ($log "Comparing $tempdir1.$file against $tempdir2.$file, $tmpsame, $keepgoing\n") if ($verbose); + if (!$keepgoing){ + if ($tmpsame == 0){ # do not bother comparing more files if one of the expanded files is different. + $same = 0; + last; + } + }else{ + if ($tmpsame == 0){ + print ($log "Failed\n\n") if ($verbose); + $same = 0; + }else{ + print ($log "OK\n\n") if ($verbose); + } + } } #Cleanup the temporary directories diff -r 37ee82a83d43 -r 341ab25bc4ef bintools/evalid/evalid.lis --- a/bintools/evalid/evalid.lis Fri Nov 12 14:49:36 2010 +0000 +++ b/bintools/evalid/evalid.lis Tue Nov 23 10:47:23 2010 +0800 @@ -116,3 +116,4 @@ Failed 1 of 47 comparisons ---------------- +FAILED: left\ok\Image_file\rofs.img and right\ok\Image_file\rofs.img (Rofs image) diff -r 37ee82a83d43 -r 341ab25bc4ef bintools/evalid/evalid.pl --- a/bintools/evalid/evalid.pl Fri Nov 12 14:49:36 2010 +0000 +++ b/bintools/evalid/evalid.pl Tue Nov 23 10:47:23 2010 +0800 @@ -27,13 +27,14 @@ my $passed=0; my $failed=0; -GetOptions("c", "v", "l=s", "g", "f", "m", "u", "x=s@", "i=s@", "d=s"); +GetOptions("c", "v", "l=s", "k", "g", "f", "m", "u", "x=s@", "i=s@", "d=s"); $opt_v = $opt_v; # To keep -w quiet. $opt_g = $opt_g; # To keep -w quiet. $opt_f = $opt_f; # To keep -w quiet. $opt_m = $opt_m; # To keep -w quiet. $opt_u = $opt_u; # To keep -w quiet. $opt_d = $opt_d; # To keep -w quiet. +$opt_k = $opt_k; # To keep -w quiet. unless ((@ARGV > 1) && (@ARGV < 4)) { @@ -61,6 +62,7 @@ -v -- verbose information about failed comparisons -c -- print results to standard output -l -- append results to + -k -- keep going The default is equivalent to "-l evalid.lis" @@ -311,7 +313,7 @@ return; } - my ($same, $type) = EvalidCompare::CompareFiles($left, $right, $opt_v, $log); + my ($same, $type) = EvalidCompare::CompareFiles($left, $right, $opt_v, $log, $opt_k); if ($same) { identical($left, $right, $type); diff -r 37ee82a83d43 -r 341ab25bc4ef bintools/evalid/evalid.txt --- a/bintools/evalid/evalid.txt Fri Nov 12 14:49:36 2010 +0000 +++ b/bintools/evalid/evalid.txt Tue Nov 23 10:47:23 2010 +0800 @@ -238,3 +238,18 @@ When using the MD5 comparing functionality EVALID processes the contents of the temporary directory using the standard EVALID process but amalgamates the results in to one MD5 signiture. + +-------- +(ROFS IMAGE file) + +EVALID applies "readimage -z" to each file expanding it to a temporary directory and then compares +the contents of the temporary directory using the following process: + +When directly comparing two Rofs image files EVALID will first compare the file listing of the temporary +directories and return failed if the file listing is not identical. +If the file listing are identical it will then compare the contents of the two temporary directories +using the normal EVALID process. + +When "-k" (keepgoing) option is specified, EVALID will first compare the file listing. If "-v" option sepcified, +list the files which do not exist in both directories. Then it will compare the contents of the directories. +If "-v" option specified, it will report the result for every file in the directories. diff -r 37ee82a83d43 -r 341ab25bc4ef bintools/evalid/left/fail/Image_file/rofs.img Binary file bintools/evalid/left/fail/Image_file/rofs.img has changed diff -r 37ee82a83d43 -r 341ab25bc4ef bintools/evalid/left/ok/Image_file/rofs.img Binary file bintools/evalid/left/ok/Image_file/rofs.img has changed diff -r 37ee82a83d43 -r 341ab25bc4ef bintools/evalid/right/fail/Image_file/rofs.img Binary file bintools/evalid/right/fail/Image_file/rofs.img has changed diff -r 37ee82a83d43 -r 341ab25bc4ef bintools/evalid/right/ok/Image_file/rofs.img Binary file bintools/evalid/right/ok/Image_file/rofs.img has changed diff -r 37ee82a83d43 -r 341ab25bc4ef bintools/evalid/tools_evalid.history.xml --- a/bintools/evalid/tools_evalid.history.xml Fri Nov 12 14:49:36 2010 +0000 +++ b/bintools/evalid/tools_evalid.history.xml Tue Nov 23 10:47:23 2010 +0800 @@ -19,6 +19,10 @@ + + EVALID : add Rofs image file comparison support + + EVALID : evalid not so happy identifying libs created by new mwldsym2.exe diff -r 37ee82a83d43 -r 341ab25bc4ef bintools/evalid/tools_evalid.history.xml.bak --- a/bintools/evalid/tools_evalid.history.xml.bak Fri Nov 12 14:49:36 2010 +0000 +++ b/bintools/evalid/tools_evalid.history.xml.bak Tue Nov 23 10:47:23 2010 +0800 @@ -18,6 +18,14 @@ + + + EVALID : add Rofs image file comparison support + + + + EVALID : evalid not so happy identifying libs created by new mwldsym2.exe + EVALID : x86 static library comparisons sometimes fail when they shouldn't diff -r 37ee82a83d43 -r 341ab25bc4ef bintools/rcomp/src/messages.cpp --- a/bintools/rcomp/src/messages.cpp Fri Nov 12 14:49:36 2010 +0000 +++ b/bintools/rcomp/src/messages.cpp Tue Nov 23 10:47:23 2010 +0800 @@ -252,8 +252,8 @@ Add(new Message(LT_044_Message, LT_044, "044", true, KWarning)); /* This warning has been added to hopefully fix a long standing defect where labels which - * have not been declared are silently included in the emitted resource file. More - * details at defect INC061459 */ + * have not been declared are silently included in the emitted resource file. + */ const String LT_045_Message = "the following label is used but has not been declared: "; Add(new Message(LT_045_Message, LT_045, "045", true, KWarning)); diff -r 37ee82a83d43 -r 341ab25bc4ef bintools/rcomp/src/rcompl.cpp --- a/bintools/rcomp/src/rcompl.cpp Fri Nov 12 14:49:36 2010 +0000 +++ b/bintools/rcomp/src/rcompl.cpp Tue Nov 23 10:47:23 2010 +0800 @@ -236,7 +236,7 @@ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... + * instead of setting up a fresh yyin. */ static int yy_did_buffer_switch_on_eof; diff -r 37ee82a83d43 -r 341ab25bc4ef deprecated/buildtools/romkiteka2/include/featuredatabase.xml diff -r 37ee82a83d43 -r 341ab25bc4ef deprecated/etouch/etouch.cpp --- a/deprecated/etouch/etouch.cpp Fri Nov 12 14:49:36 2010 +0000 +++ b/deprecated/etouch/etouch.cpp Tue Nov 23 10:47:23 2010 +0800 @@ -21,7 +21,7 @@ #endif //__MSVCDOTNET__ #if defined(__VC32__) || defined(__TOOLS2__) - #include + #include #else #include #endif diff -r 37ee82a83d43 -r 341ab25bc4ef e32tools/elf2e32/group/release.txt --- a/e32tools/elf2e32/group/release.txt Fri Nov 12 14:49:36 2010 +0000 +++ b/e32tools/elf2e32/group/release.txt Tue Nov 23 10:47:23 2010 +0800 @@ -4,6 +4,16 @@ NOTESRC_RELEASE_REASON Postlinker(elf2e32) Release +version 2.2 build(8) +=============== +Released by Jason Cui, 17/11/2010 + 1) [RC] Failure ou1cimx1#612374 created : elf2e32.exe puts wrong name in library .dso file + +version 2.2 build(7) +=============== +Released by Lorence Wang, 17/11/2010 + 1) Bug3494 elf2e32 treatment of ARM$$INIT_ARRAY$$Base can break GCCE builds + version 2.2 build(6) =============== Released by Marvin Shi, 26/10/2010 diff -r 37ee82a83d43 -r 341ab25bc4ef e32tools/elf2e32/include/h_ver.h --- a/e32tools/elf2e32/include/h_ver.h Fri Nov 12 14:49:36 2010 +0000 +++ b/e32tools/elf2e32/include/h_ver.h Tue Nov 23 10:47:23 2010 +0800 @@ -18,7 +18,7 @@ const TInt MajorVersion=2; const TInt MinorVersion=2; -const TInt Build=6; +const TInt Build=7; #endif diff -r 37ee82a83d43 -r 341ab25bc4ef e32tools/elf2e32/source/deffile.cpp --- a/e32tools/elf2e32/source/deffile.cpp Fri Nov 12 14:49:36 2010 +0000 +++ b/e32tools/elf2e32/source/deffile.cpp Tue Nov 23 10:47:23 2010 +0800 @@ -463,27 +463,27 @@ IsWord(iLine + iOffset, aCurrentPos); char *cmt = strchr(iLine + iOffset, ';'); - char *aAlias = strchr(iLine + iOffset, '='); + char *aExport = strchr(iLine + iOffset, '='); - if( aAlias && (!cmt || (aAlias < cmt)) ) + if( aExport && (!cmt || (aExport < cmt)) ) { - int aAliasPos = aAlias - (iLine+ iOffset); + int aExportPos = aExport - (iLine+ iOffset); //Check if alias name is also supplied, they should be separated - // by whitespace, i.e., SymbolName=AliasName is valid while, - // SymbolName =AliasName is invalid. - if( aAliasPos > aCurrentPos) + // by whitespace, i.e., ExportName=SymbolName is valid while, + // ExportName =SymbolName is invalid. + if( aExportPos > aCurrentPos) { char *aToken = (iLine + iOffset + aCurrentPos); throw DEFFileError(UNRECOGNIZEDTOKEN, iFileName, iLineNum, aToken); } - aSymbolName = new char[aAliasPos+1]; - strncpy(aSymbolName, iLine + iOffset, aAliasPos); - aSymbolName[aAliasPos] = '\0'; - char *aExportName = new char[aCurrentPos - aAliasPos + 1]; - strncpy(aExportName, aAlias +1, (aCurrentPos - aAliasPos)); - aExportName[(aCurrentPos - aAliasPos)] = '\0'; + char* aExportName = new char[aExportPos+1]; + strncpy(aExportName, iLine+iOffset, aExportPos); + aExportName[aExportPos] = '\0'; + aSymbolName = new char[aCurrentPos - aExportPos + 1]; + strncpy(aSymbolName, aExport +1, (aCurrentPos - aExportPos)); + aSymbolName[(aCurrentPos - aExportPos-1)] = '\0'; iSymbol->ExportName(aExportName); } else diff -r 37ee82a83d43 -r 341ab25bc4ef e32tools/elf2e32/source/e32imagefile.cpp --- a/e32tools/elf2e32/source/e32imagefile.cpp Fri Nov 12 14:49:36 2010 +0000 +++ b/e32tools/elf2e32/source/e32imagefile.cpp Tue Nov 23 10:47:23 2010 +0800 @@ -495,7 +495,7 @@ aRelocsSize = Align(rsize + sizeof(E32RelocSection), sizeof(uint32)); uint32 aBase = (*aRelocList.begin())->iSegment->p_vaddr; - //add for cleanup to be done later.. + cleanupStack.push_back(aRelocs); aRelocs = new char [aRelocsSize]; memset(aRelocs, 0, aRelocsSize); diff -r 37ee82a83d43 -r 341ab25bc4ef e32tools/elf2e32/source/pl_elfexecutable.cpp --- a/e32tools/elf2e32/source/pl_elfexecutable.cpp Fri Nov 12 14:49:36 2010 +0000 +++ b/e32tools/elf2e32/source/pl_elfexecutable.cpp Tue Nov 23 10:47:23 2010 +0800 @@ -1438,7 +1438,7 @@ try { - bool limitSymbolFound = false; + bool specialSymbolFound = false; // If Symbol is absolute then assume it came from linker and is a // limit symbol. @@ -1448,19 +1448,21 @@ } else { + // does the symbol point to the address after the end of the code or data segments? if( (iCodeSegmentHdr && aSym->st_value == (iCodeSegmentHdr->p_vaddr + iCodeSegmentHdr->p_memsz)) || (iDataSegmentHdr && aSym->st_value == (iDataSegmentHdr->p_vaddr + iDataSegmentHdr->p_memsz)) ) { - //If Symbol is a $$Limit symbol, then consider the open boundary. - String limitstr = iStringTable + aSym->st_name; - if (limitstr.rfind("$$Limit",limitstr.length()) != String::npos) + //If Symbol contains $$, it is linker generated so consider the open boundary. + //e.g. SHT$$INIT_ARRAY$$Limit and sometimes SHT$$INIT_ARRAY$$Base + String aSymstr = iStringTable + aSym->st_name; + if (aSymstr.rfind("$$",aSymstr.length()) != String::npos) { aHdr = SegmentFromAbs(aSym->st_value); - limitSymbolFound = true; + specialSymbolFound = true; } } - if(!limitSymbolFound ) + if(!specialSymbolFound ) { aHdr = Segment(aSym->st_value); } diff -r 37ee82a83d43 -r 341ab25bc4ef e32tools/elf2e32/source/pl_elfproducer.cpp --- a/e32tools/elf2e32/source/pl_elfproducer.cpp Fri Nov 12 14:49:36 2010 +0000 +++ b/e32tools/elf2e32/source/pl_elfproducer.cpp Tue Nov 23 10:47:23 2010 +0800 @@ -172,7 +172,10 @@ while(aItr != aEnd) { String aSymName(""); aSym = *aItr; - aSymName = aSym->SymbolName(); + if(aSym->ExportName()) + aSymName = aSym->ExportName(); + else + aSymName = aSym->SymbolName(); //set symbol info.. iElfDynSym[aIdx].st_name = iDSOSymNameStrTbl.size(); @@ -183,7 +186,10 @@ //set version table info... iVersionTbl[aIdx] = DEFAULT_VERSION; - AddToHashTable(aSym->SymbolName(), aIdx); + if(aSym->ExportName()) + AddToHashTable(aSym->ExportName(), aIdx); + else + AddToHashTable(aSym->SymbolName(), aIdx); aItr++;aIdx++; } diff -r 37ee82a83d43 -r 341ab25bc4ef imgtools/buildrom/group/BLD.INF --- a/imgtools/buildrom/group/BLD.INF Fri Nov 12 14:49:36 2010 +0000 +++ b/imgtools/buildrom/group/BLD.INF Tue Nov 23 10:47:23 2010 +0800 @@ -59,6 +59,7 @@ ../tools/featuresdat.pm /epoc32/tools/featuresdat.pm ../tools/features.pl /epoc32/tools/features.pl ../tools/features.pm /epoc32/tools/features.pm +../tools/featureconfigurator.pl /epoc32/tools/featureconfigurator.pl #ifndef TOOLS2_LINUX ../tools/features.cmd /epoc32/tools/features.cmd diff -r 37ee82a83d43 -r 341ab25bc4ef imgtools/buildrom/group/release.txt --- a/imgtools/buildrom/group/release.txt Fri Nov 12 14:49:36 2010 +0000 +++ b/imgtools/buildrom/group/release.txt Tue Nov 23 10:47:23 2010 +0800 @@ -1,3 +1,8 @@ +Version 3.32.0 (BUILDROM) +=============== +Released by Ross Qin, 18/11/2010 + 1) Moving feature configuration out of the buildrom scope. + Version 3.31.0 (BUILDROM) =============== Released by Lorence Wang, 20/10/2010 diff -r 37ee82a83d43 -r 341ab25bc4ef imgtools/buildrom/tools/buildrom --- a/imgtools/buildrom/tools/buildrom Fri Nov 12 14:49:36 2010 +0000 +++ b/imgtools/buildrom/tools/buildrom Tue Nov 23 10:47:23 2010 +0800 @@ -1,2 +1,8 @@ #!/bin/sh -perl -S buildrom.pl $@ +PRGDIR=`dirname "$0"` + +PRGDIR=`cd "$PRGDIR"; pwd` + + +perl "$PRGDIR/buildrom.pl" $@ + diff -r 37ee82a83d43 -r 341ab25bc4ef imgtools/buildrom/tools/buildrom.pm --- a/imgtools/buildrom/tools/buildrom.pm Fri Nov 12 14:49:36 2010 +0000 +++ b/imgtools/buildrom/tools/buildrom.pm Tue Nov 23 10:47:23 2010 +0800 @@ -67,7 +67,7 @@ my $enforceFeatureManager = 0; # Flag to make Feature Manager mandatory if SYMBIAN_FEATURE_MANAGER macro is defined. my $BuildromMajorVersion = 3 ; -my $BuildromMinorVersion = 31; +my $BuildromMinorVersion = 32; my $BuildromPatchVersion = 0; @@ -75,13 +75,18 @@ { # Option "-fm" will be supported instead of option "-f|fr" if SYMBIAN_FEATURE_MANAGER macro is defined. - my $featuresOptionUsage = "-ffeatureuids or -fr=featureuids -- feature registry database XML file name"; + my $featuresOptionUsage = "-ffeatureuids or -fr=featureuids -- [obsolete] Feature registry database XML file name\n". + " Please use featureconfigurator.pl to configurate features.\n\n". + " -nofm -- Don't perform feature configuration \n\n"; if ($enforceFeatureManager) { - $featuresOptionUsage = "-fm=featuredatabasefile -- feature manager/feature registry database XML file name.\n". - "\t\t\t\t Multiple XML files can be passed seperated by commas.\n". - " -nofm=featuresdatafile -- don't generate features data file.". - " Instead use pre-built features data file."; + $featuresOptionUsage = "-fm=featuredatabasefile -- [obsolete] Feature manager/feature registry database XML file name.\n". + " Multiple XML files can be passed seperated by commas.\n". + " Please use featureconfigurator.pl to configurate features.\n\n". + " -nofm=featuresdatafile -- [obsolete] Don't generate features data file.\n". + " Use pre-built features data file instead.\n". + " Please use featureconfigurator.pl to configurate features.\n\n". + " -nofm -- Don't perform feature configuration\n\n"; } #........1.........2.........3.........4.........5.........6.........7..... @@ -117,7 +122,8 @@ -p -- preserves the intermediate files pertaining to data drive, Z drive and BMCONV -spi -- enable producing SPI files -spiplacement -- enable positioning of spi file - -w -- warn if file has been selected from a different directory + -w -- warn if file has been selected from a different directory + $featuresOptionUsage -etool -- external tool specification (xx is tool's perl module) -compress -- compression type of ROM image: @@ -159,7 +165,9 @@ -prependepocroot -- if there is no EPOCROOT## before /epoc32/, prepend EPOCROOT## to epoc32. -stdcpp -- ignore symbian customized cpp and try to find another cpp in the PATH.(for Windows only) -cpp=xxx -- specify a CPP preprocessor used by Buildrom. - -xiponly -- just create the XIP ROM image without creating the ROFS image. + -xiponly -- just create the XIP ROM image without creating the ROFS image. + -nopreprocess -- Input oby files have been or don't need to be preprocessed, + don't preprocess the input oby files. -inputoby= -- Ignore BUILDROM config phase, invoke Rombuild/Rofsbuild using . must contain one and ONLY one of romsize/rofssize/dataimagename/imagename keywords, The keywords will be used to identify the OBY type. @@ -278,6 +286,7 @@ my $featuremanager = 0; #Flag to enable support for feature manager database XML file and to generate # features data file. my $noFeatureManager = 0; # Flag to stop the generation of features.dat file and use pre-built features.dat if provided. +my $noFeatureConf = 0 ; my $preBuiltFeaturesDataFile = ''; # To store the name of pre-built features.dat file provided with "-nofm" option. #Image Content XML file that supports specific feature to be added @@ -359,6 +368,7 @@ my $preprocessor = "cpp"; my $opt_xiponly = 0; my $ignoreconfig = 0; +my $nopreprocess = 0; my $romcount = 0; sub match_obyfile @@ -755,8 +765,7 @@ my ($paramFileFlag, @argList); - if (defined @_) - { + if (defined @_ && scalar(@_) > 0) { ($paramFileFlag, @argList) = @_; } else @@ -783,13 +792,15 @@ } } # first searching argList for keepgoing option + my @newArgList = (); foreach my $arg (@argList) { - if ( $arg =~ /^-k$/i || $arg =~ /^-keepgoing$/i ) - { - $opt_k = 1; - next; - } - if ($arg =~ /^-workdir=(.*)/) + if ( $arg =~ /^-k$/i || $arg =~ /^-keepgoing$/i ) { + $opt_k = 1; + } + elsif($arg =~ /^-nopreprocess$/i ) { + $nopreprocess = 1 ; + } + elsif ($arg =~ /^-workdir=(.*)/) { my $workdir = $1; if (!-d $workdir) @@ -806,11 +817,13 @@ $thisdir =~ s-\/-\\-g; } $opt_workdir = 1; - chdir "$currentdir"; - next; + chdir "$currentdir"; + } + else { + push @newArgList, $arg ; } } - foreach my $arg (@argList) + foreach my $arg (@newArgList) { if ($arg =~ /^-argfile=(.*)/) { @@ -927,6 +940,7 @@ $errors++; next; } + $noFeatureConf = 0; $featureXml = $1; $xmlrequired = 1; $featuremanager = 1; @@ -978,14 +992,18 @@ } next; } - if ($arg =~ /^-nofm(=(.*))?$/) - { - if (!$enforceFeatureManager) - { - print "Unknown arg: $arg\n"; + if ($arg =~ /^-nofm(=(.*))?$/) { + if(!$1) { + $noFeatureConf = 1 ; + next ; + } + + if (!$enforceFeatureManager) { + print "Unsupported option: $arg\n"; $errors++; next; - } + } + $noFeatureConf = 0; $noFeatureManager = 1; #DEF125375 If caller is simply giving -nofm without any parameter, a warning message will be given. if(!$2) @@ -1050,42 +1068,49 @@ $checkcase_test=1; next; } - if ($arg =~ /^-workdir=(.*)/) - { - next; - } + if ($arg =~ /^-stdcpp$/) - { - if (&is_linux) - { - print "Warning: option -stdcpp only apply for Windows\n"; - next; + { + if($nopreprocess) { + print STDERR "Warning: -stdcpp option is invalid because the -nopreprocess option set.\n"; } - if ($cppoption) - { - die "Error: -stdcpp option and -cpp=xxx option cannot be used at the same time.\n"; + else { + if (&is_linux) + { + print "Warning: option -stdcpp only apply for Windows\n"; + next; + } + if ($cppoption) + { + die "Error: -stdcpp option and -cpp=xxx option cannot be used at the same time.\n"; + } + $stdcpp = 1; } - $stdcpp = 1; next; } if ($arg =~ /^-cpp=(.*)/) { - if ($stdcpp) - { - die "Error: -stdcpp option and -cpp=xxx option cannot be used at the same time.\n"; - } - if ($cppoption) - { - print "Warning: -cpp option has been set before. The previous configuration will be overwritten!\n"; + if($nopreprocess) { + print STDERR "Warning: -cpp option is invalid because the -nopreprocess option set.\n"; } - $cppoption = 1; - $preprocessor = $1; - $preprocessor =~ s-\\-\/-g; - $preprocessor =~ s-EPOCROOT##\/?-$epocroot-g; - if (-d $preprocessor) - { - $preprocessor .= "\/" unless $preprocessor =~ /\/$/; - $preprocessor .= "cpp"; + else { + if ($stdcpp) + { + die "Error: -stdcpp option and -cpp=xxx option cannot be used at the same time.\n"; + } + if ($cppoption) + { + print "Warning: -cpp option has been set before. The previous configuration will be overwritten!\n"; + } + $cppoption = 1; + $preprocessor = $1; + $preprocessor =~ s-\\-\/-g; + $preprocessor =~ s-EPOCROOT##\/?-$epocroot-g; + if (-d $preprocessor) + { + $preprocessor .= "\/" unless $preprocessor =~ /\/$/; + $preprocessor .= "cpp"; + } } next; } @@ -1265,11 +1290,6 @@ } next; } - if ( $arg =~ /^-k$/i || $arg =~ /^-keepgoing$/i ) - { - $opt_k = 1; - next; - } if ( $arg =~ /^-r$/i || $arg =~ /^-retainfolder$/i ) { $opt_r = 1; @@ -1391,98 +1411,122 @@ sub preprocessing_phase { - my $temp1OBYFile = $thisdir."tmp1.oby"; - unlink "$temp1OBYFile"; - -# Macro "ROM_FEATURE_MANAGEMENT" is defined when "-f|fr" or "-fm" is used - if (defined ($featureXml)) - { - $cppargs .= " -DROM_FEATURE_MANAGEMENT "; - } - - # add pre-include file and include directories for feature variants - if ($featureVariant{'VALID'}) - { - $cppargs .= " -I."; - my $incRef = $featureVariant{'ROM_INCLUDES'}; - if ($incRef) + if($nopreprocess == 0) { + my $temp1OBYFile = $thisdir."tmp1.oby"; + unlink "$temp1OBYFile"; + + # Macro "ROM_FEATURE_MANAGEMENT" is defined when "-f|fr" or "-fm" is used + if (defined ($featureXml)) { - foreach (@$incRef) + $cppargs .= " -DROM_FEATURE_MANAGEMENT "; + } + + # add pre-include file and include directories for feature variants + if ($featureVariant{'VALID'}) + { + $cppargs .= " -I."; + my $incRef = $featureVariant{'ROM_INCLUDES'}; + if ($incRef) + { + foreach (@$incRef) + { + $cppargs .= " -I \"$_\""; + } + } + my $HRH = $featureVariant{'VARIANT_HRH'}; + if ($HRH) { - $cppargs .= " -I \"$_\""; + $cppargs .= " -include \"$HRH\""; } } - my $HRH = $featureVariant{'VARIANT_HRH'}; - if ($HRH) + else + { + # no feature variant so use the standard includes + $cppargs .= " -I. -I \"$rominclude\""; + } + + if ($stdcpp) + { + $preprocessor = find_stdcpp(); + } + print "* $preprocessor -Wno-endif-labels -o $temp1OBYFile $cppargs\n" if ($opt_v); + + is_existinpath("$preprocessor", romutl::DIE_NOT_FOUND); + $errors = 0; + open CPP, "| $preprocessor -Wno-endif-labels -o $temp1OBYFile $cppargs" or die "* Can't execute cpp"; + foreach my $arg (@obyfiles) { - $cppargs .= " -include \"$HRH\""; - } - } - else - { - # no feature variant so use the standard includes - $cppargs .= " -I. -I \"$rominclude\""; - } - - if ($stdcpp) - { - $preprocessor = find_stdcpp(); + print CPP "\n#line 1 \"$arg\"\n"; + + if(open(OBY, $arg)) { + print "* reading $arg\n" if ($opt_v); + while ($line=) { + print CPP $line; + } + close OBY; + } + else { + print STDERR "* Can't open $arg\n"; + if(!$opt_k){ + close CPP; + exit(1); + } + } + } + close CPP; + my $cpp_status = $?; + die "* cpp failed\n" if ($cpp_status != 0 || !-f "$temp1OBYFile"); + + if( defined ($image_content)) + { + #Read the OBY file that was generated by the pre-processor + &ReadPreprocessedFile($temp1OBYFile); + + # Check if the static dependencies of the OBY binaries are resolved. + &ImageContentHandler::UpdateObyBinaryStaticDep(); + + #Now append the files collected from cdfs. + &ImageContentHandler::GenObyFile($temp1OBYFile); + } + + if($obycharset =~ /utf-?8/i) + { + my $utf8file = $thisdir."tmp1utf8.oby"; + open INFILE, "<$temp1OBYFile" or die "* Can't open file $temp1OBYFile"; + open CHARSETTRAN, "| charsettran -to=hostcharset > $utf8file" or die "* Can't execute charsetran"; + while() + { + print CHARSETTRAN $_; + } + close CHARSETTRAN; + close INFILE; + unlink $temp1OBYFile or die "* Can't remove file $temp1OBYFile"; + rename $utf8file, $temp1OBYFile or die "* Can't rename file $utf8file to file $temp1OBYFile"; + } + @obydata = (); + # load tmp1.oby here + open TMP1, "$temp1OBYFile" or die("* Can't open $temp1OBYFile\n"); + while() { + push @obydata,$_; + } + close TMP1 ; } - print "* $preprocessor -Wno-endif-labels -o $temp1OBYFile $cppargs\n" if ($opt_v); - - is_existinpath("$preprocessor", romutl::DIE_NOT_FOUND); - $errors = 0; - open CPP, "| $preprocessor -Wno-endif-labels -o $temp1OBYFile $cppargs" or die "* Can't execute cpp"; - foreach my $arg (@obyfiles) - { - print CPP "\n#line 1 \"$arg\"\n"; - - if(open(OBY, $arg)) { - print "* reading $arg\n" if ($opt_v); - while ($line=) { - print CPP $line; - } - close OBY; - } - else { - print STDERR "* Can't open $arg\n"; - if(!$opt_k){ - close CPP; - exit(1); + else { + foreach my $arg (@obyfiles) { + if(open(OBY, $arg)) { + print "* reading $arg\n" if ($opt_v); + while () { + push @obydata,$_; + } + close OBY; } - } - } - close CPP; - my $cpp_status = $?; - die "* cpp failed\n" if ($cpp_status != 0 || !-f "$temp1OBYFile"); - - if( defined ($image_content)) - { - #Read the OBY file that was generated by the pre-processor - &ReadPreprocessedFile($temp1OBYFile); - -# Check if the static dependencies of the OBY binaries are resolved. - &ImageContentHandler::UpdateObyBinaryStaticDep(); - - #Now append the files collected from cdfs. - &ImageContentHandler::GenObyFile($temp1OBYFile); - } - - # Setup default rom configuration - $romimage[0] = {xip=>1, compress=>0, extension=>0, composite=>"none",uncompress=>0 }; - if($obycharset =~ /utf-?8/i) - { - my $utf8file = $thisdir."tmp1utf8.oby"; - open INFILE, "<$temp1OBYFile" or die "* Can't open file $temp1OBYFile"; - open CHARSETTRAN, "| charsettran -to=hostcharset > $utf8file" or die "* Can't execute charsetran"; - while() - { - print CHARSETTRAN $_; - } - close CHARSETTRAN; - close INFILE; - unlink $temp1OBYFile or die "* Can't remove file $temp1OBYFile"; - rename $utf8file, $temp1OBYFile or die "* Can't rename file $utf8file to file $temp1OBYFile"; + else { + print STDERR "* Can't open $arg\n"; + if(!$opt_k){ + exit(1); + } + } + } } } @@ -1553,50 +1597,46 @@ $substitutionData{"RIGHT_NOW"} = sprintf("%02d/%02d/%04d %02d:%02d:%02d", $mday, $mon+1, $year+1900, $hour, $min, $sec); $substitutionData{"EPOCROOT"} = $epocroot; @substitutionOrder = ("TODAY", "RIGHT_NOW", "EPOCROOT"); - } - - my $temp1OBYFile = $thisdir."tmp1.oby"; - - open TMP1, "$temp1OBYFile" or die("* Can't open $temp1OBYFile\n"); - while ($line=) - { - if(($line =~ /^\s*romsize\s*=/i) || ( $line=~ /^\s*rom_image/i) || ($line =~ /^\s*data_image/i)) - { + } + + foreach $line(@obydata) { + if(($line =~ /^\s*romsize\s*=/i) || ( $line=~ /^\s*rom_image/i) || ($line =~ /^\s*data_image/i)) { $onlysmrimage = 0; last; } } - close TMP1; - if ($enforceFeatureManager && (!$featuremanager) && (!$noFeatureManager) ) - { - my $defaultFeatureDbFlag = 0; - open TMP1, "$temp1OBYFile" or die("* Can't open $temp1OBYFile\n"); - while ($line=) - { - if ($line=~/^\s*defaultfeaturedb\s*=?\s*(\S+)/i) - { - # Get the default value for featuredatabasefile - - $featureXml = "$epocroot$1"; - $featureXml =~ s-\\-\/-g; - $featuremanager = 1; - $defaultFeatureDbFlag = 1; - load_featuresutil(); - last; + if($noFeatureConf == 0) { + if ($enforceFeatureManager && (!$featuremanager) && (!$noFeatureManager) ) { + my $defaultFeatureDbFlag = 0; + foreach $line(@obydata) { + if ($line=~/^\s*defaultfeaturedb\s*=?\s*(\S+)/i) + { + # Get the default value for featuredatabasefile + + $featureXml = "$epocroot$1"; + $featureXml =~ s-\\-\/-g; + $featuremanager = 1; + $defaultFeatureDbFlag = 1; + load_featuresutil(); + last; + } } - } - close TMP1; - - if(!$defaultFeatureDbFlag && !$onlysmrimage) - { - print "Error: Neither option \"-fm|-nofm\" nor default value for featuredatabase file is provided.\n"; - exit(1); + + + if(!$defaultFeatureDbFlag && !$onlysmrimage) + { + print "Error: Neither option \"-fm|-nofm\" nor default value for featuredatabase file is provided.\n"; + exit(1); + } } } - - open TMP1, "$temp1OBYFile" or die("* Can't open $temp1OBYFile\n"); - while ($line=) - { + + # Setup default rom configuration + $romimage[0] = {xip=>1, compress=>0, extension=>0, composite=>"none",uncompress=>0 }; + + my @savedObyData = @obydata; + @obydata = (); + foreach $line(@savedObyData) { track_source($line); $line =~ s-\\-\/-g; @@ -1653,19 +1693,19 @@ } } } - - if($line =~ /^\s*FEATURE\s*(.*)/i || $line =~ /^\s*EXCLUDE_FEATURE\s*(.*)/i) - { - # Process the feature keywords only when "-f|fr" or "-fm" is passed to buildrom - if(defined ($featureXml)) - { - push @obydata, "$line"; + if($noFeatureConf == 0) { + if($line =~ /^\s*FEATURE\s*(.*)/i || $line =~ /^\s*EXCLUDE_FEATURE\s*(.*)/i) { + # Process the feature keywords only when "-f|fr" or "-fm" is passed to buildrom + if(defined ($featureXml)) + { + push @obydata, "$line"; + } + else + { + push @obydata, "REM handled $line"; + } + next; } - else - { - push @obydata, "REM handled $line"; - } - next; } if ($line=~/^\s*DEFINE\s+(\w+)\s+(\S+)/i) @@ -2659,14 +2699,14 @@ my $spicount=0; #counts number of spi files in each rom image my $filescount=0; #counts number of data files my $hidefilescount=0; #counts number of data files to be hidden -my $romimage=0; #number of rom image currently working with +my $romimagecount=0; #number of rom image currently working with sub locateexisting { # if an SPI file of this type exists in a base image then returns name of SPI file from the array - my ($romimage, $spifile, $base) =@_; + my ($index, $spifile, $base) =@_; my $i=0; while(defined $spiarray[$base][$i]) { - if($spiarray[$base][$i]{spi} eq $spiarray[$romimage][$spifile]{spi}) { + if($spiarray[$base][$i]{spi} eq $spiarray[$index][$spifile]{spi}) { my $spiname; my $spiextension; if($spiarray[$base][$i]{spifile} =~ /(.*)\.(.*)$/) { @@ -2684,27 +2724,27 @@ sub create { #called to create SPI file and store in specified directory - my ($romimage, $spifile, $base) =@_; #$romimage = current rom image number, $spifile = current spifile number, $base=number of rom image basing on + my ($index, $spifile, $base) =@_; #$index = current rom image number, $spifile = current spifile number, $base=number of rom image basing on my $existingspi = ""; if(defined($base)) { # checks core image for an existing SPI file of this type, if an existing file exists then $existingspi is set to -i which will later be passed to spitool.pm - $existingspi = locateexisting($romimage, $spifile, $base); + $existingspi = locateexisting($index, $spifile, $base); if($existingspi ne "") { $existingspi = "-i$existingspi"; } } - if($spiarray[$romimage][$spifile]{spifile} =~ /(.+)\.(.*)$/) { - my $targetspi="$1-$romimage-$spifile\.$2"; #add romimage number and identifier for spi file to spi file name to distinguish from other spi files + if($spiarray[$index][$spifile]{spifile} =~ /(.+)\.(.*)$/) { + my $targetspi="$1-$index-$spifile\.$2"; #add romimage number and identifier for spi file to spi file name to distinguish from other spi files my @dataforspi; # array to store names of data files to include in spi file my @hidedatainspi; # array to store names of data files that are to be hidden in spi file for(my $k=0;$k