ROM Tools 12.3.4 + RCOMP 8.4.2
authorZheng Shen <zheng.shen@nokia.com>
Tue, 17 Aug 2010 15:31:16 +0800
changeset 626 ac03b93ca9c4
parent 625 a1925fb7753a
child 627 cb3264f4c6e6
child 629 541af5ee3ed9
ROM Tools 12.3.4 + RCOMP 8.4.2
bintools/rcomp/group/RELEASE.TXT
bintools/rcomp/inc/VERSION.H
bintools/rcomp/src/main.cpp
imgtools/buildrom/group/BLD.INF
imgtools/buildrom/group/charsettran.mmp
imgtools/buildrom/group/release.txt
imgtools/buildrom/src/charsettran.cpp
imgtools/buildrom/tools/buildrom.pl
imgtools/buildrom/tools/buildrom.pm
imgtools/buildrom/tools/checkepocroot.pl
imgtools/buildrom/tools/datadriveimage.pm
imgtools/buildrom/tools/externaltools.pm
imgtools/imgcheck/group/imgcheck.mmp
imgtools/imgcheck/group/imgutils.mmp
imgtools/imgcheck/libimgutils/src/utils.cpp
imgtools/imglib/group/bld.inf
imgtools/imglib/group/uniconv.mmp
imgtools/imglib/host/h_utl.cpp
imgtools/imglib/inc/fatdefines.h
imgtools/imglib/inc/h_utl.h
imgtools/imglib/uniconv/include/uniconv.hpp
imgtools/imglib/uniconv/source/uniconv.cpp
imgtools/romtools/group/readimage.mmp
imgtools/romtools/group/release.txt
imgtools/romtools/readimage/src/image_handler.cpp
imgtools/romtools/rofsbuild/fatimagegenerator.cpp
imgtools/romtools/rofsbuild/fatimagegenerator.h
imgtools/romtools/rofsbuild/r_build.cpp
imgtools/romtools/rofsbuild/r_driveutl.cpp
imgtools/romtools/rofsbuild/r_obey.cpp
imgtools/romtools/rofsbuild/r_obey.h
imgtools/romtools/rofsbuild/rofsbuild.cpp
imgtools/romtools/rofsbuild/rofsbuild.mmp
imgtools/romtools/rombuild/r_build.cpp
imgtools/romtools/rombuild/r_obey.cpp
imgtools/romtools/rombuild/rombuild.cpp
imgtools/romtools/rombuild/rombuild.mmp
sbsv1/abld/e32util/armasm2as.pl
sbsv1/abld/makmake/makmake.pl
--- a/bintools/rcomp/group/RELEASE.TXT	Thu Aug 12 09:00:16 2010 +0100
+++ b/bintools/rcomp/group/RELEASE.TXT	Tue Aug 17 15:31:16 2010 +0800
@@ -1,3 +1,8 @@
+version 8.4.002
+===============
+Released by Marvin Shi, 10/08/2010
+	1) BUG2173 [RCOMP] - Linux : rcomp -o fails due to too long path 
+	
 version 8.4.001
 ===============
 Released by Lorence Wang, 26/04/2010
--- a/bintools/rcomp/inc/VERSION.H	Thu Aug 12 09:00:16 2010 +0100
+++ b/bintools/rcomp/inc/VERSION.H	Tue Aug 17 15:31:16 2010 +0800
@@ -18,6 +18,6 @@
 
 const char version[]="8.4";
 
-const char build[]="001";
+const char build[]="002";
 
 // end of version.h
--- a/bintools/rcomp/src/main.cpp	Thu Aug 12 09:00:16 2010 +0100
+++ b/bintools/rcomp/src/main.cpp	Tue Aug 17 15:31:16 2010 +0800
@@ -576,9 +576,10 @@
 			MOFF; cout << uidcrcTool << " " << uidcrcUIDs[0] << " " << uidcrcUIDs[1] << " " << uidcrcUIDs[2] << " " << DataOutputFileName.GetAssertedNonEmptyBuffer(); cout << endl; MON;
 			}
 
-		char uidcrc_params[512];
+		int namelen = strlen(uidcrcTool) + strlen(uidcrcUIDs[0]) * 3 + DataOutputFileName.Length() + 10; 
+		char *uidcrc_params = new char[namelen];
 		const int ret = snprintf(uidcrc_params,
-					 sizeof(uidcrc_params),
+					 namelen,
 					 "%s %s %s %s %s",
 					 uidcrcTool,
 					 uidcrcUIDs[0],
@@ -596,6 +597,8 @@
 			cerr << "Failed to write UIDs to " << DataOutputFileName << endl;
 			exit(error);
 			}
+		delete[] uidcrc_params;
+
 		RCBinaryStream RSCStream;
 		RSCStream.OpenForAppend(DataOutputFileName);
 		if(! RSCStream.IsOpen())
--- a/imgtools/buildrom/group/BLD.INF	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/buildrom/group/BLD.INF	Tue Aug 17 15:31:16 2010 +0800
@@ -74,6 +74,7 @@
 
 PRJ_MMPFILES
 configpaging
+charsettran
 
 
  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/buildrom/group/charsettran.mmp	Tue Aug 17 15:31:16 2010 +0800
