imgtools/romtools/rofsbuild/rofsbuild.cpp
changeset 708 0757c2976f96
parent 698 e3ee96a3961c
child 714 e5a58c351011
--- 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)
 		{