Updating
authorjascui
Mon, 29 Nov 2010 15:37:06 +0800
changeset 708 0757c2976f96
parent 707 ccd52fece6ff (current diff)
parent 706 5221386d044b (diff)
child 709 1ec2202bb75b
Updating
imgtools/imgcheck/group/distribution.policy
imgtools/romtools/rofsbuild/inc/logging/loggingexception.hpp
imgtools/romtools/rofsbuild/inc/logging/logparser.hpp
imgtools/romtools/rofsbuild/rofsbuild.cpp
imgtools/romtools/rofsbuild/src/logging/loggingexception.cpp
imgtools/romtools/rofsbuild/src/logging/logparser.cpp
imgtools/romtools/rofsbuild/symbolgenerator.cpp
imgtools/romtools/rofsbuild/symbolgenerator.h
imgtools/romtools/rofsbuild/symbolprocessunit.cpp
imgtools/romtools/rofsbuild/symbolprocessunit.h
imgtools/romtools/rombuild/symbolgenerator.cpp
imgtools/romtools/rombuild/symbolgenerator.h
srctools/distillsrc/DISTRIBUTION.POLICY
srctools/distillsrc/test/DISTRIBUTION.POLICY
srctools/distillsrc/test/source/DISTRIBUTION.POLICY
srctools/distillsrc/test/source/complete/DISTRIBUTION.POLICY
srctools/distillsrc/test/source/missing/DISTRIBUTION.POLICY
srctools/distillsrc/test/source/shared/DISTRIBUTION.POLICY
srctools/distillsrc/test/source/spacey/DISTRIBUTION.POLICY
srctools/distillsrc/test/source/whole/DISTRIBUTION.POLICY
--- a/bintools/evalid/evalid.lis	Mon Nov 29 15:29:25 2010 +0800
+++ b/bintools/evalid/evalid.lis	Mon Nov 29 15:37:06 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)
--- a/cpptoolsplat/mingw-gcc-3.4.5/gcc_mingw.h	Mon Nov 29 15:29:25 2010 +0800
+++ b/cpptoolsplat/mingw-gcc-3.4.5/gcc_mingw.h	Mon Nov 29 15:37:06 2010 +0800
@@ -35,7 +35,7 @@
 #define __NORETURN_TERMINATOR()		abort()
 #endif
 #define IMPORT_C
-#if !defined __WINS__ && defined _WIN32 /* VC++ Browser Hack */
+#if !defined __WINS__ && defined _WIN32
 #define EXPORT_C
 /** @internalTechnology */
 #define asm(x)
--- a/cpptoolsplat/mingw-gcc-3.4.5/gcc_mingw_3_4_2.h	Mon Nov 29 15:29:25 2010 +0800
+++ b/cpptoolsplat/mingw-gcc-3.4.5/gcc_mingw_3_4_2.h	Mon Nov 29 15:37:06 2010 +0800
@@ -35,7 +35,7 @@
 #define __NORETURN_TERMINATOR()		abort()
 #endif
 #define IMPORT_C
-#if !defined __WINS__ && defined _WIN32 /* VC++ Browser Hack */
+#if !defined __WINS__ && defined _WIN32 
 #define EXPORT_C
 /** @internalTechnology */
 #define asm(x)
--- a/e32tools/elf2e32/group/release.txt	Mon Nov 29 15:29:25 2010 +0800
+++ b/e32tools/elf2e32/group/release.txt	Mon Nov 29 15:37:06 2010 +0800
@@ -11,7 +11,7 @@
 
 version 2.2 build(7)
 ===============
-Released by Marvin Shi, 26/10/2010
+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)
--- a/imgtools/buildrom/group/BLD.INF	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/buildrom/group/BLD.INF	Mon Nov 29 15:37:06 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
--- a/imgtools/buildrom/group/release.txt	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/buildrom/group/release.txt	Mon Nov 29 15:37:06 2010 +0800
@@ -1,3 +1,13 @@
+Version 3.32.1 (BUILDROM)
+===============
+Released by Lorence Wang, 24/11/2010
+	1) ou1cimx1#657440 [MCL]external tools cannot specify path.
+
+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
--- a/imgtools/buildrom/tools/buildrom	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/buildrom/tools/buildrom	Mon Nov 29 15:37:06 2010 +0800
@@ -1,2 +1,8 @@
 #!/bin/sh
-perl -S buildrom.pl $@
+PRGDIR=`dirname "$0"`
+
+PRGDIR=`cd "$PRGDIR"; pwd`
+
+
+perl "$PRGDIR/buildrom.pl" $@
+
--- a/imgtools/buildrom/tools/buildrom.pm	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/buildrom/tools/buildrom.pm	Mon Nov 29 15:37:06 2010 +0800
@@ -67,21 +67,26 @@
 my $enforceFeatureManager = 0; # Flag to make Feature Manager mandatory if SYMBIAN_FEATURE_MANAGER macro is defined. 
 
 my $BuildromMajorVersion = 3 ;
-my $BuildromMinorVersion = 31;
-my $BuildromPatchVersion = 0;
+my $BuildromMinorVersion = 32;
+my $BuildromPatchVersion = 1;
 
 
 sub print_usage
 {
 
 	# 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=<finalOBYfile>         -- Ignore BUILDROM config phase, invoke Rombuild/Rofsbuild using <finalOBYfile>.
                                     <finalOBYfile> 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=<OBY>) {
+					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(<INFILE>)
+			{
+				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(<TMP1>) { 
+			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=<OBY>) {
-				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 (<OBY>) {
+					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(<INFILE>)
-		{
-			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=<TMP1>)
-	{
-		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=<TMP1>)
-		{
-			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=<TMP1>)
-	{
+	
+	# 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<name of existing spi file> 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<scalar @datafiles;$k++) {
-			if($datafiles[$k]{rom}==$romimage && $datafiles[$k]{spifile} == $spifile) {
+			if($datafiles[$k]{rom}==$index && $datafiles[$k]{spifile} == $spifile) {
 				push @dataforspi, $datafiles[$k]{data}; #push name of data file onto array if correct romimage and spi type
 			}
 		}
 
 		for(my $j=0;$j<scalar @hidedatafiles;$j++) {
-			if($hidedatafiles[$j]{rom}==$romimage && $hidedatafiles[$j]{spifile} == $spifile)
+			if($hidedatafiles[$j]{rom}==$index && $hidedatafiles[$j]{spifile} == $spifile)
 			{
 				push @hidedatainspi, $hidedatafiles[$j]{data}; #push name of data file to be hidden onto array if correct romimage and spi type
 			}
@@ -2740,7 +2780,7 @@
 		{
 			if ($line=~/^\s*REM \s*ROM_IMAGE\[(\d)\]/) # specify which romimage following lines are part of
 			{
-				$romimage=$1;
+				$romimagecount=$1;
 				$spicount=0;
 			}	elsif ($line =~ /^\s*REM/i)
 			{
@@ -2751,36 +2791,36 @@
 				my $flag=1;
 				my $i;
 				for($i=0;$i<$spicount && $flag;$i++) { #loop to see if name of spi file already added to this romimage in array
-					if($spiarray[$romimage][$i]{spi} eq $targetspi) {
+					if($spiarray[$romimagecount][$i]{spi} eq $targetspi) {
 						$flag=0;
 					}
 				}
 			
 				if($flag) { # adds spi file if not yet listed for this romimage in array
-					$spiarray[$romimage][$spicount++]={spifile=>$3, spidir=>$4, spi=>$4.$3};
+					$spiarray[$romimagecount][$spicount++]={spifile=>$3, spidir=>$4, spi=>$4.$3};
 					$i=$spicount;
 				}
-					$datafiles[$filescount++]= {data=>$1, rom=>$romimage, spifile=>$i-1}; 
+					$datafiles[$filescount++]= {data=>$1, rom=>$romimagecount, spifile=>$i-1}; 
                         } elsif ($spiplacement && $line =~/^\s*SPI_POSITION/i){
         			# mark the image index at which the SPI_POSITION keyword has occured in order to avoid writing duplicate
         			# entries of the spi file.
-        			$spipositionflag{$romimage} = 1;
+        			$spipositionflag{$romimagecount} = 1;
         		} elsif ($line=~/^\s*spidatahide\s*=\s*(\S+)\s+(\S+)\s(\S+)\s*$/)	{
 				#spidatahide=\epoc32\data\Z\Resource\Plugins\Obexclasscontroller.RSC ecom.spi \private\10003a3f\
 				my $targetspi=$3.$2;
 				my $flag=1;
 				my $i;
 				for($i=0;$i<$spicount && $flag;$i++) { #loop to see if name of spi file already added to this romimage in array
-					if($spiarray[$romimage][$i]{spi} eq $targetspi) {
+					if($spiarray[$romimagecount][$i]{spi} eq $targetspi) {
 						$flag=0;
 					}
 				}
 			
 				if($flag) { # adds spi file if not yet listed for this romimage in array
-					$spiarray[$romimage][$spicount++]={spifile=>$2, spidir=>$3, spi=>$3.$2};
+					$spiarray[$romimagecount][$spicount++]={spifile=>$2, spidir=>$3, spi=>$3.$2};
 					$i=$spicount;
 				}
-					$hidedatafiles[$hidefilescount++]= {data=>$1, rom=>$romimage, spifile=>$i-1}; 
+					$hidedatafiles[$hidefilescount++]= {data=>$1, rom=>$romimagecount, spifile=>$i-1}; 
 			}
 
 		}
@@ -2970,10 +3010,13 @@
 #
 sub featurefile_creation_phase
 {
-	if($onlysmrimage)
-	{
+	if($onlysmrimage){
 		return;
 	}
+	if($noFeatureConf) {
+		checkcase() if ($checkcase);
+		return ;
+	}
 	# Set the name and Rom Image location of feature file.
 	if ($enforceFeatureManager) 
 	{
@@ -4784,11 +4827,11 @@
 		my $plat = "armv5";				
 		$plat = &get_abiv2mode() ? $plat."_abiv1" : $plat."_abiv2";		
 
-		foreach my $plat(@platlist) 
+		foreach my $plattmp(@platlist) 
 		{
-			if(($aDllFile =~ /[\/\\]($plat)[\/\\]/i) or ($aDllFile =~ /[\/\\]($plat\.\w+)[\/\\]/i ))
+			if(($aDllFile =~ /[\/\\]($plattmp)[\/\\]/i) or ($aDllFile =~ /[\/\\]($plattmp)\.\w+[\/\\]/i ))
 			{
-				$platName = $1;
+				$platName = uc $1;
 				last;
 			}
 		}		
@@ -4796,7 +4839,7 @@
 		
 		# Map files will be referred for all ARM platforms, 
 		# and for BSF platforms which cutomizes ARM platforms.
-		if($rootPlatName =~ /^armv5|$plat$/i){
+		if($rootPlatName =~ /^(armv5|$plat)$/i){
 			my $mapfile = "${aDllFile}.map";
 			
 			open MAPFILE, "$mapfile" or die "Can't open $mapfile\n";
--- a/imgtools/buildrom/tools/externaltools.pm	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/buildrom/tools/externaltools.pm	Mon Nov 29 15:37:06 2010 +0800
@@ -36,11 +36,22 @@
 	my @toolModules = split(/,/,$toolList);
 	foreach my $tool (@toolModules) {
 		# An optional command line can be passed to the tool if it is of the form "<toolname>[:<cmdline>]"
-		if ($tool !~ /^([^:]+)(:(.*))?$/) {
+		if ($tool !~ /^((\w:)?[^:]+)(:(.*))?$/) {
 			print "No tool specified as parameter for external tool invocation\n";
 		}
 		my $toolName = $1;
-		my $toolCmdLine = $3;
+		my $toolCmdLine = $4;
+		if($toolName =~ /^(.*)[\\\/]([^\\\/]+)$/){
+			$toolName = $2;
+			my $path = $1;
+			if($path =~ /^EPOCROOT/){
+				my $epocroot = $ENV{EPOCROOT};
+				$epocroot =~ s-\\-\/-g;
+				$epocroot .= "\/" unless ($epocroot =~ /\/$/);
+				$path =~ s-^EPOCROOT[\/\\]?-$epocroot-;
+			}
+			push (@INC, $path);
+		}
 		if($toolName =~ /configpaging/i){			 
 			my %info = (name=>"configpaging", args=>$toolCmdLine ); 
 			push @{$invocations{"invocationpoint2"}}, \%info;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/buildrom/tools/featureconfigurator.pl	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,998 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+# This package is to build rom image
+#
+
+use FindBin;		# for FindBin::Bin
+my $PerlLibPath;    # fully qualified pathname of the directory containing our Perl modules
+my $PerlEPOCPath;
+
+BEGIN {
+# check user has a version of perl that will cope
+	require 5.005_03;
+# establish the path to the Perl libraries
+    $PerlLibPath = $FindBin::Bin;	
+#    $PerlLibPath =~ s/\//\\/g;
+    $PerlLibPath .= "\\";
+    $PerlLibPath =~ s/\\/\//g;
+    
+    $PerlEPOCPath = $ENV{EPOCROOT};
+    $PerlEPOCPath =~ s/\\/\//g;
+    $PerlEPOCPath .= "\/" unless $PerlEPOCPath =~ /\/$/;
+    $PerlEPOCPath .= "epoc32\/tools\/";
+}
+use lib $PerlEPOCPath."build/lib/";
+use lib $PerlEPOCPath;
+use lib $PerlLibPath;
+use strict;
+use romutl;
+use romosvariant;
+# Work out the relative path to the epoc32 directory 
+use Cwd; 
+use File::Basename;
+# global variables specific to data drive image generation. 
+use File::Path ;					# Module to provide functions to remove or create directories in a convenient way.
+use File::Find; 
+use features;
+use flexmodload;	     # To load modules dynamically
+
+my $enforceFeatureManager = 0; # Flag to make Feature Manager mandatory if SYMBIAN_FEATURE_MANAGER macro is defined. 
+
+my $BuildromMajorVersion = 0 ;
+my $BuildromMinorVersion = 2;
+my $BuildromPatchVersion = 0;
+
+my $outputoby = "output.oby" ;
+
+
+sub print_usage {
+
+	# Option "-fm" will be supported instead of option "-f|fr" if SYMBIAN_FEATURE_MANAGER macro is defined.
+	my $featuresOptionUsage = "-f<featureuids> or\n".
+	"   -fr=<featureuids>            -- feature registry database XML file name\n";
+	if ($enforceFeatureManager) {
+		$featuresOptionUsage = "-fm=<featuredbfile>          -- feature manager/feature registry database XML file name.\n".
+							   "                                   Multiple XML files can be passed seperated by commas.\n".
+							   "   -nofm=<featuresdatafile>     -- don't generate features data file.\n".
+							   "                                   Instead use pre-built features data file.\n";
+	}
+
+#........1.........2.........3.........4.........5.........6.........7.....
+	print <<USAGE_EOF;
+
+FEATURECONFIGURATOR - feature configuration tool V$BuildromMajorVersion.$BuildromMinorVersion.$BuildromPatchVersion
+
+Usage:
+
+  featureconfigurator [options] obyfile [obyfile2 ...]   
+
+Configurate features from *.iby/*.oby files and output a 
+consolidated obyfile for buildrom's use. 
+
+This is a front end of buildrom, which partly implements 
+functionalities of buildrom.
+
+
+
+The available options are
+
+   -h                           -- Print this message
+
+   $featuresOptionUsage
+   -oby-charset=<charset>       -- Used character set in which OBY was written
+
+   -k or -keepgoing             -- Enable keepgoing,continue to config features
+                                   and create oby file.
+
+   -argfile=xxx                 -- Specify argument-file name containing list of 
+                                   command-line arguments to featureconfigurator
+   -workdir=xxx                 -- Specify a directory for generated files. 
+                                   The working directory will not be changed even this option is used.
+   
+   -I<directory>                -- Use <directory> for the referenced IBY/OBY files
+   -D<xxx>                      -- Define xxx for C++ preprocessor
+
+   -stdcpp                      -- Ignore symbian customized cpp and try to find 
+                                   another cpp in the PATH.(for Windows only)
+   -cpp=<xxx>                   -- Use xxx as path of CPP preprocessor.
+ 
+   -o<xxx.oby>                  -- Output oby file name is set to xxx.oby
+                                   If this argument is not given, then output oby file is
+                                   "output.oby". output files are placed under workdir.
+								   
+	-s                          -- strict option, any missing files will stop buildrom
+	-v                          -- verbose
+	-noiby[=<n>]                -- if n = 0, then create iby files, otherwise don't create iby files, "-noiby=0" is default
+	-w                          -- suppress cpp warnings.
+
+USAGE_EOF
+
+}
+
+
+my $PerlEPOCPath = &get_epocroot()."epoc32\/tools\/";   # fully qualified pathname of the directory containing EPOC Perl modules
+
+ 
+
+my $xmlrequired = 0; # assume xml required is false. Used to determine if xml
+                     # modules should be loaded.
+
+
+my @tempfiles;  	
+my $preserve = 0; 	#flag to indicate if temporary files should be preserved
+my $uppath="x";	    	# will be initialised when first needed
+
+my $epocroot = &get_epocroot;
+
+my @obyfiles;
+my $cppargs = "-nostdinc -undef";
+my $opt_k = 0;
+my $opt_v = 0; 
+my $opt_w = 0 ;
+my $strict = 0;
+my $line;
+my $errors = 0;
+my $thisdir=cwd;
+$thisdir=~s-\\-\/-go;		    # separator from Perl 5.005_02+ is forward slash
+$thisdir.= "\/" unless $thisdir =~ /\/$/;
+$thisdir =~ s-\/-\\-g if (&is_windows); 
+my $workdir = $thisdir ;
+my $rominclude = $epocroot."epoc32\/rom\/include\/";
+$rominclude = &get_epocdrive().$rominclude unless $rominclude =~ /^.:/;
+$rominclude =~s-\\-\/-g;
+
+my @xmlDBFile = ();
+my $noiby = 0;
+my @obydata;
+
+my @featurefilearray; #2d array storing names and locations of feature files in each rom image
+my @featureslist; #array of hashes, stores all the features which are to go into the feature files
+my $featurefilecount=0; #counts number of feature files in each rom image
+my $featurescount=0; #counts number of features
+my $dir; # Stores the ROM image location of features.dat/featreg.cfg files
+my $featurefilename; # Stores the name of feature file to be generated(i.e. "features.dat" or "featreg.cfg")
+
+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 $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
+my $image_content = undef;
+#Feature list XML file that acts as database containing all features details
+my $featureXml = undef; 
+my $customizedPlat = undef; 
+
+#Summary of files(both executables and data files) currently includes 
+#	host and ROM file names, 
+#	size of the file in ROM
+#	whether the file is hidden
+# This option is added so that the above additional information is emitted by rombuild/rofsbuild tools
+# only when supplied with this option so that the existing tools don't get affected.
+my $logLevel="";
+ 
+
+# Feature Variation modules and data
+my %featureVariant;
+
+
+my $opt_workdir = 0; 
+my $stdcpp = 0;
+my $obycharset;
+my $cppoption = 0;
+my $preprocessor = "cpp"; 
+
+sub is_fullpath {
+
+my $path = shift ;
+	if (&is_windows) {
+		if( $path =~ /^[a-z]:/i) {
+			return 1 ;
+		}
+		elsif($path =~ /^\\/) {
+			return 1 ;
+		}
+		else {
+			return 0 ;
+		}			
+	}
+	else {
+		return 1 if($path =~ /^\//) ;
+		return 0;
+	}
+
+}
+
+sub match_obyfile
+{
+	my ($obyfile) = @_;
+	if (-f $obyfile)
+	{
+		push @obyfiles, $obyfile;
+		return 1;
+	}
+
+	# search for the oby file in the list of include directories
+	my @otherDirs = ($rominclude);
+
+	if ($featureVariant{'VALID'})
+	{
+		my $dirRef = $featureVariant{'ROM_INCLUDES'};
+
+		@otherDirs = @$dirRef if ($dirRef);
+	}
+	foreach my $dir (@otherDirs)
+	{
+		print "$dir/$obyfile\n" if ($opt_v);
+		if (-f "$dir/$obyfile")
+		{
+		    push @obyfiles, "$dir/$obyfile";
+		    return 1;
+		}
+	}
+	return 0;
+}
+ 
+# Subroutine to process parameter-file
+sub parameterFileProcessor
+{
+	my $paramFile = shift(@_);	
+	my @paramFileParamaters = ();	
+
+	my $fileOpenFlag = 1;
+	open FILE,"<", $paramFile or $fileOpenFlag = 0;
+	
+	if(!$fileOpenFlag)
+	{
+		print "Error: Could not open parameter-file \"$paramFile\" for reading.\n";
+		return;
+	}
+	
+	# Parse parameter-file and collect all the parameters in an array
+	while(my $line = <FILE>)
+	{
+		# Read the line till character ';'(used for providing comments in the file) or EOL
+		$line = $1 if ($line =~ /(.*);/); 
+		
+		# Split the parameters specified in a line based on white-spaces		
+		my @paramaters = split(/(\s)/,$line);	
+		
+		my $flag = 0;
+		my $argWithQuotes='';
+
+		foreach my $value (@paramaters) 
+		{	
+			# If the parameter doesn't conatian double quotes then push it 
+			# to the list of parameters.
+			if(($value !~ /\"/) && (!$argWithQuotes)) 
+			{
+				if ($value !~ /^\s*$/) 
+				{
+					push @paramFileParamaters,$value;
+				}		
+			}
+			# If the parameter is in the form  -fm="faturedb.xml" then remove
+			# double quotes and push it to the list of parameters.
+			elsif(($value =~ /\".*\"/))
+			{
+				$value =~ s/\"//g;
+				push @paramFileParamaters,$value;
+			}
+			# If the parameter is in the form  -fm="fature  db.xml" then read
+			# the parameter starting from opening quote till the closing quote.
+			elsif( ($value =~ /\"/) && $argWithQuotes) 
+			{
+				$argWithQuotes .= $value;
+				$argWithQuotes =~ s/\"//g;
+				push @paramFileParamaters,$argWithQuotes;
+				$argWithQuotes='';		
+			}
+			else
+			{
+				$argWithQuotes .= $value;
+			}
+		}		
+	}
+
+	close FILE;	
+	if (!@paramFileParamaters)
+	{
+		print "Warning: No parameters specified in paramer-file \"$paramFile\".\n";		
+		return;
+	}
+	
+	my $paramFileFlag = 1;
+
+	# Invoke subroutine "process_cmdline_arguments" to process the parameters read from
+	# the parameter file.
+	&process_cmdline_arguments($paramFileFlag, @paramFileParamaters);
+
+}
+
+# Processes the command line arguments passed to buildrom tool
+
+sub process_cmdline_arguments
+{
+ 
+	my ($paramFileFlag, @argList); 
+
+	if (defined @_) {
+		($paramFileFlag, @argList) = @_;
+	}
+	else {
+		if(scalar(@ARGV) == 0){
+			my @hrhMacros = &get_variantmacrolist;	
+			$enforceFeatureManager = 1 if (grep /^SYMBIAN_FEATURE_MANAGER\s*$/, @hrhMacros);
+			print_usage();
+			exit 1;				
+		}
+		
+		@argList = @ARGV;
+	}
+
+	if (!defined $paramFileFlag)  {
+	
+		# Enforce Feature Manager if macro SYMBIAN_FEATURE_MANAGER is defined in the HRH file.
+		my @hrhMacros = &get_variantmacrolist;	
+		$enforceFeatureManager = 1 if (grep /^SYMBIAN_FEATURE_MANAGER\s*$/, @hrhMacros);
+		# Process the parameters of parameter-file if passed.
+		foreach my $arg (@argList) {
+			if ($arg =~ /^-h/i) {
+				print_usage();
+				exit 1;				
+			}
+		}
+		# Process the parameters of parameter-file if passed.
+		foreach my $arg (@argList) {
+			&parameterFileProcessor($1) if ($arg =~ /^-argfile=(.*)/) ;
+		}
+	}
+	# first searching argList for keepgoing option
+	my @newArgList = () ;
+	foreach my $arg (@argList) {
+		if ( $arg =~ /^-k$/i || $arg =~ /^-keepgoing$/i ) {
+			$opt_k = 1;	 
+		}
+		elsif ($arg =~ /^-s$/) {
+			$strict = 1; 
+	    }
+		elsif ($arg =~ /^-v$/) {
+			$opt_v =1; 
+	    }
+		elsif( $arg =~ /^-w$/) {
+			$opt_w = 1 ;
+		}
+		elsif ($arg =~ /^-workdir=(.*)/) {			
+			$workdir = $1;
+			$workdir = $thisdir.$workdir unless(&is_fullpath($workdir)) ;
+			$workdir.= "\/" unless $workdir =~ /\/$/;
+			mkdir($workdir) unless (-d $workdir); 
+		}else {
+			push @newArgList, $arg ;
+		}
+	}
+	foreach my $arg (@newArgList)
+	{
+	    if ($arg =~ /^-argfile=(.*)/)  {
+			&parameterFileProcessor($1) if (defined $paramFileFlag); 
+		}
+		elsif ($arg =~ /^-DFEATUREVARIANT=(.*)/) {
+			my $varname = $1;			
+			if ($varname =~ /^\.(.*)$/) {
+				# for testing, locate the VAR file in the current directory
+				%featureVariant = get_variant($1, ".");
+			}
+			else {
+				%featureVariant = get_variant($varname);
+			}
+			if (!$featureVariant{'VALID'}) {
+			    print "FEATUREVARIANT $varname is not VALID\n";
+				$errors++;
+			}
+			if ($featureVariant{'VIRTUAL'}) {
+			    print "FEATUREVARIANT $varname is VIRTUAL\n";
+				$errors++;
+			}
+			addDrivesToFeatureVariantPaths(); 
+		}
+		elsif ($arg =~ /^-[DI]/) {
+			$cppargs .= " $arg";  
+	    } 
+	    elsif ($arg =~/^-oby-charset=(.*)$/i) {
+		$obycharset = $1; 
+	    }
+		elsif($arg =~ /^-o(.*)/i)   {
+			$outputoby = $1;  
+		} 
+		elsif ($arg =~ /^-noiby(=(\d))$/i ) {
+			if(!$1) {
+				$noiby = 1;
+			}
+			else {
+				if(!$2) {
+					print "Warning: No value for \"-noiby=\" option, use default.\n";
+				}
+				else {
+					$noiby = $2 ;
+				}
+			}
+		}
+		#Process feature manager database xml file 
+	    elsif($arg =~ /^-fm=(.*)/) {
+			if (!$enforceFeatureManager) {
+				print "Unknown arg: $arg\n";
+				$errors++;
+				next;
+			}
+			$featureXml = $1;			
+			$xmlrequired = 1;
+			$featuremanager = 1;
+			if ($featureXml =~ /^$/)  {
+				print "Error: No filename specified with \"-fm=\" option.\n";
+			} 
+			else {			
+				@xmlDBFile = split /,/,$featureXml if($noiby == 0);
+			} 
+	    }
+		elsif ($arg =~ /^-nofm(=(.*))?$/) {
+			if (!$enforceFeatureManager)  {
+				print "Unknown arg: $arg\n";
+				$errors++;
+				next;
+			}
+   			$noFeatureManager = 1; 
+            if(!$2) {
+                print "Warning: No filename specified with \"-nofm=\" option, feature data file might not be included.\n";
+            }
+            else {
+                $preBuiltFeaturesDataFile = $2;						
+            } 	
+		}
+		#Process feature registry database xml file 
+	    elsif($arg =~ /^-fr=(.*)/ || $arg =~ /^-f(.*)/) {
+			if ($enforceFeatureManager)
+			{
+				print "Error: Option \"-f|-fr\" is no longer supported.\n";
+				$errors++;
+				next;
+			}			
+			$featureXml = $1;
+			$xmlrequired = 1;			
+			print "Error: No filename specified with \"-f|-fr\" option.\n" if ($featureXml =~ /^$/) ;
+	    } 
+		elsif ($arg =~ /^-stdcpp$/i) {
+			if (&is_linux) {
+				print "Warning: option -stdcpp only apply for Windows\n"; 
+			}
+			if ($cppoption) {
+				print "Error: -stdcpp option and -cpp=xxx option cannot be used at the same time.\n";
+				exit (1);
+			}
+			$stdcpp = 1; 
+		}
+		elsif ($arg =~ /^-cpp=(.*)/) {
+			if ($stdcpp) {
+				print "Error: -stdcpp option and -cpp=xxx option cannot be used at the same time.\n";
+				exit (1);
+			}
+			print "Warning: -cpp option has been set before. The previous configuration will be overwritten!\n" if ($cppoption);
+			$cppoption = 1;
+			$preprocessor = $1;
+			$preprocessor =~ s-\\-\/-g;
+			$preprocessor =~ s-EPOCROOT##\/?-$epocroot-g;
+			if (-d $preprocessor) {
+				$preprocessor .= "\/" unless $preprocessor =~ /\/$/;
+				$preprocessor .= "cpp";
+			} 
+		} 
+	    elsif ($arg =~ /^-/)  {
+			print "Unknown arg: $arg\n";
+			$errors++;
+			next;
+	    }
+		else {
+			# It's an OBY file
+			next if (match_obyfile($arg));
+			next if (match_obyfile("$arg.oby"));
+			print "Cannot find oby file: $arg\n";
+			$errors++ if(!$opt_k);
+		}	    
+	}
+
+	return if (defined $paramFileFlag) ;
+	if (@obyfiles<1 ) {
+	    print "Missing obyfile argument\n";
+	    $errors++ if(!$opt_k);
+	}
+	if(defined($obycharset)) {
+		print "Warning: Ignoring not supportted charset $obycharset, local charset will be used as default!\n" unless($obycharset =~ /utf-?8/i);
+	}
+
+	if ($errors) {
+	    print_usage();
+	    exit 1;
+	}
+	
+	if ($noFeatureManager && $featuremanager)  {
+		print "Warning: Ignoring \"-nofm\" option, as both \"-nofm\" and \"-fm\" options are provided.\n";			
+		$noFeatureManager = 0;
+	}
+
+	# Adding variant specific macros by including a HRH file
+	# (only required if no Feature Variant is used)
+	if (!$featureVariant{'VALID'}) {
+	    my $variantMacroHRHFile = get_variantmacroHRHfile();
+	    if($variantMacroHRHFile){
+	        my $variantFilePath = split_path('Path',$variantMacroHRHFile);
+	        $cppargs .= " -I " . &append_driveandquote($variantFilePath) . " -include " . &append_driveandquote($variantMacroHRHFile); 
+	        print "in cmd process $cppargs\n" if ($opt_v);
+	    }
+	}
+	# load the required modules if xml is required
+	if ($xmlrequired == 1) {
+	    load_featuresutil() if (defined ($featureXml));	    
+	}
+}
+
+#----------------------------------------------------------------------------------
+# Preprocessing phase	
+#
+# Concatentate the specified .oby files and pass them through cpp
+# to get the raw ROM specification in tmp1.oby
+
+sub preprocessing_phase
+{
+	 
+	
+	my $temp1OBYFile = $workdir."tmp1.oby";
+	unlink "$temp1OBYFile";
+
+#	Macro "ROM_FEATURE_MANAGEMENT" is defined when "-f|fr" or "-fm" is used
+	$cppargs .= " -w" if($opt_w) ;
+	$cppargs .= " -DROM_FEATURE_MANAGEMENT " if (defined ($featureXml));
+
+	# 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'};
+		$cppargs .= " -include \"$HRH\"" if ($HRH);
+	}
+	else {
+		# no feature variant so use the standard includes
+		$cppargs .= " -I. -I \"$rominclude\"";
+	}
+
+	$preprocessor = find_stdcpp() if ($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) {
+		print CPP "\n#line 1 \"$arg\"\n";
+	
+		if(open(OBY, $arg)) {
+			print "* reading $arg\n" if ($opt_v);
+			while ($line=<OBY>) {
+				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 = $workdir."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(<INFILE>) {
+			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";
+	}
+	
+	open TMPOBY, "<$temp1OBYFile" or die "*cpp output can not be read.\n"; 
+	@obydata = <TMPOBY> ;
+	close TMPOBY;
+ 
+
+	
+}
+ 
+sub load_featuresutil
+{
+	&FlexLoad_ModuleL("featuresutil");
+			
+	# Parse the feature database XML file
+	if(!&featuresutil::parseXMLDatabase($featureXml, $featuremanager, $strict))
+	{
+		$featureXml = undef;
+		exit(1) if($strict);
+	}
+}
+
+#----------------------------------------------------------------------------------
+# Feature registry configuration file/Features data file generation phase
+#
+# If feature registry configuration files/features data files are required then creates these files for
+# each ROM/ROFS image
+#
+sub featurefile_creation_phase
+{
+		# Set the name and Rom Image location of feature file.
+	if ($enforceFeatureManager)  {
+		# features data file location
+		$dir = "private\/10205054\/";
+		$featurefilename = "features.dat";
+	}
+	else {
+		# feature registry configuration file location
+		$dir = "private\/102744CA\/"; 
+		$featurefilename = "featreg.cfg";
+	}
+	my $onlysmrimage  = 1 ;
+	
+	foreach $line(@obydata) {		
+		if(($line =~ /^\s*romsize\s*=/i) || ( $line=~ /^\s*rom_image/i) || ($line =~ /^\s*data_image/i)) {
+			$onlysmrimage = 0;
+			last;
+		}
+	}	
+	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;
+			}
+		}
+		if(!$defaultFeatureDbFlag && !$onlysmrimage)
+		{
+			print "Error: Neither option \"-fm|-nofm\" nor default value for featuredatabase file is provided.\n";
+			exit(1);			
+		}
+	}
+	my @newobydata = ();
+	if (defined ($featureXml))  {
+		my $featurefilecount=0;
+		my $romimage=0;
+
+		foreach $line (@obydata) {
+			# specify which romimage following lines are part of
+			if ($line=~/^\s*ROM_IMAGE\[(\d)\]/) {
+				$romimage=$1;
+				$featurefilecount=0;
+			}
+			elsif ($line =~ /^\s*REM/i || $line =~ /^\s*\r?\n$/ ){
+				next ;
+				# ignore empty
+			}
+			elsif($line =~ /^\s*(FEATURE)\s*(\S*)\s*(.*)/i || $line =~ /^\s*(EXCLUDE_FEATURE)\s*(\S*)\s*(.*)/i) {
+				
+				# FEATURE  <feature_name>  [ SF  <status falgs> ] [ UD  <user data> ]
+				my $feature = $1;
+				my $featurevalue = $2;
+				my $featureargs = $3;
+				my $reservedbit = 0;
+				my %featureflags=();			 
+				# Options 'SF' and 'UD' will be supported only for "-fm" option
+				if ($featuremanager)  {
+					# [ SF  <status falgs> ] [ UD  <user data> ]
+					$featureargs =~	/(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*/ ;
+
+					# Store the values of 'SF' and 'UD', or any invalid option, if provided					
+					$featureflags{uc($1)} = $2 if ($1);  
+					$featureflags{uc($3)} = $4 if ($3); 
+
+					# Generate a warning if the option provided with Feature/Exclude_Feature keyword is  
+					# not 'SF' or 'UD'.
+					foreach my $Key (keys %featureflags) {						
+						if ($Key !~ /^(SF|UD)$/) {
+							print "Warning: Invalid argument \"$Key\" specified for feature $featurevalue\n";
+							delete $featureflags{$Key};
+							next;
+						}						
+					}							
+				}				
+				# In verbose mode, generate warning if "SF|UD" arguments or invalid arguments are specified
+				# for "-f|fr" option.
+				elsif ($featureargs && $opt_v) {
+					print "Invalid argument(s) \"$featureargs\" provided for feature \"$featurevalue\"\n";
+					foreach my $Key (keys %featureflags) {
+						delete $featureflags{$Key};
+					}
+				}				
+				
+				# The feature file name is of the format featreg.cfg[x-y] or features.dat[x-y] 
+				# where x is the romimage id, y is always 0, reserved for future use.
+				my $targetfeaturefile;
+				if (($romimage == 0) && ($reservedbit == 0)) {
+
+					# Core image will not have the mangled name
+				 	$targetfeaturefile = $featurefilename;
+				}
+				else {
+				 	$targetfeaturefile = $featurefilename . "\[". $romimage . "\-$reservedbit\]";
+				}
+				my $flag=1;
+				my $featureflag;
+				if ($feature =~ /^FEATURE$/i) {
+					$featureflag = 1;
+				}
+				else {
+					$featureflag = 0;
+				}
+
+				my $i;
+ 				# loop to see if name of feature file already added to this romimage in array
+				for($i=0;$i<$featurefilecount && $flag;$i++) {
+					$flag=0 if($featurefilearray[$romimage][$i]{cfgfile} eq $targetfeaturefile);
+				}
+			
+				if($flag) { # adds feature file if not yet listed for this romimage in array
+					$featurefilearray[$romimage][$featurefilecount++]={cfgfile=>$targetfeaturefile, cfgdir=>$dir};
+					$i=$featurefilecount;
+				}
+
+				$featureslist[$featurescount]= {feature=>$featurevalue, include=>$featureflag, rom=>$romimage, cfgfile=>$i-1};
+				
+				# Store the value of 'SF' in 'featureslist' array
+				$featureslist[$featurescount]->{SF} = $featureflags{SF} if (defined $featureflags{SF}) ;
+				# Store the value of 'UD' in 'featureslist' array
+				$featureslist[$featurescount]->{UD} = $featureflags{UD} if (defined $featureflags{UD}) ;
+				$featurescount++;
+			}
+		}
+
+		# Create Feature File
+		for(my $i=0;$i<scalar @featurefilearray;$i++) {
+			my $j=0;
+			while(defined $featurefilearray[$i][$j])
+			{
+				my $targetfeaturefile = $workdir.$featurefilearray[$i][$j]{cfgfile}; 
+				if (!(&featuresutil::createFeatureFile($i,$j,$targetfeaturefile,\@featureslist,$featuremanager)))  {
+					$featurefilearray[$i][$j]{cfgfile}= undef;
+					exit(1) if($strict);					
+				}
+				$j++;
+			}
+		} 
+		my $flag=1;
+        	my $imageIdx=0;
+
+		# Add feature files to ROM image, adds lines to obey file to specify existing locations
+		# of feature files and target locations. 
+		
+		# features.dat will be written to the end of rom/rofs
+		my @lastFLs = ();
+		my $lastRomIndex = 0 ;
+		
+		foreach $line (@obydata) {
+			if($line =~/^\s*ROM_IMAGE\[(\d)\]/i) {
+				my $index=$1;
+						
+				if($lastRomIndex != $index) {
+					foreach my $fl(@lastFLs) {
+						push @newobydata,$fl ;
+					}
+					@lastFLs = ();
+					$lastRomIndex = $index ;
+				}
+				push @newobydata, "\n" . $line . "\n";	
+				my $j=0;
+				while(defined $featurefilearray[$index][$j]) {
+					$flag = 0 if($index == 0);
+					# Put in feature files for current ROM_IMAGE
+					my $targetfeaturefile = $featurefilearray[$index][$j]{cfgfile};
+					# Rom images will not have mangled name for feature files
+				 					
+					# Rofsbuild will set attribute 'exattrib=U' in the entry record when this field is used.
+					# File Server when asked for a directory listing would notice the attribute and will return the 
+					# list with mangled names. Hence, mangled name for feature files should not be put in ROM_IMAGE.
+					my $exattribute = "" ;					
+					if (defined $targetfeaturefile ) {
+						$exattribute = "exattrib=U" if($index > 0);
+						push @lastFLs, "ROM_IMAGE[$index] data=" . $workdir . $targetfeaturefile . " \"". $featurefilearray[$index][$j]{cfgdir} .$featurefilename .  "\"\t\t" . $exattribute . "\n";
+						$featurefilearray[$index][$j]{cfgfile} = undef ;
+					}
+					$j++;
+				}
+			}
+			elsif($line !~ /^\s*(FEATURE)\s*/i && $line !~ /^\s*(EXCLUDE_FEATURE)\s*/i && $line !~/^\s*defaultfeaturedb\s*=?\s*(\S+)/i) {
+				# Put in all other lines except the FEATURE and EXCLUDE_FEATURE keywords
+				push @newobydata, $line;
+			}
+			else {
+				push @newobydata, " "; 
+			}
+			 
+		}
+		foreach my $fl(@lastFLs) {
+			push @newobydata,$fl ;
+		}
+		if($flag) { 
+			# Put in feature files for ROM_IMAGE[0] if it is the only ROM_IMAGE
+			my $k=0;
+			while(defined $featurefilearray[0][$k])
+			{ 
+				my $targetfeaturefile = $featurefilearray[0][$k]{cfgfile};
+				if (defined $targetfeaturefile)
+				{
+					push @newobydata, "data=" . $workdir . $targetfeaturefile . " \"" . $featurefilearray[0][$k]{cfgdir} . $targetfeaturefile . "\"\n";
+					$featurefilearray[0][$k]{cfgfile} = undef ;
+				}
+				$k++;
+			}
+		}
+	}
+	elsif ($enforceFeatureManager && $noFeatureManager && $preBuiltFeaturesDataFile) {
+        print "Valid: $preBuiltFeaturesDataFile\n";
+		if (-e $preBuiltFeaturesDataFile)  { 
+			my $flag = 1;
+			foreach my $line (@obydata)
+			{
+				# Put in the pre-built features data file in ROM_IMAGE[0] 
+				if($line =~/^\s*ROM_IMAGE\[1\]/i)
+				{
+					push @newobydata, "data=$preBuiltFeaturesDataFile" . " \"" . $dir . $featurefilename . "\"\n";
+					$flag =0;
+				}
+				push @newobydata, $line;
+			}
+			if($flag)
+			{ 
+				# Put in the pre-built features data file in ROM_IMAGE[0] if it is the only ROM_IMAGE
+				push @newobydata, "data=$preBuiltFeaturesDataFile" . " \"" . $dir . $featurefilename . "\"\n";
+			}
+		}
+		else
+		{
+			print "Error: File \"$preBuiltFeaturesDataFile\" doesn't exist.\n";
+			exit(1);
+		}
+	}
+	elsif ($enforceFeatureManager) {
+	    print "Error: no feature data file or pre-built feature data file is provided!";
+	    exit(1);
+	}
+	
+		my $output ;
+	if(&is_windows) {
+		if($outputoby =~ /^[\\\/]/ || $outputoby =~ /^[a-zA-Z]:/)  {
+			$output = $outputoby ;
+		}
+		else {
+			$output = $workdir.$outputoby;
+		}
+	}
+	else {
+		if($outputoby =~ /^[\/]/ )  {
+			$output = $outputoby ;
+		}
+		else {
+			$output = $workdir.$outputoby;
+		}
+	} 
+	unlink $output if(-e $output);
+	print "* Writing $output...\n" if($opt_v);
+	unless(open FOUT, ">$output"){
+		print "Error: Can not write to $output.\n";
+		exit(1);
+	}
+	foreach(@newobydata){
+		chomp ;
+		print FOUT "$_\n";
+	} 
+	close FOUT ; 
+	print "* Done.\n" if($opt_v);
+}
+
+# make sure that all the absolute feature variant paths include a
+# drive letter. This is required because cpp will not work with
+# absolute paths starting with slashes.
+sub addDrivesToFeatureVariantPaths
+{
+	return unless $featureVariant{'VALID'};
+
+	my $current = &get_epocdrive;
+	my $drive = $1 if ($current =~ /^(.:)/);
+
+	# pre-include file
+	my $HRH = $featureVariant{'VARIANT_HRH'};
+	$featureVariant{'VARIANT_HRH'} = $drive . $HRH if ($HRH =~ /^[\\\/]/);
+
+	# ROM include path
+	my $dirRef = $featureVariant{'ROM_INCLUDES'};
+	return unless $dirRef;
+	my $i = 0;
+
+	foreach my $dir (@$dirRef)
+	{
+		$$dirRef[$i] = $drive . $dir if ($dir =~ /^[\\\/]/);
+		$i++;
+	}
+}
+#
+# Process the given absolute path
+# Add backslash at the end if required
+# @param - path to be processed
+#
+sub processPath
+{
+	my ($path) = shift;
+	
+	return if( $$path =~ /(\\$)/ );
+	return if( $$path =~ /(\/$)/ );
+	$$path .= "/";
+}
+
+# Main block for buildrom module invocation
+
+
+# Processes the buildrom command line parameters.
+&process_cmdline_arguments; 
+if(scalar(@xmlDBFile) > 0) { 
+	&processPath(\$epocroot);
+	&processPath(\$thisdir);
+	&features::set_DefaultPath($epocroot, \$thisdir, \$thisdir, \$thisdir, \$thisdir);
+	if(&features::open_Database(@xmlDBFile)) {  
+		&features::generate_Obeyfile($workdir);	 
+	}
+}
+#Preprocessing phase
+&preprocessing_phase; 
+# Creates feature registry configuration file/features data file.
+&featurefile_creation_phase;
+
+
+1;
--- a/imgtools/buildrom/tools/features	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/buildrom/tools/features	Mon Nov 29 15:37:06 2010 +0800
@@ -1,2 +1,8 @@
 #!/bin/sh
-perl -S features.pl $@
+PRGDIR=`dirname "$0"`
+
+PRGDIR=`cd "$PRGDIR"; pwd`
+
+
+perl "$PRGDIR/features.pl" $@
+
--- a/imgtools/imgcheck/group/distribution.policy	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Category T
-OSD:	Reference/Test	Tools
--- a/imgtools/imgcheck/src/hash.cpp	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/imgcheck/src/hash.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -55,7 +55,7 @@
 @internalComponent
 @released
 
-@param aString - const string& on which Hash value calcualtion to be done
+@param aString - const string& on which Hash value calcualtion 
 */
 int HashTable::Hash(const string& aString) {
 	unsigned int hashVal = 0;
--- a/imgtools/imglib/compress/byte_pair.cpp	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/imglib/compress/byte_pair.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -636,3 +636,12 @@
     memcpy(dst,PakBuffer,compressedSize);
     return compressedSize;
 }
+TInt BytePairDecompress(TUint8* dst, TUint8* src, TInt size, CBytePair *aBPE)
+{
+    TUint8 UnpakBuffer[MaxBlockSize];
+    ASSERT(size<=MaxBlockSize);
+    TUint8* pakEnd;
+    TInt us = aBPE->Decompress(UnpakBuffer,MaxBlockSize,src,size,pakEnd);
+    memcpy(dst,UnpakBuffer,us);
+    return us;
+}
--- a/imgtools/imglib/compress/byte_pair.h	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/imglib/compress/byte_pair.h	Mon Nov 29 15:37:06 2010 +0800
@@ -343,6 +343,7 @@
         TInt Decompress(TUint8* dst, TInt dstSize, TUint8* src, TInt srcSize, TUint8*& srcNext);
 };
 TInt BytePairCompress(TUint8* dst, TUint8* src, TInt size, CBytePair *aBPE);
+TInt BytePairDecompress(TUint8* dst, TUint8* src, TInt size, CBytePair *aBPE);
 
 #endif
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imglib/symbolutil/bsymutil.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include "bsymutil.h"
+#include <stdio.h>
+
+
+MemoryWriter::MemoryWriter()
+{
+	iChar = new char[4*MaxSize];
+	iOffset = 0;
+	iTotalSize = 4*MaxSize;
+	iStringTableStart = 0;
+}
+MemoryWriter::~MemoryWriter()
+{
+	delete[] iChar;
+}
+int MemoryWriter::WriteBytes(const char* pChar, int size)
+{
+	while(iOffset + size > iTotalSize)
+	{
+		ExtendMemory();
+	}
+	memcpy(iChar + iOffset, pChar, size);
+	iOffset += size;
+	return size;
+}
+TUint32 MemoryWriter::GetOffset()
+{
+	return iOffset;
+}
+char* MemoryWriter::GetDataPointer()
+{
+	return iChar;
+}
+bool MemoryWriter::ExtendMemory()
+{
+	char* pTmp = new char[iTotalSize + MaxSize];
+	memcpy(pTmp, iChar, iOffset);
+	delete[] iChar;
+	iChar = pTmp;
+	iTotalSize += MaxSize;
+	return true;
+}
+bool MemoryWriter::SetOffset(TUint32 aOffset)
+{
+	while(aOffset > iTotalSize)
+	{
+		ExtendMemory();
+	}
+	iOffset = aOffset;
+	return true;
+}
+void MemoryWriter::AddEmptyString()
+{
+	unsigned char len = 0;
+	WriteBytes((char *)&len, 1);
+}
+TUint32 MemoryWriter::AddString(const string& aStr)
+{
+	TUint32 result = 0;
+	if(aStr.empty())
+		return result;
+	result = iOffset - iStringTableStart;
+	int len = aStr.length();
+	if(len >= 255)
+	{
+		TUint16 wlen = len;
+		unsigned char mark = 0xff;
+		WriteBytes((char*)&mark, 1);
+		WriteBytes((char*)&wlen, 2);
+		WriteBytes(aStr.c_str(), len);
+	}
+	else
+	{
+		unsigned char clen = len;
+		WriteBytes((char *)&clen, 1);
+		WriteBytes(aStr.c_str(), len);
+	}
+	return result;
+}
+TUint32 MemoryWriter::AddScopeName(const string& aStr)
+{
+	TUint32 result = 0;
+	if(aStr.empty())
+		return result;
+	if(aStr == iLastScopeName)
+	{
+		return iLastScopeNameOffset;
+	}
+	else
+	{
+		iLastScopeName = aStr;
+		iLastScopeNameOffset = AddString(aStr);
+	}
+	return iLastScopeNameOffset;
+}
+void MemoryWriter::SetStringTableStart(TUint32 aOffset)
+{
+	iStringTableStart = aOffset;
+}
+TUint32 MemoryWriter::GetStringTableStart()
+{
+	return iStringTableStart;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imglib/symbolutil/bsymutil.h	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef __BSYMUTIL_H__
+#define __BSYMUTIL_H__
+
+#include <e32std.h>
+#include <vector>
+#include <string>
+
+using namespace std;
+
+const int BSYM_PAGE_SIZE = 4096;
+
+const int MaxSize = 4*1024*1024;
+const TUint16 BsymMajorVer = 3;
+const TUint16 BsymMinorVer = 0;
+struct TBsymHeader {
+	char iMagic[4]; // 'B','S','Y','M' always big-endian
+	char iMajorVer[2]; // always big-endian, currently 3
+	char iMinorVer[2]; // always big-endian, currently 0.
+	char iEndiannessFlag;
+	char iCompressionFlag;
+	char iReservered[2];
+	TUint32 iDbgUnitOffset;
+	TUint32 iDbgUnitCount;
+	TUint32 iSymbolOffset;
+	TUint32 iSymbolCount;
+	TUint32 iStringTableOffset;
+	TUint32 iStringTableBytes;
+	TUint32 iCompressedSize;
+	TUint32 iUncompressSize;
+	TUint32 iCompressInfoOffset;
+};
+struct TDbgUnitEntry {
+	TUint32 iCodeAddress;
+	TUint32 iCodeSymbolCount;
+	TUint32 iDataAddress;
+	TUint32 iDataSymbolCount;
+	TUint32 iBssAddress;
+	TUint32 iBssSymbolCount;
+	TUint32 iPCNameOffset;
+	TUint32 iDevNameOffset;
+	TUint32 iStartSymbolIndex;
+	TDbgUnitEntry()
+	{
+		iCodeAddress =0;
+		iCodeSymbolCount =0;
+		iDataAddress =0;
+		iDataSymbolCount =0;
+		iBssAddress =0;
+		iBssSymbolCount =0;
+		iPCNameOffset =0;
+		iDevNameOffset =0;
+		iStartSymbolIndex =0;
+	}
+	void Reset()
+	{
+		iCodeAddress =0;
+		iCodeSymbolCount =0;
+		iDataAddress =0;
+		iDataSymbolCount =0;
+		iBssAddress =0;
+		iBssSymbolCount =0;
+		iPCNameOffset =0;
+		iDevNameOffset =0;
+		iStartSymbolIndex =0;
+	}
+};
+struct TDbgUnitPCEntry {
+	TDbgUnitEntry iDbgUnitEntry;
+	string iPCName;
+	string iDevName;
+};
+struct TSymbolEntry {
+	TUint32 iAddress;
+	TUint32 iLength;
+	TUint32 iScopeNameOffset;
+	TUint32 iNameOffset;
+	TUint32 iSecNameOffset;
+	TSymbolEntry()
+	{
+		iAddress =0;
+		iLength =0;
+		iScopeNameOffset =0;
+		iNameOffset =0;
+		iSecNameOffset =0;
+	}
+};
+
+struct TSymbolPCEntry {
+	TSymbolEntry iSymbolEntry;
+	string iScopeName;
+	string iName;
+	string iSecName;
+};
+
+struct TPageInfo {
+	TUint32 iPageStartOffset;
+	TUint32 iPageDataSize;
+};
+
+struct TCompressedHeaderInfo
+{
+	TUint32 iPageSize;
+	TUint32 iTotalPageNumber;
+	TPageInfo iPages[1];
+};
+
+typedef vector<TDbgUnitPCEntry> TDbgUnitEntrySet;
+typedef vector<TSymbolPCEntry> TSymbolPCEntrySet;
+typedef vector<string> StringList;
+
+struct MapFileInfo
+{
+	TDbgUnitPCEntry iDbgUnitPCEntry;
+	TSymbolPCEntrySet iSymbolPCEntrySet;
+};
+
+typedef vector<MapFileInfo> MapFileInfoSet;
+class ByteOrderUtil
+{
+public:
+	static bool IsLittleEndian()
+	{
+		union {
+			unsigned int a;
+			unsigned char b;
+		} c;
+		c.a = 1;
+		return (c.b == 1);
+	}
+};
+
+class MemoryWriter
+{
+public:
+	MemoryWriter();
+	~MemoryWriter();
+	int WriteBytes(const char* pChar, int size);
+	TUint32 GetOffset();
+	char* GetDataPointer();
+	bool ExtendMemory();
+	bool SetOffset(TUint32 aOffset);
+	void AddEmptyString();
+	TUint32 AddString(const string& aStr);
+	TUint32 AddScopeName(const string& aStr);
+	void SetStringTableStart(TUint32 aOffset);
+	TUint32 GetStringTableStart();
+private:
+	char* iChar;
+	TUint32 iOffset;
+	TUint32 iStringTableStart;
+	string iLastScopeName;
+	TUint32 iLastScopeNameOffset;
+	TUint32 iTotalSize;
+};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imglib/symbolutil/loggingexception.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "loggingexception.h"
+
+
+int LoggingException::RESOURCE_ALLOCATION_FAILURE = 1;
+int LoggingException::INVALID_LOG_FILENAME        = 2;
+int LoggingException::UNKNOWN_IMAGE_TYPE          = 3;
+
+
+LoggingException::LoggingException(int ErrorCode)
+{
+	this->errcode = ErrorCode;
+
+	return;
+}
+
+
+int LoggingException::GetErrorCode(void)
+{
+	return this->errcode;
+}
+
+
+const char* LoggingException::GetErrorMessage(void)
+{
+	if(this->errcode == LoggingException::RESOURCE_ALLOCATION_FAILURE)
+		return "Not enough system resources to initialize logging module.";
+	else if(this->errcode == LoggingException::INVALID_LOG_FILENAME)
+		return "Invalid log filename as input.";
+	else if(this->errcode == LoggingException::UNKNOWN_IMAGE_TYPE)
+		return "the image type not supported.";
+//	else if(this->errcode == CacheException::CACHE_IS_EMPTY)
+//		return "Cache is empty.";
+//	else if(this->errcode == CacheException::HARDDRIVE_FAILURE)
+//		return "A hard drive failure occurred in Cache operations.";
+
+	return "Undefined error type.";
+}
+
+
+LoggingException::~LoggingException(void)
+{
+	return;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imglib/symbolutil/loggingexception.h	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef ROM_TOOLS_ROFSBUILD_LOGGING_LOGGINGEXCEPTION_H_
+#define ROM_TOOLS_ROFSBUILD_LOGGING_LOGGINGEXCEPTION_H_
+
+
+/*
+ * @class LoggingException
+ */
+class LoggingException
+{
+public:
+	LoggingException(int ErrorCode);
+
+	int GetErrorCode(void);
+
+	const char* GetErrorMessage(void);
+
+	static int RESOURCE_ALLOCATION_FAILURE;
+	static int INVALID_LOG_FILENAME       ;
+	static int UNKNOWN_IMAGE_TYPE	      ;
+
+	virtual ~LoggingException(void);
+protected:
+	int errcode;
+private:
+	LoggingException(void);
+
+	LoggingException& operator = (const LoggingException&);
+};
+
+
+#endif  /* defined ROM_TOOLS_ROFSBUILD_LOGGING_LOGGINGEXCEPTION_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imglib/symbolutil/logparser.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,218 @@
+/*
+* Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include <new>
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <boost/regex.hpp>
+using namespace std;
+
+#include "loggingexception.h"
+#include "logparser.h"
+
+
+LogParser* LogParser::Only = (LogParser*)0;
+
+
+LogParser* LogParser::GetInstance(TImageType aImageType) throw (LoggingException)
+{
+	if(! LogParser::Only)
+	{
+		if(aImageType == ERomImage)
+		{
+			LogParser::Only = new (std::nothrow) RomLogParser();
+		}
+		else if(aImageType == ERofsImage)
+		{
+			LogParser::Only = new (std::nothrow) RofsLogParser();
+		}
+		else
+		{
+			throw LoggingException(LoggingException::UNKNOWN_IMAGE_TYPE);
+		}
+		if(! LogParser::Only)
+			throw LoggingException(LoggingException::RESOURCE_ALLOCATION_FAILURE);
+	}
+
+	return LogParser::Only;
+}
+
+void LogParser::Cleanup(void)
+{
+	return;
+}
+
+
+LogParser::LogParser(void)
+{
+	iImageType = EUnknownType;
+	return;
+}
+
+RofsLogParser::RofsLogParser()
+{
+	iImageType = ERofsImage;
+}
+
+void RofsLogParser::ParseSymbol(const char* LogFilename) throw (LoggingException)
+{
+	string linebuf;
+	SymbolGenerator* symgen = SymbolGenerator::GetInstance();
+	symgen->SetImageType(iImageType);
+	symgen->SetSymbolFileName(string(LogFilename));
+
+	ifstream logfd(LogFilename);
+	if(logfd.is_open())
+	{
+		while(! logfd.eof())
+		{
+			getline(logfd, linebuf);
+			if(linebuf.compare(0,4,"File") == 0)
+			{
+				if(linebuf.find("size:", 4) != string::npos)
+				{
+					size_t startpos = linebuf.find('\'') ;
+					size_t endpos   = linebuf.rfind('\'');
+					if((startpos!=string::npos) && (endpos!=string::npos))
+					{
+						symgen->AddFile(linebuf.substr(startpos+1,endpos-startpos-1), false);
+					}
+				}
+			}
+			else if(linebuf.compare(0,26,"Compressed executable File") == 0)
+			{
+				if(linebuf.find("size:", 26) != string::npos)
+				{
+					size_t startpos = linebuf.find('\'') ;
+					size_t endpos   = linebuf.rfind('\'');
+					if((startpos!=string::npos) && (endpos!=string::npos))
+					{
+						symgen->AddFile(linebuf.substr(startpos+1,endpos-startpos-1), true);
+					}
+				}
+			}
+		}
+		symgen->SetFinished();
+		symgen->Release();
+	}
+	else
+	{
+		throw LoggingException(LoggingException::INVALID_LOG_FILENAME);
+	}
+
+	return;
+}
+
+RomLogParser::RomLogParser()
+{
+	iImageType = ERomImage;
+}
+
+void RomLogParser::ParseSymbol(const char* LogFilename) throw (LoggingException)
+{
+	string linebuf;
+	SymbolGenerator* symgen = SymbolGenerator::GetInstance();
+	symgen->SetImageType(iImageType);
+	symgen->SetSymbolFileName(string(LogFilename));
+
+	ifstream logfd(LogFilename);
+	if(logfd.is_open())
+	{
+		//boost::regex beginFlag("^Creating Rom image (\\S*)");
+		boost::regex endFlag("^Writing Rom image");
+		boost::regex sourceFile("^Reading resource (.*) to rom linear address (.*)");
+		boost::regex executableFile("^Processing file (.*)");
+		boost::regex codeStart("^Code start addr:\\s*(\\w+)");
+		boost::regex dataStart("^Data start addr:\\s+(\\w+)");
+		boost::regex dataBssStart("^DataBssLinearBase:\\s+(\\w+)");
+		boost::regex textSize("^Text size:\\s+(\\w+)");
+		boost::regex dataSize("^Data size:\\s+(\\w+)");
+		boost::regex bssSize("Bsssize:\\s+(\\w+)");
+		boost::regex totalDataSize("^Total data size:\\s+(\\w+)");
+		string tmpline, tmpaddr;
+		boost::cmatch what;
+		while(getline(logfd, tmpline))
+		{
+			TPlacedEntry tmpEntry;
+			if(regex_search(tmpline, what, endFlag))
+			{
+				break;
+			}
+			if(regex_search(tmpline, what, sourceFile))
+			{
+				tmpEntry.iFileName.assign(what[1].first, what[1].second-what[1].first);
+				tmpaddr.assign(what[2].first, what[2].second-what[2].first);
+				tmpEntry.iDataAddress = strtol(tmpaddr.c_str(), NULL, 16);
+				symgen->AddEntry(tmpEntry);
+			}
+			else if(regex_search(tmpline, what, executableFile))
+			{
+				tmpEntry.iFileName.assign(what[1].first, what[1].second-what[1].first);
+				while(getline(logfd, tmpline) && tmpline != "")
+				{
+					if(regex_search(tmpline, what, codeStart))
+					{
+						tmpaddr.assign(what[1].first, what[1].second-what[1].first);
+						tmpEntry.iCodeAddress = strtol(tmpaddr.c_str(), NULL, 16);
+					} 
+					else if(regex_search(tmpline, what, dataStart))
+					{
+						tmpaddr.assign(what[1].first, what[1].second-what[1].first);
+						tmpEntry.iDataAddress = strtol(tmpaddr.c_str(), NULL, 16);
+					}
+					else if(regex_search(tmpline, what, dataBssStart))
+					{
+						tmpaddr.assign(what[1].first, what[1].second-what[1].first);
+						tmpEntry.iDataBssLinearBase = strtol(tmpaddr.c_str(), NULL, 16);
+					}
+					else if(regex_search(tmpline, what, textSize))
+					{
+						tmpaddr.assign(what[1].first, what[1].second-what[1].first);
+						tmpEntry.iTextSize = strtol(tmpaddr.c_str(), NULL, 16);
+					}
+					else if(regex_search(tmpline, what, dataSize))
+					{
+						tmpaddr.assign(what[1].first, what[1].second-what[1].first);
+						tmpEntry.iDataSize = strtol(tmpaddr.c_str(), NULL, 16);
+					}
+					else if(regex_search(tmpline, what, bssSize))
+					{
+						tmpaddr.assign(what[1].first, what[1].second-what[1].first);
+						tmpEntry.iBssSize = strtol(tmpaddr.c_str(), NULL, 16);
+					}
+					else if(regex_search(tmpline, what, totalDataSize))
+					{
+						tmpaddr.assign(what[1].first, what[1].second-what[1].first);
+						tmpEntry.iTotalDataSize = strtol(tmpaddr.c_str(), NULL, 16);
+					}
+				}
+				symgen->AddEntry(tmpEntry);
+			}
+
+
+		}
+		symgen->SetFinished();
+		symgen->Release();
+	}
+	else
+	{
+		throw LoggingException(LoggingException::INVALID_LOG_FILENAME);
+	}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imglib/symbolutil/logparser.h	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef ROM_TOOLS_ROFSBUILD_LOGGING_LOGPARSER_H_
+#define ROM_TOOLS_ROFSBUILD_LOGGING_LOGPARSER_H_
+
+#include "loggingexception.h"
+#include "symbolgenerator.h"
+
+/**
+ * @class LogParser
+ */
+class LogParser
+{
+public:
+	static LogParser* GetInstance(TImageType aImageType) throw (LoggingException);
+
+	virtual void ParseSymbol(const char* LogFilename) throw (LoggingException) = 0;
+
+	void Cleanup(void);
+	virtual ~LogParser() {}
+protected:
+	LogParser(void);
+	static LogParser* Only;
+	TImageType iImageType;
+private:
+	LogParser(const LogParser&);
+
+	LogParser& operator = (const LogParser&);
+};
+
+class RofsLogParser : public LogParser
+{
+public:
+	virtual void ParseSymbol(const char* LogFilename) throw (LoggingException);
+	RofsLogParser(void);
+};
+
+class RomLogParser : public LogParser
+{
+public:
+	virtual void ParseSymbol(const char* LogFilename) throw (LoggingException);
+	RomLogParser(void);
+};
+
+
+
+#endif  /* defined ROM_TOOLS_ROFSBUILD_LOGGING_LOGPARSER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imglib/symbolutil/symbolgenerator.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,384 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include <vector>
+#include <boost/regex.hpp>
+#define MAX_LINE 65535
+#include "symbolgenerator.h"
+#include "e32image.h"
+#include "h_utl.h"
+
+#if defined(__LINUX__)
+#define PATH_SEPARATOR '/'
+#else
+#define PATH_SEPARATOR '\\'
+#endif
+extern TInt gThreadNum;
+extern TBool gGenBsymbols;
+
+boost::mutex SymbolGenerator::iMutexSingleton;
+SymbolGenerator* SymbolGenerator::iInst = NULL;
+SymbolGenerator* SymbolGenerator::GetInstance(){
+    iMutexSingleton.lock();
+    if(iInst == NULL) {
+        iInst = new SymbolGenerator();
+    }
+    iMutexSingleton.unlock();
+    return iInst;
+}
+void SymbolGenerator::Release() {
+    if(iInst != NULL) {
+        iInst->join();
+    }
+    iMutexSingleton.lock();
+    if(iInst != NULL) {
+        delete iInst;
+        iInst = NULL;
+    }
+    iMutexSingleton.unlock();
+}
+void SymbolGenerator::SetSymbolFileName( const string& fileName ){
+    if(iSymFile.is_open())
+        iSymFile.close();
+    if(gGenBsymbols)
+    {
+    	string s = fileName.substr(0,fileName.rfind('.'))+".bsym";
+    	if(iImageType == ERofsImage)
+    	{
+    		printf("* Writing %s - ROFS BSymbol file\n", s.c_str());
+    	}
+    	else
+    	{
+    		printf("* Writing %s - ROM BSymbol file\n", s.c_str());
+    	}
+    	iSymFile.open(s.c_str(), ios_base::binary);
+    }
+    else
+    {
+    	string s = fileName.substr(0,fileName.rfind('.'))+".symbol";
+    	if(iImageType == ERofsImage)
+    	{
+    		printf("* Writing %s - ROFS Symbol file\n", s.c_str());
+    	}
+    	else
+    	{
+    		printf("* Writing %s - ROM Symbol file\n", s.c_str());
+    	}
+    iSymFile.open(s.c_str());
+    }
+	   
+}
+void SymbolGenerator::AddFile( const string& fileName, bool isExecutable ){
+    iMutex.lock();
+    iQueueFiles.push(TPlacedEntry(fileName, "" , isExecutable));
+    iMutex.unlock();
+    iCond.notify_all();
+}
+
+void SymbolGenerator::AddEntry(const TPlacedEntry& aEntry)
+{
+    iMutex.lock();
+    iQueueFiles.push(aEntry);
+    iMutex.unlock();
+    iCond.notify_all();
+}
+
+void SymbolGenerator::SetFinished() 
+{ 
+
+	iFinished = true; 
+	iCond.notify_all();
+}
+TPlacedEntry SymbolGenerator::GetNextPlacedEntry()
+{
+	TPlacedEntry pe("", "", false);
+	if(1)
+	{
+		boost::mutex::scoped_lock lock(iMutex);
+		while(!iFinished && iQueueFiles.empty())
+			iCond.wait(lock);
+		if(!iQueueFiles.empty())
+		{
+			pe = iQueueFiles.front();
+			iQueueFiles.pop();
+        	}
+    	}
+	return pe;
+}
+void SymbolGenerator::thrd_func(){
+    	boost::thread_group threads;
+	SymbolWorker worker;
+    	for(int i=0; i < gThreadNum; i++)
+    	{
+    		threads.create_thread(worker);
+    	}
+    	threads.join_all();
+	SymbolGenerator::GetInstance()->FlushSymbolFileContent();
+        }
+SymbolGenerator::SymbolGenerator() : boost::thread(thrd_func),iFinished(false) {
+	if(gGenBsymbols)
+	{
+		iSymbolType = ESymBsym;
+	}
+	else
+	{
+		iSymbolType = ESymCommon;
+	}
+    }
+SymbolGenerator::~SymbolGenerator(){
+    if(joinable())
+        join();
+    iSymFile.flush();
+    iSymFile.close();
+}
+void SymbolGenerator::FlushSymbolFileContent()
+{
+    if(iSymbolType == ESymCommon)
+    {
+	return;
+    }
+    TBsymHeader tmpBsymHeader;
+    memset(&tmpBsymHeader, 0, sizeof(tmpBsymHeader));
+    tmpBsymHeader.iMagic[0] = 'B';
+    tmpBsymHeader.iMagic[1] = 'S';
+    tmpBsymHeader.iMagic[2] = 'Y';
+    tmpBsymHeader.iMagic[3] = 'M';
+    tmpBsymHeader.iMajorVer[0] = BsymMajorVer >> 8;
+    tmpBsymHeader.iMajorVer[1] = BsymMajorVer & 0xff;
+    tmpBsymHeader.iMinorVer[0] = BsymMinorVer >> 8;
+    tmpBsymHeader.iMinorVer[1] = BsymMinorVer & 0xff;
+    if(ByteOrderUtil::IsLittleEndian())
+    {
+	    tmpBsymHeader.iEndiannessFlag = 0;
+    }
+    else
+    {
+	    tmpBsymHeader.iEndiannessFlag = 1;
+    }
+    tmpBsymHeader.iCompressionFlag = 1;
+    //count the space for TDbgUnitEntries and TSymbolEntries
+    int fileCount = iMapFileInfoSet.size();
+    TUint32 sizeNeeded = fileCount * sizeof(TDbgUnitEntry);
+    for(int i = 0; i < fileCount; i++)
+    {
+    	sizeNeeded += iMapFileInfoSet[i].iSymbolPCEntrySet.size() * sizeof(TSymbolEntry);
+    }
+    //write string to the temporary memory area
+    MemoryWriter mWriter;
+    mWriter.SetOffset(sizeNeeded);
+    mWriter.SetStringTableStart(sizeNeeded);
+    mWriter.AddEmptyString();
+
+    //first to prepare the file info entries TDbgUnitEntry
+    TUint32 startSymbolIndex = 0;
+    for(int i = 0; i < fileCount; i++)
+    {
+    	iMapFileInfoSet[i].iDbgUnitPCEntry.iDbgUnitEntry.iStartSymbolIndex = startSymbolIndex;
+    	iMapFileInfoSet[i].iDbgUnitPCEntry.iDbgUnitEntry.iPCNameOffset = mWriter.AddString(iMapFileInfoSet[i].iDbgUnitPCEntry.iPCName);
+    	iMapFileInfoSet[i].iDbgUnitPCEntry.iDbgUnitEntry.iDevNameOffset = mWriter.AddString(iMapFileInfoSet[i].iDbgUnitPCEntry.iDevName);
+    	startSymbolIndex += iMapFileInfoSet[i].iSymbolPCEntrySet.size();
+    }
+    //second to layout the symbols unit for the mapfile
+    for(int i = 0; i < fileCount; i++)
+    {
+        int symbolcount = iMapFileInfoSet[i].iSymbolPCEntrySet.size();
+        for(int j =0; j< symbolcount; j++)
+        {
+        	iMapFileInfoSet[i].iSymbolPCEntrySet[j].iSymbolEntry.iScopeNameOffset = mWriter.AddScopeName(iMapFileInfoSet[i].iSymbolPCEntrySet[j].iScopeName);
+        	iMapFileInfoSet[i].iSymbolPCEntrySet[j].iSymbolEntry.iNameOffset = mWriter.AddString(iMapFileInfoSet[i].iSymbolPCEntrySet[j].iName);
+        	iMapFileInfoSet[i].iSymbolPCEntrySet[j].iSymbolEntry.iSecNameOffset = mWriter.AddString(iMapFileInfoSet[i].iSymbolPCEntrySet[j].iSecName);
+        }
+    }
+
+    //write out the BSym file content
+    char* pstart = mWriter.GetDataPointer();
+    //write out the map file info
+    int unitlen = sizeof(TDbgUnitEntry);
+    for(int i = 0; i < fileCount; i++)
+    {
+    	memcpy(pstart, &iMapFileInfoSet[i].iDbgUnitPCEntry.iDbgUnitEntry, unitlen);
+    	pstart += unitlen;
+    }
+    //wirte out the symbol unit info
+    unitlen = sizeof(TSymbolEntry);
+    for(int i = 0; i < fileCount; i++)
+    {
+    	int symbolcount = iMapFileInfoSet[i].iSymbolPCEntrySet.size();
+    	for(int j =0; j < symbolcount; j++)
+    	{
+    		memcpy(pstart, &iMapFileInfoSet[i].iSymbolPCEntrySet[j].iSymbolEntry, unitlen);
+    		pstart += unitlen;
+    	}
+    }
+    //write out the memory out to the symbol file
+
+    int totalPages = (mWriter.GetOffset() + ( BSYM_PAGE_SIZE -1)) / 4096;
+    TUint32 compressInfoLength = sizeof(TCompressedHeaderInfo) + sizeof(TPageInfo)*(totalPages -1);
+    char* tmpBuffer = new char[compressInfoLength];
+    TCompressedHeaderInfo * pCompressedHeaderInfo = (TCompressedHeaderInfo *) tmpBuffer;
+    pCompressedHeaderInfo->iPageSize = BSYM_PAGE_SIZE;
+    pCompressedHeaderInfo->iTotalPageNumber = totalPages;
+    TPageInfo* tmpPage = &pCompressedHeaderInfo->iPages[0];
+    for(int i = 0; i < totalPages; i++)
+    {
+	    tmpPage->iPageStartOffset = i * BSYM_PAGE_SIZE;
+	    if(tmpPage->iPageStartOffset + BSYM_PAGE_SIZE < mWriter.GetOffset())
+	    {
+	    	tmpPage->iPageDataSize = BSYM_PAGE_SIZE;
+	    }
+	    else
+	    {
+		tmpPage->iPageDataSize = mWriter.GetOffset() - tmpPage->iPageStartOffset;
+	    }
+	    tmpPage++;
+    }
+
+    //prepare the TBsymHeader, TDbgUnitEntry and TSymbolEntry to the memory
+    tmpBsymHeader.iDbgUnitOffset = sizeof(TBsymHeader) + compressInfoLength;
+    tmpBsymHeader.iDbgUnitCount = fileCount;
+    tmpBsymHeader.iSymbolOffset = fileCount*sizeof(TDbgUnitEntry);
+    tmpBsymHeader.iSymbolCount = startSymbolIndex;
+    tmpBsymHeader.iStringTableOffset = mWriter.GetStringTableStart();
+    tmpBsymHeader.iStringTableBytes = mWriter.GetOffset() - tmpBsymHeader.iStringTableOffset;
+    tmpBsymHeader.iUncompressSize = mWriter.GetOffset();
+    //start the compress threads
+    Print(EAlways, "Start compress for Bsymbol file\n");
+    PageCompressWorker compressWorker(pCompressedHeaderInfo, mWriter.GetDataPointer());
+    boost::thread_group threads;
+    for(int i=0; i < gThreadNum; i++)
+    {
+	    threads.create_thread(compressWorker);
+    }
+    threads.join_all();
+    Print(EAlways, "Complete compress for Bsymbol file\n");
+    //pack all the pages together
+    tmpPage = &pCompressedHeaderInfo->iPages[0];
+    TPageInfo* prePage = NULL;
+    char* pchar = mWriter.GetDataPointer();
+    for(int i=0; i < totalPages -1; i++)
+    {
+	    prePage = tmpPage;
+	    tmpPage++;
+	    memcpy(pchar + prePage->iPageStartOffset + prePage->iPageDataSize, pchar + tmpPage->iPageStartOffset, tmpPage->iPageDataSize);
+	    tmpPage->iPageStartOffset = prePage->iPageStartOffset + prePage->iPageDataSize;
+
+    }
+    tmpBsymHeader.iCompressedSize = tmpPage->iPageStartOffset + tmpPage->iPageDataSize;
+    mWriter.SetOffset(tmpBsymHeader.iCompressedSize);
+    tmpBsymHeader.iCompressInfoOffset = sizeof(TBsymHeader);
+
+    iSymFile.write((char*)&tmpBsymHeader, sizeof(TBsymHeader));
+    iSymFile.write((char*)pCompressedHeaderInfo, compressInfoLength);
+    iSymFile.write(mWriter.GetDataPointer(), mWriter.GetOffset());
+    delete[] tmpBuffer;
+    for(int i = 0; i < fileCount; i++)
+    {
+    	iMapFileInfoSet[i].iSymbolPCEntrySet.clear();
+    }
+    iMapFileInfoSet.clear();
+}
+
+SymbolWorker::SymbolWorker()
+{
+}
+SymbolWorker::~SymbolWorker()
+{
+    }
+void SymbolWorker::operator()()
+{
+	SymbolProcessUnit* aSymbolProcessUnit;
+	SymbolGenerator* symbolgenerator = SymbolGenerator::GetInstance();
+	if(symbolgenerator->GetImageType() == ERomImage)
+	{
+		aSymbolProcessUnit = new CommenRomSymbolProcessUnit();
+	}
+	else
+	{
+		if(gGenBsymbols)
+		{
+			aSymbolProcessUnit = new BsymRofsSymbolProcessUnit(symbolgenerator);
+		}
+		else
+		{
+			aSymbolProcessUnit = new CommenRofsSymbolProcessUnit();
+		}
+	}
+
+	while(1)
+	{
+		if(symbolgenerator->HasFinished() && symbolgenerator->IsEmpty())
+		{
+			break;
+                }
+		TPlacedEntry pe = symbolgenerator->GetNextPlacedEntry();
+		if(pe.iFileName.empty())
+			continue;
+
+		aSymbolProcessUnit->ProcessEntry(pe);
+
+		symbolgenerator->LockOutput();
+		aSymbolProcessUnit->FlushStdOut(cout);
+		aSymbolProcessUnit->FlushSymbolContent(symbolgenerator->GetOutputFileStream());
+		symbolgenerator->UnlockOutput();
+	}
+	delete aSymbolProcessUnit;
+}
+TCompressedHeaderInfo* PageCompressWorker::pHeaderInfo = NULL;
+int PageCompressWorker::currentPage = 0;
+boost::mutex PageCompressWorker::m_mutex;
+int PageCompressWorker::m_error = 0;
+char* PageCompressWorker::iChar = NULL;
+
+PageCompressWorker::PageCompressWorker(TCompressedHeaderInfo* aHeaderInfo, char* aChar) 
+{
+	pHeaderInfo = aHeaderInfo;
+	iChar = aChar;
+}
+
+PageCompressWorker::~PageCompressWorker() {}
+void PageCompressWorker::operator()()
+{
+	int tobecompress = 0;
+	CBytePair bpe;
+	while(1)
+	{
+		m_mutex.lock();
+		tobecompress =currentPage;
+		currentPage++;
+		m_mutex.unlock();
+		if(tobecompress >= (int) pHeaderInfo->iTotalPageNumber)
+			break;
+		TPageInfo* current = &pHeaderInfo->iPages[0] + tobecompress;
+		TUint8* in = (TUint8*)(iChar + current->iPageStartOffset);
+		TUint8* out = in;
+		TInt outSize = BytePairCompress(out, in, current->iPageDataSize, &bpe);
+		if(outSize == KErrTooBig)
+		{
+			outSize = BSYM_PAGE_SIZE;
+		}
+		if(outSize < 0)
+		{
+			m_mutex.lock();
+			m_error = -1;
+			m_mutex.unlock();
+			break;
+		}
+		current->iPageDataSize = outSize;
+	}
+	
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imglib/symbolutil/symbolgenerator.h	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef __SYMBOLGENERATOR_H__
+#define __SYMBOLGENERATOR_H__
+#include <queue>
+#include <string>
+#include <fstream>
+using namespace std;
+#include <boost/thread/thread.hpp>
+#include <boost/thread/condition.hpp>
+#include "symbolprocessunit.h"
+
+
+enum TSymbolType {
+	ESymCommon = 0,
+	ESymBsym ,
+};
+enum TImageType {
+	ERomImage = 0,
+	ERofsImage,
+	EUnknownType,
+};
+
+
+class SymbolGenerator : public boost::thread {
+    public:
+        static SymbolGenerator* GetInstance();
+        static void Release();
+        void SetSymbolFileName( const string& fileName );
+        void AddFile( const string& fileName, bool isExecutable );
+	void AddEntry(const TPlacedEntry& aEntry);
+        bool HasFinished()	{ return iFinished; }
+        void SetFinished();
+        bool IsEmpty() { return iQueueFiles.empty(); }
+        void LockOutput() { iOutputMutex.lock(); }
+        void UnlockOutput() { iOutputMutex.unlock(); }
+        TPlacedEntry GetNextPlacedEntry();
+        ofstream& GetOutputFileStream() { return iSymFile; };
+        void AppendMapFileInfo(MapFileInfo& aMapFileInfo) { iMapFileInfoSet.push_back(aMapFileInfo); }
+        void FlushSymbolFileContent();
+	void SetImageType(TImageType aImageType) {	iImageType = aImageType; };
+	TImageType GetImageType() {	return iImageType; };
+    private:
+        SymbolGenerator();
+        ~SymbolGenerator();
+        static void thrd_func();
+
+        queue<TPlacedEntry> iQueueFiles;
+        boost::mutex iMutex;
+        boost::mutex iOutputMutex;
+        static boost::mutex iMutexSingleton;
+        static SymbolGenerator* iInst;
+        boost::condition_variable iCond;
+        bool iFinished;
+        TSymbolType iSymbolType;
+	TImageType iImageType;
+
+        ofstream iSymFile;
+        MapFileInfoSet iMapFileInfoSet;
+};
+class SymbolWorker{
+public:
+	SymbolWorker();
+	~SymbolWorker();
+	void operator()();
+private:
+};
+class PageCompressWorker {
+public:
+	PageCompressWorker(TCompressedHeaderInfo* aHeaderInfo, char* aChar);
+	~PageCompressWorker();
+	void operator()();
+	static TCompressedHeaderInfo * pHeaderInfo;
+	static int currentPage;
+	static boost::mutex m_mutex;
+	static int m_error;
+	static char* iChar;
+};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imglib/symbolutil/symbolprocessunit.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,997 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include <boost/regex.hpp>
+#include "symbolprocessunit.h"
+#include "e32image.h"
+#include "symbolgenerator.h"
+#include "h_utl.h"
+
+
+#define MAX_LINE 65535
+
+#if defined(__LINUX__)
+#define PATH_SEPARATOR '/'
+#else
+#define PATH_SEPARATOR '\\'
+#endif
+
+void SymbolProcessUnit::ProcessEntry(const TPlacedEntry& aEntry)
+{
+	if(aEntry.iFileName == "")
+		return;
+	else if(aEntry.iExecutable)
+		ProcessExecutableFile(aEntry.iFileName);
+	else
+		ProcessDataFile(aEntry.iFileName);
+}
+// CommenRomSymbolProcessUnit start
+void CommenRomSymbolProcessUnit::FlushStdOut(ostream& aOut)
+{
+	for(int i = 0; i < (int) iStdoutLog.size(); i++)
+	{
+		aOut << iStdoutLog[i];
+	}
+}
+
+void CommenRomSymbolProcessUnit::FlushSymbolContent(ostream &aOut)
+{
+	for(int i = 0; i < (int) iSymbolContentLog.size(); i++)
+	{
+		aOut << iSymbolContentLog[i];
+	}
+}
+
+void CommenRomSymbolProcessUnit::ResetContentLog()
+{
+	iStdoutLog.clear();
+	iSymbolContentLog.clear();
+}
+
+void CommenRomSymbolProcessUnit::ProcessEntry(const TPlacedEntry& aEntry)
+{
+	iPlacedEntry = aEntry;
+	SymbolProcessUnit::ProcessEntry(aEntry);
+}
+
+void CommenRomSymbolProcessUnit::ProcessExecutableFile(const string& aFile)
+{
+	ResetContentLog();
+	char str[MAX_LINE];
+	string outString;
+	outString = "\nFrom    ";
+	outString += aFile + "\n\n";
+	iSymbolContentLog.push_back(outString);
+	string mapFile2 = aFile+".map";
+	size_t dot = aFile.rfind('.');
+	string mapFile = aFile.substr(0,dot)+".map";
+	ifstream fMap;
+	fMap.open(mapFile2.c_str());
+	if(!fMap.is_open()) {
+		fMap.open(mapFile.c_str());
+	}
+
+	if(!fMap.is_open()) {
+		sprintf(str, "\nWarning: Can't open \"%s\" or \"%s\"\n",mapFile2.c_str(),mapFile.c_str());
+		iStdoutLog.push_back(str);
+	    memset(str,0,sizeof(str));
+	    sprintf(str, "%08x    %04x    ", (unsigned int)iPlacedEntry.iCodeAddress, (unsigned int)iPlacedEntry.iTotalSize);
+	    outString = str;
+	    outString += aFile.substr(aFile.rfind(PATH_SEPARATOR)+1)+"\n";
+	    iSymbolContentLog.push_back(outString);
+	}
+	else {
+	    if(!fMap.good()) fMap.clear();
+	    char buffer[100];
+	    fMap.getline(buffer, 100);
+	    boost::regex regARMV5("ARM Linker", boost::regex::icase);
+	    boost::regex regGCCEoARMV4("Archive member included", boost::regex::icase);
+	    boost::cmatch what;
+	    if(regex_search(buffer, what, regARMV5)) {
+	        ProcessArmv5File(aFile, fMap);
+	    }
+	    else if(regex_search(buffer, what, regGCCEoARMV4)) {
+	        ProcessGcceOrArm4File(aFile, fMap);
+	    }
+	    else {
+		fMap.seekg(0, ios_base::beg);
+		ProcessX86File(aFile, fMap);
+	    }
+	}
+}
+
+void CommenRomSymbolProcessUnit::ProcessDataFile(const string& aFile)
+{
+	ResetContentLog();
+	char str[MAX_LINE];
+	memset(str,0,sizeof(str));
+	string basename = aFile.substr(aFile.rfind(PATH_SEPARATOR)+1);
+	sprintf(str, "\nFrom    %s\n\n%08x    0000    %s\n", aFile.c_str(), (unsigned int) iPlacedEntry.iDataAddress, basename.c_str());
+	iSymbolContentLog.push_back(str);
+}
+
+struct ArmSymbolInfo {
+	string name ;
+	TUint size ;
+	string section ;
+};
+typedef multimap<TUint32,ArmSymbolInfo> ArmSymMap ;
+
+#define SKIP_WS(p)	 while((*p) == ' ' ||  (*p) == '\t') (p)++ 
+#define FIND_WS(p)	 while((*p) != ' ' &&  (*p) != '\t' && (*p) != 0) (p)++ 
+static void split(char* str, vector<char*>& result) {
+	result.clear();
+	while(*str) {
+		SKIP_WS(str);
+		char* saved = str ; 
+		FIND_WS(str);
+		bool end = (0 == *str);
+		*str = 0 ; 
+		if(saved != str)
+			result.push_back(saved);		
+		if(!end) str ++ ; 
+	}	 
+}
+static void make_lower(char* str){
+	while(*str){
+		if(*str >= 'A' && *str >= 'Z') {
+			*str += ('a' - 'A');
+		}
+		str++;
+	}
+}
+
+void CommenRomSymbolProcessUnit::ProcessArmv5File(const string& aFile, ifstream& aMap)
+{
+	string symName ; 
+	ArmSymMap symbols ; 
+	vector<char*> words ;
+	ArmSymbolInfo info;
+	char* lineStart ;
+	char buffer[MAX_LINE];  
+	while(aMap.good() && (!aMap.eof())){
+		*buffer = 0;
+		aMap.getline(buffer,MAX_LINE);
+		lineStart = buffer ;
+		SKIP_WS(lineStart);	 
+		if(strstr(lineStart,"Global Symbols"))
+			break ;
+		char* armstamp = strstr(lineStart,"ARM Code");
+		if(0 == armstamp)
+			armstamp = strstr(lineStart,"Thumb Code") ;
+		if(0 == armstamp) continue ; 
+		*(armstamp - 1) = 0 ;
+		
+		char* hexStr = lineStart ;
+		char* nameEnd;
+		while(1) {
+			hexStr = strstr(hexStr,"0x");
+			if(0 == hexStr) break ; 		
+			nameEnd = hexStr - 1;
+			if(*nameEnd == ' ' || *nameEnd == '\t') break ;
+			hexStr += 2 ;
+		}	 
+		if(0 == hexStr) continue ; 	
+		while(nameEnd > lineStart && (*nameEnd == ' ' || *nameEnd == '\t'))
+			nameEnd -- ;
+		
+		nameEnd[1] = 0;
+		info.name = lineStart;		
+		char* temp ;
+		TUint32 addr = strtoul(hexStr + 2,&temp,16);
+		char* decStr ;
+		if(*armstamp == 'A')
+			decStr = armstamp + 9 ;
+		else 
+			decStr = armstamp + 11 ;
+		SKIP_WS(decStr);
+		info.size = strtoul(decStr,&temp,10);
+		SKIP_WS(temp);
+		info.section = temp;
+		if(info.section.find("(StubCode)") != string::npos )
+			info.size = 8 ; 			
+		if(addr > 0){
+			symbols.insert(pair<TUint32,ArmSymbolInfo>(addr,info));
+		}
+	}	 
+	size_t lenOfFileName = iPlacedEntry.iFileName.length();
+	while(aMap.good() && (!aMap.eof())){
+		*buffer = 0;
+		aMap.getline(buffer,MAX_LINE);
+		lineStart = buffer ;
+		SKIP_WS(lineStart); 
+		char* hexStr = lineStart ;
+		char* nameEnd;
+		while(1) {
+			hexStr = strstr(hexStr,"0x");
+			if(0 == hexStr) break ; 		
+			nameEnd = hexStr - 1;
+			if(*nameEnd == ' ' || *nameEnd == '\t') 
+				break ;
+			hexStr += 2 ;
+		}	 
+		if(0 == hexStr) continue ; 
+		while(nameEnd > lineStart && (*nameEnd == ' ' || *nameEnd == '\t')){
+			nameEnd -- ;
+		}
+		nameEnd[1] = 0;
+		info.name = lineStart; 
+		char *temp ;
+		TUint32 addr = strtoul(hexStr + 2,&temp,16);
+		while(*temp < '0' || *temp > '9' )//[^\d]*
+			temp++ ;
+		char* decStr = temp ;
+		info.size = strtoul(decStr,&temp,10);
+		SKIP_WS(temp);
+		info.section = temp;
+		if(info.section.find("(StubCode)") != string::npos )
+			info.size = 8 ; 
+		if(addr > 0){
+			symbols.insert(pair<TUint32,ArmSymbolInfo>(addr,info));
+		} 
+	}
+	
+	TUint32 textSectAddr = 0x00008000;  // .text gets linked at 0x00008000
+	TUint32 dataSectAddr = 0x00400000 ; // .data gets linked at 0x00400000
+	vector<pair<int,char*> > lines ;	
+	size_t allocBytes;
+	for( ArmSymMap::iterator it = symbols.begin(); it != symbols.end() ; it++){
+		TUint32 thisAddr = it->first ;
+		TUint32 romAddr ;
+		ArmSymbolInfo& info = it->second; 
+		if (thisAddr >= textSectAddr && thisAddr <= (textSectAddr + iPlacedEntry.iTextSize)) {
+				romAddr = thisAddr - textSectAddr + iPlacedEntry.iCodeAddress ;
+		} 
+		else if ( iPlacedEntry.iDataAddress && 
+			( thisAddr >= dataSectAddr && thisAddr <= (dataSectAddr + iPlacedEntry.iTextSize))) {
+			romAddr = thisAddr-dataSectAddr + iPlacedEntry.iDataBssLinearBase;
+		} 
+		else if ( iPlacedEntry.iDataBssLinearBase && 
+			( thisAddr >= dataSectAddr && thisAddr <= (dataSectAddr+ iPlacedEntry.iTotalDataSize))) {
+			romAddr = thisAddr - dataSectAddr + iPlacedEntry.iDataBssLinearBase;
+		} 
+		else { 
+			allocBytes = info.name.length() + 60;
+			char* msg = new char[allocBytes] ;
+			snprintf(msg,allocBytes,"\r\nWarning: Symbol %s @ 0x%08x not in text or data segments\r\n", \
+				info.name.c_str() ,(unsigned int)thisAddr) ; 
+			iStdoutLog.push_back(msg);	
+			allocBytes = lenOfFileName + 80;
+			msg = new char[allocBytes];
+			snprintf(msg,allocBytes,"Warning:  The map file for binary %s is out-of-sync with the binary itself\r\n\r\n",iPlacedEntry.iFileName.c_str());
+			iStdoutLog.push_back(msg);	
+			continue ;
+		}
+		allocBytes =  info.section.length() + info.name.length() + 140;
+		char* outputLine = new char[allocBytes];
+		int len = snprintf(outputLine,allocBytes,"%08x    %04x    %-40s  %s\r\n",(unsigned int)romAddr,info.size,
+			info.name.c_str(),info.section.c_str()); 
+		if((size_t)len > allocBytes) {
+			allocBytes = len + 4 ;
+			delete []outputLine;
+			outputLine = new char[allocBytes];
+			len = snprintf(outputLine,allocBytes,"%08x    %04x    %-40s  %s\r\n",(unsigned int)romAddr,info.size,
+			info.name.c_str(),info.section.c_str()); 
+		}
+		lines.push_back(pair<int,char*>(len,outputLine));
+	 
+	} 
+
+	for (vector<pair<int,char*> >::iterator i = lines.begin() ; i < lines.end(); i ++ ) {
+		char* line = i->second; 
+		iSymbolContentLog.push_back(line);
+		delete[] line;
+	}
+}
+
+template<typename M, typename K,typename V> 
+static void put_to_map(M& m,const K& k, const V& v) {
+	typedef typename M::iterator iterator;
+	iterator it = m.find(k);
+	if(m.end() == it){
+		m.insert(pair<K,V>(k,v));
+	}
+	else { 
+		it->second = v ;
+	}	
+}
+
+void CommenRomSymbolProcessUnit::ProcessGcceOrArm4File(const string& aFile, ifstream& aMap)
+{
+	char* lineStart; 
+	vector<char*> words ;
+	char buffer[MAX_LINE];
+	while(aMap.good() && (!aMap.eof())){
+		aMap.getline(buffer,MAX_LINE);
+		lineStart = buffer ;
+		SKIP_WS(lineStart);
+		if( 0 == strncmp(lineStart,".text",5)) {
+			lineStart += 5;
+			break ;
+		}		
+	}
+	split(lineStart,words);
+	TUint32 codeAddr , codeSize;
+	size_t allocBytes ;
+	if(words.size() != 2 ||
+	KErrNone != Val(codeAddr,words.at(0)) || 
+	KErrNone != Val(codeSize,words.at(1))) {
+		allocBytes = iPlacedEntry.iFileName.length() + 60;
+		char* msg = new char[allocBytes];
+		snprintf(msg,allocBytes,"\nError: Can't get .text section info for \"%s\"\r\n",iPlacedEntry.iFileName.c_str());
+		iStdoutLog.push_back(msg);
+		return;
+	}
+	map<TUint32,string> symbols ;
+	TUint32 stubHex = 0;
+	//Slurp symbols 'til the end of the text section
+	while(aMap.good() && (!aMap.eof())){
+		aMap.getline(buffer,MAX_LINE);
+		lineStart = buffer ;
+		SKIP_WS(lineStart); 
+		if(0 == *lineStart) break ; //blank line marks the end of the text section
+		
+		// .text <addr> <len>  <library(member)>
+		// .text$something
+		//       <addr> <len>  <library(member)>
+		//       <addr> <len>  LONG 0x0
+		// (/^\s(\.text)?\s+(0x\w+)\s+(0x\w+)\s+(.*)$/io)	 
+		if(strncmp(lineStart,".text",5) == 0){
+			lineStart += 5 ;
+			SKIP_WS(lineStart);
+		}
+		char* hex1 = NULL ;
+		char* hex2 = NULL ;
+		char* strAfterhex1 = NULL ;
+		TUint32 addr,size ;
+		if(strncmp(lineStart,"0x",2) == 0){
+			hex1 = lineStart + 2;
+			char* temp ;
+			addr = strtoul(hex1,&temp,16);
+			SKIP_WS(temp);
+			strAfterhex1 = temp ;
+			if(strncmp(temp,"0x",2) == 0){
+				hex2 = temp + 2 ;
+			}
+		}
+		if(NULL != hex2){
+			char* libraryfile ;
+			size = strtoul(hex2,&libraryfile,16);
+			SKIP_WS(libraryfile);  
+			TUint32 key = addr + size ;
+			put_to_map(symbols,key,string(""));//impossible symbol as end marker 
+			make_lower(libraryfile); 
+			// EUSER.LIB(ds01423.o)
+			// EUSER.LIB(C:/TEMP/d1000s_01423.o)
+			size_t len = strlen(libraryfile);
+			char* p1 = strstr(libraryfile,".lib(");
+			if(NULL == p1) 
+				continue ; 
+			p1 += 5;
+			if(strcmp(libraryfile + len - 3,".o)")!= 0)
+				continue ;		 
+			len -= 3 ;
+			libraryfile[len] = 0; 
+			if(EFalse == IsValidNumber(libraryfile + len - 5))
+				continue ;
+			len -= 7 ;
+			if('_' == libraryfile[len])
+				len -- ;
+			if('s' != libraryfile[len])
+				continue ;		 
+			char* p2 = libraryfile + len - 1;
+			while(p2 > p1 ) { 
+				if(*p2 < '0' || *p2 > '9')
+					break ;
+				p2 -- ;
+			}
+			if(*p2 != 'd') 
+				continue ;
+			stubHex = addr ;
+		}
+		else if(NULL != hex1 && NULL != strAfterhex1){ 
+			//#  <addr>  <symbol name possibly including spaces>
+			//(/^\s+(\w+)\s\s+([a-zA-Z_].+)/o) 			 
+			char* symName = strAfterhex1; 
+			if((*symName >= 'A' && *symName <= 'Z') ||
+				(*symName >= 'a' && *symName <= 'z') || *symName == '_') {				 
+				string symbol(symName);
+				if(addr == stubHex) 
+					symbol.insert(0,"stub ");
+			 
+				put_to_map(symbols,addr,symbol);
+				 
+			}			
+		}		
+	}  
+	map<TUint32,string>::iterator it = symbols.begin();
+	TUint32 lastAddr = it->first;
+	string lastSymName = it->second;
+	vector<pair<int,char*> >lines ;
+	it ++ ;
+	while(it != symbols.end()) {		
+		TUint32 addr = it->first ; 
+		unsigned int fixedupAddr = lastAddr - codeAddr + iPlacedEntry.iCodeAddress;
+		TUint size = addr - lastAddr ;
+		if(!lastSymName.empty()) {
+			allocBytes = lastSymName.length() + 40;
+			char* outputLine = new char[allocBytes];
+			int n = snprintf(outputLine,allocBytes,"%08x    %04x    %s\r\n", fixedupAddr,size,lastSymName.c_str()); 
+			lines.push_back(pair<int,char*>(n,outputLine));
+		}		
+		lastAddr = addr ;
+		lastSymName = it->second;
+		it ++ ;
+	}
+	
+	vector<pair<int,char*> >::iterator i; 
+	for ( i = lines.begin() ; i < lines.end(); i ++ ) {
+		char* line = i->second ;
+		iSymbolContentLog.push_back(line);
+		delete []line ;
+	}
+}
+
+void CommenRomSymbolProcessUnit::ProcessX86File(const string& aFile, ifstream& aMap)
+{
+	char buffer[MAX_LINE]; 
+	char* lineStart; 
+	while(aMap.good() && (!aMap.eof())){
+		aMap.getline(buffer,MAX_LINE);
+		lineStart = buffer ;
+		SKIP_WS(lineStart);
+		if( 0 == strncmp(lineStart,"Address",7)) { 
+			break ;
+		}		
+	}
+	aMap.getline(buffer,MAX_LINE);
+	string lastName ;
+	TUint32 lastAddr = 0;
+	size_t allocBytes ;
+	vector<pair<int, char*> >lines ;
+	while(aMap.good() && (!aMap.eof())){
+		aMap.getline(buffer,MAX_LINE);
+		lineStart = buffer ;
+		SKIP_WS(lineStart);
+		if(0 != strncmp(lineStart,"0001:",5))
+			break ;		 
+		char* end ; 
+		TUint32 addr = strtoul(lineStart + 5,&end,16);
+		char* name = end + 1;
+		SKIP_WS(name);
+		end = name + 1;
+		FIND_WS(end);
+		*end = 0 ;
+		if(!lastName.empty()){
+			unsigned int size = addr - lastAddr ; 
+			unsigned int romAddr = lastAddr + iPlacedEntry.iCodeAddress;
+			allocBytes = lastName.length() + 40;
+			char* outputLine = new char[allocBytes];
+			int n = snprintf(outputLine,allocBytes,"%08x    %04x    %s\r\n",romAddr,size,lastName.c_str());
+			lines.push_back(pair<int, char*>(n,outputLine));
+		}		
+	}
+
+	vector<pair<int,char*> >::iterator it; 
+	for ( it = lines.begin() ; it < lines.end(); it ++ ) {
+		char* line = it->second  ;
+		iSymbolContentLog.push_back(line);
+		delete []line ;
+	}	
+	if(!lastName.empty()){
+		allocBytes = lastName.length() + 40 ;
+		char* outputLine = new char[allocBytes];
+		unsigned int romAddr = lastAddr + iPlacedEntry.iCodeAddress;
+		snprintf(outputLine,allocBytes,"%08x    0000    %s\r\n",romAddr,lastName.c_str());
+		iSymbolContentLog.push_back(outputLine);
+		delete []outputLine ;
+	}
+}
+// CommenRomSymbolProcessUnit end
+// CommenRofsSymbolProcessUnit start 
+void CommenRofsSymbolProcessUnit::ProcessExecutableFile(const string& aFile)
+{
+	ResetContentLog();
+	char str[MAX_LINE];
+	string outString;
+	outString = "\nFrom    ";
+	outString += aFile + "\n\n";
+	iSymbolContentLog.push_back(outString);
+	string mapFile2 = aFile+".map";
+	size_t dot = aFile.rfind('.');
+	string mapFile = aFile.substr(0,dot)+".map";
+	ifstream fMap;
+	fMap.open(mapFile2.c_str());
+	if(!fMap.is_open()) {
+		fMap.open(mapFile.c_str());
+	}
+
+	if(!fMap.is_open()) {
+		sprintf(str, "%s\nWarning: Can't open \"%s\" or \"%s\"\n",aFile.c_str(),mapFile2.c_str(),mapFile.c_str());
+		iStdoutLog.push_back(str);
+	    int binSize = GetSizeFromBinFile(aFile);
+	    memset(str,0,sizeof(str));
+	    sprintf(str,"%04x", binSize);
+	    outString = "00000000    ";
+	    outString += str;
+	    outString += "    ";
+	    outString += aFile.substr(aFile.rfind(PATH_SEPARATOR)+1)+"\n";
+	    iSymbolContentLog.push_back(outString);
+	}
+	else {
+		if(!fMap.good()) fMap.clear();
+	    boost::regex regARMV5("ARMV5", boost::regex::icase);
+	    boost::regex regGCCEoARMV4("(GCCE|ARMV4)", boost::regex::icase);
+	    boost::cmatch what;
+	    if(regex_search(aFile, what, regARMV5)) {
+	        ProcessArmv5File(aFile, fMap);
+	    }
+	    else if(regex_search(aFile, what, regGCCEoARMV4)) {
+	        ProcessGcceOrArm4File(aFile, fMap);
+	    }
+	    else {
+	        sprintf(str, "\nWarning: cannot determine linker type used to create %s\n",aFile.c_str());
+	        iStdoutLog.push_back(str);
+	        outString = "00000000    0000    ";
+	        outString += aFile.substr(aFile.rfind(PATH_SEPARATOR)+1)+"\n";
+	        iSymbolContentLog.push_back(outString);
+	        }
+	    }
+}
+void CommenRofsSymbolProcessUnit::ProcessDataFile(const string& aFile)
+{
+	ResetContentLog();
+	string line = "\nFrom    "+aFile+"\n\n00000000    0000    "+aFile.substr(aFile.rfind(PATH_SEPARATOR)+1)+"\n";
+	iSymbolContentLog.push_back(line);
+}
+void CommenRofsSymbolProcessUnit::FlushStdOut(ostream& aOut)
+{
+	for(int i = 0; i < (int) iStdoutLog.size(); i++)
+	{
+		aOut << iStdoutLog[i];
+	}
+}
+void CommenRofsSymbolProcessUnit::FlushSymbolContent(ostream &aOut)
+{
+	for(int i = 0; i < (int) iSymbolContentLog.size(); i++)
+	{
+		aOut << iSymbolContentLog[i];
+	}
+}
+void CommenRofsSymbolProcessUnit::ResetContentLog()
+{
+	iStdoutLog.clear();
+	iSymbolContentLog.clear();
+}
+void CommenRofsSymbolProcessUnit::ProcessArmv5File( const string& fileName, ifstream& aMap ){
+    aMap.seekg (0, ios::beg);
+    char str[MAX_LINE];
+    char outbuffer[MAX_LINE];
+    string outString;
+    aMap.getline(str,MAX_LINE);
+    boost::cmatch what;
+    boost::regex reg("^ARM Linker");
+    if(!regex_search(str, what, reg)) {
+        sprintf(outbuffer, "\nWarning: expecting %s to be generated by ARM linker\n", fileName.c_str());
+        iStdoutLog.push_back(outbuffer);
+        outString = "00000000    0000    "+fileName.substr(fileName.rfind(PATH_SEPARATOR)+1)+"\n";
+        iSymbolContentLog.push_back(outString);
+    }
+    reg.assign("Global Symbols");
+    while(aMap.getline(str,MAX_LINE)) {
+        if(regex_search(str, what, reg)) {
+            break;
+        }
+    }
+
+    reg.assign("^\\s*(.+)\\s*0x(\\S+)\\s+[^\\d]*(\\d+)\\s+(.*)$");
+    string sSym,sTmp,sSection;
+    unsigned int addr,size,baseOffset = 0;
+    map<unsigned int,string> syms;
+    char symString[MAX_LINE];
+    while(aMap.getline(str,MAX_LINE)) {
+        if(regex_search(str, what, reg)) {
+            sSym.assign(what[1].first,what[1].second-what[1].first);
+            sTmp.assign(what[2].first,what[2].second-what[2].first);
+            addr = strtol(sTmp.c_str(), NULL, 16);
+            sTmp.assign(what[3].first,what[3].second-what[3].first);
+            size = strtol(sTmp.c_str(), NULL, 10);
+            sSection.assign(what[4].first,what[4].second-what[4].first);
+            if(sSection.find("(StubCode)") != string::npos)
+                size = 8;
+            if(addr > 0) {
+                memset(symString,0,sizeof(symString));
+                sprintf(symString,"%04x    ",size);
+                outString = symString;
+                outString += sSym+" ";
+                outString += sSection;
+                if(baseOffset == 0)
+                    baseOffset = addr;
+                unsigned int k = addr - baseOffset;
+                if( (syms.find(k) == syms.end()) || size != 0)
+                    syms[k] = outString;
+            }
+            // end of addr>0
+        }
+        // end of regex_search
+    }
+
+    map<unsigned int,string>::iterator it;
+    for(it = syms.begin(); it != syms.end(); it++) {
+        memset(str,0,sizeof(str));
+        sprintf(str,"%08x",it->first);
+        outString = str;
+        outString += "    ";
+        outString += it->second+"\n";
+        iSymbolContentLog.push_back(outString);
+    }
+}
+void CommenRofsSymbolProcessUnit::ProcessGcceOrArm4File( const string& fileName, ifstream& aMap ){
+    aMap.seekg (0, ios_base::beg);
+    char str[MAX_LINE];
+    char outbuffer[MAX_LINE];
+    aMap.getline(str,MAX_LINE);
+    boost::cmatch what;
+    boost::regex reg("^\\.text\\s+");
+    while(aMap.getline(str,MAX_LINE)) {
+        if(regex_search(str, what, reg)) {
+            break;
+        }
+    }
+
+    reg.assign("^\\.text\\s+(\\w+)\\s+\\w+");
+    if(!regex_search(str, what, reg)) {
+        sprintf(outbuffer, "ERROR: Can't get .text section info for \"%s\"\n",fileName.c_str());
+        iStdoutLog.push_back(outbuffer);
+    }
+    else {
+        string sTmp, sLibFile;
+        sTmp.assign(what[1].first,what[1].second-what[1].first);
+        unsigned int imgText = strtol(sTmp.c_str(), NULL, 16);
+
+        reg.assign("^LONG 0x.*", boost::regex::icase);
+        boost::cmatch what1;
+        boost::regex reg1("^\\s(\\.text)?\\s+(0x\\w+)\\s+(0x\\w+)\\s+(.*)$", boost::regex::icase);
+        boost::regex reg2("^\\s+(\\w+)\\s\\s+([a-zA-Z_].+)", boost::regex::icase);
+        boost::regex reg3(".*lib\\(.*d\\d*s_?\\d{5}.o\\)$", boost::regex::icase);
+
+        map<unsigned int,string> syms;
+        unsigned int addr, len, stubhex;
+
+        while(aMap.getline(str,MAX_LINE)) {
+            if(strlen(str) == 0)
+                break;
+            else if(regex_search(str, what, reg1)) {
+                sLibFile.assign(what[4].first,what[4].second-what[4].first);
+                if(!regex_search(sLibFile, what1, reg)) {
+                    sTmp.assign(what[2].first,what[2].second-what[2].first);
+                    addr = strtol(sTmp.c_str(), NULL, 16);
+                    sTmp.assign(what[3].first,what[3].second-what[3].first);
+                    len = strtol(sTmp.c_str(), NULL, 16);
+                    syms[addr+len] = "";
+                    if(regex_search(sLibFile, what, reg3)) {
+                        stubhex = addr;
+                    }
+                }
+            }
+            else if(regex_search(str, what, reg2)) {
+                sTmp.assign(what[1].first,what[1].second-what[1].first);
+                addr = strtol(sTmp.c_str(), NULL, 16);
+                sTmp.assign(what[2].first,what[2].second-what[2].first);
+                syms[addr] = (addr == stubhex)? ("stub "+sTmp) : sTmp;
+            }
+        }
+
+        map<unsigned int,string>::iterator it = syms.begin();
+        map<unsigned int,string>::iterator itp = it++;
+        string outString;
+        for(; it != syms.end(); itp = it++) {
+            if(itp->second != "") {
+                memset(str,0,sizeof(str));
+                sprintf(str,"%08x    %04x    ",(itp->first-imgText), (it->first-itp->first));
+                outString = str;
+                outString += it->second+"\n";
+                iSymbolContentLog.push_back(outString);
+            }
+        }
+    }
+}
+// CommenRofsSymbolProcessUnit end
+int SymbolProcessUnit::GetSizeFromBinFile( const string& fileName ){
+    TInt ret = 0;
+    //char outbuffer[MAX_LINE];
+    ifstream aIf(fileName.c_str(), ios_base::binary);
+    if( !aIf.is_open() ) {
+        printf("Warning: Cannot open file %s\n", fileName.c_str());
+        //iStdoutLog.push_back(outbuffer);
+    }
+    else {
+        E32ImageFile e32Image;
+        TUint32 aSz;
+
+        aIf.seekg(0,ios_base::end);
+        aSz = aIf.tellg();
+
+        e32Image.Adjust(aSz);
+        e32Image.iFileSize = aSz;
+
+        aIf.seekg(0,ios_base::beg);
+        aIf >> e32Image;
+        ret = e32Image.iOrigHdr->iCodeSize;
+    }
+    return ret;
+}
+
+// for BSym
+void BsymRofsSymbolProcessUnit::ProcessEntry(const TPlacedEntry& aEntry)
+{
+	SymbolProcessUnit::ProcessEntry(aEntry);
+	if(aEntry.iFileName == "")
+		return;
+	else if(aEntry.iExecutable)
+		ProcessExecutableFile(aEntry.iFileName);
+	else
+		ProcessDataFile(aEntry.iFileName);
+	iMapFileInfo.iDbgUnitPCEntry.iPCName = aEntry.iFileName;
+	iMapFileInfo.iDbgUnitPCEntry.iDevName = aEntry.iDevFileName;
+}
+
+void BsymRofsSymbolProcessUnit::ProcessExecutableFile(const string& aFile)
+{
+	ResetContentLog();
+	char str[MAX_LINE];
+	string mapFile2 = aFile+".map";
+	size_t dot = aFile.rfind('.');
+	string mapFile = aFile.substr(0,dot)+".map";
+	ifstream fMap;
+	fMap.open(mapFile2.c_str());
+	if(!fMap.is_open()) {
+		fMap.open(mapFile.c_str());
+	}
+
+	if(!fMap.is_open()) {
+		sprintf(str, "%s\nWarning: Can't open \"%s\" or \"%s\"\n",aFile.c_str(),mapFile2.c_str(),mapFile.c_str());
+		iStdoutLog.push_back(str);
+	    int binSize = GetSizeFromBinFile(aFile);
+	    TSymbolPCEntry tmpEntry;
+	    tmpEntry.iSymbolEntry.iAddress = 0;
+	    tmpEntry.iSymbolEntry.iLength = binSize;
+	    tmpEntry.iName = aFile.substr(aFile.rfind(PATH_SEPARATOR)+1);
+	    iMapFileInfo.iSymbolPCEntrySet.push_back(tmpEntry);
+	    iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iDataSymbolCount++;
+	}
+	else {
+		if(!fMap.good()) fMap.clear();
+	    boost::regex regARMV5("ARMV5", boost::regex::icase);
+	    boost::regex regGCCEoARMV4("(GCCE|ARMV4)", boost::regex::icase);
+	    boost::cmatch what;
+	    if(regex_search(aFile, what, regARMV5)) {
+	        ProcessArmv5File(aFile, fMap);
+	    }
+	    else if(regex_search(aFile, what, regGCCEoARMV4)) {
+	        ProcessGcceOrArm4File(aFile, fMap);
+	    }
+	    else {
+	        sprintf(str, "\nWarning: cannot determine linker type used to create %s\n",aFile.c_str());
+	        iStdoutLog.push_back(str);
+	    	TSymbolPCEntry tmpEntry;
+	    	tmpEntry.iSymbolEntry.iAddress = 0;
+	    	tmpEntry.iSymbolEntry.iLength = 0;
+	    	tmpEntry.iName = aFile.substr(aFile.rfind(PATH_SEPARATOR)+1);
+	    	iMapFileInfo.iSymbolPCEntrySet.push_back(tmpEntry);
+	    	iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iDataSymbolCount++;
+	        }
+	    }
+}
+void BsymRofsSymbolProcessUnit::ProcessDataFile(const string& aFile)
+{
+	ResetContentLog();
+	TSymbolPCEntry tmpEntry;
+	tmpEntry.iSymbolEntry.iAddress = 0;
+	tmpEntry.iSymbolEntry.iLength = 0;
+	tmpEntry.iName = aFile.substr(aFile.rfind(PATH_SEPARATOR)+1);
+	iMapFileInfo.iSymbolPCEntrySet.push_back(tmpEntry);
+	iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iDataSymbolCount++;
+}
+void BsymRofsSymbolProcessUnit::FlushStdOut(ostream& aOut)
+{
+	for(int i = 0; i < (int) iStdoutLog.size(); i++)
+	{
+		aOut << iStdoutLog[i];
+	}
+}
+void BsymRofsSymbolProcessUnit::FlushSymbolContent(ostream &aOut)
+{
+	iSymbolGeneratorPtr->AppendMapFileInfo(iMapFileInfo);
+}
+void BsymRofsSymbolProcessUnit::ResetContentLog()
+{
+	iStdoutLog.clear();
+	iMapFileInfo.iDbgUnitPCEntry.iPCName = "";
+	iMapFileInfo.iDbgUnitPCEntry.iDevName = "";
+	iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.Reset();
+	iMapFileInfo.iSymbolPCEntrySet.clear();
+}
+void BsymRofsSymbolProcessUnit::ProcessArmv5File( const string& fileName, ifstream& aMap ){
+    aMap.seekg (0, ios::beg);
+    char str[MAX_LINE];
+    char outbuffer[MAX_LINE];
+    aMap.getline(str,MAX_LINE);
+    boost::cmatch what;
+    boost::regex reg("^ARM Linker");
+    if(!regex_search(str, what, reg)) {
+        sprintf(outbuffer, "\nWarning: expecting %s to be generated by ARM linker\n", fileName.c_str());
+        iStdoutLog.push_back(outbuffer);
+	return;
+    }
+    reg.assign("Global Symbols");
+    boost::regex bss_search("^\\s*\\.bss\\s*0x(\\S+)\\s*.*$");
+    bool hasValue = false;
+    string bssStart;
+    TUint32 bssSection = 0;
+    while(aMap.getline(str,MAX_LINE)) {
+	if(!hasValue && regex_search(str, what, bss_search))
+	{
+	    hasValue = true;
+            bssStart.assign(what[1].first,what[1].second-what[1].first);
+	}
+        if(regex_search(str, what, reg)) {
+            break;
+        }
+    }
+    if(!bssStart.empty())
+    {
+	bssSection = strtol(bssStart.c_str(), NULL, 16);
+    }
+    reg.assign("^\\s*(.+)\\s*0x(\\S+)\\s+[^\\d]*(\\d+)\\s+(.*)$");
+    string sSym,sTmp,sSection,scopeName, symName;
+    boost::regex regScope("^\\s*(\\w+)\\s*::\\s*(.*)$");
+    unsigned int addr,size,baseOffset = 0;
+    map<unsigned int, TSymbolPCEntry> syms;
+    TUint32 dataStart = 0x400000;
+    while(aMap.getline(str,MAX_LINE)) {
+        if(regex_search(str, what, reg)) {
+            sSym.assign(what[1].first,what[1].second-what[1].first);
+            sTmp.assign(what[2].first,what[2].second-what[2].first);
+            addr = strtol(sTmp.c_str(), NULL, 16);
+            sTmp.assign(what[3].first,what[3].second-what[3].first);
+            size = strtol(sTmp.c_str(), NULL, 10);
+            sSection.assign(what[4].first,what[4].second-what[4].first);
+            if(sSection.find("(StubCode)") != string::npos)
+                size = 8;
+            if(addr > 0) {
+                if(baseOffset == 0)
+                    baseOffset = addr;
+                unsigned int k = addr - baseOffset;
+                if( (syms.find(k) == syms.end()) || size != 0)
+                {
+                	TSymbolPCEntry tmpEntry;
+                	if(regex_search(sSym, what, regScope))
+                	{
+                		scopeName.assign(what[1].first, what[1].second-what[1].first);
+                		symName.assign(what[2].first, what[2].second-what[2].first);
+                		tmpEntry.iScopeName = scopeName;
+                		tmpEntry.iName = symName;
+                		tmpEntry.iSecName = sSection;
+                	}
+                	else
+                	{
+                		tmpEntry.iScopeName = "";
+                		tmpEntry.iName = sSym;
+                		tmpEntry.iSecName = sSection;
+                	}
+                	tmpEntry.iSymbolEntry.iAddress = k;
+                	tmpEntry.iSymbolEntry.iLength = size;
+			syms[k]=tmpEntry;
+                }
+
+            }
+            // end of addr>0
+        }
+        // end of regex_search
+    }
+
+    map<unsigned int, TSymbolPCEntry>::iterator it;
+    for(it = syms.begin(); it != syms.end(); it++) {
+	    unsigned int addr = it->first;
+	    if(addr < dataStart)
+	    {
+	        iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iCodeSymbolCount++;
+	    }
+	    else
+	    {
+	        if(bssSection > 0 && addr >= bssSection)
+		{
+		    iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iBssSymbolCount++;
+	        }
+		else
+	        {
+		    iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iDataSymbolCount++;
+	        }
+	    }
+            iMapFileInfo.iSymbolPCEntrySet.push_back(it->second);
+    }
+}
+void BsymRofsSymbolProcessUnit::ProcessGcceOrArm4File( const string& fileName, ifstream& aMap ){
+    aMap.seekg (0, ios_base::beg);
+    char str[MAX_LINE];
+    char outbuffer[MAX_LINE];
+    aMap.getline(str,MAX_LINE);
+    boost::cmatch what;
+    boost::regex reg("^\\.text\\s+");
+    while(aMap.getline(str,MAX_LINE)) {
+        if(regex_search(str, what, reg)) {
+            break;
+        }
+    }
+
+    reg.assign("^\\.text\\s+(\\w+)\\s+\\w+");
+    if(!regex_search(str, what, reg)) {
+        sprintf(outbuffer, "ERROR: Can't get .text section info for \"%s\"\n",fileName.c_str());
+        iStdoutLog.push_back(outbuffer);
+    }
+    else {
+        string sTmp, sLibFile;
+        sTmp.assign(what[1].first,what[1].second-what[1].first);
+        unsigned int imgText = strtol(sTmp.c_str(), NULL, 16);
+
+        reg.assign("^LONG 0x.*", boost::regex::icase);
+        boost::cmatch what1;
+        boost::regex reg1("^\\s(\\.text)?\\s+(0x\\w+)\\s+(0x\\w+)\\s+(.*)$", boost::regex::icase);
+        boost::regex reg2("^\\s+(\\w+)\\s\\s+([a-zA-Z_].+)", boost::regex::icase);
+        boost::regex reg3(".*lib\\(.*d\\d*s_?\\d{5}.o\\)$", boost::regex::icase);
+
+        map<unsigned int,string> syms;
+        unsigned int addr, len, stubhex;
+
+        while(aMap.getline(str,MAX_LINE)) {
+            if(strlen(str) == 0)
+                break;
+            else if(regex_search(str, what, reg1)) {
+                sLibFile.assign(what[4].first,what[4].second-what[4].first);
+                if(!regex_search(sLibFile, what1, reg)) {
+                    sTmp.assign(what[2].first,what[2].second-what[2].first);
+                    addr = strtol(sTmp.c_str(), NULL, 16);
+                    sTmp.assign(what[3].first,what[3].second-what[3].first);
+                    len = strtol(sTmp.c_str(), NULL, 16);
+                    syms[addr+len] = "";
+                    if(regex_search(sLibFile, what, reg3)) {
+                        stubhex = addr;
+                    }
+                }
+            }
+            else if(regex_search(str, what, reg2)) {
+                sTmp.assign(what[1].first,what[1].second-what[1].first);
+                addr = strtol(sTmp.c_str(), NULL, 16);
+                sTmp.assign(what[2].first,what[2].second-what[2].first);
+                syms[addr] = (addr == stubhex)? ("stub "+sTmp) : sTmp;
+            }
+        }
+
+        map<unsigned int,string>::iterator it = syms.begin();
+        map<unsigned int,string>::iterator itp = it++;
+        TSymbolPCEntry tmpSymbolEntry;
+        for(; it != syms.end(); itp = it++) {
+           if(itp->second != "") {
+                tmpSymbolEntry.iSymbolEntry.iAddress = itp->first-imgText;
+                tmpSymbolEntry.iSymbolEntry.iLength = it->first-itp->first;
+                tmpSymbolEntry.iName = it->second;
+		iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iCodeSymbolCount++;
+                iMapFileInfo.iSymbolPCEntrySet.push_back(tmpSymbolEntry);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imglib/symbolutil/symbolprocessunit.h	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef __SYMBOLPROCESSUNIT_H__
+#define __SYMBOLPROCESSUNIT_H__
+#include <vector>
+#include <string>
+#include <iostream>
+#include <fstream>
+
+#include "bsymutil.h"
+
+using namespace std;
+
+struct TPlacedEntry{
+    string iFileName;
+    string iDevFileName;
+    TUint32 iTotalSize;
+    TUint32 iCodeAddress;
+    TUint32 iDataAddress;
+    TUint32 iDataBssLinearBase;
+    TUint32 iTextSize;
+    TUint32 iDataSize;
+    TUint32 iBssSize;
+    TUint32 iTotalDataSize;
+    bool iExecutable;
+    TPlacedEntry(const string& aName, const string& aDevFileName, bool aExecutable) {
+        iFileName = aName;
+	iDevFileName = aDevFileName; 
+        iExecutable = aExecutable;
+    }
+    TPlacedEntry() {
+    }
+};
+
+typedef vector<string> stringlist;
+
+class SymbolProcessUnit
+{
+public:
+	virtual void ProcessExecutableFile(const string& aFile) = 0;
+	virtual void ProcessDataFile(const string& afile) = 0;
+	virtual void FlushStdOut(ostream& aOut) = 0;
+	virtual void FlushSymbolContent(ostream &aOut) = 0;
+	virtual void ResetContentLog() = 0;
+	virtual ~SymbolProcessUnit() {}
+	virtual void ProcessEntry(const TPlacedEntry& aEntry);
+	int GetSizeFromBinFile( const string& fileName );
+};
+
+class CommenRomSymbolProcessUnit : public SymbolProcessUnit
+{
+public:
+	virtual void ProcessExecutableFile(const string& aFile);
+	virtual void ProcessDataFile(const string& afile);
+	virtual void FlushStdOut(ostream& aOut);
+	virtual void FlushSymbolContent(ostream &aOut);
+	virtual void ResetContentLog();
+	virtual void ProcessEntry(const TPlacedEntry& aEntry);
+private:
+	void ProcessArmv5File( const string& fileName, ifstream& aMap );
+	void ProcessGcceOrArm4File( const string& fileName, ifstream& aMap );
+	void ProcessX86File( const string& fileName, ifstream& aMap );
+private:
+	stringlist iStdoutLog;
+	stringlist iSymbolContentLog;
+	TPlacedEntry iPlacedEntry;
+};
+
+class CommenRofsSymbolProcessUnit : public SymbolProcessUnit
+{
+public:
+	virtual void ProcessExecutableFile(const string& aFile);
+	virtual void ProcessDataFile(const string& afile);
+	virtual void FlushStdOut(ostream& aOut);
+	virtual void FlushSymbolContent(ostream &aOut);
+	virtual void ResetContentLog();
+private:
+	void ProcessArmv5File( const string& fileName, ifstream& aMap );
+	void ProcessGcceOrArm4File( const string& fileName, ifstream& aMap );
+private:
+	stringlist iStdoutLog;
+	stringlist iSymbolContentLog;
+};
+
+class SymbolGenerator;
+
+class BsymRofsSymbolProcessUnit : public SymbolProcessUnit
+{
+public:
+	BsymRofsSymbolProcessUnit(SymbolGenerator* aSymbolGeneratorPtr): iSymbolGeneratorPtr(aSymbolGeneratorPtr){}
+	BsymRofsSymbolProcessUnit(){}
+	virtual void ProcessExecutableFile(const string& aFile);
+	virtual void ProcessDataFile(const string& afile);
+	virtual void FlushStdOut(ostream& aOut);
+	virtual void FlushSymbolContent(ostream &aOut);
+	virtual void ResetContentLog();
+	virtual void ProcessEntry(const TPlacedEntry& aEntry);
+private:
+	void ProcessArmv5File( const string& fileName, ifstream& aMap );
+	void ProcessGcceOrArm4File( const string& fileName, ifstream& aMap );
+private:
+	stringlist iStdoutLog;
+	MapFileInfo iMapFileInfo;
+	SymbolGenerator* iSymbolGeneratorPtr;
+};
+#endif
--- a/imgtools/romtools/group/release.txt	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/romtools/group/release.txt	Mon Nov 29 15:37:06 2010 +0800
@@ -1,3 +1,23 @@
+Version 2.19.1 (ROMBUILD)
+===============
+Released by Lorence Wang, 19/11/2010
+	1) ou1cimx1#656196 one line message of ROM tools
+
+Version 2.17.1 (ROFSBUILD)
+===============
+Released by Marvin Shi, 19/11/2010
+	1) ou1cimx1#651819 rofsbiuld fails to generate correct log info when using multi-thread 
+
+Version 2.19.0 (ROMBUILD)
+===============
+Released by Marvin Shi, 17/11/2010
+	1) feature symbol file generation from log file
+
+Version 2.17.0 (ROFSBUILD)
+===============
+Released by Marvin Shi, 17/11/2010
+	1) feature bsym format symbol file generation for rofsbuild
+
 Version 2.16.2 (ROFSBUILD)
 ===============
 Released by Ross Qin, 02/11/2010
--- a/imgtools/romtools/maksym/fixupsym	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/romtools/maksym/fixupsym	Mon Nov 29 15:37:06 2010 +0800
@@ -1,3 +1,9 @@
 #!/bin/sh
-perl -S fixupsym.pl $@
+PRGDIR=`dirname "$0"`
+
+PRGDIR=`cd "$PRGDIR"; pwd`
 
+
+perl "$PRGDIR/fixupsym.pl" $@
+
+
--- a/imgtools/romtools/maksym/hpsym	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/romtools/maksym/hpsym	Mon Nov 29 15:37:06 2010 +0800
@@ -1,3 +1,9 @@
 #!/bin/sh
-perl -S hpsym.pl $@
+PRGDIR=`dirname "$0"`
+
+PRGDIR=`cd "$PRGDIR"; pwd`
 
+
+perl "$PRGDIR/hpsym.pl" $@
+
+
--- a/imgtools/romtools/maksym/maksym	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/romtools/maksym/maksym	Mon Nov 29 15:37:06 2010 +0800
@@ -1,3 +1,9 @@
 #!/bin/sh
-perl -S maksym.pl $@
+PRGDIR=`dirname "$0"`
+
+PRGDIR=`cd "$PRGDIR"; pwd`
 
+
+perl "$PRGDIR/maksym.pl" $@
+
+
--- a/imgtools/romtools/maksym/maksym.pl	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/romtools/maksym/maksym.pl	Mon Nov 29 15:37:06 2010 +0800
@@ -19,6 +19,7 @@
 no strict 'vars';
 use English;
 use FindBin;		# for FindBin::Bin
+use File::Copy;
 
 # Version
 my $MajorVersion = 1;
@@ -47,285 +48,16 @@
 #
 sub main()
 {
-  my $file;
-  my $mapfile;
-  my $mapfile2;
-  my $text;
-  my $data;
-  my $bss;
-  my $textsize;
-  my $datasize;
-  my $bsssize;
-  my $totaldatasize;
-  my $totalsize;
-
-  open (ROM, "<$rombuild")
-    or die "ERROR: Can't open rombuild log file \"$rombuild\"\n";
-  if ($maksym ne "") {
-    open (SYM, ">$maksym")
-      or die "ERROR: Can't open output file \"$maksym\"\n";
-    print "Creating $maksym...\n";
-  }
-
-  while (<ROM>) {
-    # Start of ROM
-    if (/^Creating Rom image (\S*)/) {
-      if ($maksym eq "") {
-	# For backwards compatibility, replace trailing .img with .symbol
-	# if no trailing .img, just append .symbol anyway
-	$maksym = $1;
-	$maksym =~ s/(\.img)?$/.symbol/i;
-	close SYM;
-	open (SYM, ">$maksym")
-	  or die "ERROR: Can't open output file \"$maksym\"\n";
-	print "\nCreating $maksym...\n";
-      }
-      next;
-    }
-    # end of ROM
-    if (/^Writing Rom image/) {
-      close SYM;
-      $maksym = "";
-      next;
-    }
-    # Data file
-    if (/^Reading resource (.*) to rom linear address (.*)/) {
-      $file = $1;
-      my $data = hex($2);
-      $file =~ /([^\\]+)$/;
-      printf SYM "\nFrom    $file\n\n%08x    0000    $1\n", $data;
-    }
-    # Executable file
-    elsif (/^Processing file (.*)/) {
-      $file = $1;
-      $text = 0;
-      $data = 0;
-      $bss = 0;
-      $textsize = 0;
-      $datasize = 0;
-      $bsssize = 0;
-      $totaldatasize = 0;
-
-      # Work out final addresses of sections
-      while (defined($_=<ROM>) && !/^$/) {
-	if (/^Size:\s+(\w+)/) {
-	  $totalsize = hex($1);
-	} elsif (/^Code start addr:\s+(\w+)/) {
-	  $text = hex($1);
-	} elsif (/^Data start addr:\s+(\w+)/) {
-	  $data = hex($1);
-	} elsif (/^DataBssLinearBase:\s+(\w+)/) {
-	  $bss = hex($1);
-	} elsif (/^Text size:\s+(\w+)/) {
-	  $textsize = hex($1);
-	} elsif (/^Data size:\s+(\w+)/) {
-	  $datasize = hex($1);
-	} elsif (/^Bsssize:\s+(\w+)/) {
-	  $bsssize = hex($1);
-	} elsif (/^Total data size:\s+(\w+)/) {
-	  $totaldatasize = hex($1);
-	}
-      }
-
-      # Sanity check - text section can't be zero
-      die "ERROR: Can't find rombuild info for \"$file\"\n"
-	if (!$text);
-
-      print SYM "\nFrom    $file\n\n";
+  my $symbolfile = $rombuild;
+  $symbolfile =~ s/\.log$/\.symbol/i;
+  my @cmdres = `rombuild -loginput=$rombuild`;
+  print "@cmdres\n";
 
-      # Look in map file for symbols in .text and relocate them
-      $mapfile2 = $file.".map";
-      $mapfile = $file;
-      $mapfile =~ s/\.\w+$/\.map/;
-      if (!(open (MAP, "$mapfile2") || open (MAP, "$mapfile"))) {
-	print "$file\nWarning: Can't open \"$mapfile2\" or \"$mapfile\"\n";
-	$file =~ /([^\\]+)$/;
-	printf SYM "%08x    %04x    $1\n", $text, $totalsize;
-      } else {
-	local $/ = undef;
-	my (@maplines) = split(/\n/, <MAP>);
-	close MAP;
-	# See if we're dealing with the RVCT output
-	if ($maplines[0] =~ /^ARM Linker/) {
-	  print "$file\n";
-	 
-		my %syms;
-		my @hasharray;
-		# Starts from begining of map file.		
-		while (@maplines) {
-		  $_ = shift @maplines;
-		  if (/Global Symbols/) {
-		    last;
-		  } elsif (!/(ARM Code|Thumb Code)/) {
-		    next;
-		  }
-		# name address type size section
-		if (/^\s*(.+)\s*(0x\S+)\s+(ARM Code|Thumb Code)\s+[^\d]*(\d+)\s+(.*)$/) {
-			# Check for static methods in local symbols section.
-			my $sym = $1;
-			my $addr = hex($2);
-			my $size = sprintf("%04x",$4);
-			my $section = $5;
-			$size = sprintf("%04x", 8) if ($section =~ /\(StubCode\)/);
-			if(exists($syms{$addr})) {
-				push @{ $syms{$addr} }, "$size    $sym $section";	   
-			}
-			elsif ($addr > 0){
-				@hasharray = "$size    $sym $section";
-				$syms{$addr} = [@hasharray];
-			}
-		}
-		}	
-	
-	  foreach (@maplines) {
-	    # name address ignore size section
-	    if (/^\s*(.+)\s*(0x\S+)\s+[^\d]*(\d+)\s+(.*)$/) {
-	      my $sym = $1;
-	      my $addr = hex($2);
-	      my $size = sprintf("%04x",$3);
-	      my $section = $4;
-	      $size = sprintf("%04x", 8) if ($section =~ /\(StubCode\)/);
-		  if(exists($syms{$addr})) {
-			push @{ $syms{$addr} }, "$size    $sym $section";	   
-		  }
-	      elsif ($addr > 0) {
-			@hasharray = "$size    $sym $section"; 
-			$syms{$addr} = [@hasharray];
-		  }
-	    }
-	  } # end of foreach
-
-	  # .text gets linked at 0x00008000
-	  # .data gets linked at 0x00400000
-	  my $srctext = hex(8000);
-	  my $srcdata = hex(400000);
-	  my $j; 
-	  # Write symbols in address order
-	  my @addrs = sort CompareAddrs keys %syms;
-	  for ($i = 0; $i < @addrs ; $i++) {
-	    my $thisaddr = $addrs[$i];
-	    my $romaddr = 0;
-	    # see if its in the text segment
-		if ($thisaddr >= $srctext && $thisaddr <= ($srctext+$textsize)) {
-	      $romaddr = $thisaddr-$srctext+$text;
-	    } elsif ( $data && ( $thisaddr >= $srcdata && $thisaddr <= ($srcdata+$datasize))) {
-	      # its in the data segment
-	      # is it from .data or .bss
-
-  			# confusingly (?) $bss is the right value to use here
-			# since we're interested in where the data gets copied to
-			# in RAM rather than where it sits in ROM
-		$romaddr = $thisaddr-$srcdata+$bss;
-	      } elsif ( $bss && ( $thisaddr >= $srcdata && $thisaddr <= ($srcdata+$totaldatasize))) {
-				# its BSS
-		$romaddr = $thisaddr-$srcdata+$bss;
-	      } else {
-		my $errsym = $syms{$thisaddr}[0];
-		my $erraddr = sprintf("%08x", $thisaddr);
-		print "WARNING: Symbol $errsym @ $erraddr not in text or data segments\n";
-		print "WARNING: The map file for binary $file is out-of-sync with the binary itself\n\n";
-		next;
-	      }
-
-	    printf SYM "%08x    %s\n", $romaddr, $_ for @{$syms{$addrs[$i]}};
-	  } # end of for.
-        # See if we're dealing with the GCC output
-	} elsif ($maplines[0] =~ /^Archive member included/) {
-	  
-	  my $imgtext;
-	  my $textlen;
-	  my %syms;
-	  my $stubhex=1;
-
-	  # Find text section
-	  while (@maplines) {
-	      $_ = shift @maplines;
-	      last if /^\.text\s+/;
-	  }
-
-	  /^\.text\s+(\w+)\s+(\w+)/
-			or die "ERROR: Can't get .text section info for \"$file\"\n";
-
-		    $imgtext=hex($1);
-		    $textlen=hex($2);
-
-		    print "$file\n";
-
-		# Slurp symbols 'til the end of the text section
-		foreach (@maplines) {
-
-			# blank line marks the end of the text section
-			last if (/^$/);
-
-			# .text <addr> <len>  <library(member)>
-			# .text$something
-			#       <addr> <len>  <library(member)>
-			#       <addr> <len>  LONG 0x0
-
-			if (/^\s(\.text)?\s+(0x\w+)\s+(0x\w+)\s+(.*)$/io) {
-				my $address = hex($2);
-				my $length = hex($3);
-				my $libraryfile = $4;
-				next if ($libraryfile =~ /^LONG 0x/);
-				$syms{$address+$length} = ' ';	# impossible symbol as end marker
-
-				# EUSER.LIB(ds01423.o)
-				# EUSER.LIB(C:/TEMP/d1000s_01423.o)
-				if ($libraryfile =~ /.*lib\(.*d\d*s_?\d{5}.o\)$/io) {
-					$stubhex=$address;
-				}
-				next;
-			}
-
-			#  <addr>  <symbol name possibly including spaces>
-			if (/^\s+(\w+)\s\s+([a-zA-Z_].+)/o) {
-				my $addr = hex($1);
-				my $symbol = $2;
-				$symbol = "stub $symbol" if ($addr == $stubhex);
-				$syms{$addr} = $symbol;
-				next;
-			}
-		}
-
-		# Write symbols in address order
-		@addrs = sort CompareAddrs keys %syms;
-		for ($i = 0; $i < @addrs - 1; $i++) {
-			my $symbol = $syms{$addrs[$i]};
-			next if ($symbol eq ' ');
-			printf SYM "%08x    %04x    %s\n",
-			$addrs[$i]-$imgtext+$text, $addrs[$i+1]-$addrs[$i], $symbol;
-		}
-		# last address assumed to be imgtext+lentext
-
-		close MAP;
-	}
-	# Must be x86 output
-	else {
-		while (@maplines) {
-	      $_ = shift @maplines;
-	      last if /^  Address/;
-		}
-	    shift @maplines;
-	    
-	    my ($lastname, $lastaddr);
-		while (@maplines) {
-	      $_ = shift @maplines;
-	      last unless /^ 0001:(\w+)\s+(\S+)/;
-		  my ($addr, $name) = (hex $1, $2);
-		  if ($lastname) {
-			  my $size = $addr - $lastaddr;
-			  printf SYM "%08x    %04x    %s\n", $lastaddr + $text, $size, $lastname;
-		  }
-		  ($lastname, $lastaddr) = ($name, $addr);
-	    }	    
-	    printf SYM "%08x    %04x    %s\n", $lastaddr + $text, 0, $lastname if $lastname;
-	}
-	
-	    }
-	  }
-	}
-    close SYM;
-    close ROM;
+  if(($maksym ne "") && ($maksym ne $symbolfile))
+  {
+	  copy($symbolfile, $maksym);
+	  unlink $symbolfile;
+  }
 }
 
 #
--- a/imgtools/romtools/maksym/maksymrofs	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/romtools/maksym/maksymrofs	Mon Nov 29 15:37:06 2010 +0800
@@ -1,3 +1,9 @@
 #!/bin/sh
-perl -S maksymrofs.pl $@
+PRGDIR=`dirname "$0"`
+
+PRGDIR=`cd "$PRGDIR"; pwd`
 
+
+perl "$PRGDIR/maksymrofs.pl" $@
+
+
--- a/imgtools/romtools/rofsbuild/inc/logging/loggingexception.hpp	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
-* Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef ROM_TOOLS_ROFSBUILD_LOGGING_LOGGINGEXCEPTION_H_
-#define ROM_TOOLS_ROFSBUILD_LOGGING_LOGGINGEXCEPTION_H_
-
-
-/*
- * @class LoggingException
- */
-class LoggingException
-{
-public:
-	LoggingException(int ErrorCode);
-
-	int GetErrorCode(void);
-
-	const char* GetErrorMessage(void);
-
-	static int RESOURCE_ALLOCATION_FAILURE;
-	static int INVALID_LOG_FILENAME       ;
-
-	virtual ~LoggingException(void);
-protected:
-	int errcode;
-private:
-	LoggingException(void);
-
-	LoggingException& operator = (const LoggingException&);
-};
-
-
-#endif  /* defined ROM_TOOLS_ROFSBUILD_LOGGING_LOGGINGEXCEPTION_H_ */
--- a/imgtools/romtools/rofsbuild/inc/logging/logparser.hpp	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef ROM_TOOLS_ROFSBUILD_LOGGING_LOGPARSER_H_
-#define ROM_TOOLS_ROFSBUILD_LOGGING_LOGPARSER_H_
-
-
-/**
- * @class LogParser
- */
-class LogParser
-{
-public:
-	static LogParser* GetInstance(void) throw (LoggingException);
-
-	void ParseSymbol(const char* LogFilename) throw (LoggingException);
-
-	void Cleanup(void);
-protected:
-	static LogParser* Only;
-private:
-	LogParser(void);
-
-	LogParser(const LogParser&);
-
-	LogParser& operator = (const LogParser&);
-};
-
-
-
-#endif  /* defined ROM_TOOLS_ROFSBUILD_LOGGING_LOGPARSER_H_ */
--- a/imgtools/romtools/rofsbuild/r_build.cpp	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/romtools/rofsbuild/r_build.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -68,6 +68,9 @@
 extern TInt  gLogLevel;
 extern bool gCache;
 extern TBool gIsOBYUTF8;
+
+#define MAX_LINE  65535
+
 TBool gDriveImage=EFalse;	// for drive image support.
 
 
@@ -625,7 +628,7 @@
 			
 			if(offset > 0xFFFF)
 			{
-				printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, offset);
+				printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, (int)offset);
 				throw "fail";
 			}
 			
@@ -640,7 +643,7 @@
 			TUint32 offset = ((((TUint8*) entry) - dirBlockBase) >> 2);
 			if(offset > 0xFFFF)
 			{
-				printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, offset);
+				printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, (int)offset);
 				throw "fail";
 			}
 			
@@ -789,6 +792,18 @@
 		}
 	iNextNodeForSameFile = aPreviousNode;
 	}
+void TRomNode::FlushLogMessages()
+	{
+	if(iEntry)
+		{
+		for(int i = 0; i < (int)iEntry->iLogMessages.size(); i++)
+			{
+			TLogItem& aLogItem = iEntry->iLogMessages[i];
+			Print(aLogItem.iPrintType, aLogItem.iLogMessage.c_str());
+			}
+		iEntry->iLogMessages.clear();
+		}
+	}
 
 
 
@@ -862,13 +877,23 @@
 // Returns the number of bytes used, or -ve error code
 TInt TRomBuilderEntry::PlaceFile( TUint8* &aDest,TUint aMaxSize, CBytePair *aBPE ){
 
-
+	char tmpbuf[MAX_LINE];
+	TLogItem tmpLog;
 	TUint compression = 0;
 	TBool executable = iExecutable;
-	Print(ELog,"Reading file %s to image\n", iFileName );
+	sprintf(tmpbuf,"Reading file %s to image\n", iFileName );
+	tmpLog.iPrintType = ELog;
+	tmpLog.iLogMessage = tmpbuf;
+	iLogMessages.push_back(tmpLog);
+
 	TUint32 size = HFile::GetLength(iFileName);
 	if (size==0)
-		Print(EWarning, "File %s does not exist or is 0 bytes in length.\n",iFileName);
+	{
+		sprintf(tmpbuf, "File %s does not exist or is 0 bytes in length.\n",iFileName);
+		tmpLog.iPrintType = EWarning;
+		tmpLog.iLogMessage = tmpbuf;
+		iLogMessages.push_back(tmpLog);
+	}
 	if (aDest == NULL) {
 		aMaxSize = size << 1;
 		aMaxSize = (aMaxSize>0) ? aMaxSize : 2;
@@ -890,7 +915,10 @@
 		// is it really a valid E32ImageFile?
 		if (r != KErrNone)
 		{
-			Print(EWarning, "File '%s' is not a valid executable.  Placing file as data.\n", iFileName);
+			sprintf(tmpbuf, "File '%s' is not a valid executable.  Placing file as data.\n", iFileName);
+			tmpLog.iPrintType = EWarning;
+			tmpLog.iLogMessage = tmpbuf;
+			iLogMessages.push_back(tmpLog);
 			executable = EFalse;
 		}
 		else
@@ -912,7 +940,10 @@
 				while( aDllEntry ){
 					if(aDllEntry->iOrdinal != (TUint32)-1){
 						if(aDllEntry->iOrdinal < 1 || aDllEntry->iOrdinal > (TUint)f.iOrigHdr->iExportDirCount){
-							Print(EWarning, "Invalid ordinal %d specified for DLL %s\n", aDllEntry->iOrdinal, iRomNode->iName);
+							sprintf(tmpbuf, "Invalid ordinal %d specified for DLL %s\n", (unsigned int) aDllEntry->iOrdinal, iRomNode->iName);
+							tmpLog.iPrintType = EWarning;
+							tmpLog.iLogMessage = tmpbuf;
+							iLogMessages.push_back(tmpLog);
 							aDllEntry = aDllEntry->NextDllDataEntry();
 							continue;
 						}
@@ -931,7 +962,10 @@
 						}
 						else
 						{
-							Print(EWarning, "Patchdata failed as address pointed by ordinal %d of DLL %s doesn't lie within Code or Data section limits\n", aDllEntry->iOrdinal, iRomNode->iName);
+							sprintf(tmpbuf, "Patchdata failed as address pointed by ordinal %d of DLL %s doesn't lie within Code or Data section limits\n", (unsigned int) aDllEntry->iOrdinal, iRomNode->iName);
+							tmpLog.iPrintType = EWarning;
+							tmpLog.iLogMessage = tmpbuf;
+							iLogMessages.push_back(tmpLog);
 						}
 					}
 					else if(aDllEntry->iDataAddress != (TLinAddr)-1){
@@ -948,7 +982,10 @@
 						}
 						else
 						{
-							Print(EWarning, "Patchdata failed as address 0x%x of DLL %s doesn't lie within Code or Data section limits\n", aDllEntry->iOrdinal, iRomNode->iName);
+							sprintf(tmpbuf, "Patchdata failed as address 0x%x of DLL %s doesn't lie within Code or Data section limits\n", (unsigned int) aDllEntry->iOrdinal, iRomNode->iName);
+							tmpLog.iPrintType = EWarning;
+							tmpLog.iLogMessage = tmpbuf;
+							iLogMessages.push_back(tmpLog);
 						}
 					}
 					aDllEntry = aDllEntry->NextDllDataEntry();
@@ -956,7 +993,10 @@
 			}
 
 			compression = f.iHdr->CompressionType();
-			Print(ELog,"Original file:'%s' is compressed by method:%08x\n", iFileName, compression);
+			sprintf(tmpbuf,"Original file:'%s' is compressed by method:%08x\n", iFileName, compression);
+			tmpLog.iPrintType = ELog;
+			tmpLog.iLogMessage = tmpbuf;
+			iLogMessages.push_back(tmpLog);
 
 
 			TUint32 oldFileComp;
@@ -1070,19 +1110,25 @@
 
 				if( newFileComp == 0)
 				{
-					Print(ELog,"Decompressing executable '%s'\n", iFileName);
+					sprintf(tmpbuf,"Decompressing executable '%s'\n", iFileName);
 					f.iHdr->iCompressionType = 0;
+					tmpLog.iPrintType = ELog;
+					tmpLog.iLogMessage = tmpbuf;
+					iLogMessages.push_back(tmpLog);
 				}
 				else
 				{
-					Print(ELog,"Compressing executable '%s' with method:%08x\n", iFileName, newFileComp);
+					sprintf(tmpbuf,"Compressing executable '%s' with method:%08x\n", iFileName, (unsigned int) newFileComp);
+					tmpLog.iPrintType = ELog;
+					tmpLog.iLogMessage = tmpbuf;
+					iLogMessages.push_back(tmpLog);
 					f.iHdr->iCompressionType = newFileComp;
 				}
 				f.UpdateHeaderCrc();
 				if (overflow)
 				{
 					// need to check if the compressed file will fit in the image
-					//TODO the checking will slow down the build process, should do it later along with the writing on aDest.
+					
 					TUint32 compressedSize;
 					char * buffer = new char [size];
 #if defined(__LINUX__)
@@ -1103,8 +1149,14 @@
 			}
 			if (overflow)
 			{
-				Print(EError, "Can't fit '%s' in image\n", iFileName);
-				Print(EError, "Overflowed by approximately 0x%x bytes.\n", size - aMaxSize);
+				sprintf(tmpbuf, "Can't fit '%s' in image\n", iFileName);
+				tmpLog.iPrintType = EError;
+				tmpLog.iLogMessage = tmpbuf;
+				iLogMessages.push_back(tmpLog);
+				sprintf(tmpbuf, "Overflowed by approximately 0x%x bytes.\n", (unsigned int) (size - aMaxSize));
+				tmpLog.iPrintType = EError;
+				tmpLog.iLogMessage = tmpbuf;
+				iLogMessages.push_back(tmpLog);
 				exit(667);
 			}
 
@@ -1124,11 +1176,27 @@
 					compression = atoi(entryref->GetCachedFileCompressionID());
 					memcpy(&iUids[0], aDest, sizeof(iUids));
 					if (compression)
-						Print(ELog,"Compressed executable File '%s' size: %08x, mode:%08x\n", iFileName, size, compression);
+					{
+						sprintf(tmpbuf,"Compressed executable File '%s' size: %08x, mode:%08x\n", iFileName, (unsigned int) size, (unsigned int) compression);
+
+						tmpLog.iPrintType = ELog;
+						tmpLog.iLogMessage = tmpbuf;
+						iLogMessages.push_back(tmpLog);
+					}
 					else if (iExecutable)
-						Print(ELog,"Executable File '%s' size: %08x\n", iFileName, size);
+					{
+						sprintf(tmpbuf,"Executable File '%s' size: %08x\n", iFileName, (unsigned int) size);
+						tmpLog.iPrintType = ELog;
+						tmpLog.iLogMessage = tmpbuf;
+						iLogMessages.push_back(tmpLog);
+					}
 					else
-						Print(ELog,"File '%s' size: %08x\n", iFileName, size);
+					{
+						sprintf(tmpbuf,"File '%s' size: %08x\n", iFileName, (unsigned int) size);
+						tmpLog.iPrintType = ELog;
+						tmpLog.iLogMessage = tmpbuf;
+						iLogMessages.push_back(tmpLog);
+					}
 					iRealFileSize = size;	// required later when directory is written
 
 					return size;
@@ -1183,7 +1251,10 @@
 					}
 					catch (CacheException ce)
 					{
-						Print(EWarning, "Cache brings up an exception (%s) when processes %s\r\n", ce.GetErrorMessage(), iFileName);
+						sprintf(tmpbuf, "Cache brings up an exception (%s) when processes %s\r\n", ce.GetErrorMessage(), iFileName);
+						tmpLog.iPrintType = EWarning;
+						tmpLog.iLogMessage = tmpbuf;
+						iLogMessages.push_back(tmpLog);
 					}
 				}
 			}
@@ -1196,8 +1267,14 @@
 	{
 		if ( size > aMaxSize )
 		{
-			Print(EError, "Can't fit '%s' in image\n", iFileName);
-			Print(EError, "Overflowed by approximately 0x%x bytes.\n", size - aMaxSize);
+			sprintf(tmpbuf, "Can't fit '%s' in image\n", iFileName);
+			tmpLog.iPrintType = EError;
+			tmpLog.iLogMessage = tmpbuf;
+			iLogMessages.push_back(tmpLog);
+			sprintf(tmpbuf, "Overflowed by approximately 0x%x bytes.\n", (unsigned int) (size - aMaxSize));
+			tmpLog.iPrintType = EError;
+			tmpLog.iLogMessage = tmpbuf;
+			iLogMessages.push_back(tmpLog);
 			exit(667);
 		}
 		size = HFile::Read(iFileName, (TAny *)aDest);
@@ -1206,11 +1283,26 @@
 	}
 
 	if (compression)
-		Print(ELog,"Compressed executable File '%s' size: %08x, mode:%08x\n", iFileName, size, compression);
+	{
+		sprintf(tmpbuf,"Compressed executable File '%s' size: %08x, mode:%08x\n", iFileName, (unsigned int) size, (unsigned int) compression);
+		tmpLog.iPrintType = ELog;
+		tmpLog.iLogMessage = tmpbuf;
+		iLogMessages.push_back(tmpLog);
+	}
 	else if (iExecutable)
-		Print(ELog,"Executable File '%s' size: %08x\n", iFileName, size);
+	{
+		sprintf(tmpbuf,"Executable File '%s' size: %08x\n", iFileName, (unsigned int) size);
+		tmpLog.iPrintType = ELog;
+		tmpLog.iLogMessage = tmpbuf;
+		iLogMessages.push_back(tmpLog);
+	}
 	else
-		Print(ELog,"File '%s' size: %08x\n", iFileName, size);
+	{
+		sprintf(tmpbuf,"File '%s' size: %08x\n", iFileName, (unsigned int) size);
+		tmpLog.iPrintType = ELog;
+		tmpLog.iLogMessage = tmpbuf;
+		iLogMessages.push_back(tmpLog);
+	}
 	iCompressEnabled = compression;
 	iRealFileSize = size;	// required later when directory is written
 
@@ -1351,3 +1443,11 @@
 		}
 
 }
+char* TRomBuilderEntry::GetSystemFullName()
+{
+	TBool aIgnoreHiddenAttrib = ETrue;
+	TInt aLen = iRomNode->FullNameLength(aIgnoreHiddenAttrib);
+	char *aBuf = new char[aLen+1];
+	iRomNode->GetFullName(aBuf, aIgnoreHiddenAttrib);
+	return aBuf;
+}
--- a/imgtools/romtools/rofsbuild/r_rofs.cpp	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/romtools/rofsbuild/r_rofs.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -32,6 +32,7 @@
 extern TBool gLowMem;
 extern TInt gThreadNum;
 extern TBool gGenSymbols;
+extern TBool gGenBsymbols;
 ////////////////////////////////////////////////////////////////////////
 
 
@@ -49,8 +50,10 @@
 //
 	: iObey( aObey ), iOverhead(0)
 	{
-	if(gGenSymbols)
+	if(gGenSymbols || gGenBsymbols) {
 		iSymGen = SymbolGenerator::GetInstance();
+		iSymGen->SetImageType(ERofsImage);
+	}
 	else
 		iSymGen = NULL;
 
@@ -263,6 +266,7 @@
 }
 class Worker : public boost::thread {
     public:
+    static boost::mutex iMutexOut;
     static void thrd_func(E32Rofs* rofs){
         CBytePair bpe;
 
@@ -273,7 +277,15 @@
                 p->len = p->node->PlaceFile(p->buf, (TUint32)-1, 0, &bpe);
                 //no symbol for hidden file
                 if(rofs->iSymGen && !p->node->iEntry->iHidden)
-                    rofs->iSymGen->AddFile(p->node->iEntry->iFileName,(p->node->iEntry->iCompressEnabled|| p->node->iEntry->iExecutable));
+		{
+		    char* fullsystemname= p->node->iEntry->GetSystemFullName();
+		    TPlacedEntry tmpEntry(p->node->iEntry->iFileName, fullsystemname, (p->node->iEntry->iCompressEnabled|| p->node->iEntry->iExecutable));
+		    rofs->iSymGen->AddEntry(tmpEntry);
+		    delete[] fullsystemname; 
+		}
+		iMutexOut.lock();
+		p->node->FlushLogMessages();
+		iMutexOut.unlock();
             }
             p = rofs->GetFileNode(deferred);
         }
@@ -288,6 +300,8 @@
     }
 };
 
+boost::mutex Worker::iMutexOut;
+
 TPlacingSection* E32Rofs::GetFileNode(bool &aDeferred) {
 	//get a node from the node list, the node list is protected by mutex iMuxTree.
 	//The iMuxTree also helps to make sure the order in iVPS is consistent with the node list.
--- a/imgtools/romtools/rofsbuild/r_romnode.h	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/romtools/rofsbuild/r_romnode.h	Mon Nov 29 15:37:06 2010 +0800
@@ -21,6 +21,8 @@
 
 #include <fstream>
 #include <e32std.h>
+#include <vector>
+#include <string>
 #include "rofs.h"
 #include "e32image.h"
 #include "h_utl.h"
@@ -123,7 +125,8 @@
 	TInt GetFullName(char* aBuf, TBool aIgnoreHiddenAttrib = EFalse) const;
 	static void InitializeCount();
 	// Accessor Function.
-    inline TRomNode* GetParent() const { return iParent; }
+    	inline TRomNode* GetParent() const { return iParent; }
+	void FlushLogMessages();
 
 private:
 	void Remove(TRomNode* aChild);
@@ -187,6 +190,12 @@
 
 
 class DllDataEntry;
+struct TLogItem
+	{
+		TPrintType iPrintType;
+		std::string iLogMessage;
+	};
+typedef vector<TLogItem> LogVector;
 class TRomBuilderEntry
 	{
 public:
@@ -199,6 +208,7 @@
 	inline TInt RealFileSize() const { return iRealFileSize; };
 	inline void SetRealFileSize(TInt aFileSize) { iRealFileSize=aFileSize;};
 	void DisplaySize(TPrintType aWhere);
+	char* GetSystemFullName();
 	
 private:
 	TRomBuilderEntry();
@@ -217,6 +227,7 @@
 	TUint iCompressEnabled;
 	TUint8 iUids[sizeof(TCheckedUid)];
 	TBool iHidden;
+	LogVector iLogMessages;
   	DllDataEntry* GetFirstDllDataEntry() const;
 	void SetFirstDllDataEntry(DllDataEntry *aDllDataEntry);
 
--- a/imgtools/romtools/rofsbuild/rofsbuild.cpp	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/romtools/rofsbuild/rofsbuild.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -34,8 +34,7 @@
 #include "cache/cachevalidator.hpp"
 #include "cache/cacheablelist.hpp"
 #include "cache/cachemanager.hpp"
-#include "logging/loggingexception.hpp"
-#include "logging/logparser.hpp"
+#include "logparser.h"
 #include <malloc.h>
  
 #ifndef WIN32
@@ -48,7 +47,7 @@
 #endif
 
 static const TInt RofsbuildMajorVersion=2;
-static const TInt RofsbuildMinorVersion=16;
+static const TInt RofsbuildMinorVersion=17;
 static const TInt RofsbuildPatchVersion=3;
 static TBool SizeSummary=EFalse;
 static TPrintType SizeWhere=EAlways;
@@ -61,6 +60,7 @@
 TInt gThreadNum = 0;
 TInt gCPUNum = 0;
 TBool gGenSymbols = EFalse;
+TBool gGenBsymbols = EFalse;
 TInt gCodePagingOverride = -1;
 TInt gDataPagingOverride = -1;
 TInt gLogLevel = 0;	// Information is logged based on logging level.
@@ -101,6 +101,7 @@
 	"        -compress   compress executable files where possible\n"
 	"        -j<digit> do the main job with <digit> threads\n"
 	"        -symbols generate symbol file\n"
+	"        -bsymbols generate binary symbol file\n"
 	"        -compressionmethod none|inflate|bytepair to set the compression\n"
 	"              none     uncompress the image.\n"
 	"              inflate  compress the image.\n"
@@ -165,13 +166,16 @@
 					gSmrFileName.assign(&argv[i][5]);
 				}
 				else {
-					Print (EError, "SMR obey file is missing\n");
+					printf ("ERROR: SMR obey file is missing\n");
 				}
 			} else if (stricmp(argv[i], "-K") == 0) {
 				gKeepGoing = ETrue;
 			}else if (stricmp(argv[i], "-SYMBOLS") == 0) {
 				gGenSymbols = ETrue;
 			}
+			else if (stricmp(argv[i], "-BSYMBOLS") == 0 ) {
+				gGenBsymbols = ETrue;
+			}
 			else if (((argv[i][1] | 0x20) == 's') &&  
 				(((argv[i][2]| 0x20) == 'l')||((argv[i][2] | 0x20) == 's'))) {
 					SizeSummary = ETrue;
@@ -241,7 +245,7 @@
 				if((stricmp(&argv[i][13], "UTF8")==0) || (stricmp(&argv[i][13], "UTF-8")==0))
 					gIsOBYUTF8 = ETrue;
 				else
-					Print(EError, "Invalid encoding %s, default system internal encoding will be used.\n", &argv[i][13]);
+					printf("ERROR: Invalid encoding %s, default system internal encoding will be used.\n", &argv[i][13]);
 			}
 			else if (stricmp(argv[i], "-UNCOMPRESS") == 0) {
 				gCompress = ECompressionUncompress;
@@ -249,7 +253,7 @@
 			else if( stricmp(argv[i], "-COMPRESSIONMETHOD") == 0 ) {
 				// next argument should a be method
 				if( (i+1) >= argc || argv[i+1][0] == '-') {
-					Print (EError, "Missing compression method! Set it to default (no compression)!");
+					printf("ERROR: Missing compression method! Set it to default (no compression)!");
 					gCompressionMethod = 0;
 				}
 				else {
@@ -267,7 +271,7 @@
 						gCompressionMethod = KUidCompressionBytePair;	
 					}
 					else {
-						Print (EError, "Unknown compression method! Set it to default (no compression)!");
+						printf("ERROR: Unknown compression method! Set it to default (no compression)!");
 						gCompress = ECompressionUnknown;
 						gCompressionMethod = 0;		
 					}
@@ -279,7 +283,7 @@
 				gUseCoreImage = ETrue;
 				// next argument should be image filename
 				if ((i+1 >= argc) || argv[i+1][0] == '-')
-					Print (EError, "Missing image file name");
+					printf("ERROR: Missing image file name");
 				else {
 					i++;
 					gImageFilename.assign(argv[i]);
@@ -291,7 +295,7 @@
 					gDriveFilename.assign(&argv[i][11]);	
 				}
 				else {
-					Print (EError, "Drive obey file is missing\n"); 
+					printf("ERROR: Drive obey file is missing\n"); 
 				}
 			}
 			else if (argv[i][1] == '?') {
@@ -303,7 +307,7 @@
 			else if( stricmp(argv[i], "-LOGLEVEL") == 0) {
 				// next argument should a be loglevel
 				if( (i+1) >= argc || argv[i+1][0] == '-') {
-					Print (EError, "Missing loglevel!");
+					printf ("ERROR: Missing loglevel!");
 					gLogLevel = DEFAULT_LOG_LEVEL;
 				}
 				else {
@@ -315,7 +319,7 @@
 					else if (strcmp(argv[i], "0") == 0)
 						gLogLevel = DEFAULT_LOG_LEVEL;
 					else
-						Print(EError, "Only loglevel 0, 1 or 2 is allowed!");
+						printf("ERROR: Only loglevel 0, 1 or 2 is allowed!");
 				}
 			}
 			else if( stricmp(argv[i], "-LOGLEVEL2") == 0)
@@ -334,13 +338,13 @@
 			}
 			else {
 #ifdef WIN32
-				Print (EWarning, "Unrecognised option %s\n",argv[i]);
+				printf ("WARNING: Unrecognised option %s\n",argv[i]);
 #else
 				if(0 == access(argv[i],R_OK)){
 					filename.assign(argv[i]);
 				}
 				else {
-					Print (EWarning, "Unrecognised option %s\n",argv[i]);
+					printf("WARNING: Unrecognised option %s\n",argv[i]);
 				}
 #endif				
 
@@ -353,6 +357,11 @@
 
 	if (paramFileFlag)
 		return;
+	if(gGenSymbols && gGenBsymbols)
+	{
+		printf("WARNING: Options symbols and bsymbols cannot be used at the same time, the common symbols file will be created this time!\n");
+		gGenBsymbols = EFalse;
+	}
 
 	if((gDriveImage == EFalse) && (gSmrImage ==  EFalse) && 
 		(filename.empty() || (gUseCoreImage && gImageFilename.length() == 0)) && (loginput.length() == 0)){
@@ -362,7 +371,7 @@
 				Print (EAlways, ReallyHelpText);
 			}
 			else if (filename.empty()){
-				Print(EAlways, "Obey filename is missing\n");
+				printf("WARNING: Obey filename is missing\n");
 			}
 	}	
 }
@@ -496,11 +505,11 @@
 	processCommandLine(argc, argv);
 	if(gThreadNum == 0) {
 		if(gCPUNum > 0) {
-			printf("WARNING: The number of processors (%d) is used as the number of concurrent jobs.\n", gCPUNum);
-			gThreadNum = gCPUNum;
+			printf("The double number of processors (%d) is used as the number of concurrent jobs.\n", gCPUNum * 2);
+			gThreadNum = gCPUNum * 2;
 		}
 		else {
-			printf("WARNING: Can't automatically get the valid number of concurrent jobs and %d is used.\n", DEFAULT_THREADS);
+			printf("Can't automatically get the valid number of concurrent jobs and %d is used.\n", DEFAULT_THREADS);
 			gThreadNum = DEFAULT_THREADS;
 		}
 	}
@@ -508,7 +517,7 @@
 	{
 		try
 		{
-			LogParser::GetInstance()->ParseSymbol(loginput.c_str());
+			LogParser::GetInstance(ERofsImage)->ParseSymbol(loginput.c_str());
 		}
 		catch(LoggingException le)
 		{
--- a/imgtools/romtools/rofsbuild/rofsbuild.mmp	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/romtools/rofsbuild/rofsbuild.mmp	Mon Nov 29 15:37:06 2010 +0800
@@ -23,15 +23,15 @@
 // rofsbuild
 SOURCEPATH	../rofsbuild
 SOURCE			 r_obey.cpp r_build.cpp r_rofs.cpp r_driveimage.cpp r_driveutl.cpp
-SOURCE			 rofsbuild.cpp r_coreimage.cpp r_smrimage.cpp symbolgenerator.cpp
+SOURCE			 rofsbuild.cpp r_coreimage.cpp r_smrimage.cpp
 SOURCE			 fatcluster.cpp fsnode.cpp fatimagegenerator.cpp
-SOURCE			 symbolprocessunit.cpp
+SOURCEPATH	../../imglib/symbolutil
+SOURCE			 symbolprocessunit.cpp bsymutil.cpp loggingexception.cpp logparser.cpp
+SOURCE                   symbolgenerator.cpp
 SOURCEPATH	../../imglib/host
 SOURCE			h_utl.cpp h_file.cpp h_mem.cpp utf16string.cpp
 SOURCEPATH ../rofsbuild/src/cache
 SOURCE cachemanager.cpp cacheexception.cpp cache.cpp cacheablelist.cpp cachevalidator.cpp cachegenerator.cpp cacheentry.cpp
-SOURCEPATH ../rofsbuild/src/logging
-SOURCE loggingexception.cpp logparser.cpp
 
 // executable compression
 SOURCEPATH	../../imglib/e32uid
@@ -46,7 +46,7 @@
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
-USERINCLUDE   ../../imglib/inc ../../imglib/compress
+USERINCLUDE   ../../imglib/inc ../../imglib/compress ../../imglib/symbolutil
 USERINCLUDE   ../../imglib/patchdataprocessor/include ../../imglib/parameterfileprocessor/include
 USERINCLUDE	  ../../imglib/memmap/include
 USERINCLUDE   ../../imglib/uniconv/include
--- a/imgtools/romtools/rofsbuild/src/logging/loggingexception.cpp	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
-* Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "logging/loggingexception.hpp"
-
-
-int LoggingException::RESOURCE_ALLOCATION_FAILURE = 1;
-int LoggingException::INVALID_LOG_FILENAME        = 2;
-
-
-LoggingException::LoggingException(int ErrorCode)
-{
-	this->errcode = ErrorCode;
-
-	return;
-}
-
-
-int LoggingException::GetErrorCode(void)
-{
-	return this->errcode;
-}
-
-
-const char* LoggingException::GetErrorMessage(void)
-{
-	if(this->errcode == LoggingException::RESOURCE_ALLOCATION_FAILURE)
-		return "Not enough system resources to initialize logging module.";
-	else if(this->errcode == LoggingException::INVALID_LOG_FILENAME)
-		return "Invalid log filename as input.";
-//	else if(this->errcode == CacheException::CACHE_INVALID)
-//		return "Cache is invalid.";
-//	else if(this->errcode == CacheException::CACHE_IS_EMPTY)
-//		return "Cache is empty.";
-//	else if(this->errcode == CacheException::HARDDRIVE_FAILURE)
-//		return "A hard drive failure occurred in Cache operations.";
-
-	return "Undefined error type.";
-}
-
-
-LoggingException::~LoggingException(void)
-{
-	return;
-}
--- a/imgtools/romtools/rofsbuild/src/logging/logparser.cpp	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
-* Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#include <new>
-#include <iostream>
-#include <fstream>
-#include <string>
-using namespace std;
-
-#include "logging/loggingexception.hpp"
-#include "logging/logparser.hpp"
-#include "symbolgenerator.h"
-
-
-LogParser* LogParser::Only = (LogParser*)0;
-
-
-LogParser* LogParser::GetInstance(void) throw (LoggingException)
-{
-	if(! LogParser::Only)
-	{
-		LogParser::Only = new (std::nothrow) LogParser();
-		if(! LogParser::Only)
-			throw LoggingException(LoggingException::RESOURCE_ALLOCATION_FAILURE);
-	}
-
-	return LogParser::Only;
-}
-
-
-void LogParser::ParseSymbol(const char* LogFilename) throw (LoggingException)
-{
-	string linebuf;
-	SymbolGenerator* symgen = SymbolGenerator::GetInstance();
-	symgen->SetSymbolFileName(string(LogFilename));
-
-	ifstream logfd(LogFilename);
-	if(logfd.is_open())
-	{
-		while(! logfd.eof())
-		{
-			getline(logfd, linebuf);
-			if(linebuf.compare(0,4,"File") == 0)
-			{
-				if(linebuf.find("size:", 4) != string::npos)
-				{
-					size_t startpos = linebuf.find('\'') ;
-					size_t endpos   = linebuf.rfind('\'');
-					if((startpos!=string::npos) && (endpos!=string::npos))
-					{
-						symgen->AddFile(linebuf.substr(startpos+1,endpos-startpos-1), false);
-					}
-				}
-			}
-			else if(linebuf.compare(0,26,"Compressed executable File") == 0)
-			{
-				if(linebuf.find("size:", 26) != string::npos)
-				{
-					size_t startpos = linebuf.find('\'') ;
-					size_t endpos   = linebuf.rfind('\'');
-					if((startpos!=string::npos) && (endpos!=string::npos))
-					{
-						symgen->AddFile(linebuf.substr(startpos+1,endpos-startpos-1), true);
-					}
-				}
-			}
-		}
-		symgen->SetFinished();
-		symgen->Release();
-	}
-	else
-	{
-		throw LoggingException(LoggingException::INVALID_LOG_FILENAME);
-	}
-
-	return;
-}
-
-
-void LogParser::Cleanup(void)
-{
-	return;
-}
-
-
-LogParser::LogParser(void)
-{
-	return;
-}
--- a/imgtools/romtools/rofsbuild/symbolgenerator.cpp	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-#include <vector>
-#include <boost/regex.hpp>
-#define MAX_LINE 65535
-#include "symbolgenerator.h"
-#include "e32image.h"
-
-#if defined(__LINUX__)
-#define PATH_SEPARATOR '/'
-#else
-#define PATH_SEPARATOR '\\'
-#endif
-extern TInt gThreadNum;
-
-boost::mutex SymbolGenerator::iMutexSingleton;
-SymbolGenerator* SymbolGenerator::iInst = NULL;
-SymbolGenerator* SymbolGenerator::GetInstance(){
-    iMutexSingleton.lock();
-    if(iInst == NULL) {
-        iInst = new SymbolGenerator();
-    }
-    iMutexSingleton.unlock();
-    return iInst;
-}
-void SymbolGenerator::Release() {
-    if(iInst != NULL) {
-        iInst->join();
-    }
-    iMutexSingleton.lock();
-    if(iInst != NULL) {
-        delete iInst;
-        iInst = NULL;
-    }
-    iMutexSingleton.unlock();
-}
-void SymbolGenerator::SetSymbolFileName( const string& fileName ){
-    if(iSymFile.is_open())
-        iSymFile.close();
-    string s = fileName.substr(0,fileName.rfind('.'))+".symbol";
-    printf("* Writing %s - ROFS symbol file\n", s.c_str());
-    iSymFile.open(s.c_str());
-}
-void SymbolGenerator::AddFile( const string& fileName, bool isExecutable ){
-    iMutex.lock();
-    iQueueFiles.push(TPlacedEntry(fileName,isExecutable));
-    iMutex.unlock();
-    iCond.notify_all();
-}
-void SymbolGenerator::SetFinished() 
-{ 
-
-	iFinished = true; 
-	iCond.notify_all();
-    }
-TPlacedEntry SymbolGenerator::GetNextPlacedEntry()
-{
-	TPlacedEntry pe("", false);
-	if(1)
-	{
-		boost::mutex::scoped_lock lock(iMutex);
-		while(!iFinished && iQueueFiles.empty())
-			iCond.wait(lock);
-		if(!iQueueFiles.empty())
-		{
-			pe = iQueueFiles.front();
-			iQueueFiles.pop();
-        }
-    }
-	return pe;
-}
-void SymbolGenerator::thrd_func(){
-    	boost::thread_group threads;
-	SymbolWorker worker;
-    	for(int i=0; i < gThreadNum; i++)
-    	{
-    		threads.create_thread(worker);
-    }
-    	threads.join_all();
-        }
-SymbolGenerator::SymbolGenerator() : boost::thread(thrd_func),iFinished(false) {
-    }
-SymbolGenerator::~SymbolGenerator(){
-    if(joinable())
-        join();
-    iSymFile.flush();
-    iSymFile.close();
-            }
-SymbolWorker::SymbolWorker()
-{
-        // end of regex_search
-    }
-SymbolWorker::~SymbolWorker()
-{
-    }
-void SymbolWorker::operator()()
-{
-	SymbolProcessUnit* aSymbolProcessUnit = new CommenSymbolProcessUnit();
-	SymbolGenerator* symbolgenerator = SymbolGenerator::GetInstance();
-
-	while(1)
-	{
-		if(symbolgenerator->HasFinished() && symbolgenerator->IsEmpty())
-		{
-
-                break;
-                    }
-
-
-
-
-		TPlacedEntry pe = symbolgenerator->GetNextPlacedEntry();
-
-            //scope the code block with if(1) for lock
-            /*
-            if(me->iQueueFiles.empty()) {
-                boost::this_thread::sleep(boost::posix_time::milliseconds(10));
-                continue;
-            }
-            */
-
-
-        if(pe.iFileName == "")
-			continue;
-        else if(pe.iExecutable) 
-			aSymbolProcessUnit->ProcessExecutableFile(pe.iFileName);
-        else
-			aSymbolProcessUnit->ProcessDataFile(pe.iFileName);
-		symbolgenerator->LockOutput();
-		aSymbolProcessUnit->FlushStdOut(cout);
-		aSymbolProcessUnit->FlushSymbolContent(symbolgenerator->GetOutputFileStream());
-		symbolgenerator->UnlockOutput();
-}
-	delete aSymbolProcessUnit;
-}
--- a/imgtools/romtools/rofsbuild/symbolgenerator.h	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-#ifndef __SYMBOLGENERATOR_H__
-#define __SYMBOLGENERATOR_H__
-#include <queue>
-#include <string>
-#include <fstream>
-using namespace std;
-#include <boost/thread/thread.hpp>
-#include <boost/thread/condition.hpp>
-#include "symbolprocessunit.h"
-
-
-struct TPlacedEntry{
-    string iFileName;
-    bool iExecutable;
-    TPlacedEntry(const string& aName, bool aExecutable) {
-        iFileName = aName;
-        iExecutable = aExecutable;
-    }
-};
-class SymbolGenerator : public boost::thread {
-    public:
-        static SymbolGenerator* GetInstance();
-        static void Release();
-        void SetSymbolFileName( const string& fileName );
-        void AddFile( const string& fileName, bool isExecutable );
-        bool HasFinished()	{ return iFinished; }
-        void SetFinished();
-        bool IsEmpty() { return iQueueFiles.empty(); }
-        void LockOutput() { iOutputMutex.lock(); }
-        void UnlockOutput() { iOutputMutex.unlock(); }
-        TPlacedEntry GetNextPlacedEntry();
-        ofstream& GetOutputFileStream() { return iSymFile; };
-    private:
-        SymbolGenerator();
-        ~SymbolGenerator();
-        static void thrd_func();
-
-        queue<TPlacedEntry> iQueueFiles;
-        boost::mutex iMutex;
-        boost::mutex iOutputMutex;
-        static boost::mutex iMutexSingleton;
-        static SymbolGenerator* iInst;
-        boost::condition_variable iCond;
-        bool iFinished;
-
-        ofstream iSymFile;
-};
-class SymbolWorker{
-public:
-	SymbolWorker();
-	~SymbolWorker();
-	void operator()();
-private:
-};
-#endif
--- a/imgtools/romtools/rofsbuild/symbolprocessunit.cpp	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,258 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-#include <boost/regex.hpp>
-#include "symbolprocessunit.h"
-#include "e32image.h"
-#define MAX_LINE 65535
-
-#if defined(__LINUX__)
-#define PATH_SEPARATOR '/'
-#else
-#define PATH_SEPARATOR '\\'
-#endif
-
-void CommenSymbolProcessUnit::ProcessExecutableFile(const string& aFile)
-{
-	ResetContentLog();
-	char str[MAX_LINE];
-	string outString;
-	outString = "\nFrom    ";
-	outString += aFile + "\n\n";
-	iSymbolContentLog.push_back(outString);
-	string mapFile2 = aFile+".map";
-	size_t dot = aFile.rfind('.');
-	string mapFile = aFile.substr(0,dot)+".map";
-	ifstream fMap;
-	fMap.open(mapFile2.c_str());
-	if(!fMap.is_open()) {
-		fMap.open(mapFile.c_str());
-	}
-
-	if(!fMap.is_open()) {
-		sprintf(str, "%s\nWarning: Can't open \"%s\" or \"%s\"\n",aFile.c_str(),mapFile2.c_str(),mapFile.c_str());
-		iStdoutLog.push_back(str);
-	    int binSize = GetSizeFromBinFile(aFile);
-	    memset(str,0,sizeof(str));
-	    sprintf(str,"%04x", binSize);
-	    outString = "00000000    ";
-	    outString += str;
-	    outString += "    ";
-	    outString += aFile.substr(aFile.rfind(PATH_SEPARATOR)+1)+"\n";
-	    iSymbolContentLog.push_back(outString);
-	}
-	else {
-		if(!fMap.good()) fMap.clear();
-	    boost::regex regARMV5("ARMV5", boost::regex::icase);
-	    boost::regex regGCCEoARMV4("(GCCE|ARMV4)", boost::regex::icase);
-	    boost::cmatch what;
-	    if(regex_search(aFile, what, regARMV5)) {
-	        ProcessArmv5File(aFile, fMap);
-	    }
-	    else if(regex_search(aFile, what, regGCCEoARMV4)) {
-	        ProcessGcceOrArm4File(aFile, fMap);
-	    }
-	    else {
-	        sprintf(str, "\nWarning: cannot determine linker type used to create %s\n",aFile.c_str());
-	        iStdoutLog.push_back(str);
-	        outString = "00000000    0000    ";
-	        outString += aFile.substr(aFile.rfind(PATH_SEPARATOR)+1)+"\n";
-	        iSymbolContentLog.push_back(outString);
-	        }
-	    }
-}
-void CommenSymbolProcessUnit::ProcessDataFile(const string& aFile)
-{
-	ResetContentLog();
-	string line = "\nFrom    "+aFile+"\n\n00000000    0000    "+aFile.substr(aFile.rfind(PATH_SEPARATOR)+1)+"\n";
-	iSymbolContentLog.push_back(line);
-}
-void CommenSymbolProcessUnit::FlushStdOut(ostream& aOut)
-{
-	for(int i = 0; i < (int) iStdoutLog.size(); i++)
-	{
-		aOut << iStdoutLog[i];
-	}
-}
-void CommenSymbolProcessUnit::FlushSymbolContent(ostream &aOut)
-{
-	for(int i = 0; i < (int) iSymbolContentLog.size(); i++)
-	{
-		aOut << iSymbolContentLog[i];
-	}
-}
-void CommenSymbolProcessUnit::ResetContentLog()
-{
-	iStdoutLog.clear();
-	iSymbolContentLog.clear();
-}
-void CommenSymbolProcessUnit::ProcessArmv5File( const string& fileName, ifstream& aMap ){
-    aMap.seekg (0, ios::beg);
-    char str[MAX_LINE];
-    char outbuffer[MAX_LINE];
-    string outString;
-    aMap.getline(str,MAX_LINE);
-    boost::cmatch what;
-    boost::regex reg("^ARM Linker");
-    if(!regex_search(str, what, reg)) {
-        sprintf(outbuffer, "\nWarning: expecting %s to be generated by ARM linker\n", fileName.c_str());
-        iStdoutLog.push_back(outbuffer);
-        outString = "00000000    0000    "+fileName.substr(fileName.rfind(PATH_SEPARATOR)+1)+"\n";
-        iSymbolContentLog.push_back(outString);
-    }
-    reg.assign("Global Symbols");
-    while(aMap.getline(str,MAX_LINE)) {
-        if(regex_search(str, what, reg)) {
-            break;
-        }
-    }
-
-    reg.assign("^\\s*(.+)\\s*0x(\\S+)\\s+[^\\d]*(\\d+)\\s+(.*)$");
-    string sSym,sTmp,sSection;
-    unsigned int addr,size,baseOffset = 0;
-    map<unsigned int,string> syms;
-    char symString[MAX_LINE];
-    while(aMap.getline(str,MAX_LINE)) {
-        if(regex_search(str, what, reg)) {
-            sSym.assign(what[1].first,what[1].second-what[1].first);
-            sTmp.assign(what[2].first,what[2].second-what[2].first);
-            addr = strtol(sTmp.c_str(), NULL, 16);
-            sTmp.assign(what[3].first,what[3].second-what[3].first);
-            size = strtol(sTmp.c_str(), NULL, 10);
-            sSection.assign(what[4].first,what[4].second-what[4].first);
-            if(sSection.find("(StubCode)") != string::npos)
-                size = 8;
-            if(addr > 0) {
-                memset(symString,0,sizeof(symString));
-                sprintf(symString,"%04x    ",size);
-                outString = symString;
-                outString += sSym+" ";
-                outString += sSection;
-                if(baseOffset == 0)
-                    baseOffset = addr;
-                unsigned int k = addr - baseOffset;
-                if( (syms.find(k) == syms.end()) || size != 0)
-                    syms[k] = outString;
-            }
-            // end of addr>0
-        }
-        // end of regex_search
-    }
-
-    map<unsigned int,string>::iterator it;
-    for(it = syms.begin(); it != syms.end(); it++) {
-        memset(str,0,sizeof(str));
-        sprintf(str,"%08x",it->first);
-        outString = str;
-        outString += "    ";
-        outString += it->second+"\n";
-        iSymbolContentLog.push_back(outString);
-    }
-}
-void CommenSymbolProcessUnit::ProcessGcceOrArm4File( const string& fileName, ifstream& aMap ){
-    aMap.seekg (0, ios_base::beg);
-    char str[MAX_LINE];
-    char outbuffer[MAX_LINE];
-    aMap.getline(str,MAX_LINE);
-    boost::cmatch what;
-    boost::regex reg("^\\.text\\s+");
-    while(aMap.getline(str,MAX_LINE)) {
-        if(regex_search(str, what, reg)) {
-            break;
-        }
-    }
-
-    reg.assign("^\\.text\\s+(\\w+)\\s+\\w+");
-    if(!regex_search(str, what, reg)) {
-        sprintf(outbuffer, "ERROR: Can't get .text section info for \"%s\"\n",fileName.c_str());
-        iStdoutLog.push_back(outbuffer);
-    }
-    else {
-        string sTmp, sLibFile;
-        sTmp.assign(what[1].first,what[1].second-what[1].first);
-        unsigned int imgText = strtol(sTmp.c_str(), NULL, 16);
-
-        reg.assign("^LONG 0x.*", boost::regex::icase);
-        boost::cmatch what1;
-        boost::regex reg1("^\\s(\\.text)?\\s+(0x\\w+)\\s+(0x\\w+)\\s+(.*)$", boost::regex::icase);
-        boost::regex reg2("^\\s+(\\w+)\\s\\s+([a-zA-Z_].+)", boost::regex::icase);
-        boost::regex reg3(".*lib\\(.*d\\d*s_?\\d{5}.o\\)$", boost::regex::icase);
-
-        map<unsigned int,string> syms;
-        unsigned int addr, len, stubhex;
-
-        while(aMap.getline(str,MAX_LINE)) {
-            if(strlen(str) == 0)
-                break;
-            else if(regex_search(str, what, reg1)) {
-                sLibFile.assign(what[4].first,what[4].second-what[4].first);
-                if(!regex_search(sLibFile, what1, reg)) {
-                    sTmp.assign(what[2].first,what[2].second-what[2].first);
-                    addr = strtol(sTmp.c_str(), NULL, 16);
-                    sTmp.assign(what[3].first,what[3].second-what[3].first);
-                    len = strtol(sTmp.c_str(), NULL, 16);
-                    syms[addr+len] = "";
-                    if(regex_search(sLibFile, what, reg3)) {
-                        stubhex = addr;
-                    }
-                }
-            }
-            else if(regex_search(str, what, reg2)) {
-                sTmp.assign(what[1].first,what[1].second-what[1].first);
-                addr = strtol(sTmp.c_str(), NULL, 16);
-                sTmp.assign(what[2].first,what[2].second-what[2].first);
-                syms[addr] = (addr == stubhex)? ("stub "+sTmp) : sTmp;
-            }
-        }
-
-        map<unsigned int,string>::iterator it = syms.begin();
-        map<unsigned int,string>::iterator itp = it++;
-        string outString;
-        for(; it != syms.end(); itp = it++) {
-            if(itp->second != "") {
-                memset(str,0,sizeof(str));
-                sprintf(str,"%08x    %04x    ",(itp->first-imgText), (it->first-itp->first));
-                outString = str;
-                outString += it->second+"\n";
-                iSymbolContentLog.push_back(outString);
-            }
-        }
-    }
-}
-int CommenSymbolProcessUnit::GetSizeFromBinFile( const string& fileName ){
-    TInt ret = 0;
-    char outbuffer[MAX_LINE];
-    ifstream aIf(fileName.c_str(), ios_base::binary);
-    if( !aIf.is_open() ) {
-        printf(outbuffer, "Warning: Cannot open file \n");
-        iStdoutLog.push_back(outbuffer);
-    }
-    else {
-        E32ImageFile e32Image;
-        TUint32 aSz;
-
-        aIf.seekg(0,ios_base::end);
-        aSz = aIf.tellg();
-
-        e32Image.Adjust(aSz);
-        e32Image.iFileSize = aSz;
-
-        aIf.seekg(0,ios_base::beg);
-        aIf >> e32Image;
-        ret = e32Image.iOrigHdr->iCodeSize;
-    }
-    return ret;
-}
--- a/imgtools/romtools/rofsbuild/symbolprocessunit.h	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-#ifndef __SYMBOLPROCESSUNIT_H__
-#define __SYMBOLPROCESSUNIT_H__
-#include <vector>
-#include <string>
-#include <iostream>
-#include <fstream>
-using namespace std;
-
-
-typedef vector<string> stringlist;
-
-class SymbolProcessUnit
-{
-public:
-	virtual void ProcessExecutableFile(const string& aFile) = 0;
-	virtual void ProcessDataFile(const string& afile) = 0;
-	virtual void FlushStdOut(ostream& aOut) = 0;
-	virtual void FlushSymbolContent(ostream &aOut) = 0;
-	virtual void ResetContentLog() = 0;
-	virtual ~SymbolProcessUnit() {}
-};
-
-class CommenSymbolProcessUnit : public SymbolProcessUnit
-{
-public:
-	virtual void ProcessExecutableFile(const string& aFile);
-	virtual void ProcessDataFile(const string& afile);
-	virtual void FlushStdOut(ostream& aOut);
-	virtual void FlushSymbolContent(ostream &aOut);
-	virtual void ResetContentLog();
-private:
-	void ProcessArmv5File( const string& fileName, ifstream& aMap );
-	void ProcessGcceOrArm4File( const string& fileName, ifstream& aMap );
-	int GetSizeFromBinFile( const string& fileName );
-private:
-	stringlist iStdoutLog;
-	stringlist iSymbolContentLog;
-};
-#endif
--- a/imgtools/romtools/rombuild/r_build.cpp	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/romtools/rombuild/r_build.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -1509,7 +1509,7 @@
 		}
 		// prevent the situiation which importer is primary, variant or extension, exporter is device
 		if (is_kernel && !Device() && romnode->iRomFile->iRbEntry->Device())	 {
-			Print(EWarning, "Kernel/variant/extension\n\t%s\nlinks to non-extension LDD/PDD\n\t%s\n",
+			Print(EWarning, "Kernel/variant/extension \"%s\"  links to non-extension LDD/PDD  \"%s\"\n",
 				(const char*)TModuleName(this), (const char*)TModuleName(find_info));
 		}
 		if (romnode->ABI() != my_abi) {
--- a/imgtools/romtools/rombuild/r_mromimage.h	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/romtools/rombuild/r_mromimage.h	Mon Nov 29 15:37:06 2010 +0800
@@ -44,9 +44,7 @@
 	virtual TUint32 DataRunAddress() const = 0 ;
 	virtual TUint32 RomAlign() const = 0 ;
  
-#ifdef __LINUX__
 	virtual ~MRomImage() { };
-#endif
 };
 
 #endif //__R_MROMIMAGE_H__
--- a/imgtools/romtools/rombuild/r_rom.cpp	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/romtools/rombuild/r_rom.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -399,7 +399,7 @@
 
 E32Rom::~E32Rom() {
 	if(iSymGen){		
-		delete iSymGen;
+		SymbolGenerator::Release();
 		iSymGen = NULL ;
 	}
 	if(gLowMem)
@@ -699,8 +699,6 @@
 	if (r!=KErrNone)
 		{
 		Print(EError, "LoadContents failed - return code %d\n", r);
-		if(iSymGen)
-			iSymGen->WaitThreads();
 		return r;
 		}
 	iExtensionRomHeader->iRomRootDirectoryList = dummy.iRomRootDirectoryList;
@@ -708,8 +706,6 @@
 	iLoaderHeader->SetUp(iObey);
 	FinaliseExtensionHeader(aKernelRom);
 	DisplayExtensionHeader();
-	if(iSymGen)
-		iSymGen->WaitThreads();
 	return KErrNone;
 	}
 	
@@ -740,8 +736,6 @@
 	if (r!=KErrNone)
 		{
 		Print(EError, "LoadContents failed - return code %d\n", r);
-		if(iSymGen)
-			iSymGen->WaitThreads();
 		return r;
 		}
 
@@ -749,16 +743,12 @@
 	if(r!=KErrNone)
 		{
 		Print(EError, "Setup pages information failed - return code %d\n", r);
-		if(iSymGen)
-			iSymGen->WaitThreads();
 		return r;
 		}
 	
 	r = CheckUnpagedMemSize(); // check for unpaged memory overflow
 	if(r!=KErrNone)
 	{
-		if(iSymGen)
-			iSymGen->WaitThreads();
 		return r;
 	}
 	
@@ -766,8 +756,6 @@
 	if(r!=KErrNone)
 		{
 		Print(EError, "CompressPages failed - return code %d\n", r);
-		if(iSymGen)
-			iSymGen->WaitThreads();
 		return r;
 		}
 
@@ -795,8 +783,6 @@
 	TUint testCheckSum = HMem::CheckSum((TUint *)iHeader, iHeader->iRomSize);
 	Print(ELog, "Rom 32bit words sum to   %08x\n", testCheckSum);
 	if (testCheckSum != iObey->iCheckSum){
-		if(iSymGen)
-			iSymGen->WaitThreads();
 		return Print(EError, "Rom checksum is incorrect: %08x should be %08x\n",
 					testCheckSum, iObey->iCheckSum);
 	}
@@ -836,8 +822,6 @@
 					}
 			}
 		}
-	if(iSymGen)
-			iSymGen->WaitThreads();
 	return KErrNone;
 	}
 
@@ -1325,9 +1309,9 @@
 	TInt fileCount=0;
 	if(gGenSymbols && !iSymGen) {
 		string filename(iObey->GetFileName());
-		filename.erase(filename.length() - 3,3);
-		filename.append("symbol");
-		iSymGen = new SymbolGenerator(filename.c_str(),gThreadNum - 1);		
+		iSymGen = SymbolGenerator::GetInstance();
+		iSymGen ->SetImageType(ERomImage);
+		iSymGen ->SetSymbolFileName(filename);		
 	}
 		
 	//
@@ -1399,9 +1383,7 @@
 	mainptr->Extend(offset);
 	iOverhead +=offset;
 	if(iSymGen){
-		SymGenContext context ;
-		memset(&context,0,sizeof(SymGenContext));
-		iSymGen->AddEntry(context);
+		iSymGen->SetFinished();
 	}
 	return (char*)mainptr->iImagePtr;
  	}
@@ -1454,8 +1436,7 @@
 			return;		// first section has overflowed
 		current->FixupRomEntries(size);
 		if(iSymGen) {
-			SymGenContext context ;
-			memset(&context,0,sizeof(SymGenContext));
+			TPlacedEntry context ;
 			context.iFileName = current->iFileName ;
 			context.iDataAddress = savedAddr ;
 			iSymGen->AddEntry(context); 
@@ -1470,8 +1451,7 @@
 		iHeader->iHcrFileAddress =  current->iHeaderRange.iImageAddr ;
 		TRACE(TAREA, Print(ELog, "iHeader->iHcrFileAddress = %08x\n", iHeader->iHcrFileAddress));	
 		if(iSymGen) {
-			SymGenContext context ;
-			memset(&context,0,sizeof(SymGenContext));
+			TPlacedEntry context ;
 			context.iFileName = current->iFileName ;
 			context.iDataAddress = savedAddr ;
 			iSymGen->AddEntry(context); 
@@ -1535,7 +1515,7 @@
 	LoadFileToRom(current);
 	TRomImageHeader *header = current->iRomImageHeader;
 	if(iSymGen){
-		SymGenContext context  ;
+		TPlacedEntry context  ;
 		context.iFileName = current->iFileName ;		
 		context.iTotalSize = section1size;
 		context.iCodeAddress = header->iCodeAddress; 
--- a/imgtools/romtools/rombuild/rombuild.cpp	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/romtools/rombuild/rombuild.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -26,14 +26,15 @@
 
 #include "r_dir.h"
 #include "r_coreimage.h"
+#include "logparser.h"
 
 const TInt KRomLoaderHeaderNone=0;
 const TInt KRomLoaderHeaderEPOC=1;
 const TInt KRomLoaderHeaderCOFF=2;
 
 static const TInt RombuildMajorVersion=2;
-static const TInt RombuildMinorVersion=18;
-static const TInt RombuildPatchVersion=4;
+static const TInt RombuildMinorVersion=19;
+static const TInt RombuildPatchVersion=1;
 static TBool SizeSummary=EFalse;
 static TPrintType SizeWhere=EAlways;
 static string compareROMName = "";
@@ -49,11 +50,13 @@
 TBool gGenDepGraph = EFalse;
 string gDepInfoFile = "";
 TBool gGenSymbols = EFalse ;
+TBool gGenBsymbols = EFalse ;
 TBool gIsOBYUTF8 = EFalse;
+static string loginput = "";
 void PrintVersion() {
- 	Print(EAlways,"\nROMBUILD - Rom builder");
-  	Print(EAlways, " V%d.%d.%d\n", RombuildMajorVersion, RombuildMinorVersion, RombuildPatchVersion);
-  	Print(EAlways,Copyright);
+ 	printf("\nROMBUILD - Rom builder");
+  	printf(" V%d.%d.%d\n", RombuildMajorVersion, RombuildMinorVersion, RombuildPatchVersion);
+  	printf(Copyright);
 	}
 
 char HelpText[] = 
@@ -82,7 +85,8 @@
 	"        -lowmem                       use memory-mapped file for image build to reduce physical memory consumption\n"
 	"        -coreimage=<core image file>  to pass the core image as input for extension ROM image generation\n"
 	"        -k                            to enable keepgoing when duplicate files exist in oby\n"
-	"        -logfile=<fileName>           specify log file\n";
+	"        -logfile=<fileName>           specify log file\n"
+    "        -loginput=<log filename>      specify as input a log file and produce as output symbol file.\n";
 
 
 char ReallyHelpText[] =
@@ -349,6 +353,9 @@
 			else if (strnicmp(arg, "logfile=",8) ==0) {
 				romlogfile = arg + 8;
 			}
+			else if (strnicmp(arg, "loginput=",9) ==0) {
+				loginput = arg + 9;
+			}
 			else 
 #ifdef WIN32
 				cout << "Unrecognised option " << argv[i] << "\n";
@@ -366,7 +373,7 @@
 		}
 	if (paramFileFlag)
 		return;
-	if (filename.empty()) {
+	if (filename.empty() && loginput.empty()) {
  		PrintVersion();
 		cout << HelpText;
 		if (reallyHelp) {
@@ -450,29 +457,42 @@
 	ParseCapabilitiesArg(gPlatSecAllCaps, "all");
 
  	processCommandLine(argc, argv);
- 	if(filename.empty())
+ 	if(filename.empty() && loginput.empty())
    		return KErrGeneral;
 		
-	if (romlogfile[romlogfile.size()-1] == '\\' || romlogfile[romlogfile.size()-1] == '/')
-		romlogfile += "ROMBUILD.LOG";
- 	H.SetLogFile(romlogfile.c_str());
 
     if(gThreadNum == 0) {
  		if(gCPUNum > 0 && gCPUNum <= MAXIMUM_THREADS) {
- 			Print(EAlways, "The number of processors (%d) is used as the number of concurrent jobs.\n", gCPUNum);
-			gThreadNum = gCPUNum;
+ 			printf("The double number of processors (%d) is used as the number of concurrent jobs.\n", gCPUNum * 2);
+			gThreadNum = gCPUNum * 2;
 		}
 		else if(g_pCharCPUNum) {
- 			Print(EWarning, "The NUMBER_OF_PROCESSORS is invalid, and the default value %d will be used.\n", DEFAULT_THREADS);
+ 			printf("The NUMBER_OF_PROCESSORS is invalid, and the default value %d will be used.\n", DEFAULT_THREADS);
 			gThreadNum = DEFAULT_THREADS;
 		}
 		else {
- 			Print(EWarning, "The NUMBER_OF_PROCESSORS is not available, and the default value %d will be used.\n", DEFAULT_THREADS);
+ 			printf("The NUMBER_OF_PROCESSORS is not available, and the default value %d will be used.\n", DEFAULT_THREADS);
 			gThreadNum = DEFAULT_THREADS;
 		}
 	} 
 	PrintVersion();
 	
+	if(loginput.length() >= 1)
+	{
+		try
+		{
+			LogParser::GetInstance(ERomImage)->ParseSymbol(loginput.c_str());
+		}
+		catch(LoggingException le)
+		{
+			printf("ERROR: %s\r\n", le.GetErrorMessage());
+			return 1;
+		}
+		return 0;
+	}
+	if (romlogfile.empty() || romlogfile[romlogfile.size()-1] == '\\' || romlogfile[romlogfile.size()-1] == '/')
+		romlogfile += "ROMBUILD.LOG";
+ 	H.SetLogFile(romlogfile.c_str());
 	ObeyFileReader *reader=new ObeyFileReader(filename.c_str());
 	if (!reader->Open()) {
  		delete reader;
--- a/imgtools/romtools/rombuild/rombuild.mmp	Mon Nov 29 15:29:25 2010 +0800
+++ b/imgtools/romtools/rombuild/rombuild.mmp	Mon Nov 29 15:37:06 2010 +0800
@@ -24,7 +24,10 @@
 source			 r_dir.cpp r_header.cpp r_obey.cpp r_srec.cpp
 source			 r_rom.cpp rombuild.cpp r_build.cpp r_collapse.cpp
 source			 r_global.cpp r_areaset.cpp
-source			 r_coreimage.cpp r_coreimagereader.cpp symbolgenerator.cpp
+source			 r_coreimage.cpp r_coreimagereader.cpp
+sourcepath	../../imglib/symbolutil
+source		symbolgenerator.cpp symbolprocessunit.cpp bsymutil.cpp
+source 		loggingexception.cpp logparser.cpp
 sourcepath	../../imglib/e32uid
 source			e32uid.cpp
 sourcepath	../../imglib/host
@@ -38,7 +41,7 @@
 source			byte_pair.cpp
 source			pagedcompress.cpp
 
-userinclude	../../imglib/compress 	../../imglib/inc 
+userinclude	../../imglib/compress 	../../imglib/inc ../../imglib/symbolutil
 userinclude	../../imglib/patchdataprocessor/include ../../imglib/parameterfileprocessor/include
 userinclude     ../../imglib/uniconv/include
 userinclude ../../imglib/memmap/include
@@ -46,7 +49,7 @@
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
-staticlibrary	patchdataprocessor parameterfileprocessor memmap boost_thread-1.39 uniconv
+staticlibrary	patchdataprocessor parameterfileprocessor memmap boost_thread-1.39 boost_regex-1.39 uniconv
 
 #ifdef TOOLS2_LINUX
 OPTION    GCC -O2 -Wno-uninitialized -pthread
--- a/imgtools/romtools/rombuild/symbolgenerator.cpp	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,553 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-#include <e32rom.h>
-#include <algorithm>
-#include "symbolgenerator.h"
-#include "r_rom.h"
-#include <string.h>
-#include "h_utl.h"
-typedef boost::unique_lock<boost::mutex>  scoped_lock ;
-typedef boost::lock_guard<boost::mutex> guarded_lock ;
-
-SymbolGenerator::SymbolGenerator(const char* aSymbolFileName, int aMultiThreadsCount/* = 1*/) :
-iOutput(aSymbolFileName,ios_base::out |ios_base::binary |  ios_base::trunc) {
-	if(iOutput.is_open()){
-		if(aMultiThreadsCount < 1)
-			aMultiThreadsCount = 1;
-		 
-		for(int i = 0 ; i < aMultiThreadsCount ; i++){		
-			iThreads.add_thread(new boost::thread(ThreadFunc,this));
-		}
-	}
-	else {
-		cerr << "\nWarning: Can't write data to \""<<aSymbolFileName << "\" ! \nPlease make sure this file is not locked by other application or you have write permission!"<<endl;
-	} 
-}
-void SymbolGenerator::WaitThreads() {
-	iThreads.join_all(); 
-}
-SymbolGenerator::~SymbolGenerator() {
-	if(iOutput.is_open()){		
-		iOutput.flush();
-		iOutput.close();
-	}
-	for(vector<char*>::iterator i = iErrMsgs.begin() ; i != iErrMsgs.end() ; i++){
-		char* msg = *i ;
-		cerr << msg ;
-		delete []msg ;
-	}
-	iErrMsgs.clear(); 
-}
-
-void SymbolGenerator::AddEntry(const SymGenContext& aEntry){
-	if(iOutput.is_open()){
-		guarded_lock lock(iQueueMutex); 		 
-		iEntries.push(aEntry);		
-		iCond.notify_all();
-	}
-}
-void SymbolGenerator::ThreadFunc(SymbolGenerator* aInst) {		
-		SymGenContext entry ;
-		while(1){ 
-			entry.iFileName = 0;
-			if(1) {
-				scoped_lock lock(aInst->iQueueMutex);
-				while(aInst->iEntries.empty()){
-						aInst->iCond.wait(lock);
-				}
-				entry = aInst->iEntries.front();
-				if(0 == entry.iFileName)  // end , exit
-					return ;
-					
-				aInst->iEntries.pop();
-			}
-			aInst->ProcessEntry(entry);
-		}
-		
-}
-#define MAX_LINE_LENGTH 65535 
-#define SKIP_WS(p)	 while((*p) == ' ' ||  (*p) == '\t') (p)++ 
-#define FIND_WS(p)	 while((*p) != ' ' &&  (*p) != '\t' && (*p) != 0) (p)++ 
-static void split(char* str, vector<char*>& result) {
-	result.clear();
-	while(*str) {
-		SKIP_WS(str);
-		char* saved = str ; 
-		FIND_WS(str);
-		bool end = (0 == *str);
-		*str = 0 ; 
-		if(saved != str)
-			result.push_back(saved);		
-		if(!end) str ++ ; 
-	}	 
-}
-static void make_lower(char* str){
-	while(*str){
-		if(*str >= 'A' && *str >= 'Z') {
-			*str += ('a' - 'A');
-		}
-		str++;
-	}
-}
-bool SymbolGenerator::ProcessEntry(const SymGenContext& aContext) {	
-	size_t allocBytes ;
-	if(aContext.iExecutable ) {
-		string mapFileName(aContext.iFileName);	
-		mapFileName += ".map";
-		ifstream ifs(mapFileName.c_str());
-		if(!ifs.is_open()){
-			int index = mapFileName.length() - 5 ;
-			int count = 1 ;
-			while(index > 0 && mapFileName.at(index) != '.'){
-				index -- ;
-				count ++ ;
-			}
-			mapFileName.erase(index,count);
-			ifs.open(mapFileName.c_str());
-		}
-		if(!ifs.is_open()){		
-			guarded_lock lock(iFileMutex);
-			allocBytes = mapFileName.length() + 60 ;
-			char* msg = new char[ allocBytes] ;
-			snprintf(msg,allocBytes,"\nWarning: Can't open \"%s.map\"\n",aContext.iFileName );
-			iErrMsgs.push_back(msg);
-			msg = new char[allocBytes] ;
-			int n = snprintf(msg,allocBytes,"%08x    %04x    %s\r\n",(unsigned int)aContext.iCodeAddress,(unsigned int)aContext.iTotalSize,aContext.iFileName);			
-			iOutput.write(msg,n);
-			iOutput.flush();
-			return false ;
-		} 
-		if(!ifs.good()) ifs.clear();
-		char buffer[100]; 
-		*buffer = 0;
-		//See if we're dealing with the RVCT output
-		ifs.getline(buffer,100);
-		if(!ifs.good()) { 
-			ifs.close();
-			guarded_lock lock(iFileMutex);
-			allocBytes = mapFileName.length() + 60;
-			char* msg = new char[allocBytes] ; 
-			snprintf(msg,allocBytes,"\nWarning: File \"%s\" is opened yet can not be read!",mapFileName.c_str());
-			iErrMsgs.push_back(msg);  
-			return false ;			 
-		}
-		if(strncmp(buffer,"ARM Linker",10) == 0){  			
-			return ProcessARMV5Map(ifs,aContext);
-		}
-		// See if we're dealing with the GCC output
-		else if ( 0 == strncmp(buffer,"Archive member included",23)){ 
-			return ProcessGCCMap(ifs,aContext);
-		}
-		else { // Must be x86 output
-			ifs.seekg(0,ios_base::beg);
-			return ProcessX86Map(ifs,aContext);		
-		}
-	}
-	else {
-		const char* fileName = aContext.iFileName;	  
-		size_t len = strlen(fileName);
-		size_t index = len - 1;
-		while(index > 0 && (fileName[index] != '\\' && fileName[index] != '/'))
-			index -- ;
-		const char* basename = fileName + index + 1  ;		
-		allocBytes = (len << 1) + 40 ;
-		char* msg = new char[allocBytes] ;
-		int n = snprintf(msg,allocBytes,"\r\nFrom    %s\r\n\r\n%08x    0000    %s\r\n", fileName ,(unsigned int)aContext.iDataAddress,basename);	
-		guarded_lock lock(iFileMutex);
-		iOutput.write(msg,n);
-		iOutput.flush();
-		delete []msg ;
-		return true ;
-	}
-	return true ;
-}
-struct ArmSymbolInfo {
-	string name ;
-	TUint size ;
-	string section ;
-};
-typedef multimap<TUint32,ArmSymbolInfo> ArmSymMap ;
- 
-bool SymbolGenerator::ProcessARMV5Map(ifstream& aStream, const SymGenContext& aContext) {	
-	string symName ; 
-	ArmSymMap symbols ; 
-	vector<char*> words ;
-	ArmSymbolInfo info;
-	char* lineStart ;
-	char buffer[MAX_LINE_LENGTH];  
-	while(aStream.good() && (!aStream.eof())){
-		*buffer = 0;
-		aStream.getline(buffer,MAX_LINE_LENGTH);
-		lineStart = buffer ;
-		SKIP_WS(lineStart);	 
-		if(strstr(lineStart,"Global Symbols"))
-			break ;
-		char* armstamp = strstr(lineStart,"ARM Code");
-		if(0 == armstamp)
-			armstamp = strstr(lineStart,"Thumb Code") ;
-		if(0 == armstamp) continue ; 
-		*(armstamp - 1) = 0 ;
-		
-		char* hexStr = lineStart ;
-		char* nameEnd;
-		while(1) {
-			hexStr = strstr(hexStr,"0x");
-			if(0 == hexStr) break ; 		
-			nameEnd = hexStr - 1;
-			if(*nameEnd == ' ' || *nameEnd == '\t') break ;
-			hexStr += 2 ;
-		}	 
-		if(0 == hexStr) continue ; 	
-		while(nameEnd > lineStart && (*nameEnd == ' ' || *nameEnd == '\t'))
-			nameEnd -- ;
-		
-		nameEnd[1] = 0;
-		info.name = lineStart;		
-		char* temp ;
-		TUint32 addr = strtoul(hexStr + 2,&temp,16);
-		char* decStr ;
-		if(*armstamp == 'A')
-			decStr = armstamp + 9 ;
-		else 
-			decStr = armstamp + 11 ;
-		SKIP_WS(decStr);
-		info.size = strtoul(decStr,&temp,10);
-		SKIP_WS(temp);
-		info.section = temp;
-		if(info.section.find("(StubCode)") != string::npos )
-			info.size = 8 ; 			
-		if(addr > 0){
-			symbols.insert(pair<TUint32,ArmSymbolInfo>(addr,info));
-		}
-	}	 
-	size_t lenOfFileName = strlen(aContext.iFileName);
-	while(aStream.good() && (!aStream.eof())){
-		*buffer = 0;
-		aStream.getline(buffer,MAX_LINE_LENGTH);
-		lineStart = buffer ;
-		SKIP_WS(lineStart); 
-		char* hexStr = lineStart ;
-		char* nameEnd;
-		while(1) {
-			hexStr = strstr(hexStr,"0x");
-			if(0 == hexStr) break ; 		
-			nameEnd = hexStr - 1;
-			if(*nameEnd == ' ' || *nameEnd == '\t') 
-				break ;
-			hexStr += 2 ;
-		}	 
-		if(0 == hexStr) continue ; 
-		while(nameEnd > lineStart && (*nameEnd == ' ' || *nameEnd == '\t')){
-			nameEnd -- ;
-		}
-		nameEnd[1] = 0;
-		info.name = lineStart; 
-		char *temp ;
-		TUint32 addr = strtoul(hexStr + 2,&temp,16);
-		while(*temp < '0' || *temp > '9' )//[^\d]*
-			temp++ ;
-		char* decStr = temp ;
-		info.size = strtoul(decStr,&temp,10);
-		SKIP_WS(temp);
-		info.section = temp;
-		if(info.section.find("(StubCode)") != string::npos )
-			info.size = 8 ; 
-		if(addr > 0){
-			symbols.insert(pair<TUint32,ArmSymbolInfo>(addr,info));
-		} 
-	}
-	
-	TUint32 textSectAddr = 0x00008000;  // .text gets linked at 0x00008000
-	TUint32 dataSectAddr = 0x00400000 ; // .data gets linked at 0x00400000
-	vector<pair<int,char*> > lines ;	
-	size_t allocBytes;
-	for( ArmSymMap::iterator it = symbols.begin(); it != symbols.end() ; it++){
-		TUint32 thisAddr = it->first ;
-		TUint32 romAddr ;
-		ArmSymbolInfo& info = it->second; 
-		if (thisAddr >= textSectAddr && thisAddr <= (textSectAddr + aContext.iTextSize)) {
-				romAddr = thisAddr - textSectAddr + aContext.iCodeAddress ;
-		} 
-		else if ( aContext.iDataAddress && 
-			( thisAddr >= dataSectAddr && thisAddr <= (dataSectAddr + aContext.iTextSize))) {
-			romAddr = thisAddr-dataSectAddr + aContext.iDataBssLinearBase;
-		} 
-		else if ( aContext.iDataBssLinearBase && 
-			( thisAddr >= dataSectAddr && thisAddr <= (dataSectAddr+ aContext.iTotalDataSize))) {
-			romAddr = thisAddr - dataSectAddr + aContext.iDataBssLinearBase;
-		} 
-		else { 
-			guarded_lock  lock(iFileMutex);
-			allocBytes = info.name.length() + 60;
-			char* msg = new char[allocBytes] ;
-			snprintf(msg,allocBytes,"\r\nWarning: Symbol %s @ 0x%08x not in text or data segments\r\n", \
-				info.name.c_str() ,(unsigned int)thisAddr) ; 
-			iErrMsgs.push_back(msg);	
-			allocBytes = lenOfFileName + 80;
-			msg = new char[allocBytes];
-			snprintf(msg,allocBytes,"Warning:  The map file for binary %s is out-of-sync with the binary itself\r\n\r\n",aContext.iFileName);
-			iErrMsgs.push_back(msg);	
-			continue ;
-		}
-		allocBytes =  info.section.length() + info.name.length() + 140;
-		char* outputLine = new char[allocBytes];
-		int len = snprintf(outputLine,allocBytes,"%08x    %04x    %-40s  %s\r\n",(unsigned int)romAddr,info.size,
-			info.name.c_str(),info.section.c_str()); 
-		if((size_t)len > allocBytes) {
-			allocBytes = len + 4 ;
-			delete []outputLine;
-			outputLine = new char[allocBytes];
-			len = snprintf(outputLine,allocBytes,"%08x    %04x    %-40s  %s\r\n",(unsigned int)romAddr,info.size,
-			info.name.c_str(),info.section.c_str()); 
-		}
-		lines.push_back(pair<int,char*>(len,outputLine));
-	 
-	}  
-	guarded_lock lock(iFileMutex);	
-	allocBytes = lenOfFileName + 40;
-	char* outputLine = new char[allocBytes];
-	int n = snprintf(outputLine,allocBytes,"\r\nFrom    %s\r\n\r\n",aContext.iFileName); 
-	iOutput.write(outputLine,n);
-	delete []outputLine ;
-	for (vector<pair<int,char*> >::iterator i = lines.begin() ; i < lines.end(); i ++ ) {
-		int len = i->first ;
-		char* line = i->second; 
-		iOutput.write(line,len);
-		delete []line ;
-	}	
-	iOutput.flush();
-	return true ;
-		
-}
-template<typename M, typename K,typename V> 
-static void put_to_map(M& m,const K& k, const V& v) {
-	typedef typename M::iterator iterator;
-	iterator it = m.find(k);
-	if(m.end() == it){
-		m.insert(pair<K,V>(k,v));
-	}
-	else { 
-		it->second = v ;
-	}	
-}
-bool  SymbolGenerator::ProcessGCCMap(ifstream& aStream, const SymGenContext& aContext){
- 	char* lineStart; 
-	vector<char*> words ;
-	char buffer[MAX_LINE_LENGTH];
-	while(aStream.good() && (!aStream.eof())){
-		aStream.getline(buffer,MAX_LINE_LENGTH);
-		lineStart = buffer ;
-		SKIP_WS(lineStart);
-		if( 0 == strncmp(lineStart,".text",5)) {
-			lineStart += 5;
-			break ;
-		}		
-	}
-	split(lineStart,words);
-	TUint32 codeAddr , codeSize;
-	size_t allocBytes ;
-	if(words.size() != 2 ||
-	KErrNone != Val(codeAddr,words.at(0)) || 
-	KErrNone != Val(codeSize,words.at(1))) {
-		allocBytes = strlen(aContext.iFileName) + 60;
-		char* msg = new char[allocBytes];
-		snprintf(msg,allocBytes,"\nError: Can't get .text section info for \"%s\"\r\n",aContext.iFileName);
-		guarded_lock lock(iFileMutex);
-		iErrMsgs.push_back(msg);
-		return false ;
-	}
-	map<TUint32,string> symbols ;
-	TUint32 stubHex = 0;
-	//Slurp symbols 'til the end of the text section
-	while(aStream.good() && (!aStream.eof())){
-		aStream.getline(buffer,MAX_LINE_LENGTH);
-		lineStart = buffer ;
-		SKIP_WS(lineStart); 
-		if(0 == *lineStart) break ; //blank line marks the end of the text section
-		
-		// .text <addr> <len>  <library(member)>
-		// .text$something
-		//       <addr> <len>  <library(member)>
-		//       <addr> <len>  LONG 0x0
-		// (/^\s(\.text)?\s+(0x\w+)\s+(0x\w+)\s+(.*)$/io)	 
-		if(strncmp(lineStart,".text",5) == 0){
-			lineStart += 5 ;
-			SKIP_WS(lineStart);
-		}
-		char* hex1 = NULL ;
-		char* hex2 = NULL ;
-		char* strAfterhex1 = NULL ;
-		TUint32 addr,size ;
-		if(strncmp(lineStart,"0x",2) == 0){
-			hex1 = lineStart + 2;
-			char* temp ;
-			addr = strtoul(hex1,&temp,16);
-			SKIP_WS(temp);
-			strAfterhex1 = temp ;
-			if(strncmp(temp,"0x",2) == 0){
-				hex2 = temp + 2 ;
-			}
-		}
-		if(NULL != hex2){
-			char* libraryfile ;
-			size = strtoul(hex2,&libraryfile,16);
-			SKIP_WS(libraryfile);  
-			TUint32 key = addr + size ;
-			put_to_map(symbols,key,string(""));//impossible symbol as end marker 
-			make_lower(libraryfile); 
-			// EUSER.LIB(ds01423.o)
-			// EUSER.LIB(C:/TEMP/d1000s_01423.o)
-			size_t len = strlen(libraryfile);
-			char* p1 = strstr(libraryfile,".lib(");
-			if(NULL == p1) 
-				continue ; 
-			p1 += 5;
-			if(strcmp(libraryfile + len - 3,".o)")!= 0)
-				continue ;		 
-			len -= 3 ;
-			libraryfile[len] = 0; 
-			if(EFalse == IsValidNumber(libraryfile + len - 5))
-				continue ;
-			len -= 7 ;
-			if('_' == libraryfile[len])
-				len -- ;
-			if('s' != libraryfile[len])
-				continue ;		 
-			char* p2 = libraryfile + len - 1;
-			while(p2 > p1 ) { 
-				if(*p2 < '0' || *p2 > '9')
-					break ;
-				p2 -- ;
-			}
-			if(*p2 != 'd') 
-				continue ;
-			stubHex = addr ;
-		}
-		else if(NULL != hex1 && NULL != strAfterhex1){ 
-			//#  <addr>  <symbol name possibly including spaces>
-			//(/^\s+(\w+)\s\s+([a-zA-Z_].+)/o) 			 
-			char* symName = strAfterhex1; 
-			if((*symName >= 'A' && *symName <= 'Z') ||
-				(*symName >= 'a' && *symName <= 'z') || *symName == '_') {				 
-				string symbol(symName);
-				if(addr == stubHex) 
-					symbol.insert(0,"stub ");
-			 
-				put_to_map(symbols,addr,symbol);
-				 
-			}			
-		}		
-	}  
-	map<TUint32,string>::iterator it = symbols.begin();
-	TUint32 lastAddr = it->first;
-	string lastSymName = it->second;
-	vector<pair<int,char*> >lines ;
-	it ++ ;
-	while(it != symbols.end()) {		
-		TUint32 addr = it->first ; 
-		unsigned int fixedupAddr = lastAddr - codeAddr + aContext.iCodeAddress;
-		TUint size = addr - lastAddr ;
-		if(!lastSymName.empty()) {
-			allocBytes = lastSymName.length() + 40;
-			char* outputLine = new char[allocBytes];
-			int n = snprintf(outputLine,allocBytes,"%08x    %04x    %s\r\n", fixedupAddr,size,lastSymName.c_str()); 
-			lines.push_back(pair<int,char*>(n,outputLine));
-		}		
-		lastAddr = addr ;
-		lastSymName = it->second;
-		it ++ ;
-	}
-	
-	guarded_lock lock(iFileMutex);
-	allocBytes = strlen(aContext.iFileName) + 40;
-	char* outputLine = new char[allocBytes];
-	int n = snprintf(outputLine,allocBytes,"\r\nFrom    %s\r\n\r\n",aContext.iFileName); 
-	iOutput.write(outputLine,n);
-	delete []outputLine ;
-	vector<pair<int,char*> >::iterator i; 
-	for ( i = lines.begin() ; i < lines.end(); i ++ ) {
-		int len = i->first ;
-		char* line = i->second ;
-		iOutput.write(line,len);
-		delete []line ;
-	}
-	iOutput.flush();	
-	return true ;
-}
-bool SymbolGenerator::ProcessX86Map(ifstream& aStream, const SymGenContext& aContext) {
-	char buffer[MAX_LINE_LENGTH]; 
-	char* lineStart; 
-	while(aStream.good() && (!aStream.eof())){
-		aStream.getline(buffer,MAX_LINE_LENGTH);
-		lineStart = buffer ;
-		SKIP_WS(lineStart);
-		if( 0 == strncmp(lineStart,"Address",7)) { 
-			break ;
-		}		
-	}
-	aStream.getline(buffer,MAX_LINE_LENGTH);
-	string lastName ;
-	TUint32 lastAddr = 0;
-	size_t allocBytes ;
-	vector<pair<int, char*> >lines ;
-	while(aStream.good() && (!aStream.eof())){
-		aStream.getline(buffer,MAX_LINE_LENGTH);
-		lineStart = buffer ;
-		SKIP_WS(lineStart);
-		if(0 != strncmp(lineStart,"0001:",5))
-			break ;		 
-		char* end ; 
-		TUint32 addr = strtoul(lineStart + 5,&end,16);
-		char* name = end + 1;
-		SKIP_WS(name);
-		end = name + 1;
-		FIND_WS(end);
-		*end = 0 ;
-		if(!lastName.empty()){
-			unsigned int size = addr - lastAddr ; 
-			unsigned int romAddr = lastAddr + aContext.iCodeAddress;
-			allocBytes = lastName.length() + 40;
-			char* outputLine = new char[allocBytes];
-			int n = snprintf(outputLine,allocBytes,"%08x    %04x    %s\r\n",romAddr,size,lastName.c_str());
-			lines.push_back(pair<int, char*>(n,outputLine));
-		}		
-	}
-	guarded_lock lock(iFileMutex);
-	allocBytes = strlen(aContext.iFileName) + 40;
-	char* outputLine = new char[allocBytes];
-	int n = snprintf(outputLine,allocBytes,"\r\nFrom    %s\r\n\r\n",aContext.iFileName); 
-	iOutput.write(outputLine,n);
-	delete []outputLine ;
-	vector<pair<int,char*> >::iterator it; 
-	for ( it = lines.begin() ; it < lines.end(); it ++ ) {
-		int len = it->first ;
-		char* line = it->second  ;
-		iOutput.write(line,len);
-		delete []line ;
-	}	
-	if(!lastName.empty()){
-		allocBytes = lastName.length() + 40 ;
-		outputLine = new char[allocBytes];
-		unsigned int romAddr = lastAddr + aContext.iCodeAddress;
-		n = snprintf(outputLine,allocBytes,"%08x    0000    %s\r\n",romAddr,lastName.c_str());
-		iOutput.write(outputLine,n);
-		delete []outputLine ;
-	}
-	iOutput.flush();
-	return false ;
-}
--- a/imgtools/romtools/rombuild/symbolgenerator.h	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-#ifndef __SYMBOLSCREATER_H__
-#define __SYMBOLSCREATER_H__
-#include <queue>
-#include <string>
-#include <fstream>
-#include <vector>
-#include <map>
-
-using namespace std;
-
-#include <boost/thread/thread.hpp>
-#include <boost/thread/condition.hpp>
-
-struct SymGenContext {
-	const char* iFileName ;
-	TUint32	iTotalSize ;
-	TUint32 iCodeAddress; 
-	TUint32 iDataAddress; 
-	TUint32 iDataBssLinearBase;	 
-	TInt iTextSize; 
-	TInt iDataSize; 
-	TInt iBssSize;   	
-	TInt iTotalDataSize;
-	TBool iExecutable ;
-};
-
-class SymbolGenerator  {  
-public :
-		SymbolGenerator(const char* aSymbolFileName, int aMultiThreadsCount = 1);
-		~SymbolGenerator();		
-		void AddEntry(const SymGenContext& aEntry); 
-		void WaitThreads();
-private :
-		SymbolGenerator();
-		SymbolGenerator& operator = (const SymbolGenerator& aRight);
-		static void ThreadFunc(SymbolGenerator* aInst); 
-		bool ProcessEntry(const SymGenContext& aContext);
-		bool ProcessARMV5Map(ifstream& aStream, const SymGenContext& aContext);
-		bool ProcessGCCMap(ifstream& aStream, const SymGenContext& aContext);
-		bool ProcessX86Map(ifstream& aStream, const SymGenContext& aContext);
-		ofstream iOutput ; 
-		boost::thread_group iThreads ;
-		boost::condition_variable iCond;
-		boost::mutex iQueueMutex;
-		boost::mutex iFileMutex ;
-		queue<SymGenContext> iEntries ;	
-		vector<char*> iErrMsgs ;
-	
-};
-
-#endif //__ROMSYMBOLGENERATOR_H__
--- a/sbsv2/raptor/RELEASE-NOTES.html	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/RELEASE-NOTES.html	Mon Nov 29 15:37:06 2010 +0800
@@ -6,6 +6,33 @@
 
 <h1>Release Notes for Symbian Build System v2</h1>
 
+<h2>version 2.15.3</h2>
+
+<h3>Engineering Changes</h2>
+<ul>
+<li><a href="notes/filter_exes.txt">New filter_exes filter for listing generated executable files from a build</a></li>
+<li><a href="notes/per_component_flm.txt">Hook for including an FLM for each component</a></li>
+</ul>
+
+<h3>Defect Fixes</h3>
+<ul>
+<li>Fix: correct calculation of build duration and cluster availability</li>
+<li>Fix: correct parsing for anno file</li>
+<li><a href="http://developer.symbian.org/bugs/show_bug.cgi?id=3687">SF Bug 3687</a> make 32-bit tools2 binaries appear in 32-bit release locations even when built on a 64-bit machine e.g. release/tools2/linux-i386-libc2_5 rather than linux-x86_64-libc2_5</li>
+<li>Fix: in some cases, tools2 build omits STLport when linking</li>
+<li><a href="http://developer.symbian.org/bugs/show_bug.cgi?id=3766">SF Bug 3766</a> - [Raptor] Missing -c option to g++ in expgen recipes when using GCCE</li>
+<li><a href="http://developer.symbian.org/bugs/show_bug.cgi?id=3778">SF Bug 3778</a> - [GCCE] Raptor 2.15 gcce.xml config breaks gcce kernel builds.</li>
+<li><a href="http://developer.symbian.org/bugs/show_bug.cgi?id=3747">SF Bug 3747</a> - Terminal filter does not report missing bld.inf names</li>
+<li>Layer information missing from logs with parallel processing on</li>
+<li><a href="http://developer.symbian.org/bugs/show_bug.cgi?id=2745">SF Bug 2745</a> - Generated .bat files are incorrect</li>
+<li><a href="http://developer.symbian.org/bugs/show_bug.cgi?id=3511">SF Bug 3511</a> - sbs shell script ignores SBS_CYGWIN17</li>
+<li><a href="http://developer.symbian.org/bugs/show_bug.cgi?id=3388">SF Bug 3388</a> - Configuration of python paths confused in sbs_filter</li>
+<li><a href="http://developer.symbian.org/bugs/show_bug.cgi?id=3246">SF Bug 3246</a> - Improve a cryptic error message</li>
+<li><a href="http://developer.symbian.org/bugs/show_bug.cgi?id=3608">SF Bug 3608</a> - Compile fails on mixed case Qt projects</li>
+<li><a href="http://developer.symbian.org/bugs/show_bug.cgi?id=3848">SF Bug 3848</a> - [Raptor] - parallel parsing in 2.15.3 - sysdef files for blocks don't have unique names</li>
+<li><a href="http://developer.symbian.org/bugs/show_bug.cgi?id=3807">SF Bug 3807</a> - [Raptor] "Child" invocations of Raptor fail with parallel parsing (--pp=on) on some linuxes - unknown hostplatform</li>
+</ul>
+
 <h2>version 2.15.2</h2>
 
 <h3>Engineering Changes</h3>
--- a/sbsv2/raptor/bin/gethost.sh	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/bin/gethost.sh	Mon Nov 29 15:37:06 2010 +0800
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 
-# Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of the License "Eclipse Public License v1.0"
@@ -25,20 +25,29 @@
 
 getopts de  OPT
 
-if [[ "${OSTYPE}" =~ "linux" ]]; then
+if [[ "${OSTYPE}" =~ "linux" || "${HOSTPLATFORM}" =~ "linux" ]]; then
 	ARCH=$(uname -i)
         LIBC=$(echo /lib/libc-* | sed -r 's#.*/libc-([0-9]*)\.([0-9]*)(\.([0-9]*))?.so#libc\1_\2#')
         HOSTPLATFORM="linux ${ARCH} ${LIBC}"
 
-	if [ "$LIBC" == "libc2_3" ]; then
-        	HOSTPLATFORM_DIR="linux-${ARCH}"
-	else
-        	HOSTPLATFORM_DIR="linux-${ARCH}-${LIBC}"
+	# The 32-bit platform is often compatible in the sense that
+	# a) 32-bit programs can run on the 64-bit OS.
+	# b) a 64-bit OS can tell the compiler to create 32-bit executables.
+
+       	ARCH32="i386"
+
+	# deal with ubuntu/debian:
+	if [ "$ARCH" == "unknown" ]; then
+		ARCH32="${ARCH}"
 	fi
+
+       	HOSTPLATFORM_DIR="linux-${ARCH}-${LIBC}"
+       	HOSTPLATFORM32_DIR="linux-${ARCH32}-${LIBC}"
 	
 elif [[ "$OS" == "Windows_NT" ]]; then
 	HOSTPLATFORM="win 32"
 	HOSTPLATFORM_DIR="win32"
+	HOSTPLATFORM32_DIR="win32"
 else
 	HOSTPLATFORM=unknown
 	HOSTPLATFORM_DIR=unknown
@@ -46,6 +55,7 @@
 
 if [ "$OPT" == "e" ]; then 
 	echo "export HOSTPLATFORM_DIR=$HOSTPLATFORM_DIR"
+	echo "export HOSTPLATFORM32_DIR=$HOSTPLATFORM32_DIR"
 	echo "export HOSTPLATFORM='$HOSTPLATFORM'"
 elif [ "$OPT" == "d" ]; then 
 	echo "$HOSTPLATFORM_DIR"
--- a/sbsv2/raptor/bin/sbs	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/bin/sbs	Mon Nov 29 15:37:06 2010 +0800
@@ -21,96 +21,11 @@
 if [ -z "$SBS_HOME" ] ; then
 	temp=$0
 	SBS_HOME=$(cd ${temp%/*} && echo $PWD)
-	export SBS_HOME=${SBS_HOME%/bin}
-fi
-
-# Ensure that the host type is set for Raptor:
-eval $($SBS_HOME/bin/gethost.sh -e)
-
-if [ -z "$HOSTPLATFORM" ]; then
-	echo "Error: HOSTPLATFORM could not be determined." 1>&2
-	exit 1
-fi
-
-if [ ! -d "$SBS_HOME/$HOSTPLATFORM_DIR" ]; then
-cat 1>&2 <<EOERROR
-Error: sbs has not been installed with support for your platform: "${HOSTPLATFORM}".
-
-The utilites for your platform should be in "$SBS_HOME/$HOSTPLATFORM_DIR" but sbs
-cannot find them there.
-
-sbs is supported on:
-	win32
-	linux i386 libc2_3 (Redhat 4)
-
-sbs has been known to work (but is not supported) on:
-	linux x86_64 libc2_5  (e.g. Centos/Redhat 5.3 64-bit)
-	linux i386 libc2_8  (e.g. Fedora 9 32-bit)
-	linux x86_64 libc2_10 (e.g. Fedora 11 64-bit)
-
-Even with the appropriate utilities it may be necessary to install 32-bit
-compatibility versions of some libraries (e.g. glibc) on these platforms,
-particularly for 3rd party tools which are not built natively such as
-compilers.
-
-It may be possible to build and install the utilities for your platform by
-entering $SBS_HOME/util and running
-	make -k
-A full development environment is required however.
-EOERROR
-	exit 1
+	export SBS_HOME
 fi
 
-if [ "$OSTYPE" == "cygwin" ]; then
-	__MINGW__=${SBS_MINGW:-$SBS_HOME/$HOSTPLATFORM_DIR/mingw}
-	__CYGWIN__=${SBS_CYGWIN:-$SBS_HOME/$HOSTPLATFORM_DIR/cygwin}
-
-	# Command for unifying path strings. For example, "c:\some\path" and
-	# "/cygdrive/c/some/path" will both be converted into "c:/some/path".
-	u="$__CYGWIN__/bin/cygpath.exe -m"
-	
-	SBS_HOME=${SBS_HOME//\\//}
-	export SBS_HOME=$($u "$SBS_HOME")
-	
-	__MINGW__=$($u "$__MINGW__")
-	__CYGWIN__=$($u "$__MINGW__")
-	export PATH=${__MINGW__}/bin:${__CYGWIN__}/bin:$SBS_HOME/$HOSTPLATFORM_DIR/bin:$PATH
-
-	# Tell Cygwin not to map unix security attributes to windows to
-	# prevent raptor from potentially creating read-only files:
-	export CYGWIN='nontsec nosmbntsec'
-
-	# The python and PYTHONPATH used by Raptor are determined by, in order of precedence:
-	#  1. the SBS_PYTHON and SBS_PYTHONPATH environment variables (if set)
-	#  2. the python shipped locally with Raptor (if present)
-	#  3. the python on the system PATH and the PYTHONPATH set in the system environment
-
-	__LOCAL_PYTHON__=$SBS_HOME/win32/python264/python.exe
-
-	if [ -n "$SBS_PYTHON" ]; then
-		__PYTHON__=$SBS_PYTHON
-	elif [ -f "$__LOCAL_PYTHON__" ]; then
-		__PYTHON__=$__LOCAL_PYTHON__
-		export SBS_PYTHON=$__PYTHON__
-		export PYTHONPATH=
-	else
-		__PYTHON__=python.exe
-	fi
-	__PYTHON__=$($u "$__PYTHON__")		
-
-	if [ -n "$SBS_PYTHONPATH" ]; then
-		export PYTHONPATH=$($u "$SBS_PYTHONPATH")
-	fi
-else
-	PYDIR=python27 # not exported on purpose
-	export PYTHONPATH=${SBS_PYTHONPATH:-$SBS_HOME/$HOSTPLATFORM_DIR/$PYDIR/lib}
-	PATH=$SBS_HOME/$HOSTPLATFORM_DIR/$PYDIR/bin:$SBS_HOME/$HOSTPLATFORM_DIR/bin:$PATH
-	LD_LIBRARY_PATH=$SBS_HOME/$HOSTPLATFORM_DIR/$PYDIR/lib:$SBS_HOME/$HOSTPLATFORM_DIR/bv/lib:$LD_LIBRARY_PATH
-
-	export PATH LD_LIBRARY_PATH
-	__PYTHON__=python
-fi
-
+# Call sbs_env script
+source $SBS_HOME/bin/sbs_env
 
 # call raptor_start.py with the arguments
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/bin/sbs_env	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,118 @@
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+# raptor script
+# manages common environment settings
+#
+
+# Ensure that the host type is set for Raptor:
+eval $($SBS_HOME/bin/gethost.sh -e)
+
+if [ -z "$HOSTPLATFORM" ]; then
+	echo "Error: HOSTPLATFORM could not be determined." 1>&2
+	exit 1
+fi
+
+if [ ! -d "$SBS_HOME/$HOSTPLATFORM_DIR" ]; then
+cat 1>&2 <<EOERROR
+Error: sbs has not been installed with support for your platform: "${HOSTPLATFORM}".
+
+The utilites for your platform should be in "$SBS_HOME/$HOSTPLATFORM_DIR" but sbs
+cannot find them there.
+
+sbs is supported on:
+	win32
+	linux i386 libc2_3 (Redhat 4)
+
+sbs has been known to work (but is not supported) on:
+	linux x86_64 libc2_5  (e.g. Centos/Redhat 5.3 64-bit)
+	linux i386 libc2_8  (e.g. Fedora 9 32-bit)
+	linux x86_64 libc2_10 (e.g. Fedora 11 64-bit)
+
+Even with the appropriate utilities it may be necessary to install 32-bit
+compatibility versions of some libraries (e.g. glibc) on these platforms,
+particularly for 3rd party tools which are not built natively such as
+compilers.
+
+It may be possible to build and install the utilities for your platform by
+entering $SBS_HOME/util and running
+	make -k
+A full development environment is required however.
+EOERROR
+	exit 1
+fi
+
+if [ "$OSTYPE" == "cygwin" ]; then
+
+	SBS_HOME=${SBS_HOME//\\//}
+
+	__MINGW__=${SBS_MINGW:-$SBS_HOME/$HOSTPLATFORM_DIR/mingw}
+	__PYTHON__=${SBS_PYTHON:-$SBS_HOME/$HOSTPLATFORM_DIR/python264/python.exe}
+	export PYTHONPATH=${SBS_PYTHONPATH:-$SBS_HOME/$HOSTPLATFORM_DIR/python264}
+			
+	# work out which version of Cygwin to use
+	# use SBS_CYGWIN17 if set and assume 1.7,
+	# otherwise use SBS_CYGWIN and assume 1.5
+	# Tell Cygwin 1.5 not to map unix security attributes to windows to
+	# prevent raptor from potentially creating read-only files:
+	if [ -z "$SBS_CYGWIN17" ]; then
+			__CYGWIN__=$SBS_CYGWIN
+			export CYGWIN='nontsec nosmbntsec'
+			
+	else
+			__CYGWIN__=$SBS_CYGWIN17
+			export CYGWIN=nodosfilewarning
+			__MOUNTOPTIONS__='-o noacl -o user'
+			__UMOUNTOPTIONS__=
+	fi
+    # Command for unifying path strings. For example, "c:\some\path" and
+    # "/cygdrive/c/some/path" will both be converted into "c:/some/path".
+	u="$__CYGWIN__/bin/cygpath.exe -m"
+
+	__MINGW__=$($u "$__MINGW__")
+	
+	export SBS_HOME=$($u "$SBS_HOME")
+
+	export PATH=${__MINGW__}/bin:${__CYGWIN__}/bin:$SBS_HOME/$HOSTPLATFORM_DIR/bin:$PATH
+	
+	# The python and PYTHONPATH used by Raptor are determined by, in order of precedence:
+	#  1. the SBS_PYTHON and SBS_PYTHONPATH environment variables (if set)
+	#  2. the python shipped locally with Raptor (if present)
+	#  3. the python on the system PATH and the PYTHONPATH set in the system environment
+
+	__LOCAL_PYTHON__=$SBS_HOME/win32/python264/python.exe
+
+	if [ -n "$SBS_PYTHON" ]; then
+		export __PYTHON__=$SBS_PYTHON
+	elif [ -f "$__LOCAL_PYTHON__" ]; then
+		export __PYTHON__=$__LOCAL_PYTHON__
+		export SBS_PYTHON=$__PYTHON__
+		export PYTHONPATH=
+	else
+		export __PYTHON__=python.exe
+	fi
+	export __PYTHON__=$($u "$__PYTHON__")		
+
+	if [ -n "$SBS_PYTHONPATH" ]; then
+		export PYTHONPATH=$($u "$SBS_PYTHONPATH")
+	fi
+
+else	
+	PYDIR=python27 # not exported on purpose
+	export PYTHONPATH=${SBS_PYTHONPATH:-$SBS_HOME/$HOSTPLATFORM_DIR/$PYDIR/lib}
+	PATH=$SBS_HOME/$HOSTPLATFORM_DIR/$PYDIR/bin:$SBS_HOME/$HOSTPLATFORM_DIR/bin:$PATH
+	LD_LIBRARY_PATH=$SBS_HOME/$HOSTPLATFORM_DIR/$PYDIR/lib:$SBS_HOME/$HOSTPLATFORM_DIR/bv/lib:$LD_LIBRARY_PATH
+
+	export PATH LD_LIBRARY_PATH
+	export __PYTHON__=python
+fi
--- a/sbsv2/raptor/bin/sbs_env.bat	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/bin/sbs_env.bat	Mon Nov 29 15:37:06 2010 +0800
@@ -16,6 +16,7 @@
 
 @SET HOSTPLATFORM=win 32
 @SET HOSTPLATFORM_DIR=win32
+@SET HOSTPLATFORM32_DIR=win32
 
 @REM Automatically find SBS_HOME if it is not set
 @IF NOT "%SBS_HOME%"=="" GOTO foundhome
--- a/sbsv2/raptor/bin/sbs_filter	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/bin/sbs_filter	Mon Nov 29 15:37:06 2010 +0800
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of the License "Eclipse Public License v1.0"
@@ -12,68 +12,20 @@
 # Contributors:
 #
 # Description:
-# raptor script
+# raptor filter script
 # add mingw to the PATH if we are running Cygwin on Windows
 #
 
 # If SBS_HOME is not set in the environment then work it out
-# from the path to this batch file
+# from the path to this script
 if [ -z "$SBS_HOME" ] ; then
 	temp=$0
 	SBS_HOME=$(cd ${temp%/*} && echo $PWD)
-	export SBS_HOME=${SBS_HOME%/bin}
-fi
-
-# Ensure that the host type is set for Raptor:
-eval $($SBS_HOME/bin/gethost.sh -e)
-
-if [ -z "$HOSTPLATFORM" ]; then
-	echo "Error: HOSTPLATFORM could not be determined." 1>&2
-	exit 1
-fi
-
-if [ ! -d "$SBS_HOME/$HOSTPLATFORM_DIR" ]; then
-cat 1>&2 <<EOERROR
-Error: sbs has not been installed with support for your platform: "${HOSTPLATFORM}".
-EOERROR
-	exit 1
+	export SBS_HOME
 fi
 
-if [ "$OSTYPE" == "cygwin" ]; then
-
-	SBS_HOME=${SBS_HOME//\\//}
-
-	__MINGW__=${SBS_MINGW:-$SBS_HOME/$HOSTPLATFORM_DIR/mingw}
-	__CYGWIN__=${SBS_CYGWIN:-$SBS_HOME/$HOSTPLATFORM_DIR/cygwin}
-	__PYTHON__=${SBS_PYTHON:-$SBS_HOME/$HOSTPLATFORM_DIR/python264/python.exe}
-	export PYTHONPATH=${SBS_PYTHONPATH:-$SBS_HOME/$HOSTPLATFORM_DIR/python264}
-
-    # Command for unifying path strings. For example, "c:\some\path" and
-    # "/cygdrive/c/some/path" will both be converted into "c:/some/path".
-	u="$__CYGWIN__/bin/cygpath.exe -m"
-
-	__MINGW__=$($u "$__MINGW__")
-	__CYGWIN__=$($u "$__MINGW__")
-	__PYTHON__=$($u "$__PYTHON__")
-
-	export SBS_HOME=$($u "$SBS_HOME")
-
-	export PATH=${__MINGW__}/bin:${__CYGWIN__}/bin:$SBS_HOME/$HOSTPLATFORM_DIR/bin:$PATH
-
-	# Tell Cygwin not to map unix security attributes to windows to
-	# prevent raptor from potentially creating read-only files:
-	export CYGWIN='nontsec nosmbntsec'
-
-else	
-	PYDIR=python27 # not exported on purpose
-	export PYTHONPATH=${SBS_PYTHONPATH:-$SBS_HOME/$HOSTPLATFORM_DIR/$PYDIR/lib}
-	PATH=$SBS_HOME/$HOSTPLATFORM_DIR/$PYDIR/bin:$SBS_HOME/$HOSTPLATFORM_DIR/bin:$PATH
-	LD_LIBRARY_PATH=$SBS_HOME/$HOSTPLATFORM_DIR/$PYDIR/lib:$SBS_HOME/$HOSTPLATFORM_DIR/bv/lib:$LD_LIBRARY_PATH
-
-	export PATH LD_LIBRARY_PATH
-	__PYTHON__=python
-fi
-
+# Call sbs_env script
+source $SBS_HOME/bin/sbs_env
 
 # call sbs_filter.py with the arguments
 
--- a/sbsv2/raptor/bin/sbs_filter.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/bin/sbs_filter.py	Mon Nov 29 15:37:06 2010 +0800
@@ -59,9 +59,13 @@
 
 	# Open the requested plugins using the pluginbox
 	the_raptor.out.open(raptor_params, the_raptor.filterList, pbox)
-	
+
+except ValueError, e:
+	sys.stderr.write("error: problem while creating filters: {0}\n".format(str(e)))
+	sys.exit(1)
 except Exception, e:
-	sys.stderr.write("error: problem while creating filters %s\n" % str(e))
+	# Unrecognised exception: print a traceback
+	sys.stderr.write("error: problem while creating filters: {0}\n".format(str(e)))
 	traceback.print_exc()
 	sys.exit(1)
 		
--- a/sbsv2/raptor/lib/config/arm.xml	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/config/arm.xml	Mon Nov 29 15:37:06 2010 +0800
@@ -12,6 +12,8 @@
 		<env name="CPPFILT" default="$(GCCPREFIX)c++filt$(DOTEXE)" type="tool"/>
 		<env name="SBS_EFREEZE" default="$(PERL) $(EPOCTOOLS)/efreeze.pl" type="script"/>
 		<set name="EFREEZE" value="$(SBS_EFREEZE)"/>
+		<env name="SBS_DEF2DLL" default="$(PERL) $(EPOCTOOLS)/def2dll.pl" type="script"/>
+		<set name="DEF2DLLTOOL" value="$(SBS_DEF2DLL)"/>
 		<env name="SBS_ELF2E32" default="$(EPOCTOOLS)/elf2e32$(DOTEXE)" type="tool"/>
 		<set name="ELF2E32" value="$(SBS_ELF2E32)"/>
 		<env name="SBS_PREPDEF" default="$(PERL) $(EPOCTOOLS)/prepdef.pl" type="script"/>
--- a/sbsv2/raptor/lib/config/gcc.xml	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/config/gcc.xml	Mon Nov 29 15:37:06 2010 +0800
@@ -15,6 +15,7 @@
 
 		<!-- tools and scripts -->
 		<env name='JAVATC' default='$(JAVA_HOME)/bin/java' type='tool'/> <!-- Java used by Trace Compiler -->
+		<env name='JAVA_HOME' default='' type='path'/>		
 
 		<!-- targettypes -->
 		<set name="TARGET_TYPES" value="exe lib"/>
@@ -28,15 +29,11 @@
 		<!-- link to bld.inf and mmp platform names -->
 		<set name='TRADITIONAL_PLATFORM' value='TOOLS2'/>
 
-		<!-- Java used by Trace Compiler -->
 		<set name='CFLAGS' value='-fdefer-pop -fmerge-constants -fthread-jumps -floop-optimize -fif-conversion -fif-conversion2 -fguess-branch-probability -fcprop-registers -foptimize-sibling-calls -fstrength-reduce -fcse-follow-jumps -fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt -fgcse -fgcse-lm -fgcse-sm -fgcse-las -fdelete-null-pointer-checks -fexpensive-optimizations -fregmove -fschedule-insns -fschedule-insns2 -fsched-interblock -fsched-spec -fcaller-saves -fpeephole2 -freorder-blocks -freorder-functions -fstrict-aliasing -funit-at-a-time -falign-functions -falign-jumps -falign-loops -falign-labels -fcrossjumping -pipe -Wall -Wno-ctor-dtor-privacy -Wno-unknown-pragmas -m32'/>
-		<env name='JAVA_HOME' default='' type='path'/>		
+		
 		<set name='VARIANTPLATFORM' value='tools2'/>
 
-		<!-- msys based programs sometimes don't search the path properly.
-		COMPILER_PATH can be set to tell gcc where to find
-		as.exe (sometimes it doesn't and a build step fails).
-		-->
+		<!-- COMPILER_PATH can be set to tell gcc where to find as.exe (sometimes it doesn't and a build step fails). -->
 		<set name='COMPILER_PATH.WIN32' value='$(SBS_HOME)/win32/mingw/bin'/>
 		<set name='COMPILER_PATH.LINUX' value=''/>
 
@@ -59,10 +56,11 @@
 		<set name='OPT.USERINCLUDE' value='-I '/>
 
 		<!-- always use stlport headers -->
-		<set name='SYSTEMINCLUDE' value='$(EPOCINCLUDE)/tools/stlport'/>
+		<env name='SBS_STLPORTINCDIR' default='$(EPOCINCLUDE)/tools/stlport' type='path'/>
+		<set name='SYSTEMINCLUDE' value='$(SBS_STLPORTINCDIR)'/>
 
 		<set name='LFLAGS' value=''/>
-		<set name='STATICLIBRARY' value='stlport.5.1'/>
+		<set name='STATICLIBRARY' value=''/>
 		<set name='LIBS' value=''/>
 		<set name='LIBS.WIN32' value='$(LIBS)'/>
 		<set name='LIBS.LINUX' value='$(LIBS) pthread'/>
@@ -79,8 +77,13 @@
 		<set name='BLDINF_OUTPUTPATH' value='$(SBS_BUILD_DIR)'/>
 
 		<set name='OUTPUTPATH' value='$(SBS_BUILD_DIR)'/>
-		<set name='RELEASEPATH' value='$(EPOCROOT)/epoc32/release/tools2' host='win.*'/>
-		<set name='RELEASEPATH' value='$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM_DIR)' host='lin.*'/>
+		<env name='SBS_STLPORTBINDIR' default='$(EPOCROOT)/epoc32/release/tools2' host='win.*' type='path'/>
+		<env name='SBS_STLPORTBINDIR' default='$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)' host='lin.*' type='path'/>
+		<set name='STLPORTBINDIR' value='$(SBS_STLPORTBINDIR)'/>
+		<set name='STLPORTLIBRARY' value='stlport.5.1'/>
+		<set name='RELEASEPATH' value='$(EPOCROOT)/epoc32/release/tools2' host='win.*' type='path'/>
+		<!-- Tools are 32-bit at the moment, so use the 32-bit directory -->
+		<set name='RELEASEPATH' value='$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)' host='lin.*' type='path'/>
 	</var>
 
 	<var name="t_deb">
@@ -90,6 +93,7 @@
 		<append name='CFLAGS' value='-g'/>
 		<append name='CDEFS' value='_DEBUG'/>
 		<append name='RELEASEPATH' value='/deb' separator=''/>
+		<append name='STLPORTBINDIR' value='/deb' separator=''/>		
 	</var>
 	<alias name="tools2_deb" meaning="tools2_base.t_deb"/>
 	
@@ -100,6 +104,7 @@
 		<append name='CFLAGS' value='-s'/>
 		<append name='CDEFS' value='NDEBUG'/>
 		<append name='RELEASEPATH' value='/rel' separator=''/>
+		<append name='STLPORTBINDIR' value='/rel' separator=''/>		
 	</var>
 	<alias name="tools2_rel" meaning="tools2_base.t_rel"/>
 	
--- a/sbsv2/raptor/lib/config/gcc_x86.xml	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/config/gcc_x86.xml	Mon Nov 29 15:37:06 2010 +0800
@@ -26,6 +26,7 @@
 		<set name="ARCHIVER_CREATE_OPTION" value="cr"/>
 		<set name="ARM_INSTRUCTION_SET" value=""/>
 		<set name="ARMLIBS" value=""/>
+		<set name="ASM_FLAGS" value="-c" />
 		<set name="ASM_OUTPUT_OPTION" value="-o"/>
 		<set name="ASSEMBLER_LISTING_OPTION" value="-S"/>
 		<set name="BPABI_OPTION" value=""/>
--- a/sbsv2/raptor/lib/config/gcce.xml	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/config/gcce.xml	Mon Nov 29 15:37:06 2010 +0800
@@ -21,6 +21,7 @@
 		<set name="ARCHIVER_CREATE_OPTION" value="cr"/>
 		<set name="ARM_INSTRUCTION_SET" value="-marm"/>
 		<set name="ARMLIBS" value=""/>
+		<set name="ASM_FLAGS" value="-c" />
 		<set name="ASM_OUTPUT_OPTION" value="-o"/>
 		<set name="ASSEMBLER_LISTING_OPTION" value="-S"/>
 		<set name="BPABI_OPTION" value=""/>
--- a/sbsv2/raptor/lib/config/interfaces.xml	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/config/interfaces.xml	Mon Nov 29 15:37:06 2010 +0800
@@ -39,6 +39,9 @@
 
 		<!-- per-configuration default interfaces -->
 		<set name="INTERFACE.config" value="Symbian.config.default"/>
+		
+		<!-- per-component interface: blank by default -->
+		<set name="INTERFACE.component" value=""/>
 	</var>
 
 </build>
--- a/sbsv2/raptor/lib/config/locations.xml	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/config/locations.xml	Mon Nov 29 15:37:06 2010 +0800
@@ -9,12 +9,14 @@
 	<var name="hostplatform.locations" host='linux.*'>	
 		<env name='SBS_SLASHBIN' default='/bin'/>
 		<env name='SBS_USRBIN' default='/usr/bin'/>
+		<env name='SBS_GCC_BIN' default='$(SBS_USRBIN)'/>
 				
 		<set name='DOTEXE' value=''/>
-		<set name='GCCPREFIX' value='$(SBS_USRBIN)/'/>
+		<set name='GCCPREFIX' value='$(SBS_GCC_BIN)/'/>
 		<set name='GNUPREFIX' value='$(SBS_SLASHBIN)/'/>
 		
 		<env name='HOSTPLATFORM_DIR' default='linux-i386' />
+		<env name='HOSTPLATFORM32_DIR' default='linux-i386' />
 		<env name='HOSTPLATFORM' default='linux i386'/>
 		
 		<env name='SBS_GNUCPP' default='$(SBS_USRBIN)/cpp' type='tool'/>
--- a/sbsv2/raptor/lib/config/rvct.xml	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/config/rvct.xml	Mon Nov 29 15:37:06 2010 +0800
@@ -20,6 +20,7 @@
 		<set name="AAPCS_OPTION" value="--apcs /inter"/>
 		<set name="ARCHIVER_CREATE_OPTION" value="--create"/>
 		<set name="ARM_INSTRUCTION_SET" value="--arm"/>
+		<set name="ASM_FLAGS" value="" />
 		<set name="ASM_OUTPUT_OPTION" value="-o"/>
 		<set name="ASSEMBLER_LISTING_OPTION" value="-S"/>
 		<set name="BPABI_OPTION" value="--bpabi"/>
--- a/sbsv2/raptor/lib/config/variants.xml	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/config/variants.xml	Mon Nov 29 15:37:06 2010 +0800
@@ -9,10 +9,15 @@
 	<!-- This variant enables building win32 tools in Linux. Tools2 on Linux only -->
 	<var name="win32">
 		<set name='TOOLS2WIN32' value='1'/>
+		<env name='SBS_MINGW_LINUX_BIN' default='/usr/bin'/>
 		<env name='SBS_MINGW_LINUX_PREFIX' default='i586-mingw32msvc'/>
-		<env name='GCC' default='$(SBS_MINGW_LINUX_PREFIX)-g++' type='tool'/>
-		<env name='ARCHIVER' default='$(SBS_MINGW_LINUX_PREFIX)-ar' type='tool'/>
-		<env name='RANLIB' default='$(SBS_MINGW_LINUX_PREFIX)-ranlib' type='tool'/>
+		<env name='GCC' default='$(SBS_MINGW_LINUX_BIN)/$(SBS_MINGW_LINUX_PREFIX)-g++' type='tool'/>
+		<env name='ARCHIVER' default='$(SBS_MINGW_LINUX_BIN)/$(SBS_MINGW_LINUX_PREFIX)-ar' type='tool'/>
+		<env name='RANLIB' default='$(SBS_MINGW_LINUX_BIN)/$(SBS_MINGW_LINUX_PREFIX)-ranlib' type='tool'/>
+		<env name='SBS_STLPORTINCDIR_WIN32' default='$(EPOCINCLUDE)/tools/stlport' type='path'/>
+		<env name='SBS_STLPORTBINDIR_WIN32' default='$(EPOCROOT)/epoc32/release/tools2' type='path'/>
+                <set name='STLPORTBINDIR' value='$(SBS_STLPORTBINDIR_WIN32)/$(VARIANTTYPE)'/>
+		<set name='SYSTEMINCLUDE' value='$(SBS_STLPORTINCDIR_WIN32)'/>
 		<set name='RELEASEPATH' value='$(EPOCROOT)/epoc32/release/tools2/$(VARIANTTYPE)'/>
 		<set name='DOTEXE' value='.exe'/>
 		<set name='PLATMACROS.LINUX' value='$(PLATMACROS.WINDOWS)'/>
--- a/sbsv2/raptor/lib/config/x86.xml	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/config/x86.xml	Mon Nov 29 15:37:06 2010 +0800
@@ -12,7 +12,10 @@
 		<env name="CPPFILT" default="$(GCCPREFIX)c++filt$(DOTEXE)" type="tool"/>
 		<env name="SBS_EFREEZE" default="$(PERL) $(EPOCTOOLS)/efreeze.pl" type="script"/>
 		<set name="EFREEZE" value="$(SBS_EFREEZE)"/>
-		<env name="GENDEF" default="$(PERL) $(EPOCROOT)/epoc32/tools/gendef.pl" type="script"/>
+		<env name="SBS_DEF2DLL" default="$(PERL) $(EPOCTOOLS)/def2dll.pl" type="script"/>
+		<set name="DEF2DLLTOOL" value="$(SBS_DEF2DLL)"/>
+		<env name="SBS_GENDEF" default="$(PERL) $(EPOCTOOLS)/gendef.pl" type="script"/>
+		<set name="GENDEF" value="$(SBS_GENDEF)"/>
 		<env name="SBS_PETRAN" default="$(EPOCTOOLS)/petran$(DOTEXE)" type="tool"/>
 		<set name="PETRAN" value="$(SBS_PETRAN)"/>
 		<env name="SBS_PREPDEF" default="$(PERL) $(EPOCTOOLS)/prepdef.pl" type="script"/>
--- a/sbsv2/raptor/lib/flm/base.xml	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/flm/base.xml	Mon Nov 29 15:37:06 2010 +0800
@@ -100,7 +100,7 @@
 		<param name='SYSTEMINCLUDE'/>
 		<param name='USERINCLUDE'/>
 		<param name='TARGET'/>
-		<param name='TARGET_lower'/>
+		<param name='TARGET_var'/>
 		<param name='TARGETPATH' default=''/>
 		<param name='UID1' default="1000007a"/>
 		<param name='UID2' default='00000000'/>
--- a/sbsv2/raptor/lib/flm/build.flm	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/flm/build.flm	Mon Nov 29 15:37:06 2010 +0800
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of the License "Eclipse Public License v1.0"
@@ -34,13 +34,13 @@
 define doexports
 PP_EXPORTS::
 	$(call startrule,makefile_generation_exports) \
-	$(SBS) --toolcheck=off --export-only $(component_list) $(config_list) -f- -m $(MAKEFILE_PATH).exports $(CLI_OPTIONS)  \
+	$(SBS) --toolcheck=off --export-only $(pp_system_definition) $(config_list) -f- -m $(MAKEFILE_PATH).exports $(CLI_OPTIONS)  \
 	$(call endrule,makefile_generation_exports)
 
 CLEANTARGETS:=$$(CLEANTARGETS) $(MAKEFILE_PATH).exports 
 endef
 
-# Generate makefiles for particular bldinf
+# Generate makefiles for a particular system definition
 # $(1) = source target source target......
 define generate_makefiles
 
@@ -48,7 +48,7 @@
 
 $(MAKEFILE_PATH): $(COMPONENT_PATHS) $(if $(DOEXPORT),| PP_EXPORTS )
 	$(call startrule,makefile_generation) \
-	$(SBS) --noexport --toolcheck=off -n $(CLI_OPTIONS) $(component_list) $(config_list) -m $$@ -f- \
+	$(SBS) --noexport --toolcheck=off -n $(CLI_OPTIONS) $(pp_system_definition) $(config_list) -m $$@ -f- \
 	$(call endrule,makefile_generation)
 
 CLEANTARGETS:=$$(CLEANTARGETS) $(MAKEFILE_PATH) 
@@ -57,9 +57,10 @@
 
 # Create config list for commands
 config_list:=$(addprefix -c ,$(CONFIGS))
-component_list:=$(addprefix -b ,$(COMPONENT_PATHS))
+pp_system_definition:=-s $(PP_SYSTEM_DEFINITION)
 
 $(if $(FLMDEBUG),$(info <debug>build.flm: configlist: $(config_list)</debug>))
+$(if $(FLMDEBUG),$(info <debug>build.flm: pp_system_definition file in use: $(pp_system_definition)</debug>))
 
 # Do exports only if asked. This doesn't work brilliantly in emake
 # since exports are often duplicated in some components - leads to conflicts 
--- a/sbsv2/raptor/lib/flm/build.xml	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/flm/build.xml	Mon Nov 29 15:37:06 2010 +0800
@@ -4,7 +4,7 @@
 	<interface name="build.makefiles" extends="base.flm" flm='build.flm' >
 		<param name='SBS_BUILD_DIR' /> 
 		<param name='DATE' /> 
-		<param name='COMPONENT_PATHS' />
+		<param name='PP_SYSTEM_DEFINITION' />
 		<param name='MAKEFILE_PATH' />
 		<param name='CONFIGS' default=''/>
 		<param name='CLI_OPTIONS' default=''/>
--- a/sbsv2/raptor/lib/flm/e32abiv2.flm	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/flm/e32abiv2.flm	Mon Nov 29 15:37:06 2010 +0800
@@ -371,8 +371,8 @@
     # If unfrozen, .lib files are based on the .def file generated by the final postlink
     $(IMPORTLIBTARGETVERSIONED_LIB): $(if $(EXPORTUNFROZEN),$(E32TARGET),$(PREPPEDDEFFILE))
 	$(call startrule,importlibversioned_abiv1) \
-        if [ -f "$(EPOCROOT)/epoc32/tools/def2dll.pl" -a -f "$(if $(EXPORTUNFROZEN),$(call dblquote,$(GENERATED_DEFFILE)),$(PREPPEDDEFFILE))" ]; then \
-                 $(PERL) $(EPOCROOT)/epoc32/tools/def2dll.pl \
+        if [ -f "$(if $(EXPORTUNFROZEN),$(call dblquote,$(GENERATED_DEFFILE)),$(PREPPEDDEFFILE))" ]; then \
+                 $(DEF2DLLTOOL) \
 		--path=$(IMPORTLIBPATH) \
 		--bldpath=$(INTERMEDIATEPATH) \
 		--import=$(notdir $(basename $(IMPORTLIBTARGETVERSIONED_LIB))) \
@@ -384,7 +384,7 @@
     ifeq ($(EXPLICITVERSION),)
       $(IMPORTLIBTARGET_LIB): $(IMPORTLIBTARGETVERSIONED_LIB)
 	$(call startrule,importlibtarget_abiv1) \
-	if [ -f $(EPOCROOT)/epoc32/tools/def2dll.pl ]; then $(GNUCP) "$$<" "$$@" ; fi \
+	$(GNUCP) "$$<" "$$@" \
 	$(call endrule,importlibtarget_abiv1)
     endif
   endef
@@ -448,7 +448,7 @@
 	   --definput=$$(call dblquote,$(DEFFILE)) \
 	   --dump=a $(if $(POSTLINKER_SUPPORTS_ASMTYPE),$(POSTLINKER_ASM_OPTION),) \
 	   --output=$(call dblquote,$(EXPTARGETASMFILE)) && \
-	$(ASM) $(TARGET_ARCH_OPTION) $(AAPCS_OPTION) $(ASM_OUTPUT_OPTION) $$(call dblquote, $$@) $(EXPTARGETASMFILE) \
+	$(ASM) $(ASM_FLAGS) $(TARGET_ARCH_OPTION) $(AAPCS_OPTION) $(ASM_OUTPUT_OPTION) $$(call dblquote, $$@) $(EXPTARGETASMFILE)  \
 	$(call endrule,expgen)
 endef
 
--- a/sbsv2/raptor/lib/flm/globals.mk	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/flm/globals.mk	Mon Nov 29 15:37:06 2010 +0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of the License "Eclipse Public License v1.0"
@@ -34,7 +34,9 @@
 TOOLPLATFORMDIR:=
 else
 DOTEXE:=
-TOOLPLATFORMDIR:=/$(HOSTPLATFORM_DIR)
+
+# For the time being tools are all 32-bit
+TOOLPLATFORMDIR:=/$(HOSTPLATFORM32_DIR)
 endif
 
 # addglobal(GlobalTargetName)
--- a/sbsv2/raptor/lib/flm/resource.flm	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/flm/resource.flm	Mon Nov 29 15:37:06 2010 +0800
@@ -43,7 +43,6 @@
 else
 RSCDIR:=$(subst //,/,$(EPOCROOT)/epoc32/data)
 endif
-RESBASE:=$(RSCDIR)/$(TARGET_lower)
 
 # Ensure that RELEASABLES and CLEANTARGETS cannot expand indefinitely in successive calls to this flm:
 CLEANTARGETS:=
@@ -64,7 +63,7 @@
 endif
 
 # we create intermediate .rpp and .d files
-INTERBASE_TMP:=$(OUTPUTPATH)/$(TARGET_lower)_$(notdir $(basename $(SOURCE)))
+INTERBASE_TMP:=$(OUTPUTPATH)/$(TARGET_var)_$(notdir $(basename $(SOURCE)))
 
 LANGUAGES:=$(LANGUAGES:SC=sc) # ensure that we don't ever have to worry about case consistency w.r.t languages or get confused into thinking that SC!=sc (which it is)
 LANGUAGES:=$(call uniq,$(LANGUAGES)) # remove any duplicates from the list (usually the result of multiple LANG lists both in and out of START RESOURCE blocks)
@@ -167,7 +166,7 @@
 
         # invoke the macro that creates targets for building resources, once per language
         # For sc we generate $(INTERBASE_TMP).rsc and define LANGUAGE_SC and LANGUAGE_sc.
-        $(foreach L,$(LANGUAGES),$(eval $(call resource.build,$(INTERBASE_TMP).r$(L),$(L),$(TARGET_lower).r$(L))))
+        $(foreach L,$(LANGUAGES),$(eval $(call resource.build,$(INTERBASE_TMP).r$(L),$(L),$(TARGET_var).r$(L))))
 
 
         DEPENDFILE:=$(wildcard $(DEPENDFILENAME))
@@ -186,7 +185,7 @@
     # We tried to copy after running rcomp itself but we still need these
     # targets for the sake of dependencies or, for example, if someone
     # merely adds a new copy when the resource is up-to-date
-    $(foreach L,$(LANGUAGES),$(eval $(call resource.makecopies,$(INTERBASE_TMP).r$(L),$(TARGET_lower).r$(L))))
+    $(foreach L,$(LANGUAGES),$(eval $(call resource.makecopies,$(INTERBASE_TMP).r$(L),$(TARGET_var).r$(L))))
 
   endif
 else
@@ -194,7 +193,7 @@
   # HEADERONLY was specified
   #
   GUARD:=TARGET_$(call sanitise,$(INTERBASE_TMP))_rsg
-  $(if $(FLMDEBUG),$(info <debug>resource.flm: Headeronly $(INTERBASE_TMP) $(TARGET_lower).rsg LANGUAGES:=$(LANGUAGES)</debug>))
+  $(if $(FLMDEBUG),$(info <debug>resource.flm: Headeronly $(INTERBASE_TMP) $(TARGET_var).rsg LANGUAGES:=$(LANGUAGES)</debug>))
 
   ifeq ($($(GUARD)),)
       $(GUARD):=1  
--- a/sbsv2/raptor/lib/flm/romfile.mk	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/flm/romfile.mk	Mon Nov 29 15:37:06 2010 +0800
@@ -13,12 +13,11 @@
 # Description:
 #
 
-EPOC_ROOT:=$(patsubst %/,%,$(EPOCROOT))
-TOBLDINF:=$(dir $(subst :,,$(subst $(EPOC_ROOT)/,,$(COMPONENT_META))))
+TOBLDINF:=$(dir $(subst :,,$(subst $(EPOCROOT)/,,$(COMPONENT_META))))
 
 ifeq ($(ROMFILE_$(call sanitise,$(TOBLDINF)$(TARGET).$(REQUESTEDTARGETEXT))),)
     ROMFILE_$(call sanitise,$(TOBLDINF)$(TARGET).$(REQUESTEDTARGETEXT)):=1
-    ROMDIR:=$(EPOC_ROOT)/epoc32/rom/$(TOBLDINF)
+    ROMDIR:=$(EPOCROOT)/epoc32/rom/$(TOBLDINF)
 
     # Default values
     ROMFILETYPE:=file
@@ -82,10 +81,10 @@
     	# Add 'TEST' to the .iby filename
     	ROMTEST:=test
         ifeq ($(TEST_OPTION),BOTH)
-            DATATEXT:="data=/epoc32/data/z/test/$(MODULE)/$(VARIANTPLATFORM).auto.bat test/$(MODULE).auto.bat"\n"data=/epoc32/data/z/test/$(MODULE)/$(VARIANTPLATFORM).manual.bat test/$(MODULE).manual.bat"
+            DATATEXT:="data=/epoc32/data/z/test/$(MODULE)/$(VARIANTPLATFORM).auto.bat test/$(VARIANTPLATFORM).auto.bat"\n"data=/epoc32/data/z/test/$(MODULE)/$(VARIANTPLATFORM).manual.bat test/$(VARIANTPLATFORM).manual.bat"
         else
             ifneq ($(TEST_OPTION),NONE)
-                DATATEXT:="data=/epoc32/data/z/test/$(MODULE)/$(VARIANTPLATFORM).$(TEST_OPTION).bat test/$(MODULE).$(TEST_OPTION).bat"
+                DATATEXT:="data=/epoc32/data/z/test/$(MODULE)/$(VARIANTPLATFORM).$(TEST_OPTION).bat test/$(VARIANTPLATFORM).$(TEST_OPTION).bat"
             endif
         endif
     endif
@@ -132,7 +131,7 @@
 ROMFILE::
 	$(call startrule,rombuild) \
 	$(GNUMKDIR) -p $(ROMDIR) \
-	$(if $(ROMFILE_CREATED_$(TOBLDINF)),,&& echo -e "// $(subst $(EPOC_ROOT)/,,$(ROMFILENAME))\n//\n$(DATATEXT)" > $(ROMFILENAME)) \
+	$(if $(ROMFILE_CREATED_$(TOBLDINF)),,&& echo -e "// $(subst $(EPOCROOT)/,,$(ROMFILENAME))\n//\n$(DATATEXT)" > $(ROMFILENAME)) \
 	$(if $(BUILDROMTARGET),&& echo "$(ROMFILETYPE)=/epoc32/release/##$(ABIDIR)##/##BUILD##/$(TARGET)$(if $(EXPLICITVERSION),{$(VERSIONHEX)},).$(REQUESTEDTARGETEXT)   $(1)$(ROMDECORATIONS)" >> $(ROMFILENAME)) \
 	$(if $(RAMTARGET),&& echo "$(ROMFILETYPE_RAM)=/epoc32/release/##$(ABIDIR)##/##BUILD##/$(TARGET)$(if $(EXPLICITVERSION),{$(VERSIONHEX)},).$(REQUESTEDTARGETEXT)   $(ROMPATH_RAM)$(ROMFILE_RAM)$(ROMDECORATIONS_RAM)" >> $(ROMFILENAME)) \
 	$(call endrule,buildromfiletarget)
--- a/sbsv2/raptor/lib/flm/standard.xml	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/flm/standard.xml	Mon Nov 29 15:37:06 2010 +0800
@@ -41,7 +41,7 @@
 		<param name='SECUREID' default=''/>
 		<param name='SOURCE' default=''/>
 		<param name='TARGET'/>
-		<param name='TARGET_lower'/>
+		<param name='TARGET_var'/>
 		<param name='TARGETPATH' default=''/>
 		<param name='LTCG' default=''/>
 		<param name='LTCG_OPTION' default='--ltcg'/>
@@ -88,6 +88,7 @@
 		<param name='DEFAULT_SYMBIAN_NEWLIB'/>
 		<param name='CHECKLIB'/>
 		<param name='ASM'/>
+		<param name='ASM_FLAGS'/>
 		<param name='ASM_OUTPUT_OPTION'/>
 		<param name='ARM_INSTRUCTION_SET'/>
 		<param name='THUMB_INSTRUCTION_SET'/>
@@ -112,6 +113,7 @@
 		<param name='CREATEVMAPCPP'/>
 		<param name='DEBUG_FORMAT'/>
 		<param name='DEBUG_INFO'/>
+		<param name='DEF2DLLTOOL'/>
 		<param name='DEFGENTOOL'/>
 		<param name='DEPEND_OPTION'/>
 		<param name='EFREEZE'/>
--- a/sbsv2/raptor/lib/flm/tools.xml	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/flm/tools.xml	Mon Nov 29 15:37:06 2010 +0800
@@ -22,6 +22,9 @@
 		<param name='OUTPUTPATH'/>
 		<param name='VARIANTPLATFORM'/>
 		<param name='PLATFORM' default='$(VARIANTPLATFORM)'/>
+		<param name='LIBRARYPATH' default=''/>
+		<param name='STLPORTBINDIR' default=''/>
+		<param name='STLPORTLIBRARY' default=''/>
 		<param name='RELEASEPATH'/>
 		<param name='SOURCE'/>
 		<param name='SYSTEMINCLUDE' default=''/>
--- a/sbsv2/raptor/lib/flm/tools2exe.flm	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/lib/flm/tools2exe.flm	Mon Nov 29 15:37:06 2010 +0800
@@ -44,14 +44,19 @@
 include $(FLMHOME)/tools2common.flm
 
 ## Static libraries
+STATICLIBS:=
 ifneq ($(STATICLIBRARY),)
 STATICLIBS:=$(patsubst %,$(RELEASEPATH)/lib%.a,$(STATICLIBRARY))
-LLIBS:=$(OPT.L)"$(RELEASEPATH)" $(patsubst %,$(OPT.l)%,$(STATICLIBRARY))
-#
+endif
+
+ifneq ($(STLPORTLIBRARY),)
+STATICLIBS:=$(STATICLIBS) $(STLPORTBINDIR)/lib$(STLPORTLIBRARY).a
+endif
+
+# System dynamic libraries (e.g. pthreads)
+LLIBS:=
 ifneq ($(SYSTEMLIBS),)
-LLIBS:=$(LLIBS) $(patsubst %,$(OPT.l)%,$(SYSTEMLIBS))
-endif
-#
+LLIBS:=$(patsubst %,$(OPT.l)%,$(SYSTEMLIBS))
 endif
 
 ## Link executable
@@ -59,7 +64,7 @@
 define tools2linkexe
 $(EXETARGET): $(OBJECTFILES) $(STATICLIBS)
 	$(call startrule,tools2linkexe) \
-	$(LINKER) $(CFLAGS) $(LFLAGS) $(OPT.O)"$(EXETARGET)" $(call dblquote,$(OBJECTFILES)) $(LLIBS) $(LINKER_OPTIONS) \
+	$(LINKER) $(CFLAGS) $(LFLAGS) $(OPT.O)"$(EXETARGET)" $(call dblquote,$(OBJECTFILES)) $(STATICLIBS) $(LLIBS) $(LINKER_OPTIONS) \
 	$(if $(SAVESPACE),; $(GNURM) -rf $(OUTPUTPATH); true,) \
 	$(call endrule,tools2linkexe)
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/notes/filter_exes.txt	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,42 @@
+Use the filter_exes filter to generate a set of files listing the executables
+created in a build.  A separate file will be created for each layer name and
+each configuration containing executable files.  The filter can be run on an
+existing log file as follows:
+
+sbs_filter --filter=filter_exes < logfile
+where 'logfile' is the name of the logfile you want to analyse.
+
+By default it will create the files in the current directory, named
+'<layer>_<config>.txt' e.g. 'layerone_armv5_urel.txt'.  If layers are not in
+use (e.g. the build was not based on a system definition) the layer name used
+will be 'nolayer' - e.g. 'nolayer_armv5_udeb.txt'.
+
+The location for output files can be overridden using the 'output' argument.
+To limit its operation to specified layers or configs, the 'layer' and 'config'
+arguments can be supplied, multiple times if necessary:
+
+sbs_filter --filter=filter_exes[output=mydir,layer=layerone,layer=layertwo,config=armv5_urel] < logfile
+
+This will search for executables generated from either 'layerone' or 'layertwo'
+components which were also build for armv5_urel.  The filter will record an
+executable if it matches any of the layers specified and also was built for any
+of the configs specified.
+
+The files contain a list of filenames with no paths and no other information, 
+for example:
+
+HelloWorld.exe
+Dummy.exe
+epoc.exe
+[...]
+
+A file will only be produced if there are any filenames to go into it.  The
+filter will report on any files that have been created e.g:
+
+Wrote 242 file(s) into layerone_armv5_urel.txt
+Write 45 file(s) into layertwo_armv5_urel.txt
+
+Note that argument names may be abbreviated e.g.
+
+sbs_filter --filter=filter_exes[o=mydir,l=layerone,c=armv5_urel] < logfile
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/notes/lowercasing_for_resource.txt	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,16 @@
+Raptor used to generate resource rsg files in lowercase, regardless what was specified 
+in mmp file. That was incompatible with qmake-generated meta data, and caused build errors
+for Qt projects in Linux.
+
+So Raptor is changed to generate rsg files case sensitively according to mmp files. 
+That could cause build errors on Linux if the case in meta data did not match the real case, 
+and people should fix case issues in their source code and metadata, and keep case consistent.
+
+Because this change could stop people building their code, option "--use-rsg-casefolding"
+is provided for temparary use, which tolerates case issues so people could continue to build 
+their code on Linux before they fixed all of them. However, they should not use this option 
+as a permanent work around.
+
+Usage: By default resource files are not case folding, to enable it use option "--use-rsg-casefolding"
+
+This does not affect build on Windows.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/notes/per_component_flm.txt	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,20 @@
+It is possible to specify an interface (and therefore an FLM) to be used
+for each component (bld.inf) in a build in addition to the normal target
+FLMs used to create the binaries.
+
+This is done by setting the variable "INTERFACE.component" in the build
+configuration to the name of the required interface.
+
+Operations can then be performed on a per-component basis. An example of
+how to use this can be seen in the test file,
+
+$SBS_HOME/test/smoke_suite/flm_extension.py
+
+which uses the following files to set-up and perform a "documenting" build,
+
+$SBS_HOME/test/smoke_suite/test_resources/docs/docs_build.xml
+$SBS_HOME/test/smoke_suite/test_resources/docs/component.flm
+$SBS_HOME/test/smoke_suite/test_resources/docs/target.flm
+
+By default the variable "INTERFACE.component" is set to "" and no extra FLM
+is included.
--- a/sbsv2/raptor/notes/tools_env_vars.txt	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/notes/tools_env_vars.txt	Mon Nov 29 15:37:06 2010 +0800
@@ -7,19 +7,44 @@
 SBS_EPOCTOOLS       Directory for epoc32 tools; defaults to $EPOCROOT/epoc32/tools
                     Changes the default locations for all of the following tools.
 SBS_CHECKLIB        Full path to checklib program
+SBS_DEF2DLL         perl, followed by full path to def2dll.pl
 SBS_EFREEZE         perl, followed by full path to efreeze.pl
 SBS_ELF2E32         Full path to elf2e32 program
+SBS_GENDEF          perl, followed by full path to gendef.pl
+SBS_MAKEDEF         perl, followed by full path to makedef.pl
+SBS_PETRAN          perl, followed by full path to petran.pl
 SBS_PREPDEF         perl, followed by full path to prepdef.pl
 SBS_RCOMP           Full path to rcomp program
+SBS_SYMLOOKUPUTIL   perl, followed by full path to sym_lkup_util.pl
 SBS_TRANASM         perl, followed by full path to tranasm.pl
-SBS_MAKEDEF         perl, followed by full path to makedef.pl
-SBS_PETRAN          perl, followed by full path to petran.pl
-SBS_SYMLOOKUPUTIL   perl, followed by full path to sym_lkup_util.pl
+
+SBS_GCC_BIN         Linux only: full path to GCC and associated tools 
+SBS_MINGW_LINUX_BIN Linux only: location of MINGW tools for Linux-hosted 
+	            cross-compilation of Win32 tools2 targets
 SBS_SLASHBIN        Linux only: location of /bin, i.e. an alternative location for
                     GCC and associated tools
 SBS_USRBIN          Linux only: location of /usr/bin, i.e. an alternative location 
                     for Gnu tools such as the Core Utils
 
+SBS_STLPORTINCDIR         Location of STLport headers files (tools2 builds only)
+SBS_STLPORTBINDIR         Location of STLport library (tools2 builds only). 
+                          Assumes that there is a "rel" and "deb" directory
+                          immediately under this directory containing the
+                          STLport library (release and debug version 
+                          respectively).
+SBS_STLPORTINCDIR_WIN32   Location of STLport headers files for Linux-hosted 
+                          cross-compilation of Win32 tools2 targets. Only 
+                          applicable when using the "win32" variant, 
+                          i.e. "tools2.win32"
+SBS_STLPORTBINDIR_WIN32   Location of STLport library for Linux-hosted 
+                          cross-compilation of Win32 tools2 targets. Only 
+                          applicable when using the "win32" variant, 
+                          i.e. "tools2.win32". 
+                          Assumes that there is a "rel" and "deb" directory
+                          immediately under this directory containing the
+                          STLport library (release and debug version 
+                          respectively).
+
 In the case Perl scripts (.pl files), "perl" can be replaced with the full path to 
 the perl program.
 
@@ -28,6 +53,7 @@
 CHECKLIB
 EFREEZE
 ELF2E32
+GENDEF
 MAKEDEF
 PETRAN
 PREPDEF
@@ -35,3 +61,4 @@
 TRANASM
 
 which are no longer in use.
+
--- a/sbsv2/raptor/python/filter_interface.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/python/filter_interface.py	Mon Nov 29 15:37:06 2010 +0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of the License "Eclipse Public License v1.0"
@@ -36,6 +36,53 @@
 	def formatWarning(self, message):
 		return "sbs: warning: " + message + "\n"	
 
+	def parseNamedParams(self, names, params):
+		''' Match named parameters e.g. ['a=b','c=d'] against a list of expected
+		names.  Allow for abbreviations.
+		'''
+		r = {}
+		
+		# Shorten all the names so they match abbreviations
+		shortnames = []
+
+		for name in names:
+			shortname = ""
+			conflict = True
+			while len(shortname)<len(name) and conflict:
+				shortname+=name[len(shortname)]
+				conflict = False
+				othernames = names[:] # Copy
+				othernames.remove(name)
+				for othername in othernames:
+					if othername.startswith(shortname):
+						conflict = True
+						break
+				if conflict == False:
+					shortnames.append((shortname,name))
+					r[name] = [] # Prime the hash key for this param
+			if conflict:
+				raise KeyError("Parameter name '{0}' duplicated".format(name))
+
+		# Parse the params
+		for param in params:
+			if '=' in param:
+				(key,value) = param.split('=')
+				matched = False
+				for (shortname, name) in shortnames:
+					if key.strip().startswith(shortname):
+						r[name].append(value.strip())
+						matched = True
+						break
+				if not matched:
+					raise ValueError("Named parameter '{0}' not valid in filter {1}".format(key,self.__class__.__name__))
+			else:
+				# Unnamed arg
+				if not '' in names:
+					raise ValueError("All parameters to the {0} filter must be named".format(self.__class__.__name__))
+				else:
+					r[''].append(param.strip())
+		return r	
+			
 import sys
 import xml.sax
 
@@ -82,29 +129,20 @@
 		"initialise"
 		
 		self.params = params
+
+		self.parser = xml.sax.make_parser(['xml.sax.expatreader'])
+		self.parser.setContentHandler(self)
+		self.parser.setErrorHandler(self)
+		
 		self.ok = True
-		try:
-			self.parser = xml.sax.make_parser(['xml.sax.expatreader'])
-			self.parser.setContentHandler(self)
-			self.parser.setErrorHandler(self)
+
+		return self.ok
 			
-		except Exception, ex:
-			sys.stderr.write(self.formatError(str(ex)))
-			self.ok = False
-		
-		return self.ok
-	
-		
 	def write(self, text):
 		"process some log text"
-		try:
+		if self.ok:
 			self.parser.feed(text)
-		except Exception, ex:
-			sys.stderr.write(self.formatError(str(ex)))
-			self.ok = False
-				
 		return self.ok
-	
 
 	def close(self):
 		"finish off"
@@ -116,5 +154,107 @@
 			
 		return self.ok
 	
+class RaptorLogNotValid(Exception):
+	pass
+
+class PerRecipeFilter(FilterSAX):
+	# Define this in your class
+	def handleRecipe(self):
+		# These variables are available to you:
+		# self.name
+		# self.target
+		# self.host
+		# self.layer
+		# self.component
+		# self.bldinf
+		# self.mmp
+		# self.config
+		# self.platform
+		# self.phase
+		# self.source
+		# self.prereqs
+		# self.text
+		# self.exit
+		# self.attempt (final attempt number)
+		# self.flags
+		# self.start
+		# self.elapsed
+
+		return False
+	
+	# Helper functions
+	def formatData(self, key, hash='self'):
+		'''Output prettifier - return the attribute value, or just return 'undef' if the attribute is not set.'''
+
+		if hash=='self':
+			hash=self.__dict__
+		if hash.has_key(key):
+			return hash[key]
+		else:
+			return 'undef'
+	
+	# data keys
+	recipeData = set(['name','target','host','layer','component','bldinf','mmp','config','platform','phase','source','prereqs'])
+	statusData = set(['exit','attempt','flags'])
+	timeData = set(['start','elapsed'])
+
+	# methods from the SAX parser
+	def startDocument(self):
+		self.inRecipe = False
+		self.text = ""
+
+	def startElement(self, name, attributes):
+		if name == "recipe":
+			if self.inRecipe:
+				self.error(RaptorLogNotValid("Nested recipes; {0} recipe for {1} inside {2} recipe for {3}".format(self.formatData('name', hash=attributes), self.formatData('target',hash=attributes), self.formatData('name'), self.formatData('target') )))
+			else:
+				self.inRecipe = True
+				self.__setHashElements(attributes, self.__dict__, self.recipeData )		
+		elif self.inRecipe:
+			if name == "status":
+				self.__setHashElements(attributes, self.__dict__, self.statusData)
+			elif name == "time":
+				self.__setHashElements(attributes, self.__dict__, self.timeData)
+			else:
+				self.error(RaptorLogNotValid("Unexpected <{0}> tag in {1} recipe for {2}".format(name, self.formatData('name'), self.formatData('target'))))
+	
+	def endElement(self, name):
+		if name == "recipe":
+			if not self.inRecipe:
+				self.error(RaptorLogNotValid("Extra recipe close tag"))
+			else:
+				if not self.handleRecipe():
+					self.error(RaptorLogNotValid('Handling of {0} recipe for {1} failed'.format(self.formatData('name'), self.formatData('target'))))
+				self.inRecipe = False
+				
+				self.__delData(self.recipeData|self.statusData|self.timeData)
+				self.text=""
+
+	def characters(self, char):
+		if self.inRecipe:
+			self.text += char
+
+	def error(self, exception):
+		"the parse found an error which is (possibly) recoverable"
+		pass
+		
+	def fatalError(self, exception):
+		"the parser thinks an error occurred which should stop everything"
+		pass
+		
+	def warning(self, exception):
+		"the parser found something to complain about that might not matter"
+		pass
+
+	# Private methods
+	def __setHashElements(self, fro, to, keys):
+		for key in keys:
+			if fro.has_key(key):
+				to[key] = fro[key]
+
+	def __delData(self, keys):
+		for key in keys:
+			if self.__dict__.has_key(key):
+				del self.__dict__[key]
 
 # the end
--- a/sbsv2/raptor/python/filter_list.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/python/filter_list.py	Mon Nov 29 15:37:06 2010 +0800
@@ -116,9 +116,16 @@
 			# if the filter exists and is a valid filter use it
 			if f.lower() in filterdict:
 				if params:
-					self.filters.append(filterdict[f.lower()](params))
+					try:
+						self.filters.append(filterdict[f.lower()](params))
+					except TypeError:
+						raise ValueError("requested filter does not take any parameters")
 				else:
-					self.filters.append(filterdict[f.lower()]())
+					try:
+						self.filters.append(filterdict[f.lower()]())
+					except TypeError:
+						# Claims to need parameters - pass in an empty list
+						self.filters.append(filterdict[f.lower()]([]))
 			else:
 				# record missing filters
 				unfound.append(f)
@@ -132,12 +139,17 @@
 		else:
 			self.out=[]
 			for filter in self.filters:
-				if filter.open(raptor_instance):
+				try:
+					ok = filter.open(raptor_instance)
+				except Exception, e:
+					sys.stderr.write(filter.formatError(str(e)))
+					ok = False
+
+				if ok:
 					self.out.append(filter)
 				else:
 					sys.stderr.write(str(raptor.name) + \
 							": error: Cannot open filter: %s\n" % str(filter))
-					ok = False
 					
 			if self.out == []:
 				sys.stderr.write(str(raptor.name) + \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/python/plugins/filter_exes.py	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,112 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+# Filter to write out a list of executable files built per sysdef layer
+
+import filter_interface
+import sys
+import os.path
+import os
+
+class Filter_EXEs(filter_interface.PerRecipeFilter):
+	def __init__(self, params):
+		super(Filter_EXEs, self).__init__()
+		
+		try:
+			params = self.parseNamedParams(['layer','config','output'],params)
+			# e.g. ['layer=a','config=armv5_udeb','config=armv5_urel']
+		except ValueError:
+			raise ValueError("All parameters to the Filter_EXEs filter must be labelled.  Valid labels are 'layer','config' and 'output'.")
+		else:
+			self.layers = params['layer']
+			self.configs = params['config']
+			output = params['output']
+			if len(output) > 1:
+				raise ValueError("Only one 'output' parameter to the Filter_EXEs filter is permissible.")
+			if len(output) > 0:
+				self.output = output[0]
+
+				if not os.path.isdir(self.output):
+					os.makedirs(self.output)
+
+			self.unmatchedlayers = self.layers[:] # [:] = Shallow copy, not ref
+			self.unmatchedconfigs = self.configs[:]
+			self.fileswritten = {}
+
+	def handleRecipe(self):
+		if (self.name == 'linkandpostlink' or self.name == 'win32simplelink') and self.target.endswith('.exe'):
+			if ((len(self.configs) == 0 or (self.config in self.configs)) and
+			  (len(self.layers) == 0 or (self.layer in self.layers))):
+				layer = self.formatData('layer') or 'nolayer'
+				config = self.formatData('config') or 'noconfig'
+				filename = "{0}_{1}.txt".format(layer,config)
+				try:
+					filename = os.path.join(self.output, filename)
+				except AttributeError:
+					pass # No output path to join
+
+				if not filename in self.fileswritten:
+					newfilename = filename
+					if os.path.exists(filename):
+						# Oops - file already exists
+						index = 2 # Start with .txt2
+						while os.path.exists(filename+str(index)):
+							index += 1
+						newfilename = filename+str(index)
+					file = open(newfilename,"w")
+					self.fileswritten[filename] = (newfilename, 1, file)
+				else:
+					(realfilename, num, file) = self.fileswritten[filename]
+					self.fileswritten[filename] = (realfilename, num+1, file)
+
+				file.write(os.path.basename(self.target)+"\n")
+
+				try:
+					self.unmatchedlayers.remove(self.layer)
+				except ValueError:
+					# Already removed
+					pass
+				try:
+					self.unmatchedconfigs.remove(self.config)
+				except ValueError:
+					# Already removed
+					pass
+		return True
+
+	def summary(self):
+		if len(self.layers) > 0:
+			for layer in self.unmatchedlayers:
+				self.info("Layer '{0}' did not match any EXEs\n".format(layer))
+		if len(self.configs) > 0:
+			for config in self.unmatchedconfigs:
+				self.info("Config '{0}' did not match any EXEs\n".format(config))
+		for (filename, num, file) in self.fileswritten.values():
+			file.close()
+			self.info("Wrote {0} file(s) into {1}\n".format(num, filename) )
+
+	def error(self,exception):
+		sys.stderr.write(self.formatError(str(exception)))
+
+	def fatalError(self,exception):
+		for (realfilename, num,file) in self.fileswritten.values():
+			file.close()
+
+		raise(exception)
+
+	def warning(self,exception):
+		sys.stderr.write(str(exception))
+
+	def info(self, text):
+		sys.stdout.write(text)
+
--- a/sbsv2/raptor/python/plugins/filter_html.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/python/plugins/filter_html.py	Mon Nov 29 15:37:06 2010 +0800
@@ -827,4 +827,4 @@
 		self.text = ""
 		self.time = 0.0
 		
-# the end
\ No newline at end of file
+# the end
--- a/sbsv2/raptor/python/plugins/filter_terminal.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/python/plugins/filter_terminal.py	Mon Nov 29 15:37:06 2010 +0800
@@ -24,6 +24,7 @@
 import os.path
 import re
 
+
 class Recipe(object):
 	"""State machine that parses a recipe
 	"""
@@ -100,7 +101,6 @@
 Recipe.recipes.append(FreezeRecipe)
 
 
-
 class FilterTerminal(filter_interface.Filter):
 
 	attribute_re = re.compile("([a-z][a-z0-9]*)='([^']*)'",re.I)
@@ -221,15 +221,23 @@
 			end = text.rfind("<")
 			self.err_count += 1
 			if not self.analyseonly:
-				sys.stderr.write(str(raptor.name) + ": error: %s\n" \
-						% text[(start + 1):end])
+				m = FilterTerminal.attribute_re.findall(text, 0, start)
+				component = ""
+				for i in m:
+					if i[0] == 'bldinf':
+						component = " (component " + i[1] + ")"
+				sys.stderr.write(self.formatError(text[(start + 1):end] + component))
 		elif text.startswith("<warning"):
 			start = text.find(">")
 			end = text.rfind("<")
 			self.warn_count += 1
 			if not self.analyseonly:
-				sys.stdout.write(str(raptor.name) + ": warning: %s\n" \
-					% text[(start + 1):end])
+				m = FilterTerminal.attribute_re.findall(text, 0, start)
+				component = ""
+				for i in m:
+					if i[0] == 'bldinf':
+						component = " (component " + i[1] + ")"
+				sys.stdout.write(self.formatWarning(text[(start + 1):end] + component))
 		elif text.startswith("<status "):
 			# detect the status report from a recipe
 			if text.find('failed') != -1:
--- a/sbsv2/raptor/python/raptor.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/python/raptor.py	Mon Nov 29 15:37:06 2010 +0800
@@ -47,12 +47,13 @@
 from xml.sax.saxutils import escape
 
 
-if not "HOSTPLATFORM" in os.environ or not "HOSTPLATFORM_DIR" in os.environ:
-	print "Error: HOSTPLATFORM and HOSTPLATFORM_DIR must be set in the environment (this is usually done automatically by the startup script)."
+if not "HOSTPLATFORM" in os.environ or not "HOSTPLATFORM_DIR" in os.environ or not "HOSTPLATFORM32_DIR" in os.environ:
+	print "Error: HOSTPLATFORM, HOSTPLATFORM_DIR and HOSTPLATFORM32_DIR must be set in the environment (this is usually done automatically by the startup script)."
 	sys.exit(1)
 
 hostplatform = os.environ["HOSTPLATFORM"].split(" ")
 hostplatform_dir = os.environ["HOSTPLATFORM_DIR"]
+hostplatform32_dir = os.environ["HOSTPLATFORM32_DIR"]
 
 # defaults can use EPOCROOT
 
@@ -238,7 +239,7 @@
 class Component(ModelNode):
 	"""A group of projects or, in symbian-speak, a bld.inf.
 	"""
-	def __init__(self, filename, layername="", componentname=""):
+	def __init__(self, filename, layername="commandline", componentname=""):
 		super(Component,self).__init__(filename)
 		# Assume that components are specified in bld.inf files for now
 		# One day that tyranny might end.
@@ -363,7 +364,7 @@
 
 		build.Info("Parallel Parsing: bld.infs split into %d blocks\n", number_blocks)
 		# Cause the binding makefiles to have the toplevel makefile's
-		# name.  The bindee's have __pp appended.
+		# name.  The bindee's have _pp appended.
 		tm = build.topMakefile.Absolute()
 		binding_makefiles = raptor_makefile.MakefileSet(str(tm.Dir()), build.maker.selectors, makefiles=None, filenamebase=str(tm.File()))
 		build.topMakefile = generic_path.Path(str(build.topMakefile) + "_pp")
@@ -372,21 +373,34 @@
 		for block in component_blocks:
 			loop_number += 1
 			specNode = raptor_data.Specification("metadata_" + self.name)
+			
+			# root path for generated sysdef files and their partnering makefiles
+			makefile_path = str(build.topMakefile) + "_" + str(loop_number)
 
-			componentList = " ".join([str(c.bldinf_filename) for c in block])
+			try:
+				os.unlink(makefile_path) # until we have dependencies working properly
+			except Exception:
+				pass
+			
+			pp_system_definition = makefile_path + ".sysdef.xml"
+			
+			try:
+				sys_def_writer = raptor_xml.SystemModel(build, aDoRead=False)
+				for component in block:
+					sys_def_writer.AddComponent(component)
+				sys_def_writer.Write(pp_system_definition)
+				build.Debug("Wrote intermediate parallel-parsing system definition file " + pp_system_definition)
+			except Exception as e:
+				build.Error("Failed to write intermediate parallel-parsing system definition file " + pp_system_definition)
+				raise
 
 
 			configList = " ".join([c.name for c in self.configs if c.name != "build" ])
 
-			makefile_path = str(build.topMakefile) + "_" + str(loop_number)
-			try:
-				os.unlink(makefile_path) # until we have dependencies working properly
-			except Exception:
-				pass
 
 			# add some basic data in a component-wide variant
 			var = raptor_data.Variant()
-			var.AddOperation(raptor_data.Set("COMPONENT_PATHS", componentList))
+			var.AddOperation(raptor_data.Set("PP_SYSTEM_DEFINITION", pp_system_definition))
 			var.AddOperation(raptor_data.Set("MAKEFILE_PATH", makefile_path))
 			var.AddOperation(raptor_data.Set("CONFIGS", configList))
 			var.AddOperation(raptor_data.Set("CLI_OPTIONS", cli_options))
@@ -528,6 +542,7 @@
 		self.doCheck = False
 		self.doWhat = False
 		self.doParallelParsing = False
+		self.doCaseFolding_rsg = False
 		self.mission = Raptor.M_BUILD
 
 		# what platform and filesystem are we running on?
@@ -712,6 +727,10 @@
 
 		return True
 
+	def SetRsgCaseFolding(self, TrueOrFalse):
+		self.doCaseFolding_rsg = TrueOrFalse
+		return True
+
 	def AddProject(self, projectName):
 		self.projects.add(projectName.lower())
 		return True
@@ -905,22 +924,30 @@
 
 		return self.toolset.check(evaluator, configname)
 
-
 	def CheckConfigs(self, configs):
 		"""	Tool checking for all the buildable configurations
 			NB. We are allowed to use different tool versions for different
 			configurations."""
 
 		tools_ok = True
+		tool_problems = []
 		for b in configs:
 			self.Debug("Tool check for %s", b.name)
-			evaluator = self.GetEvaluator(None, b, gathertools=True)
-			tools_ok = tools_ok and self.CheckToolset(evaluator, b.name)
+			config_ok = False  #default
+			try:
+				evaluator = self.GetEvaluator(None, b, gathertools=True)
+				config_ok = self.CheckToolset(evaluator, b.name)
+			except raptor_data.UninitialisedVariableException,e:
+				tool_problems.append(b.name)
+				self.Error("{0} is a bad configuration: {1}".format(b.name,str(e)))
+
+			tools_ok = tools_ok and config_ok
+
+		if len(tool_problems) > 0:
+			self.FatalError("Build stopped because the following requested configurations are incomplete or invalid: {0}".format(", ".join(tool_problems)))
 
 		return tools_ok
 
-
-
 	def GatherSysModelLayers(self, systemModel, systemDefinitionRequestedLayers):
 		"""Return a list of lists of components to be built.
 
--- a/sbsv2/raptor/python/raptor_cli.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/python/raptor_cli.py	Mon Nov 29 15:37:06 2010 +0800
@@ -167,6 +167,12 @@
 					"off" - Parse bld.infs serially 
 				     """)
 
+parser.add_option("--use-rsg-casefolding", action="store_true", dest="resource_rsg_casefolding",
+				help="""This option should not be used permanently to work around case issues on Linux. Case issues need to be fixed and this option should only be used before that has been done.
+
+					Generate resource rsg files in lowercase regardless what is specified in mmp file.
+				     """)
+
 parser.add_option("-v","--version",action="store_true",dest="version",
 				help="Print the version number and exit.")
 
@@ -245,6 +251,7 @@
 				 'source_target' : Raptor.AddSourceTarget,
 				 'command_file' : CommandFile,
 				 'parallel_parsing' : Raptor.SetParallelParsing,
+				 'resource_rsg_casefolding' : Raptor.SetRsgCaseFolding,
 			 	 'version' : Raptor.PrintVersion
 				}
 
--- a/sbsv2/raptor/python/raptor_make.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/python/raptor_make.py	Mon Nov 29 15:37:06 2010 +0800
@@ -76,6 +76,8 @@
 	inOutput = False
 
 	buildid = ""
+	duration = "unknown"
+	availability = "unknown"
 	for line in af:
 		line = line.rstrip("\n\r")
 
@@ -186,16 +188,19 @@
 			# console output is lost.  The annotation file has a copy of this
 			# output in the "parse" job and it turns out to be uncorrupted.
 			self.copyLogFromAnnoFile = (evaluator.Get("copylogfromannofile") == "true")
-			self.annoFileName = None
+			self.emakeCm = (len([opt for opt in self.raptor.makeOptions if opt.startswith("--emake-cm")]) > 0)
+			self.annoFileName = None # store the anno file name
 
 			if self.copyLogFromAnnoFile:
-				for o in self.raptor.makeOptions:
-					self.annoFileName = string_following("--emake-annofile=", o)
-					if self.annoFileName:
-						self.raptor.Info("annofile: " + o)
-
-				if not self.annoFileName:
-					self.raptor.Info("Cannot copy log from annotation file as no annotation filename was specified via the option --mo=--emake-annofile=<filename>")
+				try:
+					self.annoFileName = string_following("--emake-annofile=", [opt for opt in self.raptor.makeOptions if opt.startswith("--emake-annofile")][0])
+					self.raptor.Info("annofile: " + self.annoFileName)
+				except IndexError, bad_index:
+					cannot_use_anno_msg = "Cannot copy log from annotation file as no annotation filename was specified via the option --mo=--emake-annofile=<filename>"
+					if self.emakeCm:
+						self.raptor.Error(cannot_use_anno_msg) # Only an error if requested use of cm
+					else:
+						self.raptor.Info(cannot_use_anno_msg)
 					self.copyLogFromAnnoFile = False
 
 			# buffering
@@ -284,6 +289,7 @@
 
 HOSTPLATFORM:=%s
 HOSTPLATFORM_DIR:=%s
+HOSTPLATFORM32_DIR:=%s
 OSTYPE:=%s
 FLMHOME:=%s
 SHELL:=%s
@@ -298,6 +304,7 @@
 """ 		% (  raptor.name, raptor_version.fullversion(),
 			 " ".join(raptor.hostplatform),
 			 raptor.hostplatform_dir,
+			 raptor.hostplatform32_dir,
 			 self.raptor.filesystem,
 			 str(self.raptor.systemFLM),
 			 self.shellpath,
@@ -482,7 +489,7 @@
 				guard = "guard_" + hash
 
 		# generate the call to the FLM
-		if iface is not None:
+		if iface is not None and not dupe:
 			makefileset.addCall(spec.name, config.name, iface.name, useAllInterfaces, iface.GetFLMIncludePath(self.raptor.cache), parameters, guard)
 
 		# recursive includes
--- a/sbsv2/raptor/python/raptor_meta.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/python/raptor_meta.py	Mon Nov 29 15:37:06 2010 +0800
@@ -1440,7 +1440,12 @@
 			self.__debug("Set REQUESTEDTARGETEXT to " + self.__TARGETEXT.lower())
 
 			self.BuildVariant.AddOperation(raptor_data.Set("TARGET", self.__TARGET))
-			self.BuildVariant.AddOperation(raptor_data.Set("TARGET_lower", lowercase_TARGET))
+			# case folding: case insensitive for resources
+			if self.__Raptor.doCaseFolding_rsg:
+				self.BuildVariant.AddOperation(raptor_data.Set("TARGET_var", lowercase_TARGET))
+			else:
+				self.BuildVariant.AddOperation(raptor_data.Set("TARGET_var", self.__TARGET))
+
 			if  lowercase_TARGET !=  self.__TARGET:
 				self.__debug("TARGET is not lowercase: '%s' - might cause BC problems." % self.__TARGET)
 		elif varname=='TARGETTYPE':
@@ -1448,7 +1453,7 @@
 			self.__targettype=toks[1]
 			if  self.__targettype.lower() == "none":
 				self.BuildVariant.AddOperation(raptor_data.Set("TARGET", ""))
-				self.BuildVariant.AddOperation(raptor_data.Set("TARGET_lower",""))
+				self.BuildVariant.AddOperation(raptor_data.Set("TARGET_var",""))
 				self.BuildVariant.AddOperation(raptor_data.Set("REQUESTEDTARGETEXT", ""))
 			self.BuildVariant.AddOperation(raptor_data.Set(varname,toks[1].lower()))
 
@@ -1785,9 +1790,14 @@
 
 			target = source.File().rsplit(".", 1)[0]	# remove the extension
 			variant.AddOperation(raptor_data.Set("TARGET", target))
-			variant.AddOperation(raptor_data.Set("TARGET_lower", target.lower()))
-
-			header = target.lower() + ".rsg"			# filename policy
+			
+			if self.__Raptor.doCaseFolding_rsg:
+				variant.AddOperation(raptor_data.Set("TARGET_var", target.lower()))
+				header = target.lower() + ".rsg"
+			else:
+				variant.AddOperation(raptor_data.Set("TARGET_var", target))
+				header = target + ".rsg"
+			 
 			variant.AddOperation(raptor_data.Set("HEADER", header))
 
 			if sysRes:
@@ -1915,10 +1925,16 @@
 		target = self.__current_resource.rsplit("/",1)[-1]
 		target = target.rsplit(".",1)[0]
 		self.__currentResourceVariant.AddOperation(raptor_data.Set("TARGET", target))
-		self.__currentResourceVariant.AddOperation(raptor_data.Set("TARGET_lower", target.lower()))
+
+		if self.__Raptor.doCaseFolding_rsg:
+			self.__currentResourceVariant.AddOperation(raptor_data.Set("TARGET_var", target.lower()))
+			self.__current_resource_header = target.lower() + ".rsg"
+		else:
+			self.__currentResourceVariant.AddOperation(raptor_data.Set("TARGET_var", target))
+			self.__current_resource_header = target + ".rsg"
+
 		self.__headerspecified = False
 		self.__headeronlyspecified = False
-		self.__current_resource_header = target.lower() + ".rsg"
 
 		return "OK"
 
@@ -1935,8 +1951,14 @@
 		if varname == "TARGET":
 			target_withext = varvalue.rsplit("/\\",1)[-1]
 			target = target_withext.rsplit(".",1)[0]
-			self.__current_resource_header = target.lower() + ".rsg"
-			self.__currentResourceVariant.AddOperation(raptor_data.Set("TARGET_lower", target.lower()))
+
+			if self.__Raptor.doCaseFolding_rsg:
+				self.__current_resource_header = target.lower() + ".rsg"
+				self.__currentResourceVariant.AddOperation(raptor_data.Set("TARGET_var", target.lower()))
+			else:
+				self.__current_resource_header = target + ".rsg"
+				self.__currentResourceVariant.AddOperation(raptor_data.Set("TARGET_var", target))
+
 			self.__debug("Set resource "+varname+" to " + target)
 			self.__currentResourceVariant.AddOperation(raptor_data.Set(varname,target))
 		if varname == "TARGETPATH":
@@ -2007,7 +2029,7 @@
 
 		self.__currentBitmapVariant = raptor_data.Variant(name = toks[1].replace('.','_'))
 		# Use BMTARGET and BMTARGET_lower because that prevents
-		# confusion with the TARGET and TARGET_lower of our parent MMP
+		# confusion with the TARGET and TARGET_var of our parent MMP
 		# when setting the OUTPUTPATH.  This in turn allows us to
 		# not get tripped up by multiple mbms being generated with
 		# the same name to the same directory.
@@ -2360,9 +2382,9 @@
 		self.BuildVariant.AddOperation(raptor_data.Set("DEBUGGABLE", self.__debuggable))
 
 		if self.__explicitversion:
-			self.BuildVariant.AddOperation(raptor_data.Append("UNIQUETARGETPATH","$(TARGET_lower)_$(VERSIONHEX)_$(REQUESTEDTARGETEXT)",'/'))
+			self.BuildVariant.AddOperation(raptor_data.Append("UNIQUETARGETPATH","$(TARGET_var)_$(VERSIONHEX)_$(REQUESTEDTARGETEXT)",'/'))
 		else:
-			self.BuildVariant.AddOperation(raptor_data.Append("UNIQUETARGETPATH","$(TARGET_lower)_$(REQUESTEDTARGETEXT)",'/'))
+			self.BuildVariant.AddOperation(raptor_data.Append("UNIQUETARGETPATH","$(TARGET_var)_$(REQUESTEDTARGETEXT)",'/'))
 
 		# Put the list of sourcefiles in with one Set operation - saves memory
 		# and performance over using multiple Append operations.
@@ -2586,6 +2608,7 @@
 			flm_export_dir = evaluator.CheckedGet("FLM_EXPORT_DIR")
 			detail['FLM_EXPORT_DIR'] = generic_path.Path(flm_export_dir)
 			detail['CACHEID'] = flm_export_dir
+			detail['INTERFACE.component'] = evaluator.Get('INTERFACE.component')
 			if raptor_utilities.getOSPlatform().startswith("win"):
 				detail['PLATMACROS'] = evaluator.CheckedGet("PLATMACROS.WINDOWS")
 			else:
@@ -2646,7 +2669,7 @@
 		    	+ detail['PLATFORM'] \
 		    	+ detail['PLATMACROS']
 
-		    # Keep a short version of the key for use in filenames.
+			# Keep a short version of the key for use in filenames.
 			uniq = hashlib.md5()
 			uniq.update(key)
 
@@ -2840,14 +2863,10 @@
 	def ModuleName(self,aBldInfPath):
 		"""Calculate the name of the ROM/emulator batch files that run the tests"""
 
-		def LeftPortionOf(pth,sep):
-			""" Internal function to return portion of str that is to the left of sep. 
-			The split is case-insensitive."""
-			length = len((pth.lower().split(sep.lower()))[0])
-			return pth[0:length]
-			
-		modulePath = LeftPortionOf(LeftPortionOf(os.path.dirname(aBldInfPath), "group"), "ongoing")
-		moduleName = os.path.basename(modulePath.strip("/"))
+		epocroot = str(self.ExportPlatforms[0]['EPOCROOT'])
+		modulePath = os.path.dirname(aBldInfPath).replace(epocroot, '', 1).lower().replace('group', '')
+		# Only join the last 3 folder names in case the path is very long
+		moduleName = '_'.join([i for i in modulePath.split('/') if i][-3:])
 		
 		# Ensure that ModuleName does not return blank, if the above calculation determines
 		# that moduleName is blank
@@ -2902,6 +2921,11 @@
 				# remember what component this spec node comes from for later
 				specNode.component = component
 
+				# if there is a per-component interface for this platform
+				# then set it for this spec node.
+				if bp['INTERFACE.component']:
+					specNode.SetInterface(bp['INTERFACE.component'])
+					
 				# add some basic data in a component-wide variant
 				var = raptor_data.Variant(name='component-wide-settings-' + plat)
 				var.AddOperation(raptor_data.Set("COMPONENT_META",str(component.bldinf_filename)))
--- a/sbsv2/raptor/python/raptor_version.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/python/raptor_version.py	Mon Nov 29 15:37:06 2010 +0800
@@ -19,7 +19,7 @@
 #
 # both of these are done automatically by the installer builder.
 
-version=(2,15,2,"ISODATE","symbian build system","CHANGESET")
+version=(2,15,3,"ISODATE","symbian build system","CHANGESET")
 
 def numericversion():
 	"""Raptor version string"""
--- a/sbsv2/raptor/python/raptor_xml.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/python/raptor_xml.py	Mon Nov 29 15:37:06 2010 +0800
@@ -173,10 +173,19 @@
 class SystemModel(object):
 	"""A representation of the SystemModel section of a Symbian system_definition.xml file."""
 
-	def __init__(self, aLogger, aSystemDefinitionFile, aSystemDefinitionBase):
+	def __init__(self, aLogger, aSystemDefinitionFile = None, aSystemDefinitionBase = None, aDoRead = True):
 		self.__Logger = aLogger
-		self.__SystemDefinitionFile = aSystemDefinitionFile.GetLocalString()
-		self.__SystemDefinitionBase = aSystemDefinitionBase.GetLocalString()
+
+		if aSystemDefinitionFile:
+			self.__SystemDefinitionFile = aSystemDefinitionFile.GetLocalString()
+		else:
+			self.__SystemDefinitionFile = generic_path.Path('undefined').GetLocalString()
+
+		if aSystemDefinitionBase:
+			self.__SystemDefinitionBase = aSystemDefinitionBase.GetLocalString()
+		else:
+			self.__SystemDefinitionBase = generic_path.Path('undefined').GetLocalString()
+
 		self.__Version = {'MAJOR':0,'MID':0,'MINOR':0}
 		self.__IdAttribute = "name"
 		self.__ComponentRoot = ""
@@ -188,12 +197,13 @@
 		self.__DOM = None
 		self.__SystemDefinitionElement = None
 
-		if self.__Read():
-			if self.__Validate():
-				self.__Parse()
+		if aDoRead:
+			if self.__Read():
+				if self.__Validate():
+					self.__Parse()
 
-		if self.__DOM:
-			self.__DOM.unlink()
+			if self.__DOM:
+				self.__DOM.unlink()
 
 	def HasLayer(self, aLayer):
 		return aLayer in self.__LayerList
@@ -201,6 +211,24 @@
 	def GetLayerNames(self):
 		return self.__LayerList
 
+	def AddComponent(self, aComponent):
+		'''Add a dummy component, sufficient for the purposes of
+		writing a new system definition file. Argument is a Raptor
+		Component object.
+		'''
+		layername = aComponent.layername
+		if layername == '':
+			raise Exception("Can't add a component ("+str(aComponent.bldinf_filename)+") without a layer name to a system defintion file")
+		containers = {'layer':layername,'component':aComponent.componentname}
+		component = SystemModelComponent(aComponent.bldinf_filename, layername, containers, self.__SystemDefinitionFile, self.__SystemDefinitionBase, self.__Version)
+
+		if not layername in self.__LayerList:
+			self.__LayerList.append(layername)
+
+		if not self.__LayerDetails.has_key(layername):
+			self.__LayerDetails[layername] = []
+		self.__LayerDetails[layername].append(component)
+
 	def GetLayerComponents(self, aLayer):
 		if not self.HasLayer(aLayer):
 			self.__Logger.Error("System Definition layer \"%s\" does not exist in %s", aLayer, self.__SystemDefinitionFile)
@@ -226,7 +254,6 @@
 			components.extend(self.GetLayerComponents(layer))
 
 		return components
-
 	def DumpLayerInfo(self, aLayer):
 		if self.HasLayer(aLayer):
 			self.__Logger.Info("Found %d bld.inf references in layer \"%s\"", len(self.GetLayerComponents(aLayer)), aLayer)
@@ -238,6 +265,45 @@
 				count = len(self.GetLayerNames()))
 		self.__Logger.InfoDiscovery(object_type = "bld.inf references",
 				count = len(self.GetAllComponents()))
+		
+	def Write(self, aFilename):
+		"""Write out a system definition that can be used to create an
+		identical SystemModel object.
+		Note it isn't guaranteed to be a valid system definition - just one
+		that will unserialise to an object identical to this one
+		"""
+		impl = xml.dom.minidom.getDOMImplementation()
+		self.__DOM = impl.createDocument(None, "SystemDefinition", None)
+		self.__SystemDefinitionElement = self.__DOM.documentElement
+		self.__DOM.insertBefore(self.__DOM.createComment('This document is generated by Raptor.  Please do not edit.'),self.__SystemDefinitionElement)
+		self.__SystemDefinitionElement.setAttribute('name','MCL')
+		self.__SystemDefinitionElement.setAttribute('schema','2.0.0')
+		systemModelNode = self.__DOM.createElement('systemModel')
+		self.__SystemDefinitionElement.appendChild(systemModelNode)
+		for layer in self.__LayerList:
+			if len(self.__LayerDetails[layer]) == 0:
+				continue
+			if layer == '':
+				self.__Logger.Error("Can't write out layer with no name to "+aFilename)
+			else:
+				layerNode = self.__DOM.createElement('layer')
+				layerNode.setAttribute('name',layer)
+				systemModelNode.appendChild(layerNode)
+				for component in self.__LayerDetails[layer]:
+					componentNode = self.__DOM.createElement('component')
+					componentNode.setAttribute('name',component.GetContainerName('component'))
+					layerNode.appendChild(componentNode)
+					path = str(component)
+					unitNode = self.__DOM.createElement('unit')
+					unitNode.setAttribute('bldFile',path)
+					componentNode.appendChild(unitNode)
+		
+		# Record that we haven't stripped the file names off our bld.infs
+		self.__SystemDefinitionElement.setAttribute('fullbldinfs','True')
+
+		self.__DOM.writexml(open(aFilename,"w"),newl="\n",indent="",addindent="\t")
+
+		self.__DOM.unlink()		
 
 	def __Read(self):
 		if not os.path.exists(self.__SystemDefinitionFile):
@@ -273,6 +339,12 @@
 		self.__Version['MID'] = int(version.group('MID'))
 		self.__Version['MINOR'] = int(version.group('MINOR'))
 
+		self.__fullbldinfs = None
+		if self.__SystemDefinitionElement.hasAttribute('fullbldinfs'):
+			# Lower case it since we're not evil
+			if self.__SystemDefinitionElement.getAttribute('fullbldinfs').lower() == 'true':
+				self.__fullbldinfs = 1
+
 		if self.__Version['MAJOR'] == 1 and self.__Version['MID'] > 2:
 			self.__ComponentRoot = self.__SystemDefinitionBase
 		elif self.__Version['MAJOR'] == 2 or self.__Version['MAJOR'] == 3:
@@ -382,27 +454,31 @@
 							self.__Logger.Error("Cannot resolve \'root\' attribute value \"%s\" in %s", rootValue, self.__SystemDefinitionFile)
 							return
 
-				group = generic_path.Path(bldFileValue)
+				bldinfval = generic_path.Path(bldFileValue)
 
 				if self.__Version['MAJOR'] < 3:
 					# absolute paths are not changed by root var in 1.x and 2.x
-					if not group.isAbsolute() and bldInfRoot:
-						group = generic_path.Join(bldInfRoot, group)
+					if not bldinfval.isAbsolute() and bldInfRoot:
+						bldinfval = generic_path.Join(bldInfRoot, bldinfval)
 				else:
 					# relative paths for v3
-					if not group.isAbsolute():
-						group = generic_path.Join(generic_path.Join(self.__SystemDefinitionFile).Dir(),group)
+					if not bldinfval.isAbsolute():
+						bldinfval = generic_path.Join(generic_path.Join(self.__SystemDefinitionFile).Dir(),bldinfval)
 					# absolute paths for v3
 					# are relative to bldInfRoot if set, or relative to the drive root otherwise
 					elif bldInfRoot:
-						group = generic_path.Join(bldInfRoot, group)
-
-				bldinf = generic_path.Join(group, "bld.inf").FindCaseless()
+						bldinfval = generic_path.Join(bldInfRoot, bldinfval)
+				
+				if self.__fullbldinfs:
+					bldinf = bldinfval.FindCaseless()
+				else:
+					bldinf = generic_path.Join(bldinfval, "bld.inf").FindCaseless()
 
 				if bldinf == None:
 					# recording layers containing non existent bld.infs
-					bldinfname = group.GetLocalString()
-					bldinfname = bldinfname+'/'+'bld.inf'
+					bldinfname = bldinfval.GetLocalString()
+					if not self.__fullbldinfs:
+						bldinfname = bldinfname+'/'+'bld.inf'
 					layer = self.__GetEffectiveLayer(aElement)
 					if not layer in self.__MissingBldInfs:
 						self.__MissingBldInfs[layer]=[]
--- a/sbsv2/raptor/test/common/raptor_tests.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/common/raptor_tests.py	Mon Nov 29 15:37:06 2010 +0800
@@ -27,7 +27,10 @@
 sys.path.append(os.environ["SBS_HOME"]+"/python")
 from raptor_meta import BldInfFile
 
-logDir = "$(EPOCROOT)/epoc32/build/smoketestlogs"
+if 'SMOKETESTLOGS' in os.environ:
+	logDir = os.environ['SMOKETESTLOGS']
+else:
+	logDir = "$(EPOCROOT)/epoc32/build/smoketestlogs"
 
 debug_mode_active = False
 
--- a/sbsv2/raptor/test/smoke_suite/armv5_testcode.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/armv5_testcode.py	Mon Nov 29 15:37:06 2010 +0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of the License "Eclipse Public License v1.0"
@@ -31,9 +31,9 @@
 		"$(EPOCROOT)/epoc32/release/armv5/udeb/simple_test_auto.exe",
 		"$(EPOCROOT)/epoc32/release/armv5/udeb/simple_test_manual.exe",
 		"$(EPOCROOT)/epoc32/include/testexportheader.h",
-		"$(EPOCROOT)/epoc32/data/z/test/simple_test/armv5.auto.bat",
-		"$(EPOCROOT)/epoc32/data/z/test/simple_test/armv5.manual.bat"
+		"$(EPOCROOT)/epoc32/data/z/test/smoke_suite_test_resources_simple_test/armv5.auto.bat",
+		"$(EPOCROOT)/epoc32/data/z/test/smoke_suite_test_resources_simple_test/armv5.manual.bat"
 		]
-	t.mustmatch = [".*/epoc32/data/z/test/simple_test/armv5.auto.bat</build>.*"]
+	t.mustmatch = [".*/epoc32/data/z/test/smoke_suite_test_resources_simple_test/armv5.auto.bat</build>.*"]
 	t.run()
 	return t
--- a/sbsv2/raptor/test/smoke_suite/armv7_testcode.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/armv7_testcode.py	Mon Nov 29 15:37:06 2010 +0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of the License "Eclipse Public License v1.0"
@@ -31,9 +31,9 @@
 		"$(EPOCROOT)/epoc32/release/armv7/udeb/simple_test_auto.exe",
 		"$(EPOCROOT)/epoc32/release/armv7/udeb/simple_test_manual.exe",
 		"$(EPOCROOT)/epoc32/include/testexportheader.h",
-		"$(EPOCROOT)/epoc32/data/z/test/simple_test/armv7.auto.bat",
-		"$(EPOCROOT)/epoc32/data/z/test/simple_test/armv7.manual.bat"
+		"$(EPOCROOT)/epoc32/data/z/test/smoke_suite_test_resources_simple_test/armv7.auto.bat",
+		"$(EPOCROOT)/epoc32/data/z/test/smoke_suite_test_resources_simple_test/armv7.manual.bat"
 		]
-	t.mustmatch = [".*/epoc32/data/z/test/simple_test/armv7.auto.bat</build>.*"]
+	t.mustmatch = [".*/epoc32/data/z/test/smoke_suite_test_resources_simple_test/armv7.auto.bat</build>.*"]
 	t.run()
 	return t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/bad_config.py	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,41 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+from raptor_tests import SmokeTest
+
+def run():
+	t = SmokeTest()
+	t.name="bad_config"
+
+	t.description = """Checks that if you give an incomplete (unbuildable) configuration that raptor complains nicely without a traceback."""
+	
+	t.command = "sbs -b smoke_suite/test_resources/simple/bld.inf -c arm.v5.rvct4_0 -c arm.v5.rvct2_2" # missing "urel" or "udeb"
+	t.targets = [
+		]	
+	t.mustmatch = [
+	"sbs: error: arm.v5.rvct2_2 is a bad configuration: Unset variable '.*' used in spec 'none' with config 'none'",
+	"sbs: error: arm.v5.rvct4_0 is a bad configuration: Unset variable '.*' used in spec 'none' with config 'none'",
+	"sbs: error: Build stopped because the following requested configurations are incomplete or invalid: arm.v5.rvct2_2, arm.v5.rvct4_0"
+	]
+	t.mustnotmatch = [
+		".*Traceback.*",
+		".*UninitialisedVariableException.*"
+	]
+	t.errors = 3
+	t.returncode = 1
+	
+	t.run()
+	return t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/custom_dll.py	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+
+
+from raptor_tests import SmokeTest 
+
+def run():
+	t = SmokeTest()
+	t.name = "custom_dll"
+	t.usebash = True
+	t.command = "SBS_ELF2E32=$SBS_HOME/test/smoke_suite/test_resources/custom_dll/elf2e32/windows/elf2e32.exe  sbs -b smoke_suite/test_resources/custom_dll/bld.inf -c armv5 --configpath=$SBS_HOME/test/smoke_suite/test_resources/custom_dll/config"
+	t.targets = [
+		"$(EPOCROOT)/epoc32/release/armv5/lib/customdll.dso",
+		"$(EPOCROOT)/epoc32/release/armv5/lib/customdll{000a0000}.dso",
+		"$(EPOCROOT)/epoc32/release/armv5/udeb/customdll.dll",
+		"$(EPOCROOT)/epoc32/release/armv5/udeb/customdll.dll.map",
+		"$(EPOCROOT)/epoc32/release/armv5/urel/customdll.dll",
+		"$(EPOCROOT)/epoc32/release/armv5/urel/customdll.dll.map"
+		]
+	# Windows-only until we know about a suitable linux version of the post-linker
+	t.run("windows")
+	return t
--- a/sbsv2/raptor/test/smoke_suite/dependencies.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/dependencies.py	Mon Nov 29 15:37:06 2010 +0800
@@ -44,7 +44,7 @@
 		"$(EPOCROOT)/epoc32/tools/dependency.exe"
 	]
 	linuxTargets = [
-		"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM_DIR)/rel/dependency",
+		"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)/rel/dependency",
 		"$(EPOCROOT)/epoc32/tools/dependency"
 	]
 
@@ -68,7 +68,7 @@
 	if t.result == AntiTargetSmokeTest.SKIP:
 		hostPlatform = "linux"
 		hostPlatformTargets = genericTargets + linuxTargets
-		hostPlatformOffset = "$(HOSTPLATFORM_DIR)/"
+		hostPlatformOffset = "$(HOSTPLATFORM32_DIR)/"
 		t.targets = hostPlatformTargets
 		t.run(hostPlatform)
 	
@@ -129,7 +129,7 @@
 	buildLocation = "$(EPOCROOT)/epoc32/build/" + BldInfFile.outputPathFragment('smoke_suite/test_resources/dependencies/bld.inf') + "/dependency_"
         # use one long bash command so that we can capture 
 	# the output in a way that isn't messed up with all the ordering confused.
-	t.command = " mkdir -p $(EPOCROOT)/epoc32/build/smoketestlogs ; { sleep 1 ; set -x ; \
+	t.command = " echo \"making directory for logfile ${SBSLOGFILE}\" ; mkdir -p `dirname ${SBSLOGFILE} 2>/dev/null` ; { sleep 1 ; set -x ; \
 touch smoke_suite/test_resources/dependencies/dependency.cpp; \
 echo INVALIDATE_ARMV5_DEPENDENCY_FILE >> %s/armv5/urel/dependency.o.d ; \
 echo INVALIDATE_WINSCW_DEPENDENCY_FILE >> %s/winscw/urel/dependency.o.d ;\
--- a/sbsv2/raptor/test/smoke_suite/exe_armv5_winscw_single_file.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/exe_armv5_winscw_single_file.py	Mon Nov 29 15:37:06 2010 +0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of the License "Eclipse Public License v1.0"
@@ -27,8 +27,9 @@
 	t.command = "sbs -b smoke_suite/test_resources/simple_gui/Bld.inf -c armv5 -c winscw"
 	t.addbuildtargets('smoke_suite/test_resources/simple_gui/Bld.inf', [
 		"helloworld_exe/helloworld.mbm_bmconvcommands",
-		"helloworld_exe/helloworld_HelloWorld.rsc.rpp",
-		"helloworld_exe/helloworld_HelloWorld.rsc.d",
+		"HelloWorld_exe/HelloWorld_HelloWorld.rsc",
+		"HelloWorld_exe/HelloWorld_HelloWorld.rsc.rpp",
+		"HelloWorld_exe/HelloWorld_HelloWorld.rsc.d",
 		"helloworld_exe/armv5/udeb/HelloWorld_Application.o",
 		"helloworld_exe/armv5/udeb/HelloWorld_Application.o.d",
 		"helloworld_exe/armv5/udeb/HelloWorld_AppUi.o",
@@ -91,13 +92,11 @@
 		"helloworld_exe/winscw/urel/helloworld_UID_.o",
 		"helloworld_exe/winscw/urel/helloworld_UID_.o.d",
 		"helloworld_exe/winscw/urel/helloworld_urel_objects.lrf",
-		"helloworld_reg_exe/helloworld_reg_HelloWorld_reg.rsc.rpp",
-		"helloworld_reg_exe/helloworld_reg_HelloWorld_reg.rsc.d"
+		"HelloWorld_reg_exe/HelloWorld_reg_HelloWorld_reg.rsc",
+		"HelloWorld_reg_exe/HelloWorld_reg_HelloWorld_reg.rsc.rpp",
+		"HelloWorld_reg_exe/HelloWorld_reg_HelloWorld_reg.rsc.d"
 	])
-
 	t.run()
-	if t.result == SmokeTest.FAIL:
-		result = SmokeTest.FAIL
 
 	# Ensure we don't clean up from the previous build in any subsequent runs
 	t.addbuildtargets('smoke_suite/test_resources/simple_gui/Bld.inf', [])
@@ -120,10 +119,7 @@
 	t.mustnotmatch = [
 		".*recipe name='(win32simplelink|postlink|link)'.*"
 	]
-
 	t.run()
-	if t.result == SmokeTest.FAIL:
-		result = SmokeTest.FAIL
 
 	# Attempt separate source and resource file compile where nothing should be done
 	t.id = "0089c"
@@ -136,14 +132,10 @@
 	t.mustnotmatch = [
 		".*recipe name='(resourcecompile|win32compile2object|compile|win32simplelink|postlink|link)'.*"
 	]
-
 	t.run()
-	if t.result == SmokeTest.FAIL:
-		result = SmokeTest.FAIL
 
 	t.id = "89"
 	t.name = "exe_armv5_winscw_single_file"
 	t.description = """Builds a component and tests single file compilation for straight source and resource files"""
-	t.result = result
 	t.print_result()
 	return t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/filter_exes.py	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,74 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+# Test for the filter_exes filter
+
+from raptor_tests import AntiTargetSmokeTest
+
+def run():
+	t = AntiTargetSmokeTest()
+	t.description = "Test the filter_exes filter"
+
+	log = "< smoke_suite/test_resources/logexamples/filter_exes.log"
+
+	t.usebash = True
+	t.name = "filter_exes_all_exes"
+	t.id = "999a"
+	t.command = "sbs_filter --filter=filter_exes[] "+log+" -f ${SBSLOGFILE} -m ${SBSMAKEFILE} && cat one_armv5_urel.txt"
+	t.mustmatch = [ "Wrote 1 file\(s\) into one_armv5_urel\.txt",
+		"Wrote 1 file\(s\) into two_winscw_udeb\.txt",
+		"^one\.exe$" ]
+	t.targets = [ "one_armv5_urel.txt",
+		"two_winscw_udeb.txt" ]
+	t.antitargets = [ "ignore_armv5_udeb.txt",
+		"ignore_armv5_urel.txt" ]
+	t.run()
+
+	t.name = "filter_exes_by_layer"
+	t.id = "999b"
+	t.usebash = False
+	t.command = "sbs_filter --filter=filter_exes[layer=two] "+log
+	t.mustmatch = [ "Wrote 1 file\(s\) into two_winscw_udeb\.txt" ]
+	t.mustnotmatch = [ "Wrote 1 file\(s\) into one_armv5_urel\.txt" ]
+	t.targets = [ "two_winscw_udeb.txt" ]
+	t.antitargets = [ "ignore_armv5_udeb.txt",
+		"ignore_armv5_urel.txt",
+		"one_armv5_urel.txt" ]
+	t.run()
+
+	t.name = "filter_exes_by_config"
+	t.id = "999c"
+	t.command = "sbs_filter --filter=filter_exes[config=armv5_urel] "+log
+	t.mustmatch = [ "Wrote 1 file\(s\) into one_armv5_urel\.txt" ]
+	t.mustnotmatch = [ "Wrote 1 file\(s\) into two_winscw_udeb\.txt" ]
+	t.targets = [ "one_armv5_urel.txt" ]
+	t.antitargets = [ "ignore_armv5_udeb.txt",
+		"ignore_armv5_urel.txt",
+		"two_winscw_udeb.txt" ]
+	t.run()
+	
+	t.clean()
+
+	t.name = "filter_exes_specified_output"
+	t.id = "999d"
+	t.command = "sbs_filter --filter=filter_exes[output=$(EPOCROOT)/epoc32/build/filter_exes_test] "+log
+	t.mustmatch = [ "Wrote 1 file\(s\) into .*epoc32/build/filter_exes_test[/\\\\]one_armv5_urel\.txt",
+		"Wrote 1 file\(s\) into .*epoc32/build/filter_exes_test[/\\\\]two_winscw_udeb\.txt" ]
+	t.targets = [ "$(EPOCROOT)/epoc32/build/filter_exes_test/one_armv5_urel.txt",
+		"$(EPOCROOT)/epoc32/build/filter_exes_test/two_winscw_udeb.txt"]
+	t.run()
+
+	t.id = "999"
+	t.name = "filter_exes"
+	return t
--- a/sbsv2/raptor/test/smoke_suite/flm_extension.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/flm_extension.py	Mon Nov 29 15:37:06 2010 +0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of the License "Eclipse Public License v1.0"
@@ -14,18 +14,48 @@
 # Description: 
 #
 
-from raptor_tests import SmokeTest
+from raptor_tests import SmokeTest, ReplaceEnvs
 
 def run():
 	t = SmokeTest()
-	t.id = "20"
-	t.name = "flm_extension"
-	t.command = "sbs -b " + \
-			"smoke_suite/test_resources/simple_extension/flm_bld.inf -c armv5"
+	
+	t.name = "exported_flm_extension"
+	t.command = "sbs -b smoke_suite/test_resources/simple_extension/flm_bld.inf -c armv5"
 	t.targets = [
 		"$(EPOCROOT)/epoc32/build/flm_test_1_2",
 		"$(EPOCROOT)/epoc32/tools/makefile_templates/tools/flm_export.xml",
 		"$(EPOCROOT)/epoc32/tools/makefile_templates/tools/flm_export.flm"
 		]
 	t.run()
+	
+	t.name = "per_component_flm"
+	t.usebash = True
+	t.command = "sbs --configpath=test/smoke_suite/test_resources/docs" + \
+	            " -b smoke_suite/test_resources/simple_dll/bld.inf" + \
+	            " -b smoke_suite/test_resources/simple_lib/bld.inf" + \
+	            " -b smoke_suite/test_resources/tools2/bld.inf" + \
+	            " -c armv5.documentation -c tools2.documentation -f-"
+	t.targets = [         
+		"$(EPOCROOT)/epoc32/docs/simple_dll.txt",
+		"$(EPOCROOT)/epoc32/docs/CreateStaticDLL.mmp",
+
+		"$(EPOCROOT)/epoc32/docs/simple_lib.txt",
+		"$(EPOCROOT)/epoc32/docs/simple.mmp",
+
+		"$(EPOCROOT)/epoc32/docs/tools2.txt",
+		"$(EPOCROOT)/epoc32/docs/tool_exe.mmp",
+		"$(EPOCROOT)/epoc32/docs/tool_lib1.mmp",
+		"$(EPOCROOT)/epoc32/docs/tool_lib2.mmp"
+		]
+	t.mustmatch = [
+		"simple_dll.txt uses " + ReplaceEnvs(t.targets[1]),
+		"simple_lib.txt uses " + ReplaceEnvs(t.targets[3]),
+		"tools2.txt uses " + ReplaceEnvs(t.targets[5]) + " " + \
+		                     ReplaceEnvs(t.targets[6]) + " " + \
+		                     ReplaceEnvs(t.targets[7])
+		]
+	t.run()
+		
+	t.name = "flm_extension"
+	t.print_result()
 	return t
--- a/sbsv2/raptor/test/smoke_suite/gui_whatlog.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/gui_whatlog.py	Mon Nov 29 15:37:06 2010 +0800
@@ -32,10 +32,10 @@
 		"$(EPOCROOT)/epoc32/data/z/resource/apps/helloworld.mbm",
 		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/resource/apps/helloworld.mbm",
 		"$(EPOCROOT)/epoc32/release/winscw/urel/z/resource/apps/helloworld.mbm",
-		"$(EPOCROOT)/epoc32/include/helloworld.rsg",
-		"$(EPOCROOT)/epoc32/data/z/resource/apps/helloworld.rsc",
-		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/resource/apps/helloworld.rsc",
-		"$(EPOCROOT)/epoc32/release/winscw/urel/z/resource/apps/helloworld.rsc",
+		"$(EPOCROOT)/epoc32/include/HelloWorld.rsg",
+		"$(EPOCROOT)/epoc32/data/z/resource/apps/HelloWorld.rsc",
+		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/resource/apps/HelloWorld.rsc",
+		"$(EPOCROOT)/epoc32/release/winscw/urel/z/resource/apps/HelloWorld.rsc",
 		"$(EPOCROOT)/epoc32/release/armv5/udeb/helloworld.exe",
 		"$(EPOCROOT)/epoc32/release/armv5/udeb/helloworld.exe.map",
 		"$(EPOCROOT)/epoc32/release/winscw/udeb/helloworld.exe",
@@ -46,8 +46,8 @@
 		]
 	t.addbuildtargets('smoke_suite/test_resources/simple_gui/Bld.inf', [
 		"helloworld_exe/helloworld.mbm_bmconvcommands",
-		"helloworld_exe/helloworld_HelloWorld.rsc.rpp",
-		"helloworld_exe/helloworld_HelloWorld.rsc.d",
+		"HelloWorld_exe/HelloWorld_HelloWorld.rsc.rpp",
+		"HelloWorld_exe/HelloWorld_HelloWorld.rsc.d",
 		"helloworld_exe/armv5/udeb/HelloWorld_Application.o",
 		"helloworld_exe/armv5/udeb/HelloWorld_Application.o.d",
 		"helloworld_exe/armv5/udeb/HelloWorld_AppUi.o",
@@ -108,27 +108,27 @@
 		"helloworld_exe/winscw/urel/helloworld_UID_.dep",
 		"helloworld_exe/winscw/urel/helloworld_UID_.o",
 		"helloworld_exe/winscw/urel/helloworld_UID_.o.d",
-		"helloworld_reg_exe/helloworld_reg_HelloWorld_reg.rsc.d"
+		"HelloWorld_reg_exe/HelloWorld_reg_HelloWorld_reg.rsc.d"
 	])
 	t.stdout = [
 		"<whatlog bldinf='"+componentpath+"/Bld.inf' mmp='"+componentpath+"/HelloWorld.mmp' config='armv5_udeb.whatlog'>",
 		"<bitmap>$(EPOCROOT)/epoc32/data/z/resource/apps/helloworld.mbm</bitmap>",
-		"<resource>$(EPOCROOT)/epoc32/include/helloworld.rsg</resource>",
-		"<resource>$(EPOCROOT)/epoc32/data/z/resource/apps/helloworld.rsc</resource>",
-		"<resource>$(EPOCROOT)/epoc32/data/z/private/10003a3f/apps/helloworld_reg.rsc</resource>",
+		"<resource>$(EPOCROOT)/epoc32/include/HelloWorld.rsg</resource>",
+		"<resource>$(EPOCROOT)/epoc32/data/z/resource/apps/HelloWorld.rsc</resource>",
+		"<resource>$(EPOCROOT)/epoc32/data/z/private/10003a3f/apps/HelloWorld_reg.rsc</resource>",
 		"<build>$(EPOCROOT)/epoc32/release/armv5/udeb/helloworld.exe</build>",
 		"<build>$(EPOCROOT)/epoc32/release/armv5/udeb/helloworld.exe.map</build>",
 		"<whatlog bldinf='"+componentpath+"/Bld.inf' mmp='"+componentpath+"/HelloWorld.mmp' config='winscw_urel.whatlog'>",
 		"<bitmap>$(EPOCROOT)/epoc32/data/z/resource/apps/helloworld.mbm</bitmap>",
 		"<bitmap>$(EPOCROOT)/epoc32/release/winscw/udeb/z/resource/apps/helloworld.mbm</bitmap>",
 		"<bitmap>$(EPOCROOT)/epoc32/release/winscw/urel/z/resource/apps/helloworld.mbm</bitmap>",
-		"<resource>$(EPOCROOT)/epoc32/include/helloworld.rsg</resource>",
-		"<resource>$(EPOCROOT)/epoc32/data/z/resource/apps/helloworld.rsc</resource>",
-		"<resource>$(EPOCROOT)/epoc32/release/winscw/udeb/z/resource/apps/helloworld.rsc</resource>",
-		"<resource>$(EPOCROOT)/epoc32/release/winscw/urel/z/resource/apps/helloworld.rsc</resource>",
-		"<resource>$(EPOCROOT)/epoc32/data/z/private/10003a3f/apps/helloworld_reg.rsc</resource>",
-		"<resource>$(EPOCROOT)/epoc32/release/winscw/udeb/z/private/10003a3f/apps/helloworld_reg.rsc</resource>",
-		"<resource>$(EPOCROOT)/epoc32/release/winscw/urel/z/private/10003a3f/apps/helloworld_reg.rsc</resource>",
+		"<resource>$(EPOCROOT)/epoc32/include/HelloWorld.rsg</resource>",
+		"<resource>$(EPOCROOT)/epoc32/data/z/resource/apps/HelloWorld.rsc</resource>",
+		"<resource>$(EPOCROOT)/epoc32/release/winscw/udeb/z/resource/apps/HelloWorld.rsc</resource>",
+		"<resource>$(EPOCROOT)/epoc32/release/winscw/urel/z/resource/apps/HelloWorld.rsc</resource>",
+		"<resource>$(EPOCROOT)/epoc32/data/z/private/10003a3f/apps/HelloWorld_reg.rsc</resource>",
+		"<resource>$(EPOCROOT)/epoc32/release/winscw/udeb/z/private/10003a3f/apps/HelloWorld_reg.rsc</resource>",
+		"<resource>$(EPOCROOT)/epoc32/release/winscw/urel/z/private/10003a3f/apps/HelloWorld_reg.rsc</resource>",
 		"<build>$(EPOCROOT)/epoc32/release/winscw/urel/helloworld.exe</build>",
 		"<build>$(EPOCROOT)/epoc32/release/winscw/urel/helloworld.exe.map</build>",
 		"<whatlog bldinf='"+componentpath+"/Bld.inf' mmp='"+componentpath+"/HelloWorld.mmp' config='armv5_urel.whatlog'>",
--- a/sbsv2/raptor/test/smoke_suite/mmp_select.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/mmp_select.py	Mon Nov 29 15:37:06 2010 +0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of the License "Eclipse Public License v1.0"
@@ -30,10 +30,10 @@
 		"$(EPOCROOT)/epoc32/release/winscw/urel/HelloWorld.exe"
 		]
 	t.addbuildtargets('smoke_suite/test_resources/basics/helloworld/Bld.inf', [
-		"helloworld_exe/armv5/udeb/HelloWorld.o",
-		"helloworld_exe/armv5/urel/HelloWorld.o",
-		"helloworld_exe/winscw/udeb/HelloWorld.o",
-		"helloworld_exe/winscw/urel/HelloWorld.o"
+		"HelloWorld_exe/armv5/udeb/HelloWorld.o",
+		"HelloWorld_exe/armv5/urel/HelloWorld.o",
+		"HelloWorld_exe/winscw/udeb/HelloWorld.o",
+		"HelloWorld_exe/winscw/urel/HelloWorld.o"
 	])
 	t.run()
 	return t
--- a/sbsv2/raptor/test/smoke_suite/parallel_parsing.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/parallel_parsing.py	Mon Nov 29 15:37:06 2010 +0800
@@ -22,7 +22,7 @@
 	result = SmokeTest.PASS
 
 	description = """This test covers parallel parsing."""
-	command = "cd $(SBS_HOME)/test/smoke_suite/test_resources/pp/ && sbs --command=$(SBS_HOME)/test/smoke_suite/test_resources/pp/ppbldinf_commandfile -c armv5 -c winscw --pp=on --noexport -m ${SBSMAKEFILE} -f - | grep recipe "
+	command = "mkdir -p $(EPOCROOT)/epoc32/build && cd $(SBS_HOME)/test/smoke_suite/test_resources/pp/ && sbs --command=$(SBS_HOME)/test/smoke_suite/test_resources/pp/ppbldinf_commandfile -c armv5 -c winscw --pp=on --noexport -m ${SBSMAKEFILE} -f - | grep recipe "
 
 	mmpcount = 10 # how many mmps in this parallel parsing test
 
--- a/sbsv2/raptor/test/smoke_suite/query_cli.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/query_cli.py	Mon Nov 29 15:37:06 2010 +0800
@@ -141,7 +141,7 @@
 	if t.onWindows:
 		t2 = "tools2"
 	else:
-		t2 = raptor_tests.ReplaceEnvs("tools2/$(HOSTPLATFORM_DIR)")
+		t2 = raptor_tests.ReplaceEnvs("tools2/$(HOSTPLATFORM32_DIR)")
 		
 	t.mustmatch_singleline = [
 		"<sbs version='2\.\d+\.\d+'>",
--- a/sbsv2/raptor/test/smoke_suite/resource.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/resource.py	Mon Nov 29 15:37:06 2010 +0800
@@ -27,22 +27,23 @@
 		"$(EPOCROOT)/epoc32/data/z/resource/apps/helloworld.mbm",
 		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/resource/apps/helloworld.mbm",
 		"$(EPOCROOT)/epoc32/release/winscw/urel/z/resource/apps/helloworld.mbm",
-		"$(EPOCROOT)/epoc32/include/helloworld.rsg",
-		"$(EPOCROOT)/epoc32/data/z/resource/apps/helloworld.rsc",
-		"$(EPOCROOT)/epoc32/data/z/private/10003a3f/apps/helloworld_reg.rsc",
-		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/resource/apps/helloworld.rsc",
-		"$(EPOCROOT)/epoc32/release/winscw/urel/z/resource/apps/helloworld.rsc",
-		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/private/10003a3f/apps/helloworld_reg.rsc",
-		"$(EPOCROOT)/epoc32/release/winscw/urel/z/private/10003a3f/apps/helloworld_reg.rsc"	
+		"$(EPOCROOT)/epoc32/include/HelloWorld.rsg",
+		"$(EPOCROOT)/epoc32/data/z/resource/apps/HelloWorld.rsc",
+		"$(EPOCROOT)/epoc32/data/z/private/10003a3f/apps/HelloWorld_reg.rsc",
+		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/resource/apps/HelloWorld.rsc",
+		"$(EPOCROOT)/epoc32/release/winscw/urel/z/resource/apps/HelloWorld.rsc",
+		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/private/10003a3f/apps/HelloWorld_reg.rsc",
+		"$(EPOCROOT)/epoc32/release/winscw/urel/z/private/10003a3f/apps/HelloWorld_reg.rsc"	
 		]
 	
 
 	t.addbuildtargets('smoke_suite/test_resources/simple_gui/Bld.inf', [
 		"helloworld_exe/helloworld.mbm_bmconvcommands",
-		"helloworld_exe/helloworld_HelloWorld.rsc.rpp",
-		"helloworld_exe/helloworld_HelloWorld.rsc.d",
-		"helloworld_reg_exe/helloworld_reg_HelloWorld_reg.rsc.rpp",
-		"helloworld_reg_exe/helloworld_reg_HelloWorld_reg.rsc.d"])
+		"HelloWorld_exe/HelloWorld_HelloWorld.rsc.rpp",
+		"HelloWorld_exe/HelloWorld_HelloWorld.rsc.d",
+		"HelloWorld_reg_exe/HelloWorld_reg_HelloWorld_reg.rsc.rpp",
+		"HelloWorld_reg_exe/HelloWorld_reg_HelloWorld_reg.rsc.d"
+		])
 
 	t.mustnotmatch = ["HelloWorld.rss.* warning: trigraph"]
 	
@@ -91,7 +92,7 @@
 		"onelang_/onelang_onelang_sc.rsg.rpp",
 		"testresource_/testresource_testresource.rsc.rpp"])
 
-	t.command = "sbs -b smoke_suite/test_resources/resource/group/bld.inf  -c armv5_urel -c winscw_urel reallyclean ; sbs --no-depend-generate -j 16 -b smoke_suite/test_resources/resource/group/bld.inf -c armv5_urel -c  winscw_urel -f ${SBSLOGFILE} -m ${SBSMAKEFILE} && grep 'epoc32.include.test[^ ]*.rsg' %s && { X=`md5sum $(EPOCROOT)/epoc32/release/winscw/urel/z/resource/anotherresource/testresource.rsc` && Y=`md5sum $(EPOCROOT)/epoc32/data/z/resource/testresource/testresource.rsc` && [ \"${X%% *}\" != \"${Y%% *}\" ] ; }  && wc -l %s " % (res_depfile, res_depfile)
+	t.command = "sbs -b smoke_suite/test_resources/resource/group/bld.inf  -c armv5_urel -c winscw_urel reallyclean ; sbs --no-depend-generate -j 16 -b smoke_suite/test_resources/resource/group/bld.inf -c armv5_urel -c winscw_urel -f ${SBSLOGFILE} -m ${SBSMAKEFILE} && grep 'epoc32.include.test[^ ]*.rsg' %s && { X=`md5sum $(EPOCROOT)/epoc32/release/winscw/urel/z/resource/anotherresource/testresource.rsc` && Y=`md5sum $(EPOCROOT)/epoc32/data/z/resource/testresource/testresource.rsc` && [ \"${X%% *}\" != \"${Y%% *}\" ] ; }  && wc -l %s " % (res_depfile, res_depfile)
 
 
 	t.mustnotmatch = []
@@ -137,6 +138,28 @@
 	t.mustmatch = []
 	t.run()
 
+
+	t.id = "30d"
+	t.name =  "resource_rsg_casefolding_fail"
+	t.command = "sbs -b smoke_suite/test_resources/resource/rsg_casefolding/bld.inf RESOURCE"
+	t.targets = []
+	
+	t.warnings = 1
+	t.errors = 3
+	t.returncode = 1
+	t.run("linux")
+
+	t.id = "30e"
+	t.name =  "resource_rsg_casefolding_pass"
+	t.command = "sbs -b smoke_suite/test_resources/resource/rsg_casefolding/bld.inf --use-rsg-casefolding RESOURCE"
+	t.targets = []
+
+	t.warnings = 0
+	t.errors = 0
+	t.returncode = 0
+	t.run("linux")
+
+
 	t.name = 'resource'
 	t.print_result()
 	return t
--- a/sbsv2/raptor/test/smoke_suite/romfile.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/romfile.py	Mon Nov 29 15:37:06 2010 +0800
@@ -39,8 +39,8 @@
 	
 	t.targets = [
 		"$(EPOCROOT)/epoc32/rom/src/ongoing/group/romfile/armv5test.iby",
-		"$(EPOCROOT)/epoc32/data/z/test/src/armv5.auto.bat",
-		"$(EPOCROOT)/epoc32/data/z/test/src/armv5.manual.bat"
+		"$(EPOCROOT)/epoc32/data/z/test/src_ongoing_romfile/armv5.auto.bat",
+		"$(EPOCROOT)/epoc32/data/z/test/src_ongoing_romfile/armv5.manual.bat"
 		]
 
 	# Check the content of the generated .iby file.
@@ -49,8 +49,8 @@
 		r".*// epoc32/rom/src/ongoing/group/romfile/armv5test\.iby\n.*",
 
 		# The batch files that are added by the build system.
-		r".*\ndata=/epoc32/data/z/test/src/armv5\.auto\.bat test/src\.auto\.bat\n.*",
-		r".*\ndata=/epoc32/data/z/test/src/armv5\.manual\.bat test/src\.manual\.bat\n.*",
+		r".*\ndata=/epoc32/data/z/test/src_ongoing_romfile/armv5\.auto\.bat test/armv5\.auto\.bat\n.*",
+		r".*\ndata=/epoc32/data/z/test/src_ongoing_romfile/armv5\.manual\.bat test/armv5\.manual\.bat\n.*",
 
 		# Some normal files.
 		r".*\nfile=/epoc32/release/##MAIN##/##BUILD##/t_rand\.exe\s+sys/bin/t_rand\.exe\n.*",
@@ -86,8 +86,8 @@
 	t.mustmatch = [
 		# Check whatlog output includes batch files and .iby file
 		r".*/epoc32/rom/src/ongoing/group/romfile/armv5test.iby</build>.*",
-		r".*/epoc32/data/z/test/src/armv5.auto.bat</build>.*",
-		r".*/epoc32/data/z/test/src/armv5.manual.bat</build>.*"
+		r".*/epoc32/data/z/test/src_ongoing_romfile/armv5.auto.bat</build>.*",
+		r".*/epoc32/data/z/test/src_ongoing_romfile/armv5.manual.bat</build>.*"
 		]
 	t.mustnotmatch = []
 	t.run()
--- a/sbsv2/raptor/test/smoke_suite/sbs_with_nonexisting_bldinf.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/sbs_with_nonexisting_bldinf.py	Mon Nov 29 15:37:06 2010 +0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of the License "Eclipse Public License v1.0"
@@ -18,11 +18,23 @@
 
 def run():
 	t = SmokeTest()
-	t.id = "80"
+
 	t.name = "sbs_with_nonexisting_bldinf"
 	t.description = "Test if sbs generates warning if invoked without bld.inf specified i.e. using default bld.inf which doesn't exist"
 	t.command = "mkdir ${EPOCROOT}/emptydir; rm ${EPOCROOT}/emptydir/*;  cd ${EPOCROOT}/emptydir; sbs -f ${SBSLOGFILE} -m {SBSMAKEFILE}"
 	t.usebash = True
 	t.warnings = 1 
 	t.run()
+	
+	t.name = "sbs_with_nonexisting_bldinf_cli"
+	t.description = "Test if sbs generates an error if invoked with a bad -b option"
+	t.command = "sbs -b none.inf"
+	t.usebash = False
+	t.errors = 1
+	t.warnings = 0
+	t.returncode = 1
+	t.mustmatch = ["sbs: error: build info file does not exist \(component .*none.inf\)"] 
+	t.run()
+	
+	t.print_result()
 	return t
--- a/sbsv2/raptor/test/smoke_suite/sysdef_layers.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/sysdef_layers.py	Mon Nov 29 15:37:06 2010 +0800
@@ -14,23 +14,25 @@
 # Description: 
 #
 
-from raptor_tests import SmokeTest
+from raptor_tests import AntiTargetSmokeTest
 
 def run():
-	t = SmokeTest()
-	t.id = "48"
+	command = 'sbs -f- -s smoke_suite/test_resources/sysdef/system_definition_order_layer_test.xml ' + \
+			'-l "Metadata Export" -l "Build Generated Source" -l "Component with Layer Dependencies" -o'
+
+	t = AntiTargetSmokeTest()
+	t.id = "48a"
 	t.name = "sysdef_layers"
 	t.usebash = True
 	t.description = "Test system_definition.xml layer processing and log reporting"
-	t.command = 'sbs -f- -s smoke_suite/test_resources/sysdef/system_definition_order_layer_test.xml ' + \
-			'-l "Metadata Export" -l "Build Generated Source" -l "Component with Layer Dependencies" -o'
+	t.command = command
 	t.targets = [
 		"$(SBS_HOME)/test/smoke_suite/test_resources/sysdef/build_gen_source/exported.inf",
 		"$(SBS_HOME)/test/smoke_suite/test_resources/sysdef/build_gen_source/exported.mmh",
 		"$(EPOCROOT)/epoc32/data/z/resource/apps/helloworld.mbm",
-		"$(EPOCROOT)/epoc32/data/z/private/10003a3f/apps/helloworld_reg.rsc",
-		"$(EPOCROOT)/epoc32/data/z/resource/apps/helloworld.rsc",
-		"$(EPOCROOT)/epoc32/include/helloworld.rsg",
+		"$(EPOCROOT)/epoc32/data/z/private/10003a3f/apps/HelloWorld_reg.rsc",
+		"$(EPOCROOT)/epoc32/data/z/resource/apps/HelloWorld.rsc",
+		"$(EPOCROOT)/epoc32/include/HelloWorld.rsg",
 		"$(EPOCROOT)/epoc32/release/armv5/udeb/helloworld.exe",
 		"$(EPOCROOT)/epoc32/release/armv5/udeb/helloworld.exe.sym",
 		"$(EPOCROOT)/epoc32/release/armv5/udeb/helloworld.exe.map",
@@ -39,16 +41,18 @@
 		"$(EPOCROOT)/epoc32/release/armv5/urel/helloworld.exe.map",
 		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/resource/apps/helloworld.mbm",
 		"$(EPOCROOT)/epoc32/release/winscw/udeb/helloworld.exe",
-		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/private/10003a3f/apps/helloworld_reg.rsc",
-		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/resource/apps/helloworld.rsc",
+		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/private/10003a3f/apps/HelloWorld_reg.rsc",
+		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/resource/apps/HelloWorld.rsc",
 		"$(EPOCROOT)/epoc32/release/winscw/urel/z/resource/apps/helloworld.mbm",
 		"$(EPOCROOT)/epoc32/release/winscw/urel/helloworld.exe",
 		"$(EPOCROOT)/epoc32/release/winscw/urel/helloworld.exe.map",
-		"$(EPOCROOT)/epoc32/release/winscw/urel/z/private/10003a3f/apps/helloworld_reg.rsc",
-		"$(EPOCROOT)/epoc32/release/winscw/urel/z/resource/apps/helloworld.rsc",
+		"$(EPOCROOT)/epoc32/release/winscw/urel/z/private/10003a3f/apps/HelloWorld_reg.rsc",
+		"$(EPOCROOT)/epoc32/release/winscw/urel/z/resource/apps/HelloWorld.rsc",
 		]
 	t.addbuildtargets('smoke_suite/test_resources/sysdef/build_gen_source/bld.inf', [
-		"helloworld_/helloworld_HelloWorld.rsc.rpp"
+		"HelloWorld_/HelloWorld_HelloWorld.rsc.rpp",
+		"HelloWorld_/HelloWorld_HelloWorld.rsc",
+		"HelloWorld_/HelloWorld_HelloWorld.rsc.d"
 		])
 	t.addbuildtargets('smoke_suite/test_resources/sysdef/dependent/bld.inf', [
 		"helloworld_exe/armv5/udeb/HelloWorld_Application.o",
@@ -75,11 +79,21 @@
 		"helloworld_exe/winscw/urel/HelloWorld_Main.o",
 		"helloworld_exe/winscw/urel/helloworld.UID.CPP",
 		"helloworld_exe/winscw/urel/helloworld_UID_.o",
-		"helloworld_reg_exe/helloworld_reg_HelloWorld_reg.rsc.rpp"
+		"HelloWorld_reg_exe/HelloWorld_reg_HelloWorld_reg.rsc.rpp",
+		"HelloWorld_reg_exe/HelloWorld_reg_HelloWorld_reg.rsc.d"
 		])
 	t.countmatch = [
 		["<recipe .*layer='Component with Layer Dependencies' component='dependent'.*>", 33],
 		["<recipe .*layer='Build Generated Source' component='build generated source'.*>", 3]		
 		]
 	t.run()
+
+	t.id = "48b"
+	t.name = "sysdef_layers_pp"
+	t.description = "Test system definition layer building and logging with parallel processing on"
+	t.command = command + " --pp on"
+	t.run()
+
+	t.id = "48"
+	t.name = "sysdef_layers"
 	return t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/custom_dll/bld.inf	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* Component description file
+*
+*/
+
+
+PRJ_PLATFORMS
+ARMV5 ARMV6 ARMV7 WINSCW ARMV5SMP X86
+
+PRJ_MMPFILES
+
+customdll.mmp
+customlib.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/custom_dll/config/postlinker.xml	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<build xmlns="http://symbian.com/xml/build"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://symbian.com/xml/build build/2_0.xsd">
+	<var name="root.changes">
+		<set name="POSTLINKER_SUPPORTS_ASMTYPE" value="TRUE"/>
+	</var>
+</build>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/custom_dll/customdll.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* This program creates a custom dll.
+*
+*/
+
+
+#include "customdll.h"
+#include <e32uid.h>
+
+// construct/destruct
+
+#if !defined(__ARMCC_4__) and !defined(__X86__)
+extern "C" void __ARM_switch8();
+
+void sbs_test()
+	{
+	__ARM_switch8();
+	}
+#endif
+
+EXPORT_C CCustomDll* CCustomDll::NewLC(CConsoleBase& aConsole, const TDesC& aString)
+	{
+	CCustomDll* self=new (ELeave) CCustomDll(aConsole);
+	CleanupStack::PushL(self);
+	self->ConstructL(aString);
+	return self;
+	}
+
+CCustomDll::~CCustomDll() // destruct - virtual, so no export
+	{
+	delete iString;
+	}
+
+EXPORT_C void CCustomDll::ShowMessage()
+	{
+	_LIT(KFormat1,"%S\n");
+	iConsole.Printf(KFormat1, iString); // notify completion
+	}
+
+// constructor support
+// don't export these, because used only by functions in this DLL, eg our NewLC()
+
+CCustomDll::CCustomDll(CConsoleBase& aConsole) // first-phase C++ constructor
+	: iConsole(aConsole)
+	{
+	}
+
+void CCustomDll::ConstructL(const TDesC& aString) // second-phase constructor
+	{
+	iString=aString.AllocL(); // copy given string into own descriptor
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/custom_dll/customdll.h	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+ 
+
+#include <e32cons.h>
+
+
+class CCustomDll : public CBase
+  	{
+public:
+		// Construction
+	IMPORT_C static CCustomDll* NewLC(CConsoleBase& aConsole, const TDesC& aString);
+		// Destructor - virtual and class not intended
+		// for derivation, so not exported
+	~CCustomDll();
+		// general functions - exported
+	IMPORT_C void ShowMessage();
+private:
+		// C++ constructor - not exported;
+		// implicitly called from NewLC()
+	CCustomDll(CConsoleBase& aConsole);
+		// 2nd phase construction, called by NewLC()
+	void ConstructL(const TDesC& aString); // second-phase constructor
+private:
+	CConsoleBase& iConsole; // Use the console (but not owned)
+	HBufC*        iString;  // Allocated container for string data (destructor destroys)
+	};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/custom_dll/customdll.mmp	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* Custom DLL - a DLL that exports functions from a static library
+*/
+
+TARGET        customdll.dll
+TARGETTYPE    dll
+
+STATICLIBRARY customlib.lib
+
+UID             0xE800004C
+CAPABILITY   All -TCB
+
+ALWAYS_BUILD_AS_ARM
+VENDORID 0x70000001
+
+SOURCEPATH    .
+
+USERINCLUDE   .
+APP_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY       euser.lib
+
+EPOCALLOWDLLDATA
+
+#if defined(X86GCC)
+    deffile ./customdllx86gcc.def
+#else
+    deffile ./customdllarm.def
+#endif
+nostrictdef
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/custom_dll/customdllarm.def	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z3foov @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/custom_dll/customlib.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* This program creates a static library
+*/
+
+
+void foo()
+	{
+	return;
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/custom_dll/customlib.mmp	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+TARGET        customlib.lib
+TARGETTYPE    lib
+
+SOURCEPATH    .
+SOURCE        customlib.cpp
+
+SYSTEMINCLUDE /epoc32/include
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/custom_dll/elf2e32/readme.txt	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,11 @@
+This directory contains a version of elf2e32 patched for the --asm option (a result of the Symbian Foundation 'GCC Surge'.
+
+The linux folder is a placeholder until a patched elf2e32 is available (making this test Windows only).
+
+At the time of writing information on the GCC Surge was available here:
+
+http://developer.symbian.org/wiki/GCC_SURGE
+
+The patched elf2e32 was taken from here:
+
+http://cdn.symbian.org/SF_builds/symbian4/builds/FCL/symbian4_FCL.single.732/zips/zip_of_zips.7z
Binary file sbsv2/raptor/test/smoke_suite/test_resources/custom_dll/elf2e32/windows/elf2e32.exe has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/docs/component.flm	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,31 @@
+
+# put all files in a specific docs folder
+#
+EPOCDOCS:=$(EPOCROOT)/epoc32/docs
+$(call makepath,$(EPOCDOCS))
+
+# this test produces a text file per component (which lists all the
+# .mmp files in the component).
+#
+# define a macro to create the target name from COMPONENT_META so that
+# the target.flm can use it to work out which target to add dependencies to.
+#
+# use a shorter name for the component (the name of the directory
+# which contains the bld.inf file) for portability of the tests only.
+#
+define component_target
+$(EPOCDOCS)/$(lastword $(subst /, ,$(dir $1))).txt
+endef
+
+DOCTARGET:=$(call component_target,$(COMPONENT_META))
+
+ALL:: $(DOCTARGET)
+
+# Script to generate the per-component file. The special "make" variable $^
+# contains the list of prerequisites.
+#
+SCRIPT:=echo $(DOCTARGET) uses $$(sort $$^) > $(DOCTARGET)
+
+# Create a recipe to execute the script.
+#
+$(call raptor_recipe,doc_component,$(DOCTARGET),,$(SCRIPT))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/docs/docs_build.xml	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<build xmlns="http://symbian.com/xml/build"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://symbian.com/xml/build build/2_0.xsd">
+
+  <!--
+  
+  This variant replaces [some] standard interfaces with docs ones.
+  
+  The result is that a build of armv5.documentation will use different
+  FLMs for DLL, EXE and LIB target types which gather up documentation
+  rather than building the code.
+  
+  There is also a per-component FLM which gets included for every bld.inf
+  in the build so that documentation can be generated at that granularity
+  as well as at the target (or MMP) level.
+  
+  -->
+  <var name="documentation">
+    <set name='INTERFACE.component' value='doc.component'/>
+    <set name='INTERFACE.dll' value='doc.target'/>
+    <set name='INTERFACE.exe' value='doc.target'/>
+    <set name='INTERFACE.lib' value='doc.target'/>
+  </var>
+ 
+  <!-- these are the new interfaces referred to in the above variant -->
+  
+  <interface name="doc.component" extends="base.flm" flm="component.flm">
+    <param name="COMPONENT_META"/>    <!-- absolute path of bld.inf file -->
+    <param name="COMPONENT_NAME"/>    <!-- descriptive name in package definition -->
+	<param name="COMPONENT_LAYER"/>   <!-- layer name in package definition -->
+	<param name="EPOCROOT"/>
+  </interface>
+
+  <interface name="doc.target" extends="base.flm" flm="target.flm">
+    <param name="COMPONENT_META"/>    <!-- absolute path of bld.inf file -->
+    <param name="PROJECT_META"/>      <!-- absolute path of .mmp file -->
+    <param name="TARGET"/>
+    <param name="TARGETTYPE"/>
+  </interface>
+
+</build>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/docs/target.flm	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,30 @@
+
+# Put all files in a specific docs folder.
+#
+EPOCDOCS:=$(EPOCROOT)/epoc32/docs
+$(call makepath,$(EPOCDOCS))
+
+# Generate the name of the target for our component. We are going to
+# add dependencies to it in this FLM.
+#
+DOCTARGET:=$(call component_target,$(COMPONENT_META))
+
+# This test also produces a text file per project (which simply lists the
+# target name and target type) to show how per-target data can be fed back
+# up to the per-component target.
+#
+# By making the per-target files into prerequisites of the per-component
+# target we ensure that the per-component target has access to the full list
+# of per-target files.
+#
+MMPTARGET:=$(EPOCDOCS)/$(notdir $(PROJECT_META))
+
+$(DOCTARGET): $(MMPTARGET)
+
+# Script to generate the per-target file.
+#
+SCRIPT:=echo "$(TARGET) $(TARGETTYPE)" > $(MMPTARGET)
+
+# Create a recipe to execute the script.
+#
+$(call raptor_recipe,doc_target,$(MMPTARGET),,$(SCRIPT))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/logexamples/filter_exes.log	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,6 @@
+<buildlog>
+<recipe name='ignore' target='ignore/this' config='armv5_udeb' layer='ignore'/>
+<recipe name='linkandpostlink' target='ignore/this.dll' config='armv5_urel' layer='ignore'/>
+<recipe name='linkandpostlink' target='target/one.exe' config='armv5_urel' layer='one'/>
+<recipe name='win32simplelink' target='target/two.exe' config='winscw_udeb' layer='two'/>
+</buildlog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/resource/rsg_casefolding/DISTRIBUTION.policy	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,2 @@
+Category G
+OSD:	Reference/Test	Tools
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/resource/rsg_casefolding/HelloWorld.h	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2000-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef __HELLOWORLD_H
+#define __HELLOWORLD_H
+
+#include <coeccntx.h>
+
+#include <eikenv.h>
+#include <eikappui.h>
+#include <eikapp.h>
+#include <eikdoc.h>
+#include <eikmenup.h>
+
+#include <eikon.hrh>
+
+#include <helloworld.rsg>
+#include "HelloWorld.hrh"
+
+
+
+////////////////////////////////////////////////////////////////////////
+//
+// CExampleApplication
+//
+////////////////////////////////////////////////////////////////////////
+
+class CExampleApplication : public CEikApplication
+	{
+private: 
+	           // Inherited from class CApaApplication
+	CApaDocument* CreateDocumentL();
+	TUid AppDllUid() const;
+	};
+
+////////////////////////////////////////////////////////////////////////
+//
+// CExampleAppView
+//
+////////////////////////////////////////////////////////////////////////
+class CExampleAppView : public CCoeControl
+    {
+public:
+	static CExampleAppView* NewL(const TRect& aRect);
+	CExampleAppView();
+	~CExampleAppView();
+    void ConstructL(const TRect& aRect);
+
+private:
+	           // Inherited from CCoeControl
+	void Draw(const TRect& /*aRect*/) const;
+
+private:
+	HBufC*  iExampleText;
+    };
+
+
+////////////////////////////////////////////////////////////////////////
+//
+// CExampleAppUi
+//
+////////////////////////////////////////////////////////////////////////
+class CExampleAppUi : public CEikAppUi
+    {
+public:
+    void ConstructL();
+	~CExampleAppUi();
+
+private:
+              // Inherirted from class CEikAppUi
+	void HandleCommandL(TInt aCommand);
+
+private:
+	CCoeControl* iAppView;
+	};
+
+
+////////////////////////////////////////////////////////////////////////
+//
+// CExampleDocument
+//
+////////////////////////////////////////////////////////////////////////
+class CExampleDocument : public CEikDocument
+	{
+public:
+	static CExampleDocument* NewL(CEikApplication& aApp);
+	CExampleDocument(CEikApplication& aApp);
+	void ConstructL();
+private: 
+	           // Inherited from CEikDocument
+	CEikAppUi* CreateAppUiL();
+	};
+
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/resource/rsg_casefolding/HelloWorld.hrh	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+
+enum TExampleMenuCommands
+	{
+	EExampleItem0 = 200,
+	EExampleItem1,
+	EExampleItem2
+	};
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/resource/rsg_casefolding/HelloWorld.mmp	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2000-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+TARGET        helloworld_rsg_casefolding.exe
+TARGETTYPE    exe
+UID           0x100039CE 0xE800005A
+VENDORID 	  0x70000001
+
+SOURCEPATH    .
+SOURCE        HelloWorld_Main.cpp
+SOURCE        HelloWorld_Application.cpp
+SOURCE        HelloWorld_Document.cpp
+SOURCE        HelloWorld_AppUi.cpp
+SOURCE        HelloWorld_AppView.cpp
+
+USERINCLUDE   .
+APP_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+START RESOURCE	HelloWorld.rss
+HEADER
+TARGETPATH		/resource/apps
+end
+
+START RESOURCE	HelloWorld_reg.rss
+TARGETPATH		/private/10003a3f/apps
+DEPENDS		helloworld.rsg
+END
+
+
+LIBRARY       euser.lib apparc.lib cone.lib eikcore.lib gdi.lib
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/resource/rsg_casefolding/HelloWorld.pkg	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,48 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the License "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: 
+;
+;
+; Basic install file for HelloWorld application
+;
+
+; List of languages supported.
+; Here, only UK English is supported.
+&EN
+
+; List of localised vendor names.
+; Here, only UK English version is specified.
+%{"Symbian Software Ltd."}
+
+; Single, non-localised (global) vendor name.
+:"Symbian Software Ltd."
+
+; Installation header.
+; Only specifies one component name as we only support English.
+; The UID is the package UID - this is not the same as the app's UID, 
+; which is specified in HelloWorld.mmp.
+
+#{"Hello World"},(0xE8000091),1,0,0
+
+; Four files to install for the minimal application
+"HelloWorld.exe"-"!:\sys\bin\HelloWorld.exe"
+"HelloWorld.rsc"-"!:\resource\apps\HelloWorld.rsc"
+"HelloWorld.mbm" - "!:\resource\apps\HelloWorld.mbm"
+"HelloWorld_reg.rsc" - "!:\private\10003a3f\import\apps\HelloWorld_reg.rsc"
+
+; Required files
+; None
+
+; Component .sis files
+; None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/resource/rsg_casefolding/HelloWorld.rss	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+NAME HEWO
+
+#include <eikon.rh>
+#include <eikcore.rsg>
+#include <appinfo.rh>
+
+#include "HelloWorld.hrh"
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf=""; }
+
+RESOURCE EIK_APP_INFO
+	{
+	hotkeys=r_example_hotkeys;
+	menubar=r_example_menubar;
+	}
+
+RESOURCE HOTKEYS r_example_hotkeys
+    {
+    control=
+        {
+        HOTKEY { command=EEikCmdExit; key='e'; }
+        };
+    }
+
+RESOURCE MENU_BAR r_example_menubar
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane=r_example_first_menu; txt="HelloWld"; }
+		};
+    }
+
+RESOURCE MENU_PANE r_example_first_menu
+	{
+	items=
+		{
+		MENU_ITEM { command=EExampleItem0; txt="Item 0"; },
+		MENU_ITEM { command=EExampleItem1; txt="Item 1"; },
+		MENU_ITEM { command=EExampleItem2; txt="Item 2"; },
+		MENU_ITEM { command=EEikCmdExit; txt="Close"; }
+        };
+    }
+
+
+RESOURCE TBUF r_example_text_Hello { buf="Hello World!"; }
+RESOURCE TBUF r_example_text_Item0 { buf="Item 0"; }
+RESOURCE TBUF r_example_text_Item1 { buf="Item 1"; }
+RESOURCE TBUF r_example_text_Item2 { buf="Item 2"; }
+RESOURCE TBUF r_example_text_Item3 { buf="This string generates a trigraph warning if not suppressed: <h>ID3?????????<m>"; }
+
+RESOURCE LOCALISABLE_APP_INFO r_lai
+	{
+	short_caption = "HW";
+	caption_and_icon =
+		{
+		CAPTION_AND_ICON_INFO
+			{
+			caption = "helloworld";
+			number_of_icons = 3; // each icon must be a bitmap/mask pair
+			icon_file = "z:\\resource\\apps\\helloworld.mbm";
+			}
+		};							
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/resource/rsg_casefolding/HelloWorld_AppUi.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* HelloWorld_CExampleAppUi.cpp
+*
+*/
+
+
+#include "HelloWorld.h"
+
+//             The second phase constructor of the application UI class.
+//             The application UI creates and owns the one and only view.
+// 
+void CExampleAppUi::ConstructL()
+    {
+	           // BaseConstructL() completes the UI framework's
+	           // construction of the App UI.
+    BaseConstructL();
+	           // Create the single application view in which to
+	           // draw the text "Hello World!", passing into it
+	           // the rectangle available to it.
+	iAppView = CExampleAppView::NewL(ClientRect());
+	}
+
+
+//             The app Ui owns the two views and is. 
+//             therefore, responsible for destroying them
+//
+CExampleAppUi::~CExampleAppUi()
+	{
+	delete iAppView;
+	}
+
+
+//             Called by the UI framework when a command has been issued.
+//             In this example, a command can originate through a 
+//             hot-key press or by selection of a menu item.
+//             The command Ids are defined in the .hrh file
+//             and are 'connected' to the hot-key and menu item in the
+//             resource file.
+//             Note that the EEikCmdExit is defined by the UI
+//             framework and is pulled in by including eikon.hrh
+//
+void CExampleAppUi::HandleCommandL(TInt aCommand)
+	{
+	switch (aCommand)
+		{
+		      // Just issue simple info messages to show that
+		      // the menu items have been selected
+	case EExampleItem0:
+		iEikonEnv->InfoMsg(R_EXAMPLE_TEXT_ITEM0);
+		break;
+
+	
+	case EExampleItem1:
+		iEikonEnv->InfoMsg(R_EXAMPLE_TEXT_ITEM1);
+		break;
+	
+	case EExampleItem2:
+		iEikonEnv->InfoMsg(R_EXAMPLE_TEXT_ITEM2);
+		break;
+               // Exit the application. The call is
+		       // implemented by the UI framework.
+
+	case EEikCmdExit: 
+		Exit();
+		break;
+		}
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/resource/rsg_casefolding/HelloWorld_AppView.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* HelloWorld_CExampleAppView.cpp
+*
+*/
+
+
+#include "HelloWorld.h"
+
+//
+//             Constructor for the view.
+//
+CExampleAppView::CExampleAppView()
+	{
+	}
+
+
+//             Static NewL() function to start the standard two
+//             phase construction.
+//
+CExampleAppView* CExampleAppView::NewL(const TRect& aRect)
+	{
+	CExampleAppView* self = new(ELeave) CExampleAppView();
+	CleanupStack::PushL(self);
+	self->ConstructL(aRect);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+//
+//             Destructor for the view.
+//
+CExampleAppView::~CExampleAppView()
+	{
+	delete iExampleText;
+	}
+
+
+//             Second phase construction.
+//
+void CExampleAppView::ConstructL(const TRect& aRect)
+    {
+			   // Fetch the text from the resource file.
+	iExampleText = iEikonEnv->AllocReadResourceL(R_EXAMPLE_TEXT_HELLO);
+	           // Control is a window owning control
+	CreateWindowL();
+	           // Extent of the control. This is
+	           // the whole rectangle available to application.
+	           // The rectangle is passed to us from the application UI.
+	SetRect(aRect);
+			   // At this stage, the control is ready to draw so
+	           // we tell the UI framework by activating it.
+	ActivateL();
+	}
+
+
+//             Drawing the view - in this example, 
+//             consists of drawing a simple outline rectangle
+//             and then drawing the text in the middle.
+//             We use the Normal font supplied by the UI.
+//
+//             In this example, we don't use the redraw
+//             region because it's easier to redraw to
+//             the whole client area.
+//
+void CExampleAppView::Draw(const TRect& /*aRect*/) const
+	{
+               // Window graphics context
+	CWindowGc& gc = SystemGc();
+	           // Area in which we shall draw
+	TRect      drawRect = Rect();
+			   // Font used for drawing text
+	const CFont*     fontUsed;
+	
+	           // Start with a clear screen
+	gc.Clear();
+			   // Draw an outline rectangle (the default pen
+	           // and brush styles ensure this) slightly
+	           // smaller than the drawing area.
+	drawRect.Shrink(10,10);		   	
+	gc.DrawRect(drawRect);
+               // Use the title font supplied by the UI
+	fontUsed = iEikonEnv->TitleFont();
+	gc.UseFont(fontUsed);
+			   // Draw the text in the middle of the rectangle.
+	TInt   baselineOffset=(drawRect.Height() - fontUsed->HeightInPixels())/2; 
+	gc.DrawText(*iExampleText,drawRect,baselineOffset,CGraphicsContext::ECenter, 0);
+               // Finished using the font
+	gc.DiscardFont();
+	}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/resource/rsg_casefolding/HelloWorld_Application.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* HelloWorld_CExampleApplication.cpp
+*
+*/
+
+
+#include "HelloWorld.h"
+
+const TUid KUidHelloWorld = { 0xE800005A };
+
+//             The function is called by the UI framework to ask for the
+//             application's UID. The returned value is defined by the
+//             constant KUidHelloWorlde and must match the second value
+//             defined in the project definition file.
+//
+TUid CExampleApplication::AppDllUid() const
+	{
+	return KUidHelloWorld;
+	}
+
+//             This function is called by the UI framework at
+//             application start-up. It creates an instance of the
+//             document class.
+//
+CApaDocument* CExampleApplication::CreateDocumentL()
+	{
+	return new (ELeave) CExampleDocument(*this);
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/resource/rsg_casefolding/HelloWorld_Document.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* HelloWorld_CExampleDocument.cpp
+*
+*/
+
+
+#include "HelloWorld.h"
+
+//             The constructor of the document class just passes the
+//             supplied reference to the constructor initialisation list.
+//             The document has no real work to do in this application.
+//
+CExampleDocument::CExampleDocument(CEikApplication& aApp)
+		: CEikDocument(aApp)
+	{
+	}
+
+
+//             This is called by the UI framework as soon as the 
+//             document has been created. It creates an instance
+//             of the ApplicationUI. The Application UI class is
+//             an instance of a CEikAppUi derived class.
+//
+CEikAppUi* CExampleDocument::CreateAppUiL()
+	{
+    return new(ELeave) CExampleAppUi;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/resource/rsg_casefolding/HelloWorld_Main.cpp	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+
+#include "HelloWorld.h"
+
+//             The entry point for the application code. It creates
+//             an instance of the CApaApplication derived
+//             class, CExampleApplication.
+//
+
+#if defined(EKA2)
+
+#include <eikstart.h>
+LOCAL_C CApaApplication* NewApplication()
+	{
+	return new CExampleApplication;
+	}
+	
+GLDEF_C TInt E32Main()
+	{
+	return EikStart::RunApplication(NewApplication);
+	}
+	
+#endif
+
+#if defined(__WINS__) && !defined(EKA2)
+//             This function is required by all Symbian OS DLLs. In this 
+//             example, it does nothing.
+
+EXPORT_C CApaApplication* NewApplication()
+	{
+	return new CExampleApplication;
+	}
+
+GLDEF_C TInt E32Dll(TDllReason)
+	{
+	return KErrNone;
+	}
+	
+EXPORT_C TInt WinsMain(TDesC* aCmdLine)
+	{
+	return EikStart::RunApplication(NewApplication, aCmdLine);
+	}
+	
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/resource/rsg_casefolding/HelloWorld_reg.rss	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#include <appinfo.rh>
+#include <helloworld.rsg>
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0xE800005A // application UID
+
+RESOURCE APP_REGISTRATION_INFO
+	{
+	app_file = "HelloWorld";
+	localisable_resource_file = "\\resource\\apps\\HelloWorld";
+	localisable_resource_id = R_LAI;	
+	}
+	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/resource/rsg_casefolding/bld.inf	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,22 @@
+/*
+* Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+
+PRJ_MMPFILES
+
+HelloWorld.mmp
--- a/sbsv2/raptor/test/smoke_suite/test_resources/simple_gui/HelloWorld.h	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/simple_gui/HelloWorld.h	Mon Nov 29 15:37:06 2010 +0800
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2000-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -28,7 +28,7 @@
 
 #include <eikon.hrh>
 
-#include <helloworld.rsg>
+#include <HelloWorld.rsg>
 #include "HelloWorld.hrh"
 
 
--- a/sbsv2/raptor/test/smoke_suite/test_resources/simple_gui/HelloWorld_reg.rss	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/simple_gui/HelloWorld_reg.rss	Mon Nov 29 15:37:06 2010 +0800
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -15,7 +15,7 @@
 *
 */
 #include <appinfo.rh>
-#include <helloworld.rsg>
+#include <HelloWorld.rsg>
 
 UID2 KUidAppRegistrationResourceFile
 UID3 0xE800005A // application UID
--- a/sbsv2/raptor/test/smoke_suite/test_resources/sysdef/dependent/HelloWorld.h	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/sysdef/dependent/HelloWorld.h	Mon Nov 29 15:37:06 2010 +0800
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2000-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -28,7 +28,7 @@
 
 #include <eikon.hrh>
 
-#include <helloworld.rsg>
+#include <HelloWorld.rsg>
 #include "HelloWorld.hrh"
 
 
--- a/sbsv2/raptor/test/smoke_suite/test_resources/sysdef/dependent/HelloWorld_reg.rss	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/sysdef/dependent/HelloWorld_reg.rss	Mon Nov 29 15:37:06 2010 +0800
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -15,7 +15,7 @@
 *
 */
 #include <appinfo.rh>
-#include <helloworld.rsg>
+#include <HelloWorld.rsg>
 
 UID2 KUidAppRegistrationResourceFile
 UID3 0xE800005A // application UID
--- a/sbsv2/raptor/test/smoke_suite/toolcheck.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/toolcheck.py	Mon Nov 29 15:37:06 2010 +0800
@@ -20,13 +20,13 @@
 def run():
 	t = SmokeTest()
 	t.id = "0092a"
-	t.name = "toolcheck"
 	t.description = """Test toolcheck works properly, with 3 options: on, off and forced. 
 				TOOL1 3 4 and 5 are expected to fail and 2 to pass"""
 	result = SmokeTest.PASS
 	toolcheckDir = os.environ["SBS_HOME"].replace("\\","/") + "/test/smoke_suite/test_resources/toolcheck"
 
 	# toolcheck ON
+	t.name = "toolcheck_on"
 	t.command = "sbs -b smoke_suite/test_resources/simple/bld.inf -n --configpath=" + toolcheckDir + \
 			" -c default.toolcheck --toolcheck=on"
 	
@@ -40,12 +40,13 @@
 		".*TOOLCHECK2.*",
 		".*TOOLCHECK6.*"
 		]
-	t.errors = 4
+	t.errors = 7
 	t.returncode = 1
 	t.run()
 	if t.result == SmokeTest.FAIL:
 		result = SmokeTest.FAIL
 
+	t.name = "toolcheck_off"
 	# toolcheck OFF
 	t.command = "sbs -b smoke_suite/test_resources/simple/bld.inf -n --configpath=" + toolcheckDir + \
 			" -c default.toolcheck --toolcheck=off"
@@ -66,6 +67,7 @@
 		result = SmokeTest.FAIL
 
 	# force toolcheck
+	t.name = "toolcheck_force"
 	t.command = "sbs -b smoke_suite/test_resources/simple/bld.inf -n --configpath=" + toolcheckDir + \
 			" -c default.toolcheck --toolcheck=forced"
 
@@ -80,7 +82,7 @@
 		".*TOOLCHECK2.*",
 		".*TOOLCHECK6.*"
 	]
-	t.errors = 4
+	t.errors = 16
 	t.returncode = 1
 	t.run()
 	if t.result == SmokeTest.FAIL:
--- a/sbsv2/raptor/test/smoke_suite/tools2.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/tools2.py	Mon Nov 29 15:37:06 2010 +0800
@@ -51,27 +51,27 @@
 
 	if t.result == SmokeTest.SKIP:
 		t.targets = [
-			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM_DIR)/deb/tool_exe",
-			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM_DIR)/deb/libtool_lib1.a",
-			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM_DIR)/deb/libtool_lib2.a",
-			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM_DIR)/rel/tool_exe",
-			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM_DIR)/rel/libtool_lib1.a",
-			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM_DIR)/rel/libtool_lib2.a",
+			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)/deb/tool_exe",
+			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)/deb/libtool_lib1.a",
+			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)/deb/libtool_lib2.a",
+			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)/rel/tool_exe",
+			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)/rel/libtool_lib1.a",
+			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)/rel/libtool_lib2.a",
 			"$(EPOCROOT)/epoc32/tools/tool_exe"
 		]
 		t.addbuildtargets("smoke_suite/test_resources/tools2/bld.inf", [
-			"libtool_lib1_a/libtool_lib1_lib/tools2/rel/$(HOSTPLATFORM_DIR)/tool_lib1_b.o",
-			"libtool_lib1_a/libtool_lib1_lib/tools2/rel/$(HOSTPLATFORM_DIR)/tool_lib1_a.o",
-			"libtool_lib2_a/libtool_lib2_lib/tools2/rel/$(HOSTPLATFORM_DIR)/tool_lib2_b.o",
-			"libtool_lib2_a/libtool_lib2_lib/tools2/rel/$(HOSTPLATFORM_DIR)/tool_lib2_a.o",
-			"libtool_lib1_a/libtool_lib1_lib/tools2/deb/$(HOSTPLATFORM_DIR)/tool_lib1_b.o",
-			"libtool_lib1_a/libtool_lib1_lib/tools2/deb/$(HOSTPLATFORM_DIR)/tool_lib1_a.o",
-			"libtool_lib2_a/libtool_lib2_lib/tools2/deb/$(HOSTPLATFORM_DIR)/tool_lib2_a.o",
-			"libtool_lib2_a/libtool_lib2_lib/tools2/deb/$(HOSTPLATFORM_DIR)/tool_lib2_b.o",
-			"tool_exe_exe/tool_exe_exe/tools2/rel/$(HOSTPLATFORM_DIR)/tool_exe_a.o",
-			"tool_exe_exe/tool_exe_exe/tools2/rel/$(HOSTPLATFORM_DIR)/tool_exe_b.o",
-			"tool_exe_exe/tool_exe_exe/tools2/deb/$(HOSTPLATFORM_DIR)/tool_exe_b.o",
-			"tool_exe_exe/tool_exe_exe/tools2/deb/$(HOSTPLATFORM_DIR)/tool_exe_a.o"
+			"libtool_lib1_a/libtool_lib1_lib/tools2/rel/$(HOSTPLATFORM32_DIR)/tool_lib1_b.o",
+			"libtool_lib1_a/libtool_lib1_lib/tools2/rel/$(HOSTPLATFORM32_DIR)/tool_lib1_a.o",
+			"libtool_lib2_a/libtool_lib2_lib/tools2/rel/$(HOSTPLATFORM32_DIR)/tool_lib2_b.o",
+			"libtool_lib2_a/libtool_lib2_lib/tools2/rel/$(HOSTPLATFORM32_DIR)/tool_lib2_a.o",
+			"libtool_lib1_a/libtool_lib1_lib/tools2/deb/$(HOSTPLATFORM32_DIR)/tool_lib1_b.o",
+			"libtool_lib1_a/libtool_lib1_lib/tools2/deb/$(HOSTPLATFORM32_DIR)/tool_lib1_a.o",
+			"libtool_lib2_a/libtool_lib2_lib/tools2/deb/$(HOSTPLATFORM32_DIR)/tool_lib2_a.o",
+			"libtool_lib2_a/libtool_lib2_lib/tools2/deb/$(HOSTPLATFORM32_DIR)/tool_lib2_b.o",
+			"tool_exe_exe/tool_exe_exe/tools2/rel/$(HOSTPLATFORM32_DIR)/tool_exe_a.o",
+			"tool_exe_exe/tool_exe_exe/tools2/rel/$(HOSTPLATFORM32_DIR)/tool_exe_b.o",
+			"tool_exe_exe/tool_exe_exe/tools2/deb/$(HOSTPLATFORM32_DIR)/tool_exe_b.o",
+			"tool_exe_exe/tool_exe_exe/tools2/deb/$(HOSTPLATFORM32_DIR)/tool_exe_a.o"
 			])
 		t.run("linux") # tools2 output is platform dependent
 	
--- a/sbsv2/raptor/test/smoke_suite/tools2_cross_compilation.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/tools2_cross_compilation.py	Mon Nov 29 15:37:06 2010 +0800
@@ -27,8 +27,8 @@
 	t.targets = [
 			"$(EPOCROOT)/epoc32/release/tools2/deb/pdrtran.exe",
 			"$(EPOCROOT)/epoc32/release/tools2/rel/pdrtran.exe",
-			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM_DIR)/deb/pdrtran",
-			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM_DIR)/rel/pdrtran",
+			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)/deb/pdrtran",
+			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)/rel/pdrtran",
 			"$(EPOCROOT)/epoc32/tools/pdrtran.exe",
 			"$(EPOCROOT)/epoc32/tools/pdrtran"
 			]
@@ -47,20 +47,20 @@
 			"pdrtran_/pdrtran_exe/tools2/rel/READER.o",
 			"pdrtran_/pdrtran_exe/tools2/rel/RECORD.o",
 			"pdrtran_/pdrtran_exe/tools2/rel/STRNG.o",
-			"pdrtran_/pdrtran_exe/tools2/deb/$(HOSTPLATFORM_DIR)/PDRTRAN.o",
-			"pdrtran_/pdrtran_exe/tools2/deb/$(HOSTPLATFORM_DIR)/LEXICAL.o",
-			"pdrtran_/pdrtran_exe/tools2/deb/$(HOSTPLATFORM_DIR)/PDRREADR.o",
-			"pdrtran_/pdrtran_exe/tools2/deb/$(HOSTPLATFORM_DIR)/PDRRECRD.o",
-			"pdrtran_/pdrtran_exe/tools2/deb/$(HOSTPLATFORM_DIR)/READER.o",
-			"pdrtran_/pdrtran_exe/tools2/deb/$(HOSTPLATFORM_DIR)/RECORD.o",
-			"pdrtran_/pdrtran_exe/tools2/deb/$(HOSTPLATFORM_DIR)/STRNG.o",
-			"pdrtran_/pdrtran_exe/tools2/rel/$(HOSTPLATFORM_DIR)/PDRTRAN.o",
-			"pdrtran_/pdrtran_exe/tools2/rel/$(HOSTPLATFORM_DIR)/LEXICAL.o",
-			"pdrtran_/pdrtran_exe/tools2/rel/$(HOSTPLATFORM_DIR)/PDRREADR.o",
-			"pdrtran_/pdrtran_exe/tools2/rel/$(HOSTPLATFORM_DIR)/PDRRECRD.o",
-			"pdrtran_/pdrtran_exe/tools2/rel/$(HOSTPLATFORM_DIR)/READER.o",
-			"pdrtran_/pdrtran_exe/tools2/rel/$(HOSTPLATFORM_DIR)/RECORD.o",
-			"pdrtran_/pdrtran_exe/tools2/rel/$(HOSTPLATFORM_DIR)/STRNG.o"
+			"pdrtran_/pdrtran_exe/tools2/deb/$(HOSTPLATFORM32_DIR)/PDRTRAN.o",
+			"pdrtran_/pdrtran_exe/tools2/deb/$(HOSTPLATFORM32_DIR)/LEXICAL.o",
+			"pdrtran_/pdrtran_exe/tools2/deb/$(HOSTPLATFORM32_DIR)/PDRREADR.o",
+			"pdrtran_/pdrtran_exe/tools2/deb/$(HOSTPLATFORM32_DIR)/PDRRECRD.o",
+			"pdrtran_/pdrtran_exe/tools2/deb/$(HOSTPLATFORM32_DIR)/READER.o",
+			"pdrtran_/pdrtran_exe/tools2/deb/$(HOSTPLATFORM32_DIR)/RECORD.o",
+			"pdrtran_/pdrtran_exe/tools2/deb/$(HOSTPLATFORM32_DIR)/STRNG.o",
+			"pdrtran_/pdrtran_exe/tools2/rel/$(HOSTPLATFORM32_DIR)/PDRTRAN.o",
+			"pdrtran_/pdrtran_exe/tools2/rel/$(HOSTPLATFORM32_DIR)/LEXICAL.o",
+			"pdrtran_/pdrtran_exe/tools2/rel/$(HOSTPLATFORM32_DIR)/PDRREADR.o",
+			"pdrtran_/pdrtran_exe/tools2/rel/$(HOSTPLATFORM32_DIR)/PDRRECRD.o",
+			"pdrtran_/pdrtran_exe/tools2/rel/$(HOSTPLATFORM32_DIR)/READER.o",
+			"pdrtran_/pdrtran_exe/tools2/rel/$(HOSTPLATFORM32_DIR)/RECORD.o",
+			"pdrtran_/pdrtran_exe/tools2/rel/$(HOSTPLATFORM32_DIR)/STRNG.o"
 			])
 	t.run("linux")
 
@@ -76,12 +76,12 @@
 			"$(EPOCROOT)/epoc32/release/tools2/rel/tool_exe.exe",
 			"$(EPOCROOT)/epoc32/release/tools2/rel/libtool_lib1.a",
 			"$(EPOCROOT)/epoc32/release/tools2/rel/libtool_lib2.a",
-			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM_DIR)/deb/tool_exe",
-			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM_DIR)/deb/libtool_lib1.a",
-			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM_DIR)/deb/libtool_lib2.a",
-			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM_DIR)/rel/tool_exe",
-			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM_DIR)/rel/libtool_lib1.a",
-			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM_DIR)/rel/libtool_lib2.a",
+			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)/deb/tool_exe",
+			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)/deb/libtool_lib1.a",
+			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)/deb/libtool_lib2.a",
+			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)/rel/tool_exe",
+			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)/rel/libtool_lib1.a",
+			"$(EPOCROOT)/epoc32/release/tools2/$(HOSTPLATFORM32_DIR)/rel/libtool_lib2.a",
 			"$(EPOCROOT)/epoc32/tools/tool_exe.exe",
 			"$(EPOCROOT)/epoc32/tools/tool_exe"
 			]
@@ -98,18 +98,18 @@
 			"tool_exe_exe/tool_exe_exe/tools2/rel/tool_exe_b.o",
 			"tool_exe_exe/tool_exe_exe/tools2/deb/tool_exe_b.o",
 			"tool_exe_exe/tool_exe_exe/tools2/deb/tool_exe_a.o",
-			"libtool_lib1_a/libtool_lib1_lib/tools2/rel/$(HOSTPLATFORM_DIR)/tool_lib1_b.o",
-			"libtool_lib1_a/libtool_lib1_lib/tools2/rel/$(HOSTPLATFORM_DIR)/tool_lib1_a.o",
-			"libtool_lib2_a/libtool_lib2_lib/tools2/rel/$(HOSTPLATFORM_DIR)/tool_lib2_b.o",
-			"libtool_lib2_a/libtool_lib2_lib/tools2/rel/$(HOSTPLATFORM_DIR)/tool_lib2_a.o",
-			"libtool_lib1_a/libtool_lib1_lib/tools2/deb/$(HOSTPLATFORM_DIR)/tool_lib1_b.o",
-			"libtool_lib1_a/libtool_lib1_lib/tools2/deb/$(HOSTPLATFORM_DIR)/tool_lib1_a.o",
-			"libtool_lib2_a/libtool_lib2_lib/tools2/deb/$(HOSTPLATFORM_DIR)/tool_lib2_a.o",
-			"libtool_lib2_a/libtool_lib2_lib/tools2/deb/$(HOSTPLATFORM_DIR)/tool_lib2_b.o",
-			"tool_exe_exe/tool_exe_exe/tools2/rel/$(HOSTPLATFORM_DIR)/tool_exe_a.o",
-			"tool_exe_exe/tool_exe_exe/tools2/rel/$(HOSTPLATFORM_DIR)/tool_exe_b.o",
-			"tool_exe_exe/tool_exe_exe/tools2/deb/$(HOSTPLATFORM_DIR)/tool_exe_b.o",
-			"tool_exe_exe/tool_exe_exe/tools2/deb/$(HOSTPLATFORM_DIR)/tool_exe_a.o"
+			"libtool_lib1_a/libtool_lib1_lib/tools2/rel/$(HOSTPLATFORM32_DIR)/tool_lib1_b.o",
+			"libtool_lib1_a/libtool_lib1_lib/tools2/rel/$(HOSTPLATFORM32_DIR)/tool_lib1_a.o",
+			"libtool_lib2_a/libtool_lib2_lib/tools2/rel/$(HOSTPLATFORM32_DIR)/tool_lib2_b.o",
+			"libtool_lib2_a/libtool_lib2_lib/tools2/rel/$(HOSTPLATFORM32_DIR)/tool_lib2_a.o",
+			"libtool_lib1_a/libtool_lib1_lib/tools2/deb/$(HOSTPLATFORM32_DIR)/tool_lib1_b.o",
+			"libtool_lib1_a/libtool_lib1_lib/tools2/deb/$(HOSTPLATFORM32_DIR)/tool_lib1_a.o",
+			"libtool_lib2_a/libtool_lib2_lib/tools2/deb/$(HOSTPLATFORM32_DIR)/tool_lib2_a.o",
+			"libtool_lib2_a/libtool_lib2_lib/tools2/deb/$(HOSTPLATFORM32_DIR)/tool_lib2_b.o",
+			"tool_exe_exe/tool_exe_exe/tools2/rel/$(HOSTPLATFORM32_DIR)/tool_exe_a.o",
+			"tool_exe_exe/tool_exe_exe/tools2/rel/$(HOSTPLATFORM32_DIR)/tool_exe_b.o",
+			"tool_exe_exe/tool_exe_exe/tools2/deb/$(HOSTPLATFORM32_DIR)/tool_exe_b.o",
+			"tool_exe_exe/tool_exe_exe/tools2/deb/$(HOSTPLATFORM32_DIR)/tool_exe_a.o"
 			])
 	t.run("linux")
 
--- a/sbsv2/raptor/test/smoke_suite/tracecompiler_general.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/tracecompiler_general.py	Mon Nov 29 15:37:06 2010 +0800
@@ -14,11 +14,10 @@
 # Description: 
 #
 
-from raptor_tests import SmokeTest
 from raptor_tests import AntiTargetSmokeTest
 
 def run():
-	t = SmokeTest()
+	t = AntiTargetSmokeTest()
 	t.description = "Testcases (ID 0101a - 0101d) test trace compiler"
 	# General test for trace compiler, which generates
 	# 1. trace headers like <source>Traces.h
@@ -43,31 +42,31 @@
 		"$(EPOCROOT)/epoc32/include/platform/symbiantraces/autogen/testTC_0x1000008d_TraceDefinitions.h"
 		]
 	t.addbuildtargets('smoke_suite/test_resources/tracecompiler/testTC/group/bld.inf', [
-		"testtc_dll/armv5/udeb/wlanhwinit.o",
-		"testtc_dll/armv5/udeb/wlanhwinit.o.d",
-		"testtc_dll/armv5/udeb/wlanhwinitmain.o",
-		"testtc_dll/armv5/udeb/wlanhwinitmain.o.d",
-		"testtc_dll/armv5/udeb/wlanhwinitpermparser.o",
-		"testtc_dll/armv5/udeb/wlanhwinitpermparser.o.d",
-		"testtc_dll/armv5/udeb/testTC_udeb_objects.via",
-		"testtc_dll/armv5/udeb/testTC{000a0000}.def",
-		"testtc_dll/armv5/urel/wlanhwinit.o",
-		"testtc_dll/armv5/urel/wlanhwinit.o.d",
-		"testtc_dll/armv5/urel/wlanhwinitmain.o",
-		"testtc_dll/armv5/urel/wlanhwinitmain.o.d",
-		"testtc_dll/armv5/urel/wlanhwinitpermparser.o",
-		"testtc_dll/armv5/urel/wlanhwinitpermparser.o.d",	
-		"testtc_dll/armv5/urel/testTC_urel_objects.via",
-		"testtc_dll/armv5/urel/testTC{000a0000}.def",
-		"testtc_dll/tracecompile_testTC_dll_1000008d.done"
+		"testTC_dll/armv5/udeb/wlanhwinit.o",
+		"testTC_dll/armv5/udeb/wlanhwinit.o.d",
+		"testTC_dll/armv5/udeb/wlanhwinitmain.o",
+		"testTC_dll/armv5/udeb/wlanhwinitmain.o.d",
+		"testTC_dll/armv5/udeb/wlanhwinitpermparser.o",
+		"testTC_dll/armv5/udeb/wlanhwinitpermparser.o.d",
+		"testTC_dll/armv5/udeb/testTC_udeb_objects.via",
+		"testTC_dll/armv5/udeb/testTC{000a0000}.def",
+		"testTC_dll/armv5/urel/wlanhwinit.o",
+		"testTC_dll/armv5/urel/wlanhwinit.o.d",
+		"testTC_dll/armv5/urel/wlanhwinitmain.o",
+		"testTC_dll/armv5/urel/wlanhwinitmain.o.d",
+		"testTC_dll/armv5/urel/wlanhwinitpermparser.o",
+		"testTC_dll/armv5/urel/wlanhwinitpermparser.o.d",	
+		"testTC_dll/armv5/urel/testTC_urel_objects.via",
+		"testTC_dll/armv5/urel/testTC{000a0000}.def",
+		"testTC_dll/tracecompile_testTC_dll_1000008d.done"
 	])
 	t.run()
 	
 	# General CLEAN test for trace compiler outputs
-	t = AntiTargetSmokeTest()
 	t.id = "101b"
 	t.name = "TC_general_CLEAN"
-	t.command = "sbs -b smoke_suite/test_resources/tracecompiler/testTC/group/bld.inf -c armv5.tracecompiler CLEAN" 	
+	t.command = "sbs -b smoke_suite/test_resources/tracecompiler/testTC/group/bld.inf -c armv5.tracecompiler CLEAN"
+	t.targets = []	
 	t.antitargets = [
 		"$(SBS_HOME)/test/smoke_suite/test_resources/tracecompiler/testTC/traces/wlanhwinitTraces.h",
 		"$(SBS_HOME)/test/smoke_suite/test_resources/tracecompiler/testTC/traces/wlanhwinitmainTraces.h",
@@ -78,7 +77,6 @@
 	])
 	t.run()
 			
-	t = SmokeTest()
 	t.id = "101c"
 	t.name = "TC_bv_path"
 	t.command = "sbs -b smoke_suite/test_resources/tracecompiler/TC_featurevariant/group/bld.inf -c armv5.tracecompiler" 
@@ -93,21 +91,21 @@
 		"$(EPOCROOT)/epoc32/include/platform/symbiantraces/autogen/HelloWorld_0xe78a5aa3_TraceDefinitions.h"
 		]
 	t.addbuildtargets('smoke_suite/test_resources/tracecompiler/TC_featurevariant/group/bld.inf', [
-		"helloworld_exe/armv5/udeb/HelloWorld.o",
-		"helloworld_exe/armv5/udeb/HelloWorld.o.d",
-		"helloworld_exe/armv5/udeb/HelloWorld_udeb_objects.via",
-		"helloworld_exe/armv5/urel/HelloWorld.o",
-		"helloworld_exe/armv5/urel/HelloWorld.o.d",
-		"helloworld_exe/armv5/urel/HelloWorld_urel_objects.via",
-		"helloworld_exe/tracecompile_HelloWorld_exe_e78a5aa3.done"
+		"HelloWorld_exe/armv5/udeb/HelloWorld.o",
+		"HelloWorld_exe/armv5/udeb/HelloWorld.o.d",
+		"HelloWorld_exe/armv5/udeb/HelloWorld_udeb_objects.via",
+		"HelloWorld_exe/armv5/urel/HelloWorld.o",
+		"HelloWorld_exe/armv5/urel/HelloWorld.o.d",
+		"HelloWorld_exe/armv5/urel/HelloWorld_urel_objects.via",
+		"HelloWorld_exe/tracecompile_HelloWorld_exe_e78a5aa3.done"
 	])
+	t.antitargets = []
 	t.run()
 
 	# 101d-101f test trace compiler auto mechanism, which is used to avoid wasting time on source 
 	# containing no osttraces.
 	# Trace compiler only runs when there are osttraces code in source. Raptor decides this by
 	# checking whether there is a "traces" or "traces_<prj_name>" folder in USERINCLUDE in a mmp file. 
-	t = SmokeTest()
 	t.id = "101d"
 	t.name = "TC_autorun1"
 	# Run - USERINCLUDE ../traces_autorun1
@@ -122,9 +120,9 @@
 		"test_/armv5/urel/test.o",
 		"test_/tracecompile_test_exe_00000001.done"
 	])
+	t.antitargets = [] # Currently unnecessary, but helps the code be robust
 	t.run()
 	
-	t = AntiTargetSmokeTest()
 	t.id = "101e"
 	t.name = "TC_autorun2"
 	# No run - USERINCLUDE ./tracesnotmatch
@@ -140,12 +138,12 @@
 		"test_/armv5/udeb/test.o",
 		"test_/armv5/urel/test.o",
 	])
+	t.antitargets = [] # Currently unnecessary, but helps the code be robust
 	t.addbuildantitargets('smoke_suite/test_resources/tracecompiler/TC_autorun/bld.inf', [
 		"test_/tracecompile_test_exe_00000001.done"
 	])
 	t.run()
 
-	t = AntiTargetSmokeTest()
 	t.id = "101f"
 	t.name = "TC_autorun3"
 	# No run - no UID
@@ -161,6 +159,7 @@
 		"test_/armv5/udeb/test.o",
 		"test_/armv5/urel/test.o",
 	])
+	t.antitargets = []
 	t.addbuildantitargets('smoke_suite/test_resources/tracecompiler/TC_autorun/bld.inf', [
 		"test_/tracecompile_test_exe_00000001.done"
 	])
@@ -168,7 +167,6 @@
 
 	# Test trace compiler doesn't run when it is switched off
 	# Trace compiler switch is off by default. To turn it on use variant ".tracecompiler". 
-	t = AntiTargetSmokeTest()
 	t.id = "101g"
 	t.name = "TC_switch_off"
 	t.command = "sbs -b smoke_suite/test_resources/tracecompiler/TC_autorun/bld.inf -c armv5.tracecompiler" + \
@@ -182,6 +180,7 @@
 		"test_/armv5/udeb/test.o",
 		"test_/armv5/urel/test.o"
 	])
+	t.antitargets = []
 	t.addbuildantitargets('smoke_suite/test_resources/tracecompiler/TC_autorun/bld.inf', [
 		"test_/tracecompile_test_exe_00000001.done"
 	])
--- a/sbsv2/raptor/test/smoke_suite/whatlog_cache.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/whatlog_cache.py	Mon Nov 29 15:37:06 2010 +0800
@@ -33,7 +33,7 @@
 	# Build something using the .whatlog variant.  Take the build log and give it to sbsv2cache.py, deducing
 	# the location of the generated cache file from the verbose output.  If generated, dump the cache file to
 	# STDOUT so we can validate the content in this test script.  Clean up when finished.
-	t.command = """sbs -b smoke_suite/test_resources/simple_gui/Bld.inf -f ${SBSLOGFILE} -m ${SBSMAKEFILE} -c armv5.whatlog -c winscw.whatlog
+	t.command = """sbs -b smoke_suite/test_resources/simple_gui/Bld.inf -f ${SBSLOGFILE} -m ${SBSMAKEFILE} -c armv5.whatlog -c winscw.whatlog 
 		CACHEFILE=`%s $SBS_HOME/bin/sbsv2cache.py -v -s -o $EPOCROOT/epoc32/build/abldcache -l $SBSLOGFILE | sed -n \'s#Creating: ##p\'`
 		if [ -n \"${CACHEFILE:+x}\" ]; then
 			cat $CACHEFILE
@@ -44,13 +44,13 @@
 		"$(EPOCROOT)/epoc32/data/z/resource/apps/helloworld.mbm",
 		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/resource/apps/helloworld.mbm",
 		"$(EPOCROOT)/epoc32/release/winscw/urel/z/resource/apps/helloworld.mbm",
-		"$(EPOCROOT)/epoc32/include/helloworld.rsg",
-		"$(EPOCROOT)/epoc32/data/z/resource/apps/helloworld.rsc",
-		"$(EPOCROOT)/epoc32/data/z/private/10003a3f/apps/helloworld_reg.rsc",
-		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/resource/apps/helloworld.rsc",
-		"$(EPOCROOT)/epoc32/release/winscw/urel/z/resource/apps/helloworld.rsc",
-		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/private/10003a3f/apps/helloworld_reg.rsc",
-		"$(EPOCROOT)/epoc32/release/winscw/urel/z/private/10003a3f/apps/helloworld_reg.rsc",
+		"$(EPOCROOT)/epoc32/include/HelloWorld.rsg",
+		"$(EPOCROOT)/epoc32/data/z/resource/apps/HelloWorld.rsc",
+		"$(EPOCROOT)/epoc32/data/z/private/10003a3f/apps/HelloWorld_reg.rsc",
+		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/resource/apps/HelloWorld.rsc",
+		"$(EPOCROOT)/epoc32/release/winscw/urel/z/resource/apps/HelloWorld.rsc",
+		"$(EPOCROOT)/epoc32/release/winscw/udeb/z/private/10003a3f/apps/HelloWorld_reg.rsc",
+		"$(EPOCROOT)/epoc32/release/winscw/urel/z/private/10003a3f/apps/HelloWorld_reg.rsc",
 		"$(EPOCROOT)/epoc32/release/armv5/udeb/helloworld.exe",
 		"$(EPOCROOT)/epoc32/release/armv5/udeb/helloworld.exe.map",
 		"$(EPOCROOT)/epoc32/release/winscw/udeb/helloworld.exe",
@@ -61,8 +61,8 @@
 		]
 	t.addbuildtargets('smoke_suite/test_resources/simple_gui/Bld.inf', [
 		"helloworld_exe/helloworld.mbm_bmconvcommands",
-		"helloworld_exe/helloworld_HelloWorld.rsc.rpp",
-		"helloworld_exe/helloworld_HelloWorld.rsc.d",
+		"HelloWorld_exe/HelloWorld_HelloWorld.rsc.rpp",
+		"HelloWorld_exe/HelloWorld_HelloWorld.rsc.d",
 		"helloworld_exe/armv5/udeb/HelloWorld_Application.o",
 		"helloworld_exe/armv5/udeb/HelloWorld_Application.o.d",
 		"helloworld_exe/armv5/udeb/HelloWorld_AppUi.o",
@@ -123,19 +123,19 @@
 		"helloworld_exe/winscw/urel/helloworld_UID_.dep",
 		"helloworld_exe/winscw/urel/helloworld_UID_.o",
 		"helloworld_exe/winscw/urel/helloworld_UID_.o.d",
-		"helloworld_reg_exe/helloworld_reg_HelloWorld_reg.rsc.d"
+		"HelloWorld_reg_exe/HelloWorld_reg_HelloWorld_reg.rsc.d"
 	])
 	t.countmatch = [
 		["\$self->{abldcache}->{.*\\\\test\\\\smoke_suite\\\\test_resources\\\\simple_gui target (armv5|winscw) (udeb|urel) -what\'} =", 4],
-		[".*\'.*\\\\\\\\epoc32\\\\\\\\data\\\\\\\\z\\\\\\\\private\\\\\\\\10003a3f\\\\\\\\apps\\\\\\\\helloworld_reg.rsc\'", 4],
+		[".*\'.*\\\\\\\\epoc32\\\\\\\\data\\\\\\\\z\\\\\\\\private\\\\\\\\10003a3f\\\\\\\\apps\\\\\\\\HelloWorld_reg.rsc\'", 4],
 		[".*\'.*\\\\\\\\epoc32\\\\\\\\data\\\\\\\\z\\\\\\\\resource\\\\\\\\apps\\\\\\\\helloworld.mbm\'", 4],
-		[".*\'.*\\\\\\\\epoc32\\\\\\\\data\\\\\\\\z\\\\\\\\resource\\\\\\\\apps\\\\\\\\helloworld.rsc\'", 4],
-		[".*\'.*\\\\\\\\epoc32\\\\\\\\include\\\\\\\\helloworld.rsg\'", 4],
+		[".*\'.*\\\\\\\\epoc32\\\\\\\\data\\\\\\\\z\\\\\\\\resource\\\\\\\\apps\\\\\\\\HelloWorld.rsc\'", 4],
+		[".*\'.*\\\\\\\\epoc32\\\\\\\\include\\\\\\\\HelloWorld.rsg\'", 4],
 		[".*\'.*\\\\\\\\epoc32\\\\\\\\release\\\\\\\\(armv5|winscw)\\\\\\\\(udeb|urel)\\\\\\\\helloworld.exe\'",4],
 		[".*\'.*\\\\\\\\epoc32\\\\\\\\release\\\\\\\\(armv5|winscw)\\\\\\\\(udeb|urel)\\\\\\\\helloworld.exe.map\'", 3],
-		[".*\'.*\\\\\\\\epoc32\\\\\\\\release\\\\\\\\winscw\\\\\\\\(udeb|urel)\\\\\\\\z\\\\\\\\private\\\\\\\\10003a3f\\\\\\\\apps\\\\\\\\helloworld_reg.rsc\'", 2],
+		[".*\'.*\\\\\\\\epoc32\\\\\\\\release\\\\\\\\winscw\\\\\\\\(udeb|urel)\\\\\\\\z\\\\\\\\private\\\\\\\\10003a3f\\\\\\\\apps\\\\\\\\HelloWorld_reg.rsc\'", 2],
 		[".*\'.*\\\\\\\\epoc32\\\\\\\\release\\\\\\\\winscw\\\\\\\\(udeb|urel)\\\\\\\\z\\\\\\\\resource\\\\\\\\apps\\\\\\\\helloworld.mbm\'", 2],
-		[".*\'.*\\\\\\\\epoc32\\\\\\\\release\\\\\\\\winscw\\\\\\\\(udeb|urel)\\\\\\\\z\\\\\\\\resource\\\\\\\\apps\\\\\\\\helloworld.rsc\'", 2],
+		[".*\'.*\\\\\\\\epoc32\\\\\\\\release\\\\\\\\winscw\\\\\\\\(udeb|urel)\\\\\\\\z\\\\\\\\resource\\\\\\\\apps\\\\\\\\HelloWorld.rsc\'", 2],
 		["\$self->{abldcache}->{\'plats\'} =", 1],
 		[".*\'ARMV5\'", 1],
 		[".*\'WINSCW\'", 1]
--- a/sbsv2/raptor/test/smoke_suite/xml_invalid_chars.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/smoke_suite/xml_invalid_chars.py	Mon Nov 29 15:37:06 2010 +0800
@@ -45,9 +45,9 @@
 	
 	if t.result == SmokeTest.PASS:
 		
-		print "Testing validity of XML..."
+		log = t.logfile()
+		print ("Testing validity of XML file " + log)
 		
-		log = "$(EPOCROOT)/epoc32/build/smoketestlogs/xml_invalid_chars.log"
 		logfile = open(ReplaceEnvs(log), "r")
 		
 		try:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/unit_suite/filter_interface_unit.py	Mon Nov 29 15:37:06 2010 +0800
@@ -0,0 +1,156 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+# Unit tests for the filter_interface module
+
+import unittest
+import filter_interface
+import sys
+
+# No point testing the Filter interface - it's fully abstract
+
+class TestFilterInterface(unittest.TestCase):
+	def testSAXFilter(self):
+		# Areas for improvement:
+		# - Test non-well formed XML
+		# - Test all error cases (error, fatalError, warning)
+		class testFilter(filter_interface.FilterSAX):
+			def __init__(self):
+				super(testFilter,self).__init__()
+				self.failed = False
+				self.seendoc = False
+				self.startcount = 2
+				self.endcount = 2
+				self.charcount = 14
+
+			def startDocument(self):
+				if self.seendoc:
+					self.failed = True
+					sys.stdout.write('FAIL: Nested document elements')
+				self.seendoc = True
+
+			def startElement(self, name, attributes):
+				self.startcount -= 1
+
+				if self.startcount < 0:
+					self.failed = True
+					# Report the number of excessive start elements
+					sys.stdout.write('FAIL: Seen {0} too many start elements'.format(0-self.startcount))
+
+			def endElement(self, name):
+				self.endcount -= 1
+
+				if self.endcount < 0:
+					self.failed = True
+					# Report the number of excessive end elements
+					sys.stdout.write('FAIL: Seen {0} too many end elements'.format(0-self.endcount))
+
+			def endDocument(self):
+				if not self.seendoc:
+					self.failed = True
+					self.stdout.write('FAIL: Not in a document at doc end')
+				self.seendoc = False
+
+			def characters(self, char):
+				self.charcount -= len(char)
+
+				if self.charcount < 0:
+					self.failed = True
+					# Report the number of excessive characters
+					sys.stdout.write('FAIL: Seen {0} too many characters'.format(0-self.charcount))
+
+			def finish(self):
+				# if self.seendoc:
+				# 	self.failed = True
+				#	sys.stdout.write('FAIL: Still in a doc at end')
+				if self.startcount > 0:
+					# Already tested to see if it's less than 0
+					self.failed = True
+					sys.stdout.write('FAIL: Not enough start elements')
+				if self.endcount > 0:
+					self.failed = True
+					sys.stdout.write('FAIL: Not enough end elements')
+				if self.charcount > 0:
+					self.failed = True
+					sys.stdout.write('FAIL: Not enough chars')
+
+		
+		filter = testFilter()
+		filter.open([])
+		self.assertTrue(filter.write("<foo>FooText<bar>BarText</bar></foo>"))
+		filter.finish()
+		self.assertFalse(filter.failed)
+
+	def testPerRecipeFilter(self):
+		class testFilter(filter_interface.PerRecipeFilter):
+			recipes = [ { 'name':'recipe1', 'target':'target1', 'host':'host1', 'layer':'layer1',  'component':'component1', 'bldinf':'test1.inf', 'mmp':'test1.mmp', 'config':'winscw_test1', 'platform':'plat1', 'phase':'PHASE1', 'source':'source1', 'prereqs':'prereqs1', 'text':'\nTest text 1\n\n'},
+			{ 'name':'recipe2', 'target':'target2', 'host':'host2', 'layer':'layer2',  'component':'component2', 'bldinf':'test2.inf', 'mmp':'test2.mmp', 'config':'winscw_test2', 'platform':'', 'phase':'PHASE2', 'source':'', 'prereqs':'', 'text':'\nTest text 2\n\n'} ]
+
+			def __init__(self):
+				super(testFilter,self).__init__()
+				self.failed = False
+
+			def HandleRecipe(self):
+				testRecipe = self.recipes[0]
+				self.recipes = self.recipes[1:]
+
+				for key in testRecipe.keys():
+					if not self.__dict__.has_key(key):
+						self.failed = True
+						sys.stdout.write('FAIL: self.{0} not set\n'.format(key))
+					elif self.__dict__[key] != testRecipe[key]:
+						self.failed = True
+						sys.stdout.write('FAIL: {0} != {1}\n'.format(repr(self.__dict__[key]),repr(testRecipe[key])))
+	
+		filter = testFilter()
+		filter.open([])
+		self.assertTrue(filter.write('''<?xml version="1.0" encoding="ISO-8859-1" ?>
+<buildlog sbs_version="99.99.9 [ISODATE symbian build system CHANGESET]" xmlns="http://symbian.com/xml/build/log" xmlns:progress="http://symbian.com/xml/build/log/progress" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symbian.com/xml/build/log http://symbian.com/xml/build/log/1_0.xsd">
+<info>sbs: version 99.99.9 [ISODATE symbian build system CHANGESET]
+</info>
+<progress:discovery object_type='bld.inf references' count='1' />
+<whatlog bldinf='test.inf' mmp='' config=''>
+<export destination='test' source='test2'/>
+</whatlog>
+<recipe name='recipe1' target='target1' host='host1' layer='layer1' component='component1' bldinf='test1.inf' mmp='test1.mmp' config='winscw_test1' platform='plat1' phase='PHASE1' source='source1' prereqs='prereqs1'>
+<![CDATA[Test text 1]]><time start='1234567890.01234' elapsed='1.234' />
+<status exit='ok' attempt='1' flags='FLAGS1' />
+</recipe>
+<recipe name='recipe2' target='target2' host='host2' layer='layer2' component='component2' bldinf='test2.inf' mmp='test2.mmp' config='winscw_test2' platform='' phase='PHASE2' source='' prereqs=''>
+<![CDATA[Test text 2]]><time start='0123456789.12340' elapsed='2.345' />
+<status exit='failed' attempt='2' flags='FLAGS2' />
+</recipe>
+</buildlog>
+'''))
+		self.assertFalse(filter.failed)
+
+# run all the tests
+
+from raptor_tests import SmokeTest
+
+def run():
+	t = SmokeTest()
+	t.id = "999"
+	t.name = "filter_interface_unit"
+
+	tests = unittest.makeSuite(TestFilterInterface)
+	result = unittest.TextTestRunner(verbosity=2).run(tests)
+
+	if result.wasSuccessful():
+		t.result = SmokeTest.PASS
+	else:
+		t.result = SmokeTest.FAIL
+
+	return t
--- a/sbsv2/raptor/test/unit_suite/raptor_cli_unit.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/unit_suite/raptor_cli_unit.py	Mon Nov 29 15:37:06 2010 +0800
@@ -150,6 +150,9 @@
 		self.pp=onoroff
 		return True
 
+	def SetRsgCaseFolding(self, yesOrNo):
+		return True
+
 	def AddProject(self, project):
 		return True
 
--- a/sbsv2/raptor/test/unit_suite/raptor_meta_unit.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/unit_suite/raptor_meta_unit.py	Mon Nov 29 15:37:06 2010 +0800
@@ -671,7 +671,7 @@
 	
 	
 		mmpContent = mmpFile.getContent(self.ARMV5)
-		mmpBackend = raptor_meta.MMPRaptorBackend(None, str(mmpFile.filename), str(bldInfObject.filename))
+		mmpBackend = raptor_meta.MMPRaptorBackend(self.raptor, str(mmpFile.filename), str(bldInfObject.filename))
 		mmpParser = mmpparser.MMPParser(mmpBackend)
 		parseresult = None
 		try:
@@ -830,6 +830,7 @@
 
 		def DummyMetaReaderInit(self, aRaptor):
 			self._MetaReader__Raptor = aRaptor
+			self.ExportPlatforms = []
 
 		raptor_meta.MetaReader.__init__ = DummyMetaReaderInit
 
@@ -913,20 +914,20 @@
 		# Test how we resolve known permutations of values given to the .mmp file OPTION_REPLACE keyword
 		mockBackend = raptor_meta.MetaReader(self.raptor)
 		
-		resultsDictList = [ {"bldinf":"Z:/src/romfile/group/tb92/GROUP/bld.inf", "result":"romfile"},
-				    {"bldinf":"/src/romfile/group/tb92/GROUP/bld.inf", "result":"romfile"},
-				    {"bldinf":"Z:/src/romFile/group/tb92/GROUP/another.inf", "result":"romFile"},
-				    {"bldinf":"X:/src/RoMfile/group/bld.inf", "result":"RoMfile"},
-				    {"bldinf":"w:/contacts/group/ONgoing/group/bld.inf", "result":"contacts"},
-				    {"bldinf":"p:/group/bld.inf", "result":"module"},
-				    {"bldinf":"/group/bld.inf", "result":"module"},
-				    {"bldinf":"p:/ONGOING/bld.inf", "result":"module"},
-				    {"bldinf":"/ONGOING/bld.inf", "result":"module"}
-				    ]
+		resultsDictList = [ {"bldinf":"Z:/src/Romfile/group/tb92/GROUP/bld.inf", 'epocroot': 'Z:', "result":"src_romfile_tb92"},
+				    {"bldinf":"/home/src/roMfile/group/tb92/GROUP/bld.inf", 'epocroot': '/home', "result":"src_romfile_tb92"},
+				    {"bldinf":"Z:/src/romFile/tb92/GROUP/another.inf", 'epocroot': 'Z:', "result":"src_romfile_tb92"},
+				    {"bldinf":"X:/some/path/that/is/much/longer/than/expected/bld.inf", 'epocroot': 'X:', "result":"longer_than_expected"},
+				    {"bldinf":"w:/contacts/ONgoing/group/bld.inf", 'epocroot': 'w:', "result":"contacts_ongoing"},
+				    {"bldinf":"p:/group/bld.inf", 'epocroot': 'p:', "result":"module"},
+				    {"bldinf":"/home/group/bld.inf", 'epocroot': '/home', "result":"module"}
+				]
 
 		for result in resultsDictList:
+			mockBackend.ExportPlatforms.append({'EPOCROOT': result['epocroot']})
 			moduleName = mockBackend.ModuleName(result["bldinf"])
 			self.assertEquals(moduleName, result["result"])
+			mockBackend.ExportPlatforms.pop()
 
 		self.restoreMetaReader()
 
--- a/sbsv2/raptor/test/unit_suite/raptor_xml_unit.py	Mon Nov 29 15:29:25 2010 +0800
+++ b/sbsv2/raptor/test/unit_suite/raptor_xml_unit.py	Mon Nov 29 15:37:06 2010 +0800
@@ -131,6 +131,44 @@
 				
 		# Probably redundant, but return local environment (at least its dictionary) to pre-test state
 		os.environ["SOURCEROOT"] = sourceroot
+
+	def testSystemDefinitionWriting(self):
+		# Test creating a system model not from a file
+		model = raptor_xml.SystemModel(self.__logger, aDoRead=False)
+		sbsHome = os.environ["SBS_HOME"]
+		bldInfDir = os.path.join(sbsHome, "test/smoke_suite/test_resources/sysdef/")
+		bldinf1 = generic_path.Path(os.path.join(bldInfDir,'metadata_export_pre1/bld.inf'))
+		bldinf2 = generic_path.Path(os.path.join(bldInfDir,'dependent_on_exports/bld.inf'))
+		bldinf3 = generic_path.Path(os.path.join(bldInfDir,'metadata_export_pre2/bld.inf'))
+		model.AddComponent(raptor.Component(bldinf1,'layer1'))
+		model.AddComponent(raptor.Component(bldinf2,'layer1'))
+		model.AddComponent(raptor.Component(bldinf3,'layer2'))
+		self.assertTrue(model.HasLayer('layer2'))
+		self.assertTrue(len(model.GetLayerNames())==2)
+		self.__compareFileLists([bldinf1,bldinf2],model.GetLayerComponents('layer1'))
+		self.__compareFileLists([bldinf3],model.GetLayerComponents('layer2'))
+		self.__compareFileLists([bldinf1,bldinf2,bldinf3],model.GetAllComponents())
+
+		# Write out the file
+		epocroot="/"
+		if os.environ.has_key('EPOCROOT'):
+			epocroot = os.environ['EPOCROOT']
+		try:
+			os.mkdir(os.path.join(epocroot,'epoc32/build'))
+		except OSError:
+			# Dir already exists?
+			pass
+		sysdeffile = os.path.join(epocroot,'epoc32/build/sysdefwrite.xml')
+		model.Write(sysdeffile)
+
+		# Reload it and rerun the tests
+		model2 = raptor_xml.SystemModel(self.__logger,generic_path.Path(sysdeffile),"")
+		self.assertTrue(model2.HasLayer('layer2'))
+		self.assertTrue(len(model2.GetLayerNames())==2)
+		self.__compareFileLists([bldinf1,bldinf2],model2.GetLayerComponents('layer1'))
+		self.__compareFileLists([bldinf3],model2.GetLayerComponents('layer2'))
+		self.__compareFileLists([bldinf1,bldinf2,bldinf3],model2.GetAllComponents())
+
 		
 	def __compareFileLists (self, aListOne, aListTwo):
 		
--- a/srctools/distillsrc/DISTRIBUTION.POLICY	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Category T
-OSD:	Reference/Test	Tools
--- a/srctools/distillsrc/test/DISTRIBUTION.POLICY	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Category T
-OSD:	Reference/Test	Tools
--- a/srctools/distillsrc/test/source/DISTRIBUTION.POLICY	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Category T
-OSD:	Reference/Test	Tools
--- a/srctools/distillsrc/test/source/complete/DISTRIBUTION.POLICY	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Category T
-OSD:	Reference/Test	Tools
--- a/srctools/distillsrc/test/source/missing/DISTRIBUTION.POLICY	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Category T
-OSD:	Reference/Test	Tools
--- a/srctools/distillsrc/test/source/shared/DISTRIBUTION.POLICY	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Category T
-OSD:	Reference/Test	Tools
--- a/srctools/distillsrc/test/source/spacey/DISTRIBUTION.POLICY	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Category T
-OSD:	Reference/Test	Tools
--- a/srctools/distillsrc/test/source/spacey/spacey.mrp	Mon Nov 29 15:29:25 2010 +0800
+++ b/srctools/distillsrc/test/source/spacey/spacey.mrp	Mon Nov 29 15:37:06 2010 +0800
@@ -1,5 +1,5 @@
 component spacey
 source \source//spacey\\spacey.mrp
-source \source//spacey\\DISTRIBUTION.POLICY
+
 source \source\spacey\spa cey.txt
 notes_source	dummy     
--- a/srctools/distillsrc/test/source/whole/DISTRIBUTION.POLICY	Mon Nov 29 15:29:25 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Category T
-OSD:	Reference/Test	Tools