@@ -0,0 +1,40 @@
+// 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:
+//
+
+
+TARGET			charsettran.exe
+TARGETTYPE		exe
+SOURCEPATH		../src
+SOURCE			charsettran.cpp
+SOURCEPATH		../../imglib/host
+SOURCE			h_utl.cpp
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+//SYSTEMINCLUDE	/epoc32/include
+SYSTEMINCLUDE	/epoc32/include/tools/stlport
+//SYSTEMINCLUDE	../../imglib/boostlibrary
+USERINCLUDE ../../imglib/uniconv/include
+USERINCLUDE ../../imglib/inc
+
+//STATICLIBRARY   boost_regex-1.39
+//STATICLIBRARY   stlport.5.1 
+STATICLIBRARY  uniconv
+#ifdef TOOLS2_LINUX
+OPTION    GCC -pthread -O2 -Wno-uninitialized
+#else
+OPTION    GCC -mthreads -O2 -Wno-uninitialized
+#endif 
+
+ 
+VENDORID 0x70000001
--- a/imgtools/buildrom/group/release.txt	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/buildrom/group/release.txt	Tue Aug 17 15:31:16 2010 +0800
@@ -1,3 +1,21 @@
+Version 3.27.1 (BUILDROM)
+===============
+Released by Lorence Wang, 10/08/2010
+	1) -cpp=xxx option support
+
+Version 3.27.0 (BUILDROM)
+Version 0.1    (charsettran)
+===============
+Released by Marvin Shi, 02/08/2010
+	1) UTF-8 OBY Support
+	
+Version 3.26.1 (BUILDROM)
+Version 0.2 (checkepocroot.pl)
+===============
+Released by Lorence Wang 28/07/2010
+	1) Standard cpp selection -stdcpp option
+	2) Case insensitive in checkepocroot.pl
+
 Version 3.26.0 (BUILDROM)
 ===============
 Released by Lorence Wang 28/06/2010
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/buildrom/src/charsettran.cpp	Tue Aug 17 15:31:16 2010 +0800
@@ -0,0 +1,117 @@
+/*
+* 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 <iostream>
+#include <string>
+#include "uniconv.hpp"
+#include "h_utl.h"
+
+using namespace std;
+
+void UTF82Host();
+void Host2UTF8();
+void PrintUsage();
+const unsigned int maxlength = 512;
+const float version = 0.1;
+
+int main(int argc, char* argv[])
+{
+	if(argc != 2)
+	{
+		PrintUsage();
+		return 0;
+	}
+	if(strncmp(argv[1], "-to=", 4))
+	{
+		cout << "Error parameters!" << endl;
+		return 0;
+	}
+	char * p = argv[1]+4;
+	if(!strnicmp(p, "hostcharset", 11))
+	{
+		UTF82Host();
+	}
+	else if(!strnicmp(p, "utf8", 4) || !strnicmp(p, "utf-8", 5))
+	{
+		Host2UTF8();
+	}
+	else
+	{
+		PrintUsage();
+	}
+}
+void PrintUsage()
+{
+	cout << "Charset translation tool - version: " << version << endl;
+	cout << "Usage: charsettran -to=[utf8|hostcharset]" << endl;
+}
+void UTF82Host()
+{
+	string tmpline;
+	char* tmpBuf = new char[maxlength];
+	unsigned int strLen = maxlength;
+	while(getline(cin, tmpline))
+	{
+		if(UniConv::IsPureASCIITextStream(tmpline.c_str()))
+		{
+			cout << tmpline << endl;
+			continue;
+		}
+		unsigned int outLen = maxlength;
+		int ret = UniConv::UTF82DefaultCodePage(tmpline.c_str(), tmpline.length(), &tmpBuf, &outLen);
+		if(ret == -1)
+		{
+			cout << tmpline << endl;
+			continue;
+		}
+		if(outLen > strLen)
+		{
+			strLen = outLen;
+		}
+		cout << tmpBuf << endl;
+
+	}
+	delete[] tmpBuf;
+}
+void Host2UTF8()
+{
+	string tmpline;
+	char* tmpBuf = new char[maxlength];
+	unsigned int strLen = maxlength;
+	while(cin >> tmpline)
+	{
+		if(UniConv::IsPureASCIITextStream(tmpline.c_str()))
+		{
+			cout << tmpline << endl;
+			continue;
+		}
+		unsigned int outLen = maxlength;
+		int ret = UniConv::DefaultCodePage2UTF8(tmpline.c_str(), tmpline.length(), &tmpBuf, &outLen);
+		if(ret == -1)
+		{
+			cout << tmpline << endl;
+			continue;
+		}
+		if(outLen > strLen)
+		{
+			strLen = outLen;
+		}
+		cout << tmpBuf << endl;
+
+	}
+	delete[] tmpBuf;
+}
--- a/imgtools/buildrom/tools/buildrom.pl	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/buildrom/tools/buildrom.pl	Tue Aug 17 15:31:16 2010 +0800
@@ -88,7 +88,7 @@
 
 	# Run single Invocation external tool at InvocationPoint1
 
-	&externaltools::runExternalTool("InvocationPoint1", &getOBYDataRef);
+	&externaltools::runExternalTool("InvocationPoint1", &getOBYDataRef, &getWorkdir);
 	
 	# Creates intermediate tmp4.oby file. Avoids processing of REM ECOM_PLUGIN(xxx,yyy)
 	&plugin_phase;
@@ -100,7 +100,7 @@
 	&spi_creation_phase;
 
 	# Run single Invocation external tool at InvocationPoint2
-	&externaltools::runExternalTool("InvocationPoint2",&getOBYDataRef);
+	&externaltools::runExternalTool("InvocationPoint2",&getOBYDataRef, &getWorkdir);
 	
 	# Creates intermediate tmp7.oby file. Problem Suppression phase
 	&suppress_phase;
@@ -115,13 +115,13 @@
 	&cleaning_phase;
 	
 	# Run single Invocation external tool at InvocationPoint2.5
-	&externaltools::runExternalTool("InvocationPoint2.5",&getOBYDataRef);
+	&externaltools::runExternalTool("InvocationPoint2.5",&getOBYDataRef, &getWorkdir);
 
 	#Creates dump OBY file for final oby file
 	&create_dumpfile;
 
 	# Run single Invocation external tool at InvocationPoint3
-	&externaltools::runExternalTool("InvocationPoint3",&getOBYDataRef);
+	&externaltools::runExternalTool("InvocationPoint3",&getOBYDataRef, &getWorkdir);
 
 	#ROM directory listing
 	&create_dirlisting;
--- a/imgtools/buildrom/tools/buildrom.pm	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/buildrom/tools/buildrom.pm	Tue Aug 17 15:31:16 2010 +0800
@@ -56,6 +56,7 @@
 	featurefile_creation_phase
 	processData
 	create_smrimage
+	getWorkdir
 );
 
 my $useinterpretsis = 1;
@@ -65,8 +66,8 @@
 my $enforceFeatureManager = 0; # Flag to make Feature Manager mandatory if SYMBIAN_FEATURE_MANAGER macro is defined. 
 
 my $BuildromMajorVersion = 3 ;
-my $BuildromMinorVersion = 26;
-my $BuildromPatchVersion = 0;
+my $BuildromMinorVersion = 27;
+my $BuildromPatchVersion = 2;
 
 
 sub print_usage
@@ -131,6 +132,7 @@
    -cache                           -- allow the ROFSBUILD to reuse/generate cached executable files
    -nocache                         -- force the ROFSBUILD not to reuse/generate cached executable files
    -cleancache                      -- permanently remove all cached executable files
+   -oby-charset=<charset>	        -- used character set in which OBY was written
    -loglevel<level>                 -- Level of information logging where loglevel is 0,1,2
                                        0 default level of information
                                        1 host/ROM filenames, file size and the hidden attribute along with level0 log
@@ -154,7 +156,9 @@
                                     the result will be checkcase.log, this option is only valid on windows.
    -workdir=xxx                     -- specify a directory to contain generated files. 
    -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.
+   
 Popular -D defines to use include
 
    -D_DEBUG         -- select debug versions of some files
@@ -344,6 +348,10 @@
 my $checkcase_test = 0;
 my $opt_workdir = 0;
 my $prependepocroot = 0;
+my $stdcpp = 0;
+my $obycharset;
+my $cppoption = 0;
+my $preprocessor = "cpp";
 
 sub match_obyfile
 {
@@ -497,8 +505,8 @@
 	{
 		# set the default path for Z drive and Data drive directory,
 		# if and only if, path is not specified by the user. 
-		$ZDirloc = &datadriveimage::setPath("zdrive") unless ($ZDirloc);
-		$DataDriveDirloc = &datadriveimage::setPath("datadrive") unless ($DataDriveDirloc);
+		$ZDirloc = $thisdir."zdrive" unless ($ZDirloc);
+		$DataDriveDirloc = $thisdir."datadrive" unless ($DataDriveDirloc);
 		#delete any existing Z drive directory.
 		my $retVal = &datadriveimage::deleteDirectory($ZDirloc,$opt_v)if(!$opt_r);
 		if($retVal)
@@ -535,6 +543,10 @@
 					# Location of stub-sis file(s) inside Z Drive folder.
 					my $zDriveSisFileLoc;
 					# check if more than one data drive image needs to be generated. 
+					if ($datadrivename =~ /.*[\\\/]([^\\\/]+)$/)
+					{
+						$datadrivename = $1;
+					}
 					if( $dataImageCount > 1 )
 					{
 						# if yes, then set the location of prototype data drive folder as 
@@ -602,7 +614,7 @@
 						# invoke INTERPRETSIS tool with z drive folder location.
 						if ($useinterpretsis)
 						{
-							&datadriveimage::invokeInterpretsis( \@sisfilelist,$proDataDriveDirloc,$opt_v,$zDriveSisFileLoc,$paraFile,$opt_k,\@interpretsisOptList)if($sisfilepresent);
+							&datadriveimage::invokeInterpretsis( \@sisfilelist,$proDataDriveDirloc,$opt_v,$zDriveSisFileLoc,$paraFile,$opt_k,\@interpretsisOptList,$thisdir)if($sisfilepresent);
 						}else
 						{
 							print "Warning: interpretsis is not ready on linux.\n";
@@ -763,7 +775,27 @@
 		if ( $arg =~ /^-k$/i || $arg =~ /^-keepgoing$/i )
 	  {
 			$opt_k = 1;		
-  		last;	
+  		next;	
+		}
+		if ($arg =~ /^-workdir=(.*)/)
+		{
+			my $workdir = $1;
+			if (!-d $workdir)
+			{
+				die "directory $workdir does not exist\n";
+			}
+			my $currentdir = cwd;
+			chdir "$workdir" or die "cannot change to directory $workdir\n";
+			$thisdir=cwd;
+			$thisdir=~s-\\-\/-go;		    # separator from Perl 5.005_02+ is forward slash
+			$thisdir.= "\/" unless $thisdir =~ /\/$/;
+			if(&is_windows)
+			{
+				$thisdir =~ s-\/-\\-g;
+			}
+			$opt_workdir = 1;
+			chdir "$currentdir";
+			next;	
 		}
 	}
 	foreach my $arg (@argList)
@@ -814,7 +846,12 @@
 		}
 		next;
 	    }
-	    if ($arg =~ /^-o(.*)/i)
+	    if ($arg =~/^-oby-charset=(.*)$/i)
+	    {
+		$obycharset = $1;
+		next;
+	    }
+	    if (($arg =~ /^-o(.*)/i) && ($arg !~ /^-oby-charset/i))
 	    {
 		$opt_o = $1;
 		next;
@@ -1003,24 +1040,44 @@
 		}
 		if ($arg =~ /^-workdir=(.*)/)
 		{
-			my $workdir = $1;
-			if (!-d $workdir)
+			next;
+		}
+		if ($arg =~ /^-stdcpp$/)
+		{
+			if (&is_linux)
 			{
-				die "directory $workdir does not exist\n";
+				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";
 			}
-			my $currentdir = cwd;
-			chdir "$workdir" or die "cannot change to directory $workdir\n";
-			$thisdir=cwd;
-			$thisdir=~s-\\-\/-go;		    # separator from Perl 5.005_02+ is forward slash
-			$thisdir.= "\/" unless $thisdir =~ /\/$/;
-			if(&is_windows)
+			$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)
 			{
-				$thisdir =~ s-\/-\\-g;
+				print "Warning: -cpp option has been set before. The previous configuration will be overwritten!\n";
 			}
-			$opt_workdir = 1;
-			chdir "$currentdir";
-			next;	
+			$cppoption = 1;
+			$preprocessor = $1;
+			$preprocessor =~ s-\\-\/-g;
+			$preprocessor =~ s-EPOCROOT##\/?-$epocroot-g;
+			if (-d $preprocessor)
+			{
+				$preprocessor .= "\/" unless $preprocessor =~ /\/$/;
+				$preprocessor .= "cpp";
+			}
+			next;
 		}
+
 		if ($arg =~ /^-prependepocroot$/)
 		{
 			$prependepocroot = 1;
@@ -1074,7 +1131,7 @@
 				if( $ZDirloc !~ m/:/)
 				{
 					print "drive letter not specified\n";
-					$ZDirloc = &datadriveimage::setPath($ZDirloc);
+					$ZDirloc = $thisdir.$ZDirloc;
 				}
 				print "Z Drive directory location = $ZDirloc\n";
 				#set the location of Z Drive directory.
@@ -1104,7 +1161,7 @@
 				if( $DataDriveDirloc !~ m/:/)
 				{
 					print "drive not specified\n";
-					$DataDriveDirloc = &datadriveimage::setPath($DataDriveDirloc);
+					$DataDriveDirloc = $thisdir.$DataDriveDirloc;
 				}
 				print "Data Drive directory location = $DataDriveDirloc\n";
 				#set the location of Data Drive directory.
@@ -1199,6 +1256,13 @@
 	    print "Missing obyfile argument\n";
 	    $errors++ if(!$opt_k);
 	}
+	if(defined($obycharset))
+	{
+		unless($obycharset =~ /utf-?8/i)
+		{
+			print "Warning: Ignoring not supportted charset $obycharset, local charset will be used as default!\n";
+		}
+	}
 
 	if ($errors)
 	{
@@ -1287,11 +1351,15 @@
 		$cppargs .= " -I. -I \"$rominclude\"";
 	}
 
-	print "* cpp -Wno-endif-labels -o $temp1OBYFile $cppargs\n" if ($opt_v);
+	if ($stdcpp)
+	{
+		$preprocessor = find_stdcpp();
+	}
+	print "* $preprocessor -Wno-endif-labels -o $temp1OBYFile $cppargs\n" if ($opt_v);
 	
-	is_existinpath("cpp", romutl::DIE_NOT_FOUND);
+	is_existinpath("$preprocessor", romutl::DIE_NOT_FOUND);
 	$errors = 0;
-	open CPP, "| cpp -Wno-endif-labels -o $temp1OBYFile $cppargs" or die "* Can't execute cpp";
+	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";
@@ -1329,6 +1397,20 @@
 
 	# 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";
+	}
 }
 
 sub ReadPreprocessedFile
@@ -2124,9 +2206,14 @@
 			}
 			elsif($smrImageStartRegion && !$smrImageEndRegion)
 			{
-				if($line =~ /^\s*IMAGENAME\s*=\s*(\S+)/i)
+				if($line =~ /^(\s*IMAGENAME\s*=\s*)(\S+)/i)
 				{
-					my $smrimagename = $1;
+					my $front = $1;
+					my $smrimagename = $2;
+					if ($smrimagename !~ /^.:/ && $smrimagename !~ /^[\\\/]/)
+					{
+						$smrimagename = $thisdir.$smrimagename;
+					}
 					$smrimagename =~s/(\.img)//i;
 					if(exists($smrNameInfo{$smrimagename}))
 					{
@@ -2136,9 +2223,11 @@
 					{
 						$smrNameInfo{$smrimagename} = 1;
 					}
-					$line =~s/(\.img)//i;
+					push @linesArray, "$front$smrimagename\n";
+				}else
+				{
+					push @linesArray, $line;
 				}
-				push @linesArray, $line;
 				$line = "REM handled $line";
 			}
 		}
@@ -3164,7 +3253,7 @@
 				# it is a manatory ROMBUILD keyword, in which case it is better
 				# to let ROMBUILD report the missing file rather than report the
 				# missing keyword.
-   				if ($what !~ /^bootbinary|variant|primary|secondary|hide|dir/i)
+   				if ($what !~ /^bootbinary|variant|primary|secondary|hide|dir|imagename/i)
 				{
    					$line = "REM MISSING " . $line;
    					print_source_error("Missing file: '$filename' in statement '$what='");
@@ -4103,6 +4192,11 @@
 		{
 				my $dataimageidx=$1;
 				close DUMPFILE;
+				my $name = $datadriveimage[$dataimageidx]{name};
+				if ($name !~ /^.:/ && $name !~ /^[\\\/]/)
+				{
+					$datadriveimage[$dataimageidx]{name} = $thisdir.$name;
+				}
 				$dumpfile="$datadriveimage[$dataimageidx]{name}";
 				$datadriveimage[$dataimageidx]{obeyfile}=$dumpfile;
 				$dumpfile .= ".oby";
@@ -4185,7 +4279,7 @@
 sub run_rombuilder
 {
 	my ($command, $obeyfile, $logfile) = @_;
-	$command .= " $obeyfile.oby";
+	$command .= " -logfile=$logfile $obeyfile.oby";
 	#CR1258 test cases are depending on the following output.
 	print "* Executing $command\n" if ($opt_v);
 
@@ -4306,7 +4400,7 @@
 			{
 				is_existinpath("rombuild", romutl::DIE_NOT_FOUND);
 				$rombuild .= " -symbols" unless($nosymbols) ;
-				run_rombuilder($rombuild.$compress, $obeyfile, "ROMBUILD.LOG");
+				run_rombuilder($rombuild.$compress, $obeyfile, $thisdir."ROMBUILD.LOG");
 			}
 			else
 			{
@@ -4333,7 +4427,7 @@
 					{
 						$rofsbuild .= " -symbols";
 					}			
-					run_rombuilder($rofsbuild.$compress, $obeyfile, "ROFSBUILD.LOG");
+					run_rombuilder($rofsbuild.$compress, $obeyfile, $thisdir."ROFSBUILD.LOG");
 				}
 			}
 			unlink "rombuild.log";
@@ -4802,6 +4896,49 @@
 	}
 }
 
+sub getWorkdir
+{
+	return $thisdir;
+}
+
+sub find_stdcpp
+{
+    return "cpp" if (!$stdcpp);
+    return "cpp" if (&is_linux);
+    
+    my $delimiter = &env_delimiter;
+		$ENV{PATH}="${epocroot}epoc32\/gcc_mingw\/bin$delimiter".$ENV{PATH};
+    my @paths;
+ 		@paths = split(/$delimiter/, $ENV{PATH});
+    unshift @paths, "\.";
+    
+    foreach my $path (@paths)
+    {
+        next if ($path =~ /^\s*$/);
+        chomp $path;
+        $path =~ s/\\/\//g;
+        $path .= "\/" unless ($path =~ /\/$/);
+        $path = $path."cpp.exe";
+        if (-e $path)
+        {
+		        $path = "\"$path\"";
+        		my $command = "$path --version 2>&1";
+						open DATA, "$command |"   or die "Couldn't execute command: $command\n";
+						my $line = <DATA>;
+						chomp($line);
+						print "$line\n" if($opt_v);
+						if ($line =~ /cpp\.exe \(GCC\) .* \(mingw special\)/)
+						{
+							print "found stdcpp in $path\n" if($opt_v);
+							close DATA;
+							return $path;
+						}
+						close DATA;
+        }
+    }
+    die "Error: Cannot found standard cpp.exe in the PATH.\n";
+} 
+
 sub checkcase()
 {
 	if (&is_windows)
--- a/imgtools/buildrom/tools/checkepocroot.pl	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/buildrom/tools/checkepocroot.pl	Tue Aug 17 15:31:16 2010 +0800
@@ -2,7 +2,7 @@
 
 use Getopt::Long;
 
-use constant TOOL_VERSION=>"0.1";
+use constant TOOL_VERSION=>"0.2";
 
 my $help;
 my $dir;
@@ -65,20 +65,20 @@
 	my $line;
 	while($line = <SRC>)
 	{
-		if ($line =~ /[\\\/]epoc32/)
+		if ($line =~ /[\\\/]epoc32[\\\/]/i)
 		{
 	  	print "Found content in file $src\n";
 	  	print LOG "Found content in file $src\n";
 	  	print "current line is $line";
 	  	print LOG "current line is $line";
-			if ($line =~ /EPOCROOT##[\\\/]?epoc32/)
+			if ($line =~ /EPOCROOT##[\\\/]?epoc32[\\\/]/i)
 			{
 				print "Error: this line already contain EPOCROOT\n";
 				next;
 			}
 	  	if($convert)
 	  	{
-		  	$line =~ s-[\\\/]epoc32-EPOCROOT##epoc32-g;
+		  	$line =~ s-[\\\/]epoc32(?=[\\\/])-EPOCROOT##epoc32-ig;
 		  	print "converted line is $line";
 		  	print LOG "converted line is  $line";
 		  }
--- a/imgtools/buildrom/tools/datadriveimage.pm	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/buildrom/tools/datadriveimage.pm	Tue Aug 17 15:31:16 2010 +0800
@@ -363,7 +363,7 @@
 # invoke the INTERPRETSIS tool with appropriate parameters.
 sub invokeInterpretsis
 {
-	my($sisFileArray,$dataDrivePath,$verboseOpt,$zDrivePath,$parafile,$keepgoingOpt,$interpretsisOptList) = @_;
+	my($sisFileArray,$dataDrivePath,$verboseOpt,$zDrivePath,$parafile,$keepgoingOpt,$interpretsisOptList,$outputdir) = @_;
 	my $sisfile = ""; 
 	# default system drive letter is specified since interpretsis doesnt allow overloading of options unless default 
 	# options are specified.
@@ -379,17 +379,33 @@
 		$dataDrivePath = '"'.$dataDrivePath.'"';
 	}
 
+	my $currentdir=cwd;
+	$currentdir=~s-\\-\/-go;
+	$currentdir.= "\/" unless $currentdir =~ /\/$/;
+	$currentdir =~ s-\/-\\-g if (&is_windows);
+	my $drive = "";
+	$drive = $1 if ($currentdir =~ /^(.:)/);
+
 	# find out size of the array
 	my $sisarraysize = scalar(@$sisFileArray);
 	for( my $i=0; $i<$sisarraysize; $i++ )
 	{
+		my $tempsisfile = pop(@$sisFileArray);
+		if ($tempsisfile =~ /^[\\\/]/)
+		{
+			$tempsisfile = $drive.$tempsisfile;
+		}elsif ($tempsisfile !~ /^.:/)
+		{
+			$tempsisfile = $currentdir.$tempsisfile;
+		}
+		
 		if($sisfile ne "")
 		{
-			$sisfile = pop(@$sisFileArray).",".$sisfile;
+			$sisfile = $tempsisfile.",".$sisfile;
 		}
 		else
 		{
-			$sisfile = pop(@$sisFileArray);
+			$sisfile = $tempsisfile;
 		}
 	}
 
@@ -421,10 +437,11 @@
 	else
 	{
 		# Truncate and open the parameter file for writing..
-		open( OPTDATA, "> parameterfile.txt" )  or die "can't open parameterfile.txt";
+		$parafile = $outputdir."parameterfile.txt";
+		open( OPTDATA, "> $parafile" )  or die "can't open $parafile";
 		print OPTDATA $basicOption."\n";
 		close( OPTDATA );
-		$command .= "-p parameterfile.txt ";
+		$command .= "-p $parafile ";
 	}
 
 	if( $interpretsisOptList )
@@ -437,6 +454,9 @@
 		}
 	}
 	
+	print "* Changing to $outputdir\n" if ( $verboseOpt );
+	chdir "$outputdir";
+	
 	print "* Executing $command\n" if ( $verboseOpt );
 	system ( $command );
 
@@ -444,6 +464,9 @@
 	{
 		&datadriveimage::reportError("* ERROR: INTERPRETSIS failed",$keepgoingOpt);
 	}
+	
+	print "* Changing back to $currentdir\n" if ( $verboseOpt );
+	chdir "$currentdir";
 }
 
 # invoke the READIMAGE tool with appropriate parameters.
--- a/imgtools/buildrom/tools/externaltools.pm	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/buildrom/tools/externaltools.pm	Tue Aug 17 15:31:16 2010 +0800
@@ -85,7 +85,7 @@
 # Called between the buildrom stage to invoke single or multiple invocation
 sub runExternalTool {
 	
-	my ($stageName,$OBYData) = @_;
+	my ($stageName,$OBYData,$workdir) = @_;
 	$stageName = lc $stageName;
 	my @toolInfoList =  @{$invocations{$stageName}}; # Collect Tools with respect to its stagename.
 	
@@ -93,8 +93,8 @@
 		if($tool->{name} eq "configpaging"){
 			my $pid ; 
 			my $args = $tool->{args};
-		
-			open CONFIG, "| configpaging $args >cfgp_out.oby" or die "* Can't execute cpp";
+			my $outputoby = $workdir."cfgp_out.oby";
+			open CONFIG, "| configpaging $args >$outputoby" or die "* Can't execute configpaging";
 	
 			foreach (@$OBYData){
 				chomp ;
@@ -105,13 +105,13 @@
 			close CONFIG;
 	
 			my $config_status = $?;
-			die "* configpaging failed\n" if ($config_status != 0 || !-f "cfgp_out.oby");
+			die "* configpaging failed\n" if ($config_status != 0 || !-f "$outputoby");
 
-			if(open(INTF,"cfgp_out.oby")){
+			if(open(INTF,"$outputoby")){
 				@$OBYData = <INTF>;
 				close INTF;
 			}			
-			unlink("cfgp_out.oby") or die "cannot delete cfgp_out.oby";	
+			unlink("$outputoby") or die "cannot delete $outputoby";	
 			next ;
 		}
 		if (exists($tool->{single})) {#Check if single invocation exists
--- a/imgtools/imgcheck/group/imgcheck.mmp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/imgcheck/group/imgcheck.mmp	Tue Aug 17 15:31:16 2010 +0800
@@ -26,6 +26,7 @@
 USERINCLUDE ../libimgutils/inc ../inc ../../imglib/compress
 USERINCLUDE   ../../imglib/boostlibrary
 USERINCLUDE   ../../imglib/boostlibrary/boost
+USERINCLUDE   ../../imglib/uniconv/include
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 #ifdef TOOL2_LINUX
@@ -35,7 +36,7 @@
 #endif
 SYSTEMINCLUDE ../../imglib/inc ../../romtools/rofsbuild
 
-STATICLIBRARY imgutils patchdataprocessor boost_thread-1.39 boost_filesystem-1.39  boost_system-1.39 stlport.5.1
+STATICLIBRARY imgutils patchdataprocessor boost_thread-1.39 boost_filesystem-1.39  boost_system-1.39 stlport.5.1 uniconv
 
 #ifdef TOOLS2_LINUX
 OPTION    GCC -pthread -O2 -Wno-uninitialized -lxml2 -lz -lm 
--- a/imgtools/imgcheck/group/imgutils.mmp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/imgcheck/group/imgutils.mmp	Tue Aug 17 15:31:16 2010 +0800
@@ -51,6 +51,7 @@
 USERINCLUDE	..\libimgutils\inc
 USERINCLUDE   ..\..\imglib\boostlibrary
 USERINCLUDE   ..\..\imglib\boostlibrary\boost
+USERINCLUDE   ..\..\imglib\uniconv\include
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
--- a/imgtools/imgcheck/libimgutils/src/utils.cpp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/imgcheck/libimgutils/src/utils.cpp	Tue Aug 17 15:31:16 2010 +0800
@@ -36,6 +36,7 @@
 TInt gDataPagingOverride = -1;
 TInt gLogLevel = 0;
 bool gCache = false;
+TBool gIsOBYUTF8 = EFalse;
 
 /** 
 Function receives an UID type of an executable and identifies whether it is a
--- a/imgtools/imglib/group/bld.inf	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/imglib/group/bld.inf	Tue Aug 17 15:31:16 2010 +0800
@@ -65,3 +65,4 @@
 parameterfileprocessor
 memmap
 uidcrc
+uniconv
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imglib/group/uniconv.mmp	Tue Aug 17 15:31:16 2010 +0800
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2008-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: 
+*
+*/
+
+
+target			libuniconv.a
+targettype		lib
+sourcepath		../uniconv/source
+source			uniconv.cpp
+
+userinclude		../uniconv/include
--- a/imgtools/imglib/host/h_utl.cpp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/imglib/host/h_utl.cpp	Tue Aug 17 15:31:16 2010 +0800
@@ -177,7 +177,7 @@
 
 
 	TInt build=0;
