imgtools/romtools/rofsbuild/rofsbuild.cpp
changeset 694 c3fbb20e86f0
parent 691 9eeecb73a5d4
child 698 e3ee96a3961c
equal deleted inserted replaced
692:1dfff72f0961 694:c3fbb20e86f0
    32 #include "cache/cache.hpp"
    32 #include "cache/cache.hpp"
    33 #include "cache/cachegenerator.hpp"
    33 #include "cache/cachegenerator.hpp"
    34 #include "cache/cachevalidator.hpp"
    34 #include "cache/cachevalidator.hpp"
    35 #include "cache/cacheablelist.hpp"
    35 #include "cache/cacheablelist.hpp"
    36 #include "cache/cachemanager.hpp"
    36 #include "cache/cachemanager.hpp"
    37 #include "logging/loggingexception.hpp"
    37 #include "logparser.h"
    38 #include "logging/logparser.hpp"
       
    39 #include <malloc.h>
    38 #include <malloc.h>
    40  
    39  
    41 #ifndef WIN32
    40 #ifndef WIN32
    42 #include <unistd.h>
    41 #include <unistd.h>
    43 #include <strings.h>
    42 #include <strings.h>
    46 #define stricmp strcasecmp
    45 #define stricmp strcasecmp
    47 #define _alloca alloca
    46 #define _alloca alloca
    48 #endif
    47 #endif
    49 
    48 
    50 static const TInt RofsbuildMajorVersion=2;
    49 static const TInt RofsbuildMajorVersion=2;
    51 static const TInt RofsbuildMinorVersion=16;
    50 static const TInt RofsbuildMinorVersion=17;
    52 static const TInt RofsbuildPatchVersion=3;
    51 static const TInt RofsbuildPatchVersion=0;
    53 static TBool SizeSummary=EFalse;
    52 static TBool SizeSummary=EFalse;
    54 static TPrintType SizeWhere=EAlways;
    53 static TPrintType SizeWhere=EAlways;
    55 
    54 
    56 static TInt gHeaderType=1;			// EPOC header
    55 static TInt gHeaderType=1;			// EPOC header
    57 static TInt MAXIMUM_THREADS = 128;
    56 static TInt MAXIMUM_THREADS = 128;
    59 ECompression gCompress=ECompressionUnknown;
    58 ECompression gCompress=ECompressionUnknown;
    60 TUint  gCompressionMethod=0;
    59 TUint  gCompressionMethod=0;
    61 TInt gThreadNum = 0;
    60 TInt gThreadNum = 0;
    62 TInt gCPUNum = 0;
    61 TInt gCPUNum = 0;
    63 TBool gGenSymbols = EFalse;
    62 TBool gGenSymbols = EFalse;
       
    63 TBool gGenBsymbols = EFalse;
    64 TInt gCodePagingOverride = -1;
    64 TInt gCodePagingOverride = -1;
    65 TInt gDataPagingOverride = -1;
    65 TInt gDataPagingOverride = -1;
    66 TInt gLogLevel = 0;	// Information is logged based on logging level.
    66 TInt gLogLevel = 0;	// Information is logged based on logging level.
    67 // The default is 0. So all the existing logs are generated as if gLogLevel = 0.
    67 // The default is 0. So all the existing logs are generated as if gLogLevel = 0.
    68 // If any extra information required, the log level must be appropriately supplied.
    68 // If any extra information required, the log level must be appropriately supplied.
    99 	"Option: -v verbose,  -?,  -s[log|screen|both] size summary\n"
    99 	"Option: -v verbose,  -?,  -s[log|screen|both] size summary\n"
   100 	"        -d<bitmask> set trace mask (DEB build only)\n"
   100 	"        -d<bitmask> set trace mask (DEB build only)\n"
   101 	"        -compress   compress executable files where possible\n"
   101 	"        -compress   compress executable files where possible\n"
   102 	"        -j<digit> do the main job with <digit> threads\n"
   102 	"        -j<digit> do the main job with <digit> threads\n"
   103 	"        -symbols generate symbol file\n"
   103 	"        -symbols generate symbol file\n"
       
   104 	"        -bsymbols generate binary symbol file\n"
   104 	"        -compressionmethod none|inflate|bytepair to set the compression\n"
   105 	"        -compressionmethod none|inflate|bytepair to set the compression\n"
   105 	"              none     uncompress the image.\n"
   106 	"              none     uncompress the image.\n"
   106 	"              inflate  compress the image.\n"
   107 	"              inflate  compress the image.\n"
   107 	"              bytepair compress the image.\n"
   108 	"              bytepair compress the image.\n"
   108 	"        -coreimage <core image file>\n"
   109 	"        -coreimage <core image file>\n"
   170 			} else if (stricmp(argv[i], "-K") == 0) {
   171 			} else if (stricmp(argv[i], "-K") == 0) {
   171 				gKeepGoing = ETrue;
   172 				gKeepGoing = ETrue;
   172 			}else if (stricmp(argv[i], "-SYMBOLS") == 0) {
   173 			}else if (stricmp(argv[i], "-SYMBOLS") == 0) {
   173 				gGenSymbols = ETrue;
   174 				gGenSymbols = ETrue;
   174 			}
   175 			}
       
   176 			else if (stricmp(argv[i], "-BSYMBOLS") == 0 ) {
       
   177 				gGenBsymbols = ETrue;
       
   178 			}
   175 			else if (((argv[i][1] | 0x20) == 's') &&  
   179 			else if (((argv[i][1] | 0x20) == 's') &&  
   176 				(((argv[i][2]| 0x20) == 'l')||((argv[i][2] | 0x20) == 's'))) {
   180 				(((argv[i][2]| 0x20) == 'l')||((argv[i][2] | 0x20) == 's'))) {
   177 					SizeSummary = ETrue;
   181 					SizeSummary = ETrue;
   178 					if ((argv[i][2]| 0x20) == 'l')
   182 					if ((argv[i][2]| 0x20) == 'l')
   179 						SizeWhere = ELog;
   183 						SizeWhere = ELog;
   351 		i++;
   355 		i++;
   352 	}
   356 	}
   353 
   357 
   354 	if (paramFileFlag)
   358 	if (paramFileFlag)
   355 		return;
   359 		return;
       
   360 	if(gGenSymbols && gGenBsymbols)
       
   361 	{
       
   362 		Print(EWarning, "Options symbols and bsymbols cannot be used at the same time, the common symbols file will be created this time!\n");
       
   363 		gGenBsymbols = EFalse;
       
   364 	}
   356 
   365 
   357 	if((gDriveImage == EFalse) && (gSmrImage ==  EFalse) && 
   366 	if((gDriveImage == EFalse) && (gSmrImage ==  EFalse) && 
   358 		(filename.empty() || (gUseCoreImage && gImageFilename.length() == 0)) && (loginput.length() == 0)){
   367 		(filename.empty() || (gUseCoreImage && gImageFilename.length() == 0)) && (loginput.length() == 0)){
   359 			Print (EAlways, HelpText);
   368 			Print (EAlways, HelpText);
   360 			if (reallyHelp) {
   369 			if (reallyHelp) {
   494 		gCPUNum = MAXIMUM_THREADS;
   503 		gCPUNum = MAXIMUM_THREADS;
   495 	PrintVersion();
   504 	PrintVersion();
   496 	processCommandLine(argc, argv);
   505 	processCommandLine(argc, argv);
   497 	if(gThreadNum == 0) {
   506 	if(gThreadNum == 0) {
   498 		if(gCPUNum > 0) {
   507 		if(gCPUNum > 0) {
   499 			printf("WARNING: The number of processors (%d) is used as the number of concurrent jobs.\n", gCPUNum);
   508 			printf("The double number of processors (%d) is used as the number of concurrent jobs.\n", gCPUNum * 2);
   500 			gThreadNum = gCPUNum;
   509 			gThreadNum = gCPUNum * 2;
   501 		}
   510 		}
   502 		else {
   511 		else {
   503 			printf("WARNING: Can't automatically get the valid number of concurrent jobs and %d is used.\n", DEFAULT_THREADS);
   512 			printf("Can't automatically get the valid number of concurrent jobs and %d is used.\n", DEFAULT_THREADS);
   504 			gThreadNum = DEFAULT_THREADS;
   513 			gThreadNum = DEFAULT_THREADS;
   505 		}
   514 		}
   506 	}
   515 	}
   507 	if(loginput.length() >= 1)
   516 	if(loginput.length() >= 1)
   508 	{
   517 	{
   509 		try
   518 		try
   510 		{
   519 		{
   511 			LogParser::GetInstance()->ParseSymbol(loginput.c_str());
   520 			LogParser::GetInstance(ERofsImage)->ParseSymbol(loginput.c_str());
   512 		}
   521 		}
   513 		catch(LoggingException le)
   522 		catch(LoggingException le)
   514 		{
   523 		{
   515 			printf("ERROR: %s\r\n", le.GetErrorMessage());
   524 			printf("ERROR: %s\r\n", le.GetErrorMessage());
   516 			return 1;
   525 			return 1;