24 #include "r_obey.h" |
24 #include "r_obey.h" |
25 #include "parameterfileprocessor.h" |
25 #include "parameterfileprocessor.h" |
26 |
26 |
27 #include "r_dir.h" |
27 #include "r_dir.h" |
28 #include "r_coreimage.h" |
28 #include "r_coreimage.h" |
|
29 #include "logparser.h" |
29 |
30 |
30 const TInt KRomLoaderHeaderNone=0; |
31 const TInt KRomLoaderHeaderNone=0; |
31 const TInt KRomLoaderHeaderEPOC=1; |
32 const TInt KRomLoaderHeaderEPOC=1; |
32 const TInt KRomLoaderHeaderCOFF=2; |
33 const TInt KRomLoaderHeaderCOFF=2; |
33 |
34 |
34 static const TInt RombuildMajorVersion=2; |
35 static const TInt RombuildMajorVersion=2; |
35 static const TInt RombuildMinorVersion=18; |
36 static const TInt RombuildMinorVersion=19; |
36 static const TInt RombuildPatchVersion=5; |
37 static const TInt RombuildPatchVersion=1; |
37 static TBool SizeSummary=EFalse; |
38 static TBool SizeSummary=EFalse; |
38 static TPrintType SizeWhere=EAlways; |
39 static TPrintType SizeWhere=EAlways; |
39 static string compareROMName = ""; |
40 static string compareROMName = ""; |
40 static TInt MAXIMUM_THREADS = 128; |
41 static TInt MAXIMUM_THREADS = 128; |
41 static TInt DEFAULT_THREADS = 8; |
42 static TInt DEFAULT_THREADS = 8; |
47 TInt gThreadNum = 0; |
48 TInt gThreadNum = 0; |
48 char* g_pCharCPUNum = NULL; |
49 char* g_pCharCPUNum = NULL; |
49 TBool gGenDepGraph = EFalse; |
50 TBool gGenDepGraph = EFalse; |
50 string gDepInfoFile = ""; |
51 string gDepInfoFile = ""; |
51 TBool gGenSymbols = EFalse ; |
52 TBool gGenSymbols = EFalse ; |
|
53 TBool gGenBsymbols = EFalse ; |
52 TBool gIsOBYUTF8 = EFalse; |
54 TBool gIsOBYUTF8 = EFalse; |
|
55 static string loginput = ""; |
53 void PrintVersion() { |
56 void PrintVersion() { |
54 Print(EAlways,"\nROMBUILD - Rom builder"); |
57 printf("\nROMBUILD - Rom builder"); |
55 Print(EAlways, " V%d.%d.%d\n", RombuildMajorVersion, RombuildMinorVersion, RombuildPatchVersion); |
58 printf(" V%d.%d.%d\n", RombuildMajorVersion, RombuildMinorVersion, RombuildPatchVersion); |
56 Print(EAlways,Copyright); |
59 printf(Copyright); |
57 } |
60 } |
58 |
61 |
59 char HelpText[] = |
62 char HelpText[] = |
60 "Syntax: ROMBUILD [options] obeyfilename\n" |
63 "Syntax: ROMBUILD [options] obeyfilename\n" |
61 "Option: -v verbose, -? \n" |
64 "Option: -v verbose, -? \n" |
80 " -wstdpath warn if destination path provided for a file is not a standard path\n" |
83 " -wstdpath warn if destination path provided for a file is not a standard path\n" |
81 " -argfile=<fileName> specify argument-file name containing list of command-line arguments to rombuild\n" |
84 " -argfile=<fileName> specify argument-file name containing list of command-line arguments to rombuild\n" |
82 " -lowmem use memory-mapped file for image build to reduce physical memory consumption\n" |
85 " -lowmem use memory-mapped file for image build to reduce physical memory consumption\n" |
83 " -coreimage=<core image file> to pass the core image as input for extension ROM image generation\n" |
86 " -coreimage=<core image file> to pass the core image as input for extension ROM image generation\n" |
84 " -k to enable keepgoing when duplicate files exist in oby\n" |
87 " -k to enable keepgoing when duplicate files exist in oby\n" |
85 " -logfile=<fileName> specify log file\n"; |
88 " -logfile=<fileName> specify log file\n" |
|
89 " -loginput=<log filename> specify as input a log file and produce as output symbol file.\n"; |
86 |
90 |
87 |
91 |
88 char ReallyHelpText[] = |
92 char ReallyHelpText[] = |
89 "Priorities:\n" |
93 "Priorities:\n" |
90 " low background foreground high windowserver\n" |
94 " low background foreground high windowserver\n" |
347 } |
351 } |
348 } |
352 } |
349 else if (strnicmp(arg, "logfile=",8) ==0) { |
353 else if (strnicmp(arg, "logfile=",8) ==0) { |
350 romlogfile = arg + 8; |
354 romlogfile = arg + 8; |
351 } |
355 } |
|
356 else if (strnicmp(arg, "loginput=",9) ==0) { |
|
357 loginput = arg + 9; |
|
358 } |
352 else |
359 else |
353 #ifdef WIN32 |
360 #ifdef WIN32 |
354 cout << "Unrecognised option " << argv[i] << "\n"; |
361 cout << "Unrecognised option " << argv[i] << "\n"; |
355 #else |
362 #else |
356 if(0 == access(argv[i],R_OK)){ |
363 if(0 == access(argv[i],R_OK)){ |
448 #endif |
455 #endif |
449 // initialise set of all capabilities |
456 // initialise set of all capabilities |
450 ParseCapabilitiesArg(gPlatSecAllCaps, "all"); |
457 ParseCapabilitiesArg(gPlatSecAllCaps, "all"); |
451 |
458 |
452 processCommandLine(argc, argv); |
459 processCommandLine(argc, argv); |
453 if(filename.empty()) |
460 if(filename.empty() && loginput.empty()) |
454 return KErrGeneral; |
461 return KErrGeneral; |
455 |
462 |
456 if (romlogfile[romlogfile.size()-1] == '\\' || romlogfile[romlogfile.size()-1] == '/') |
|
457 romlogfile += "ROMBUILD.LOG"; |
|
458 H.SetLogFile(romlogfile.c_str()); |
|
459 |
463 |
460 if(gThreadNum == 0) { |
464 if(gThreadNum == 0) { |
461 if(gCPUNum > 0 && gCPUNum <= MAXIMUM_THREADS) { |
465 if(gCPUNum > 0 && gCPUNum <= MAXIMUM_THREADS) { |
462 Print(EAlways, "The number of processors (%d) is used as the number of concurrent jobs.\n", gCPUNum); |
466 printf("The double number of processors (%d) is used as the number of concurrent jobs.\n", gCPUNum * 2); |
463 gThreadNum = gCPUNum; |
467 gThreadNum = gCPUNum * 2; |
464 } |
468 } |
465 else if(g_pCharCPUNum) { |
469 else if(g_pCharCPUNum) { |
466 Print(EWarning, "The NUMBER_OF_PROCESSORS is invalid, and the default value %d will be used.\n", DEFAULT_THREADS); |
470 printf("The NUMBER_OF_PROCESSORS is invalid, and the default value %d will be used.\n", DEFAULT_THREADS); |
467 gThreadNum = DEFAULT_THREADS; |
471 gThreadNum = DEFAULT_THREADS; |
468 } |
472 } |
469 else { |
473 else { |
470 Print(EWarning, "The NUMBER_OF_PROCESSORS is not available, and the default value %d will be used.\n", DEFAULT_THREADS); |
474 printf("The NUMBER_OF_PROCESSORS is not available, and the default value %d will be used.\n", DEFAULT_THREADS); |
471 gThreadNum = DEFAULT_THREADS; |
475 gThreadNum = DEFAULT_THREADS; |
472 } |
476 } |
473 } |
477 } |
474 PrintVersion(); |
478 PrintVersion(); |
475 |
479 |
|
480 if(loginput.length() >= 1) |
|
481 { |
|
482 try |
|
483 { |
|
484 LogParser::GetInstance(ERomImage)->ParseSymbol(loginput.c_str()); |
|
485 } |
|
486 catch(LoggingException le) |
|
487 { |
|
488 printf("ERROR: %s\r\n", le.GetErrorMessage()); |
|
489 return 1; |
|
490 } |
|
491 return 0; |
|
492 } |
|
493 if (romlogfile.empty() || romlogfile[romlogfile.size()-1] == '\\' || romlogfile[romlogfile.size()-1] == '/') |
|
494 romlogfile += "ROMBUILD.LOG"; |
|
495 H.SetLogFile(romlogfile.c_str()); |
476 ObeyFileReader *reader=new ObeyFileReader(filename.c_str()); |
496 ObeyFileReader *reader=new ObeyFileReader(filename.c_str()); |
477 if (!reader->Open()) { |
497 if (!reader->Open()) { |
478 delete reader; |
498 delete reader; |
479 return KErrGeneral; |
499 return KErrGeneral; |
480 } |
500 } |