-	memset(&aVersion, sizeof(TVersion), 0);	
+	memset(&aVersion, 0, sizeof(TVersion));	
 	TInt i;
 	TInt len=strlen(str);
 	for (i=0; i<len; i++)
--- a/imgtools/imglib/inc/fatdefines.h	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/imglib/inc/fatdefines.h	Tue Aug 17 15:31:16 2010 +0800
@@ -128,9 +128,9 @@
     char iDriveVolumeLabel[12];
     TInt64 iImageSize ;
     TUint16 iDriveSectorSize;
-    TUint8 iSectorPerCluster ;
+    TUint32 iDriveClusterSize;
     TUint8 iDriveNoOfFATs;    
-    ConfigurableFatAttributes():iImageSize(0),iDriveSectorSize(512),iSectorPerCluster(0),iDriveNoOfFATs(2){
+    ConfigurableFatAttributes():iImageSize(0),iDriveSectorSize(512),iDriveClusterSize(0),iDriveNoOfFATs(2){
         memcpy(iDriveVolumeLabel,"NO NAME    \0",12);
     }
 };
--- a/imgtools/imglib/inc/h_utl.h	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/imglib/inc/h_utl.h	Tue Aug 17 15:31:16 2010 +0800
@@ -93,7 +93,7 @@
 #endif
 #define Print H.PrintString
 //
-const TInt KMaxStringLength=0x400;
+const TInt KMaxStringLength=0x800;
 //
 class HFile
 	{
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imglib/uniconv/include/uniconv.hpp	Tue Aug 17 15:31:16 2010 +0800
@@ -0,0 +1,45 @@
+/*
+* 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 BU_ROMTOOLS_IMGLIB_UNICONV_HPP_
+#define BU_ROMTOOLS_IMGLIB_UNICONV_HPP_
+
+
+/**
+ * @class UniConv
+ * @brief a helper class used to convert text stream from one encoding into another.
+ */
+class UniConv
+{
+public:
+	static int DefaultCodePage2UTF8(const char* DCPStringRef, unsigned int DCPLength, char** UTF8StringRef, unsigned int* UTFLength) throw ();
+
+	static int UTF82DefaultCodePage(const char* UTF8StringRef, unsigned int UTFLength, char** DCPStringRef, unsigned int* DCPLength) throw ();
+
+	static bool IsPureASCIITextStream(const char* StringRef) throw ();
+protected:
+private:
+	UniConv(void);
+
+	UniConv(const UniConv&);
+
+	UniConv& operator = (const UniConv&);
+};
+
+
+#endif  /* defined BU_ROMTOOLS_IMGLIB_UNICONV_HPP_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgtools/imglib/uniconv/source/uniconv.cpp	Tue Aug 17 15:31:16 2010 +0800
@@ -0,0 +1,260 @@
+/*
+* 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <string>
+#include <new>
+
+#ifdef WIN32
+#include <windows.h>
+#else
+#include <strings.h>
+#include <iconv.h>
+#endif
+
+#include "uniconv.hpp"
+
+
+int UniConv::DefaultCodePage2UTF8(const char* DCPStringRef, unsigned int DCPLength, char** UTF8StringRef, unsigned int* UTFLength) throw ()
+{
+	int reslen = -1;
+
+	if(!UTF8StringRef || !UTFLength || !DCPStringRef)
+		return (int)-1;
+
+#ifdef WIN32
+	//make Unicode string from its default code page
+	reslen = MultiByteToWideChar(CP_ACP, 0, DCPStringRef, DCPLength, NULL, 0);
+	if(0 == reslen)
+		return (int)-1;
+	WCHAR* unistr = new (std::nothrow) WCHAR[reslen+1];
+	if(!unistr)
+		return (int)-1;
+
+	reslen = MultiByteToWideChar(CP_ACP, 0, DCPStringRef, DCPLength, unistr, reslen);
+	if(0 == reslen)
+	{
+		delete[] unistr;
+		return (int)-1;
+	}
+
+	//make UTF-8 string from its Unicode encoding
+	unsigned int realutflen = 0;
+	realutflen = WideCharToMultiByte(CP_UTF8, 0, unistr, reslen, NULL, 0, NULL, NULL);
+	if(0 == realutflen)
+	{
+		delete[] unistr;
+		return (int)-1;
+	}
+	if(realutflen+1 > *UTFLength)
+	{
+		if(*UTF8StringRef)
+			delete[] *UTF8StringRef;
+		*UTF8StringRef = new (std::nothrow) char[realutflen+1];
+		if(!*UTF8StringRef)
+		{
+			delete[] unistr;
+			*UTFLength = 0;
+			return (int)-1;
+		}
+	}
+	*UTFLength = realutflen;
+	reslen = WideCharToMultiByte(CP_UTF8, 0, unistr, reslen, *UTF8StringRef, *UTFLength, NULL, NULL);
+	(*UTF8StringRef)[realutflen] = 0;
+
+	if(0 == reslen)
+		reslen = (int)-1;
+
+	//clean up temporarily allocated resources
+	delete[] unistr;
+#else
+	//character set format: language[_territory][.codeset][@modifier]
+	char* dcp = getenv("LANG");
+	if(!dcp)
+		return (int)-1;
+	char* dot = strstr(dcp, ".");
+	if(dot)
+		dcp += ((dot-dcp) + 1);
+	char* atmark = strstr(dcp, "@");
+	if(atmark)
+		*(atmark) = 0;
+	if(strcasecmp(dcp, "UTF-8") == 0)
+	{
+		strcpy(*UTF8StringRef, DCPStringRef);
+		*UTFLength = DCPLength;
+		return DCPLength;
+	}
+	iconv_t convhan = iconv_open("UTF-8", dcp);
+	if((iconv_t)(-1) == convhan)
+		return (int)-1;
+	char* utf8str = new (std::nothrow) char[DCPLength*4];
+	if(!utf8str)
+	{
+		iconv_close(convhan);
+		return (int)-1;
+	}
+	int realutflen = DCPLength*4;
+	int origLen = realutflen;
+	char* pout = utf8str;
+	if(iconv(convhan, const_cast<char**>(&DCPStringRef), (size_t*)&DCPLength, &pout, (size_t*)&realutflen) < 0)
+	{
+		iconv_close(convhan);
+		delete[] utf8str;
+		return (int)-1;
+	}
+	realutflen = origLen - realutflen;
+	if((unsigned int)(realutflen+1) > *UTFLength)
+	{
+		if(*UTF8StringRef)
+			delete[] *UTF8StringRef;
+		*UTF8StringRef = new (std::nothrow) char[realutflen+1];
+		if(!*UTF8StringRef)
+		{
+			delete[] utf8str;
+			iconv_close(convhan);
+			return (int)-1;
+		}
+	}
+	strncpy(*UTF8StringRef, utf8str, realutflen);
+	(*UTF8StringRef)[realutflen] = 0;
+	*UTFLength = realutflen;
+	reslen = realutflen;
+	delete[] utf8str;
+	iconv_close(convhan);
+#endif
+
+	return reslen;
+}
+
+int UniConv::UTF82DefaultCodePage(const char* UTF8StringRef, unsigned int UTFLength, char** DCPStringRef, unsigned int* DCPLength) throw ()
+{
+	int reslen = -1;
+
+	if(!DCPStringRef || !DCPLength || !UTF8StringRef)
+		return (int)-1;
+
+#ifdef WIN32
+	//make Unicode string from its UTF-8 encoding
+	reslen = MultiByteToWideChar(CP_UTF8, 0, UTF8StringRef, UTFLength, NULL, 0);
+	if(0 == reslen)
+		return (int)-1;
+	WCHAR* unistr = new (std::nothrow) WCHAR[reslen+1];
+	if(!unistr)
+		return (int)-1;
+
+	reslen = MultiByteToWideChar(CP_UTF8, 0, UTF8StringRef, UTFLength, unistr, reslen);
+	if(0 == reslen)
+	{
+		delete[] unistr;
+		return (int)-1;
+	}
+
+	//make default code paged string from its Unicode encoding
+	unsigned int realdcplen = 0;
+	realdcplen = WideCharToMultiByte(CP_ACP, 0, unistr, reslen, NULL, 0, NULL, NULL);
+	if(0 == realdcplen)
+	{
+		delete[] unistr;
+		return (int)-1;
+	}
+	if(realdcplen+1 > *DCPLength)
+	{
+		if(*DCPStringRef)
+			delete[] *DCPStringRef;
+		*DCPStringRef = new (std::nothrow) char[realdcplen+1];
+		if(!*DCPStringRef)
+		{
+			delete[] unistr;
+			*DCPLength = 0;
+			return (int)-1;
+		}
+	}
+	*DCPLength = realdcplen;
+	reslen = WideCharToMultiByte(CP_ACP, 0, unistr, reslen, *DCPStringRef, *DCPLength, NULL, NULL);
+	(*DCPStringRef)[realdcplen] = 0;
+
+	if(0 == reslen)
+		reslen = (int)-1;
+
+	//clean up temporarily allocated resources
+	delete[] unistr;
+#else
+	//character set format: language[_territory][.codeset][@modifier]
+	char* dcp = getenv("LANG");
+	if(!dcp)
+		return (int)-1;
+
+	char* dot = strstr(dcp, ".");
+	if(dot)
+		dcp += ((dot-dcp) + 1);
+	char* atmark = strstr(dcp, "@");
+	if(atmark)
+		*(atmark) = 0;
+	iconv_t convhan = iconv_open(dcp, "UTF-8");
+	if((iconv_t)(-1) == convhan)
+		return (int)-1;
+	char* dcpstr = new (std::nothrow) char[UTFLength*4];
+	if(!dcpstr)
+	{
+		iconv_close(convhan);
+		return (int)-1;
+	}
+	int realdcplen = UTFLength*4;
+	int origLen = realdcplen;
+	char* pout = dcpstr;
+	if(iconv(convhan, const_cast<char**>(&UTF8StringRef), (size_t*)&UTFLength, &pout, (size_t*)&realdcplen) < 0)
+	{
+		iconv_close(convhan);
+		delete[] dcpstr;
+		return (int)-1;
+	}
+	realdcplen = origLen - realdcplen;
+	if((unsigned int)(realdcplen+1) > *DCPLength)
+	{
+		if(*DCPStringRef)
+			delete[] *DCPStringRef;
+		*DCPStringRef = new (std::nothrow) char[realdcplen+1];
+		if(!*DCPStringRef)
+		{
+			delete[] dcpstr;
+			iconv_close(convhan);
+			return (int)-1;
+		}
+	}
+	strncpy(*DCPStringRef, dcpstr, realdcplen);
+	(*DCPStringRef)[realdcplen] = 0;
+	*DCPLength = realdcplen;
+	reslen = realdcplen;
+	delete[] dcpstr;
+	iconv_close(convhan);
+#endif
+
+	return reslen;
+}
+
+
+bool UniConv::IsPureASCIITextStream(const char* StringRef) throw ()
+{
+	while (*StringRef && !(*StringRef++ & 0x80))
+		;
+	if (*StringRef)
+		return false;
+	else
+		return true;
+}
--- a/imgtools/romtools/group/readimage.mmp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/romtools/group/readimage.mmp	Tue Aug 17 15:31:16 2010 +0800
@@ -46,13 +46,14 @@
 userinclude     ..\..\imglib\compress 
 userinclude		..\..\imglib\patchdataprocessor\include
 userinclude		..\..\sisutils\inc
+userinclude     ../../imglib/uniconv/include
 USERINCLUDE   ../rofsbuild/inc
 userinclude   ..\..\imglib\boostlibrary
 USERINCLUDE   ../../imglib/boostlibrary/boost
 
 USERINCLUDE ..\..\imglib\inc
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-STATICLIBRARY   boost_thread-1.39 boost_filesystem-1.39 sisutils
+STATICLIBRARY   boost_thread-1.39 boost_filesystem-1.39 sisutils uniconv
 
 #ifdef TOOLS2_LINUX
 STATICLIBRARY	boost_system-1.39
--- a/imgtools/romtools/group/release.txt	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/romtools/group/release.txt	Tue Aug 17 15:31:16 2010 +0800
@@ -1,3 +1,24 @@
+Version 2.18.1 (ROMBUILD)
+Version 2.13.1 (ROFSBUILD)
+===============
+Released by Lorence Wang, 10/08/2010
+	1) Add -logfile=<file> option to specify log file
+
+Version 2.18.0 (ROMBUILD)
+===============
+Released by Jason Cui, 28/07/2010
+	1) UTF-8 OBY Support
+
+Version 2.13.0 (ROFSBUILD)
+===============
+Released by Jason Cui, 28/07/2010
+	1) UTF-8 OBY Support
+
+Version 2.12.4 (ROFSBUILD)
+===============
+Released by Lorence Wang, 23/07/2010
+	1) Cluster size support 
+
 Version 2.12.3 (ROFSBUILD)
 ===============
 Released by Marvin Shi, 09/07/2010
--- a/imgtools/romtools/readimage/src/image_handler.cpp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/romtools/readimage/src/image_handler.cpp	Tue Aug 17 15:31:16 2010 +0800
@@ -40,6 +40,7 @@
 string SisUtils::iOutputPath = ".";
 string SisUtils::iExtractPath = ".";
 
+TBool gIsOBYUTF8 = EFalse;
 ImageHandler::ImageHandler() : iReader(NULL) ,iOptions(0), iSisUtils(NULL) {
 }
 
--- a/imgtools/romtools/rofsbuild/fatimagegenerator.cpp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/romtools/rofsbuild/fatimagegenerator.cpp	Tue Aug 17 15:31:16 2010 +0800
@@ -35,12 +35,35 @@
 iFatTable(0),
 iFatTableBytes(0), 
 iTotalClusters(0),	
-iBytsPerClus(0)
+iBytsPerClus(aAttr.iDriveClusterSize)
 {
 	memset(&iBootSector,0,sizeof(iBootSector));
 	memset(&iFat32Ext,0,sizeof(iFat32Ext));
 	memset(&iFatHeader,0,sizeof(iFatHeader));
+	
+	if(iBytsPerClus != 0){
+		if(iBytsPerClus > KMaxClusterBytes){
+			Print(EError,"Cluster size is too large!\n");
+			iType = EFatUnknown;
+			return ;
+		}else if(iBytsPerClus < aAttr.iDriveSectorSize){
+			Print(EError,"Cluster size cannot be smaller than sector size (%d)!\n", aAttr.iDriveSectorSize);
+			iType = EFatUnknown;
+			return ;
+		}else{
+			TUint32 tempSectorSize = aAttr.iDriveSectorSize;
+			while (tempSectorSize < iBytsPerClus){
+				tempSectorSize <<=1;
+			}
+			if (tempSectorSize > iBytsPerClus){
+				Print(EError,"Cluster size should be (power of 2)*(sector size) i.e. 512, 1024, 2048, 4096, etc!\n");
+				iType = EFatUnknown;
+				return;
+			}
+		}
+	}
 	if(aAttr.iDriveSectorSize != 512 && aAttr.iDriveSectorSize != 1024 && aAttr.iDriveSectorSize != 2048 && aAttr.iDriveSectorSize != 4096) {
+		Print(EError,"Sector size must be one of (512, 1024, 2048, 4096)!\n");
 		iType = EFatUnknown ;
 		return ;
 	}
@@ -66,19 +89,13 @@
 
 	TUint32 totalSectors = (TUint32)((aAttr.iImageSize + aAttr.iDriveSectorSize - 1) / aAttr.iDriveSectorSize);
 	if(aType == EFat32) {
-		InitAsFat32(totalSectors,aAttr.iSectorPerCluster ,aAttr.iDriveSectorSize);
+		InitAsFat32(totalSectors,aAttr.iDriveSectorSize);
 	}
 	else if(aType == EFat16) {
-		InitAsFat16(totalSectors,aAttr.iSectorPerCluster,aAttr.iDriveSectorSize); 
+		InitAsFat16(totalSectors,aAttr.iDriveSectorSize); 
 	}
 	if(iType == EFatUnknown) return ;
 	iBytsPerClus = iBootSector.BPB_SecPerClus * aAttr.iDriveSectorSize;
-//	if(iBytsPerClus > KMaxClusterBytes){
-//		Print(EError,"Cluster too large!\n");
-//		iType = EFatUnknown;
-//		return ;
-//	}
-	
 
 }
 TFatImgGenerator::~TFatImgGenerator() {
@@ -92,9 +109,10 @@
 	}
 }
 
-void TFatImgGenerator::InitAsFat16(TUint32 aTotalSectors,TUint8 aSecPerClus,TUint16 aBytsPerSec){
+void TFatImgGenerator::InitAsFat16(TUint32 aTotalSectors,TUint16 aBytsPerSec){
 	
 	TUint32 numOfClusters ;
+	TUint8 aSecPerClus = iBytsPerClus / aBytsPerSec;
 	if(aSecPerClus == 0) {
 		//Auto-calc the SecPerClus
 		// FAT32 ,Count of clusters must >= 4085 and < 65525 , however , to avoid the "off by xx" warning, 
@@ -122,19 +140,14 @@
 		}	
 	}
 	else {
-		if( (aSecPerClus * aBytsPerSec) > KMaxClusterBytes){
-			Print(EError,"Cluster too large!\n");
-			iType = EFatUnknown;
-			return ;
-		}
 		numOfClusters = (aTotalSectors + aSecPerClus - 1) / aSecPerClus;
 		if(numOfClusters >= (65525 - 16)){
-      Print(EError,"Cluster count is too big for FAT16, please use the FAT32 format or set a new bigger sector count of cluster!\n");
+      Print(EError,"Cluster count is too big for FAT16, please use the FAT32 format or set a new bigger cluster size!\n");
 			iType = EFatUnknown ;
 			return ;
 		}
 		else if(numOfClusters < (4085 + 16)){
-      Print(EError,"Cluster count is too small for FAT16, please set a new small sector count of cluster or set the size bigger!\n");
+      Print(EError,"Cluster count is too small for FAT16, please set a new smaller cluster size or set the image size bigger!\n");
 			iType = EFatUnknown ;
 			return ;
 		}
@@ -161,9 +174,10 @@
 	*((TUint16*)iBootSector.BPB_FATSz16) =  sectorsForFAT ; 
 	memcpy(iFatHeader.BS_FilSysType,"FAT16   ",sizeof(iFatHeader.BS_FilSysType));
 }
-void TFatImgGenerator::InitAsFat32(TUint32 aTotalSectors,TUint8 aSecPerClus,TUint16 aBytsPerSec) { 
+void TFatImgGenerator::InitAsFat32(TUint32 aTotalSectors,TUint16 aBytsPerSec) { 
 	
 	TUint32 numOfClusters;
+	TUint8 aSecPerClus = iBytsPerClus / aBytsPerSec;
 	if(aSecPerClus == 0) {
 		//Auto-calc the SecPerClus
 		// FAT32 ,Count of clusters must >= 65525, however , to avoid the "off by xx" warning, 
@@ -185,14 +199,9 @@
 		}	
 	}
 	else {
-		if( (aSecPerClus * aBytsPerSec) > KMaxClusterBytes){
-			Print(EError,"Cluster too large!\n");
-			iType = EFatUnknown;
-			return ;
-		}
 		numOfClusters = (aTotalSectors + aSecPerClus - 1) / aSecPerClus;
 		if(numOfClusters < (65525 + 16)) {
-            Print(EError,"Cluster count is too small for FAT32, please set a new small sector count of cluster or set the size bigger or use the FAT16 format!\n");
+            Print(EError,"Cluster count is too small for FAT32, please set a new smaller cluster size or set the image size bigger or use the FAT16 format!\n");
 			iType = EFatUnknown ;
 			return ;
 		}
--- a/imgtools/romtools/rofsbuild/fatimagegenerator.h	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/romtools/rofsbuild/fatimagegenerator.h	Tue Aug 17 15:31:16 2010 +0800
@@ -52,8 +52,8 @@
 	//If FAT image is not valid, or error accurs, return false
 	bool Execute(TFSNode* aRootDir , const char* aOutputFile);
 protected :
-	void InitAsFat16(TUint32 aTotalSectors,TUint8 aSecPerClus,TUint16 aBytsPerSec);
-	void InitAsFat32(TUint32 aTotalSectors,TUint8 aSecPerClus,TUint16 aBytsPerSec);
+	void InitAsFat16(TUint32 aTotalSectors, TUint16 aBytsPerSec);
+	void InitAsFat32(TUint32 aTotalSectors, TUint16 aBytsPerSec);
 	bool PrepareClusters(TUint& aNextClusIndex,TFSNode* aNode);
 	TSupportedFatType iType ;
 	char* iFatTable ; 
--- a/imgtools/romtools/rofsbuild/r_build.cpp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/romtools/rofsbuild/r_build.cpp	Tue Aug 17 15:31:16 2010 +0800
@@ -58,6 +58,7 @@
 #include "cache/cacheablelist.hpp"
 #include "cache/cachemanager.hpp"
 
+#include "uniconv.hpp"
 extern TUint checkSum(const void* aPtr);
 
 extern ECompression gCompress;
@@ -66,6 +67,7 @@
 extern TInt  gDataPagingOverride;
 extern TInt  gLogLevel;
 extern bool gCache;
+extern TBool gIsOBYUTF8;
 TBool gDriveImage=EFalse;	// for drive image support.
 
 
@@ -790,9 +792,29 @@
 iHidden(0), iRomNode(0), iRealFileSize(0)
 {
 	if (aFileName)
+	{
    		iFileName = NormaliseFileName(aFileName);
+   		if(gIsOBYUTF8 && !UniConv::IsPureASCIITextStream(iFileName))
+   		{
+			char* tempnname = strdup(iFileName);
+			unsigned int namelen = 0;
+			if(UniConv::UTF82DefaultCodePage(tempnname, strlen(tempnname), &iFileName, &namelen) < 0)
+				Print(EError, "Invalid filename encoding: %s\n", tempnname);
+			free(tempnname);
+   		}
+	}
 	if (aName)
+	{
 		iName = NormaliseFileName(aName);
+		if(!gIsOBYUTF8 && !UniConv::IsPureASCIITextStream(iName))
+		{
+			char* tempnname = strdup(iName);
+			unsigned int namelen = 0;
+			if(UniConv::DefaultCodePage2UTF8(tempnname, strlen(tempnname), &iName, &namelen) < 0)
+				Print(EError, "Invalid filename encoding: %s\n", tempnname);
+			free(tempnname);
+		}
+	}
 	memset(iUids,0 ,sizeof(TCheckedUid));
 }
 //
--- a/imgtools/romtools/rofsbuild/r_driveutl.cpp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/romtools/rofsbuild/r_driveutl.cpp	Tue Aug 17 15:31:16 2010 +0800
@@ -45,24 +45,6 @@
 	// Validate the user entered driveoby file name.
 	char* logFile = (char*)aDriveObeyFileName;
 
-#ifdef __LINUX__
-	logFile = strrchr(logFile,'/');
-#else
-	while(*logFile)
-		{
-		if(*logFile == '/')
-			*logFile = '\\';
-		logFile++;
-		}
-	logFile = (char*)aDriveObeyFileName;
-	logFile = strrchr(logFile,'\\');
-#endif
-	
-	if(logFile)
-		++logFile;
-	else
-		logFile = (char*)aDriveObeyFileName;
-
 	TInt len = strlen(logFile);
 	if(!len)
 		return KErrGeneral;
--- a/imgtools/romtools/rofsbuild/r_obey.cpp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/romtools/rofsbuild/r_obey.cpp	Tue Aug 17 15:31:16 2010 +0800
@@ -40,11 +40,13 @@
 #include "fatimagegenerator.h" 
 #include "r_driveimage.h"
 
+#include "uniconv.hpp"
 extern TInt gCodePagingOverride;
 extern TInt gDataPagingOverride;
 extern ECompression gCompress;
 extern TBool gEnableStdPathWarning; // Default to not warn if destination path provided for a file is not in standard path.
 extern TBool gKeepGoing;
+extern TBool gIsOBYUTF8;
 
 
 #define _P(word)	word, sizeof(word)-1	// match prefix, optionally followed by [HWVD]
@@ -80,6 +82,7 @@
 	{_K("dataimagesize"),1, 1,EKeywordDataImageSize, "Maximum size of Data Drive image"},
 	{_K("volume"),1, -1,EKeywordDataImageVolume, "Volume Label of Data Drive image"},
 	{_K("sectorsize"),1, 1,EKeywordDataImageSectorSize, "Sector size(in bytes) of Data Drive image"},
+	{_K("clustersize"),1, 1,EKeywordDataImageClusterSize, "Cluster size(in bytes) of Data Drive image"},
 	{_K("fattable"),1, 1,EKeywordDataImageNoOfFats, "Number of FATs in the Data Drive image"},
 	// things we don't normally report in the help information
 	{_K("trace"),		1, 1, EKeywordTrace, "(ROMBUILD activity trace flags)"},
@@ -782,13 +785,15 @@
 	case EKeywordDataImageSize:
 		{
 			const char* bigString = iReader.Word(1);
-			if(*bigString == '\0')
+			TInt64 imagesize = 0;
+			Val(imagesize,bigString); 
+			if(imagesize <= 0)
 			{
 				Print(EWarning,"Not a valid Image Size. Default size is considered\n");		
-				break;
-			}
- 
-			Val(iConfigurableFatAttributes.iImageSize,bigString); 
+			}else
+			{
+				iConfigurableFatAttributes.iImageSize = imagesize;
+			} 
 		}
 		break;
 	case EKeywordDataImageVolume:
@@ -829,23 +834,38 @@
 	case EKeywordDataImageSectorSize:
 		{
 			const char* bigString = iReader.Word(1);
-			TInt sectorSize = atoi(bigString);
+			TInt sectorSize = 0;
+			Val(sectorSize,bigString); 
 			if(sectorSize <= 0)	{
 				Print(EWarning,"Invalid Sector Size value. Default value is considered.\n");
 			}
 			else {
-				iConfigurableFatAttributes.iDriveSectorSize = atoi(bigString);
+				iConfigurableFatAttributes.iDriveSectorSize = sectorSize;
+			}
+		}			
+		break;
+	case EKeywordDataImageClusterSize:
+		{
+			const char* bigString = iReader.Word(1);
+			TInt clusterSize = 0;
+			Val(clusterSize,bigString); 
+			if(clusterSize <= 0)	{
+				Print(EWarning,"Invalid Cluster Size value. Default value is considered.\n");
+			}
+			else {
+				iConfigurableFatAttributes.iDriveClusterSize = clusterSize;
 			}
 		}			
 		break;
 	case EKeywordDataImageNoOfFats:
 		{
 			const char* bigString = iReader.Word(1);
-			TInt noOfFats = atoi(bigString);
+			TInt noOfFats = 0;
+			Val(noOfFats,bigString); 
 			if (noOfFats <=0)
 				Print(EWarning,"Invalid No of FATs specified. Default value is considered.\n");
 			else
-				iConfigurableFatAttributes.iDriveNoOfFATs = atoi(bigString);			
+				iConfigurableFatAttributes.iDriveNoOfFATs = noOfFats;			
 		}			
 		break;			
 	default:
@@ -947,6 +967,20 @@
 	if (aKeyword!=EKeywordHide && aKeyword!=EKeywordDir) {
 		// check the PC file exists
 		char* nname = NormaliseFileName(iReader.Word(1));		  
+		if(gIsOBYUTF8 && !UniConv::IsPureASCIITextStream(nname))
+		{
+			char* tempnname = strdup(nname);
+			unsigned int namelen = 0;
+			if(UniConv::UTF82DefaultCodePage(tempnname, strlen(tempnname), &nname, &namelen) < 0)
+			{
+				Print(EError, "Invalid filename encoding: %s\n", tempnname);
+				free(tempnname);
+				delete[] nname;
+				iMissingFiles++;
+				return EFalse;
+			}
+			free(tempnname);
+		}
 		ifstream test(nname);
 		if(!test.is_open()){
 			Print(EError,"Cannot open file %s for input.\n",iReader.Word(1));
@@ -1301,6 +1335,19 @@
 
 		// check the PC file exists
 		char* nname = NormaliseFileName(iReader.Word(1)); 
+		if(gIsOBYUTF8 && !UniConv::IsPureASCIITextStream(nname))
+		{
+			char* tempnname = strdup(nname);
+			unsigned int namelen = 0;
+			if(UniConv::UTF82DefaultCodePage(tempnname, strlen(tempnname), &nname, &namelen) < 0)
+			{
+				Print(EError, "Invalid filename encoding: %s\n", tempnname);
+				free(tempnname);
+				delete[] nname;
+				return EFalse;
+			}
+			free(tempnname);
+		}
 		ifstream test(nname);
 		if (!test) {
 			Print(EError,"Cannot open file %s for input.\n",iReader.Word(1));
@@ -1638,6 +1685,7 @@
 		break;
 	default:
 		// unexpected keyword iReader.Word(0)
+		Print(EWarning, "Unexpected keyword '%s' on line %d.\n",iReader.Word(0),iReader.CurrentLine());
 		break;
 	}
 
--- a/imgtools/romtools/rofsbuild/r_obey.h	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/romtools/rofsbuild/r_obey.h	Tue Aug 17 15:31:16 2010 +0800
@@ -76,6 +76,7 @@
 	EKeywordDataImageSize,
 	EKeywordDataImageVolume,
 	EKeywordDataImageSectorSize,
+	EKeywordDataImageClusterSize,
 	EKeywordDataImageNoOfFats,
 	EKeywordSmrImageName,
 	EKeywordSmrFileData,
--- a/imgtools/romtools/rofsbuild/rofsbuild.cpp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/romtools/rofsbuild/rofsbuild.cpp	Tue Aug 17 15:31:16 2010 +0800
@@ -46,8 +46,8 @@
 #endif
 
 static const TInt RofsbuildMajorVersion=2;
-static const TInt RofsbuildMinorVersion=12;
-static const TInt RofsbuildPatchVersion=4;
+static const TInt RofsbuildMinorVersion=13;
+static const TInt RofsbuildPatchVersion=1;
 static TBool SizeSummary=EFalse;
 static TPrintType SizeWhere=EAlways;
 
@@ -77,11 +77,13 @@
 TBool reallyHelp = EFalse;	
 TBool gSmrImage = EFalse;
 string gSmrFileName = "";
+static string rofslogfile = "ROFSBUILD.LOG";
 
 //Cache global variables
 bool gCache = false;
 bool gCleanCache = false;
 bool gNoCache = false;
+TBool gIsOBYUTF8 = EFalse;
 TBool gKeepGoing = EFalse;
 void PrintVersion() {
 	Print(EAlways,"\nROFSBUILD - Rofs/Datadrive image builder");
@@ -107,11 +109,13 @@
 	"        -datadrive=<drive obyfile1>,<drive obyfile2>,... for driveimage creation\n"
 	"              user can also input rofs oby file if required to generate both.\n"
 	"        -smr=<SMR obyfile1>,<SMR obyfile2>,... for SMR partition creation\n"
+	"        -oby-charset=<charset> used character set in which OBY was written\n"
 	"        -loglevel<level>  level of information to log (valid levels are 0,1,2).\n"//Tools like Visual ROM builder need the host/ROM filenames, size & if the file is hidden.
 	"        -wstdpath   warn if destination path provided for a file is not the standard path\n"
 	"        -argfile=<FileName>   specify argument-file name containing list of command-line arguments\n"
 "        -lowmem     use memory-mapped file for image build to reduce physical memory consumption\n"
-"        -k     to enable keepgoing when duplicate files exist in oby\n";
+"        -k     to enable keepgoing when duplicate files exist in oby\n"
+"        -logfile=<fileName>           specify log file\n";
 
 char ReallyHelpText[] =
 "Log Level:\n"
@@ -228,6 +232,13 @@
 					}
 				}
 			}
+			else if(strnicmp(argv[i], "-OBY-CHARSET=", 13) == 0)
+			{
+				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]);
+			}
 			else if (stricmp(argv[i], "-UNCOMPRESS") == 0) {
 				gCompress = ECompressionUncompress;
 			}
@@ -311,6 +322,9 @@
 				gLogLevel = DEFAULT_LOG_LEVEL;
 			else if (stricmp(argv[i], "-LOWMEM") == 0)
 				gLowMem = ETrue;
+			else if (strnicmp(argv[i], "-logfile=",9) ==0) {
+				rofslogfile = argv[i] + 9;
+			}
 			else {
 #ifdef WIN32
 				Print (EWarning, "Unrecognised option %s\n",argv[i]);
@@ -570,7 +584,9 @@
 	}
 	// Process Rofs Obey files.
 	if(obeyFileName) {
-		H.SetLogFile("ROFSBUILD.LOG");		
+		if (rofslogfile[rofslogfile.size()-1] == '\\' || rofslogfile[rofslogfile.size()-1] == '/')
+			rofslogfile += "ROFSBUILD.LOG";
+	 	H.SetLogFile(rofslogfile.c_str());
 		ObeyFileReader *reader = new ObeyFileReader(obeyFileName); 
 		if (!reader->Open())
 			return KErrGeneral;
--- a/imgtools/romtools/rofsbuild/rofsbuild.mmp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/romtools/rofsbuild/rofsbuild.mmp	Tue Aug 17 15:31:16 2010 +0800
@@ -46,12 +46,13 @@
 USERINCLUDE   ../../imglib/inc ../../imglib/compress
 USERINCLUDE   ../../imglib/patchdataprocessor/include ../../imglib/parameterfileprocessor/include
 USERINCLUDE	  ../../imglib/memmap/include
+USERINCLUDE   ../../imglib/uniconv/include
 USERINCLUDE   ../rofsbuild/inc
 USERINCLUDE   ../../imglib/boostlibrary/
 USERINCLUDE   ../../imglib/boostlibrary/boost
 
 STATICLIBRARY 	patchdataprocessor parameterfileprocessor memmap
-STATICLIBRARY   boost_thread-1.39 boost_filesystem-1.39 boost_regex-1.39 boost_system-1.39
+STATICLIBRARY   boost_thread-1.39 boost_filesystem-1.39 boost_regex-1.39 boost_system-1.39 uniconv
 #ifdef TOOLS2_LINUX
 OPTION    GCC -pthread -O2 -Wno-uninitialized
 #else
--- a/imgtools/romtools/rombuild/r_build.cpp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/romtools/rombuild/r_build.cpp	Tue Aug 17 15:31:16 2010 +0800
@@ -35,7 +35,9 @@
 #include "r_global.h"
 #include "r_dir.h"
 
+#include "uniconv.hpp"
 TInt NumRootDirs;
+extern TBool gIsOBYUTF8;
 
 inline TLinAddr ActualToRomAddress(TAny* anAddr) { 
 	return TLinAddr(anAddr)-TheRomMem+TheRomLinearAddress; 
@@ -723,13 +725,32 @@
 iHardwareVariant(KVariantIndependent),iDataBssOffset(0xffffffff), 
 iStackReserve(0),iIATRefs(0), iNext(0), iNextInArea(0), 
 iRomImageFlags(0),iProcessName(0), iRomNode(NULL) {
-	if (aFileName){
+	if (aFileName)
+	{
 		if(iFileName)
 			delete []iFileName;
 		iFileName = NormaliseFileName(aFileName);	 
+   		if(gIsOBYUTF8 && !UniConv::IsPureASCIITextStream(iFileName))
+   		{
+			char* tempnname = strdup(iFileName);
+			unsigned int namelen = 0;
+			if(UniConv::UTF82DefaultCodePage(tempnname, strlen(tempnname), &iFileName, &namelen) < 0)
+				Print(EError, "Invalid filename encoding: %s\n", tempnname);
+			free(tempnname);
+   		}
 	}
 	if (aName)
+	{
 		iName = NormaliseFileName(aName);
+		if(!gIsOBYUTF8 && !UniConv::IsPureASCIITextStream(iName))
+		{
+			char* tempnname = strdup(iName);
+			unsigned int namelen = 0;
+			if(UniConv::DefaultCodePage2UTF8(tempnname, strlen(tempnname), &iName, &namelen) < 0)
+				Print(EError, "Invalid filename encoding: %s\n", tempnname);
+			free(tempnname);
+		}
+	}
 }
 //
 // Destructor
--- a/imgtools/romtools/rombuild/r_obey.cpp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/romtools/rombuild/r_obey.cpp	Tue Aug 17 15:31:16 2010 +0800
@@ -41,6 +41,8 @@
 #include "patchdataprocessor.h"
 #include "r_coreimage.h" 
 
+#include "uniconv.hpp"
+extern TBool gIsOBYUTF8;
 #define _P(word)	word, sizeof(word)-1	// match prefix, optionally followed by [HWVD]
 #define _K(word)	word, 0					// match whole word
 static char* const NullString = "" ;
@@ -1070,6 +1072,20 @@
 
 	// check the PC file exists
 	char* nname = NormaliseFileName(iReader.Word(1)); 
+	if(gIsOBYUTF8 && !UniConv::IsPureASCIITextStream(nname))
+	{
+		char* tempnname = strdup(nname);
+		unsigned int namelen = 0;
+		if(UniConv::UTF82DefaultCodePage(tempnname, strlen(tempnname), &nname, &namelen) < 0)
+		{
+			Print(EError, "Invalid filename encoding: %s\n", tempnname);
+			free(tempnname);
+			iMissingFiles++;
+			delete[] nname;
+			return EFalse;
+		}
+		free(tempnname);
+	}
 	ifstream test(nname,ios_base::binary | ios_base::in); 
 
 	if (!test.is_open()) {
--- a/imgtools/romtools/rombuild/rombuild.cpp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/romtools/rombuild/rombuild.cpp	Tue Aug 17 15:31:16 2010 +0800
@@ -32,13 +32,14 @@
 const TInt KRomLoaderHeaderCOFF=2;
 
 static const TInt RombuildMajorVersion=2;
-static const TInt RombuildMinorVersion=17;
-static const TInt RombuildPatchVersion=4;
+static const TInt RombuildMinorVersion=18;
+static const TInt RombuildPatchVersion=1;
 static TBool SizeSummary=EFalse;
 static TPrintType SizeWhere=EAlways;
 static string compareROMName = "";
 static TInt MAXIMUM_THREADS = 128;
 static TInt DEFAULT_THREADS = 8;
+static string romlogfile = "ROMBUILD.LOG";
 
 string filename;			// to store oby filename passed to Rombuild.
 TBool reallyHelp=EFalse;
@@ -48,6 +49,7 @@
 TBool gGenDepGraph = EFalse;
 string gDepInfoFile = "";
 TBool gGenSymbols = EFalse ;
+TBool gIsOBYUTF8 = EFalse;
 void PrintVersion() {
  	Print(EAlways,"\nROMBUILD - Rom builder");
   	Print(EAlways, " V%d.%d.%d\n", RombuildMajorVersion, RombuildMinorVersion, RombuildPatchVersion);
@@ -72,13 +74,15 @@
 	"        -symbols                      generate symbol file\n"
 	"        -compressionmethod <method>   method one of none|inflate|bytepair to set the compression\n"
 	"        -no-sorted-romfs              do not add sorted entries arrays (6.1 compatible)\n"
+	"        -oby-charset=<charset> used character set in which OBY was written\n"
 	"        -geninc                       to generate include file for licensee tools to use\n"			// DEF095619
 	"        -loglevel<level>              level of information to log (valid levels are 0,1,2,3,4).\n" //Tools like Visual ROM builder need the host/ROM filenames, size & if the file is hidden.
 	"        -wstdpath                     warn if destination path provided for a file is not a standard path\n"
 	"        -argfile=<fileName>           specify argument-file name containing list of command-line arguments to rombuild\n"
 	"        -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";
+	"        -k                            to enable keepgoing when duplicate files exist in oby\n"
+	"        -logfile=<fileName>           specify log file\n";
 
 
 char ReallyHelpText[] =
@@ -256,6 +260,13 @@
 					delete[] parameter;
 					}
 				}	
+			else if(strnicmp(argv[i], "-OBY-CHARSET=", 13) == 0)
+			{
+				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]);
+			}
 			else if( stricmp(arg, "compressionmethod") == 0 ) {
  				// next argument should be a method
 				if( (i+1) >= argc || argv[i+1][0] == '-') {
@@ -335,6 +346,9 @@
  					Print (EError, "Core ROM image file is missing\n"); 
 				}
 			}
+			else if (strnicmp(arg, "logfile=",8) ==0) {
+				romlogfile = arg + 8;
+			}
 			else 
 #ifdef WIN32
 				cout << "Unrecognised option " << argv[i] << "\n";
@@ -424,7 +438,6 @@
 }
 
 int main(int argc, char *argv[])  {
- 	H.SetLogFile("ROMBUILD.LOG");
 	TInt r = 0;
 #ifdef __LINUX__
 	gCPUNum = sysconf(_SC_NPROCESSORS_CONF);
@@ -440,6 +453,10 @@
  	if(filename.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);
--- a/imgtools/romtools/rombuild/rombuild.mmp	Thu Aug 12 09:00:16 2010 +0100
+++ b/imgtools/romtools/rombuild/rombuild.mmp	Tue Aug 17 15:31:16 2010 +0800
@@ -40,12 +40,13 @@
 
 userinclude	../../imglib/compress 	../../imglib/inc 
 userinclude	../../imglib/patchdataprocessor/include ../../imglib/parameterfileprocessor/include
+userinclude     ../../imglib/uniconv/include
 userinclude ../../imglib/memmap/include
 userinclude	../../imglib/boostlibrary/
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
-staticlibrary	patchdataprocessor parameterfileprocessor memmap boost_thread-1.39
+staticlibrary	patchdataprocessor parameterfileprocessor memmap boost_thread-1.39 uniconv
 
 #ifdef TOOLS2_LINUX
 OPTION    GCC -O2 -Wno-uninitialized -pthread
--- a/sbsv1/abld/e32util/armasm2as.pl	Thu Aug 12 09:00:16 2010 +0100
+++ b/sbsv1/abld/e32util/armasm2as.pl	Tue Aug 17 15:31:16 2010 +0800
@@ -288,12 +288,14 @@
 	$val =~ s/\{TRUE\}/(1)/g;
 	$val =~ s/\{FALSE\}/(0)/g;
 
-	my @lops = split( /(\s*\:LAND\:\s*|\s*\:LOR\:\s*|\s*\:LNOT\:\s*|\s*\:DEF\:\s*)/, $val );
+	my @lops = split( /(\s*\:LAND\:\s*|\s*\:LOR\:\s*|\s*\:LNOT\:\s*|\s*\:DEF\:\s*|\s*\(\s*|\s*\)\s*)/, $val );
 	foreach (@lops) {
 		s/\s*\:LAND\:\s*/\:LAND\:/go;
 		s/\s*\:LOR\:\s*/\:LOR\:/go;
 		s/\s*\:LNOT\:\s*/\:LNOT\:/go;
 		s/\s*\:DEF\:\s*/\:DEF\:/go;
+		s/\s*\(\s*/\(/go;
+		s/\s*\)\s*/\)/go;
 	}
 	my @lops2;
 	while (scalar (@lops)) {
@@ -320,12 +322,28 @@
 	while (scalar (@lops2)) {
 		my $x = shift @lops2;
 		if ($x eq ':LNOT:') {
-			my $operand;
-			while (1) {
+			my $operand= shift @lops2;
+			while( @lops2 && $operand =~ /^\s*$/) {
 				$operand = shift @lops2;
-				last if ($operand !~ /^\s*$/);
 			}
-			push @lops3, "(0==($operand))";
+			if($operand eq '(') {
+				my $balance = 1;
+				my $compound = $operand;
+				while($balance > 0 && @lops2) {
+					$operand = shift @lops2;
+					if($operand eq '(') {
+						++$balance;
+					}
+					elsif ($operand eq ')') {
+						--$balance;
+					}
+					$compound .= $operand;
+				}
+				push @lops3, "(0==$compound)";
+			}
+			else {
+				push @lops3, "(0==($operand))";
+			}
 		} else {
 			push @lops3, $x;
 		}
--- a/sbsv1/abld/makmake/makmake.pl	Thu Aug 12 09:00:16 2010 +0100
+++ b/sbsv1/abld/makmake/makmake.pl	Tue Aug 17 15:31:16 2010 +0800
@@ -456,7 +456,7 @@
 					@reusedHash = featurevariantmap->CheckOldVmapFile($vmap, \%FeatureVariantInfo);
 				}
 			}
-			if(defined(@reusedHash))
+			if(@reusedHash)
 			{
 				$FeatureVariantInfo{$bld."_LABEL"} = $reusedHash[0];
 				$FeatureVariantInfo{$bld."_FEATURES"} = $reusedHash[1];
@@ -557,7 +557,7 @@
 	$variant_info = &Path_Chop($E32env::Data{BldPath}).$Path{BldInfPath}."\\FeatureVariantInfo\\".$Plat{Real}."\\".$Plat{Real}.".".$FeatureVariantInfo{NAME}.".info" if ! -e $MMPFILE;
 # modified by SV end: makefile improvement 
 	my $variant_key = "VARIANT_PLAT_NAME_".&Path_Split('Base', $MMPFILE);
-	$variant_info_new = $variant_info.".tmp";
+	my $variant_info_new = $variant_info.".tmp";
 	open VARIANTINFOR_NEW, ">$variant_info_new" or die "ERROR: Can't open or create file \"$variant_info_new\"\n";
 
 	# Open the variant infor file