imgtools/romtools/rofsbuild/rofsbuild.cpp
author lorewang
Wed, 01 Dec 2010 16:05:36 +0800
changeset 715 e0739b8406dd
parent 714 e5a58c351011
permissions -rw-r--r--
Specify extenal tool with path
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     1
/*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     2
* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     3
* All rights reserved.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     4
* This component and the accompanying materials are made available
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     6
* which accompanies this distribution, and is available
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     8
*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     9
* Initial Contributors:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    10
* Nokia Corporation - initial contribution.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    11
*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    12
* Contributors:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    13
*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    14
* Description: 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    15
*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    16
*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    17
#include <string.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    18
#include <stdlib.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    19
#include <f32file.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    20
#include "e32image.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    21
#include "h_utl.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    22
#include "h_ver.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    23
#include "r_obey.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    24
#include "r_driveimage.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    25
#include "r_driveutl.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    26
#include "r_coreimage.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    27
#include "parameterfileprocessor.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    28
#include "r_smrimage.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    29
//cache headers
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    30
#include "cache/cacheexception.hpp"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    31
#include "cache/cacheentry.hpp"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    32
#include "cache/cache.hpp"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    33
#include "cache/cachegenerator.hpp"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    34
#include "cache/cachevalidator.hpp"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    35
#include "cache/cacheablelist.hpp"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    36
#include "cache/cachemanager.hpp"
694
c3fbb20e86f0 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents: 691
diff changeset
    37
#include "logparser.h"
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    38
#include <malloc.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    39
 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    40
#ifndef WIN32
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    41
#include <unistd.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    42
#include <strings.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    43
#include <fstream>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    44
#define strnicmp strncasecmp
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    45
#define stricmp strcasecmp
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    46
#define _alloca alloca
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    47
#endif
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    48
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    49
static const TInt RofsbuildMajorVersion=2;
694
c3fbb20e86f0 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents: 691
diff changeset
    50
static const TInt RofsbuildMinorVersion=17;
708
0757c2976f96 Updating
jascui
parents: 698
diff changeset
    51
static const TInt RofsbuildPatchVersion=3;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    52
static TBool SizeSummary=EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    53
static TPrintType SizeWhere=EAlways;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    54
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    55
static TInt gHeaderType=1;			// EPOC header
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    56
static TInt MAXIMUM_THREADS = 128;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    57
static TInt DEFAULT_THREADS = 8;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    58
ECompression gCompress=ECompressionUnknown;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    59
TUint  gCompressionMethod=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    60
TInt gThreadNum = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    61
TInt gCPUNum = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    62
TBool gGenSymbols = EFalse;
694
c3fbb20e86f0 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents: 691
diff changeset
    63
TBool gGenBsymbols = EFalse;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    64
TInt gCodePagingOverride = -1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    65
TInt gDataPagingOverride = -1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    66
TInt gLogLevel = 0;	// Information is logged based on logging level.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    67
// The default is 0. So all the existing logs are generated as if gLogLevel = 0.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    68
// If any extra information required, the log level must be appropriately supplied.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    69
// Currrently, file details in ROM (like, file name in ROM & host, file size, whether
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    70
// the file is hidden etc) are logged when gLogLevel >= LOG_LEVEL_FILE_DETAILS.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    71
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    72
TBool gUseCoreImage = EFalse; // command line option for using core image file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    73
string gImageFilename = "";	// instead of obey file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    74
TBool gEnableStdPathWarning = EFalse;// for in-correct destination path warning(executables).
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    75
TBool gLowMem = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    76
extern TBool gDriveImage;		// to Support data drive image.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    77
string gDriveFilename = "";		// input drive oby filename.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    78
string filename;				// to store oby filename passed to Rofsbuild.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    79
TBool reallyHelp = EFalse;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    80
TBool gSmrImage = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    81
string gSmrFileName = "";
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
    82
static string cmdlogfile = "";
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
    83
static string loginput = "";
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    84
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    85
//Cache global variables
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    86
bool gCache = false;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    87
bool gCleanCache = false;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    88
bool gNoCache = false;
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
    89
TBool gIsOBYUTF8 = EFalse;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    90
TBool gKeepGoing = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    91
void PrintVersion() {
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 708
diff changeset
    92
	Print(EAlways,"\nROFSBUILD - Rofs/Datadrive image builder");
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 708
diff changeset
    93
	Print(EAlways, " V%d.%d.%d\n", RofsbuildMajorVersion, RofsbuildMinorVersion, RofsbuildPatchVersion);
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 708
diff changeset
    94
	Print(EAlways, "Copyright (c) 1996-2010 Nokia Corporation.");
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    95
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    96
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    97
char HelpText[] = 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    98
	"Syntax: ROFSBUILD [options] obeyfilename(Rofs)\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    99
	"Option: -v verbose,  -?,  -s[log|screen|both] size summary\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   100
	"        -d<bitmask> set trace mask (DEB build only)\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   101
	"        -compress   compress executable files where possible\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   102
	"        -j<digit> do the main job with <digit> threads\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   103
	"        -symbols generate symbol file\n"
694
c3fbb20e86f0 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents: 691
diff changeset
   104
	"        -bsymbols generate binary symbol file\n"
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   105
	"        -compressionmethod none|inflate|bytepair to set the compression\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   106
	"              none     uncompress the image.\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   107
	"              inflate  compress the image.\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   108
	"              bytepair compress the image.\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   109
	"        -coreimage <core image file>\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   110
	"        -cache allow the ROFSBUILD to reuse/generate cached executable files\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   111
	"        -nocache force the ROFSBUILD not to reuse/generate cached executable files\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   112
	"        -cleancache permanently remove all cached executable files\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   113
	"        -datadrive=<drive obyfile1>,<drive obyfile2>,... for driveimage creation\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   114
	"              user can also input rofs oby file if required to generate both.\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   115
	"        -smr=<SMR obyfile1>,<SMR obyfile2>,... for SMR partition creation\n"
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   116
	"        -oby-charset=<charset> used character set in which OBY was written\n"
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   117
	"        -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.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   118
	"        -wstdpath   warn if destination path provided for a file is not the standard path\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   119
	"        -argfile=<FileName>   specify argument-file name containing list of command-line arguments\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   120
"        -lowmem     use memory-mapped file for image build to reduce physical memory consumption\n"
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   121
"        -k     to enable keepgoing when duplicate files exist in oby\n"
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   122
"        -logfile=<fileName>           specify log file\n"
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   123
"        -loginput=<log filename>      specify as input a log file and produce as output symbol file.\n";
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   124
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   125
char ReallyHelpText[] =
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   126
"Log Level:\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   127
"        0  produce the default logs\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   128
"        1  produce file detail logs in addition to the default logs\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   129
"        2  logs e32 header attributes in addition to the level 1 details\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   130
void processParamfile(const string& aFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   131
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   132
Process the command line arguments and prints the helpful message if none are supplied.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   133
@param argc    - No. of argument.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   134
@param *argv[] - Arguments value.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   135
*/ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   136
void processCommandLine(int argc, char *argv[], TBool paramFileFlag = EFalse) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   137
	// If "-argfile" option is passed to rofsbuild, then process the parameters
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   138
	// specified in parameter-file first and then the options passed from the command-line.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   139
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   140
	string ParamFileArg("-ARGFILE=");	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   141
	if(paramFileFlag == EFalse) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   142
		for (int count = 1; count<argc; count++) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   143
			string paramFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   144
			//strupr(argv[count]);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   145
			if(strnicmp(argv[count],ParamFileArg.c_str(),ParamFileArg.length()) == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   146
				paramFile.assign(&argv[count][ParamFileArg.length()]);									
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   147
				processParamfile(paramFile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   148
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   149
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   150
	}	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   151
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   152
	int i = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   153
	while (i<argc) {		 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   154
#ifdef __LINUX__	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   155
		if (argv[i][0] == '-') 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   156
#else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   157
		if ((argv[i][0] == '-') || (argv[i][0] == '/'))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   158
#endif
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   159
		{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   160
			// switch
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   161
			if ((argv[i][1] & 0x20) == 'v')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   162
				H.iVerbose = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   163
			else if(strnicmp (argv[i], "-SMR=", 5) == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   164
				if(argv[i][5]) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   165
					gSmrImage = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   166
					gSmrFileName.assign(&argv[i][5]);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   167
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   168
				else {
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 708
diff changeset
   169
					Print (EError, "SMR obey file is missing\n");
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   170
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   171
			} else if (stricmp(argv[i], "-K") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   172
				gKeepGoing = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   173
			}else if (stricmp(argv[i], "-SYMBOLS") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   174
				gGenSymbols = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   175
			}
694
c3fbb20e86f0 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents: 691
diff changeset
   176
			else if (stricmp(argv[i], "-BSYMBOLS") == 0 ) {
c3fbb20e86f0 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents: 691
diff changeset
   177
				gGenBsymbols = ETrue;
c3fbb20e86f0 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents: 691
diff changeset
   178
			}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   179
			else if (((argv[i][1] | 0x20) == 's') &&  
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   180
				(((argv[i][2]| 0x20) == 'l')||((argv[i][2] | 0x20) == 's'))) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   181
					SizeSummary = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   182
					if ((argv[i][2]| 0x20) == 'l')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   183
						SizeWhere = ELog;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   184
					else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   185
						SizeWhere = EScreen;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   186
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   187
			else if (strnicmp(argv[i],ParamFileArg.c_str(),ParamFileArg.length()) == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   188
				if (paramFileFlag){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   189
					string paramFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   190
					paramFile.assign(&argv[i][ParamFileArg.length()]);		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   191
					processParamfile(paramFile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   192
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   193
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   194
					i++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   195
					continue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   196
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   197
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   198
			else if (stricmp(argv[i], "-COMPRESS") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   199
				gCompress = ECompressionCompress;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   200
				gCompressionMethod = KUidCompressionDeflate;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   201
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   202
			else if(stricmp(argv[i], "-CACHE") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   203
				gCache = true;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   204
				if(gCleanCache || gNoCache) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   205
					printf("Cache command line options are mutually exclusive, only one option can be used at a time\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   206
					exit(1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   207
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   208
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   209
			else if(stricmp(argv[i], "-NOCACHE") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   210
				gNoCache = true;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   211
				if(gCleanCache || gCache) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   212
					printf("Cache command line options are mutually exclusive, only one option can be used at a time\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   213
					exit(1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   214
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   215
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   216
			else if(stricmp(argv[i], "-CLEANCACHE") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   217
				gCleanCache = true;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   218
				if(gCache || gNoCache)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   219
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   220
					printf("Cache command line options are mutually exclusive, only one option can be used at a time\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   221
					exit(1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   222
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   223
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   224
			else if (strnicmp(argv[i], "-J",2) == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   225
				if(argv[i][2])
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   226
					gThreadNum = atoi(&argv[i][2]);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   227
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   228
					printf("WARNING: The option should be like '-j4'.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   229
					gThreadNum = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   230
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   231
				if(gThreadNum <= 0 || gThreadNum > MAXIMUM_THREADS) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   232
					printf("WARNING: The number of concurrent jobs set by -j should be between 1 and 128. ");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   233
					if(gCPUNum > 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   234
						printf("WARNING: The number of processors %d is used as the number of concurrent jobs.\n", gCPUNum);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   235
						gThreadNum = gCPUNum;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   236
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   237
					else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   238
						printf("WARNING: Can't automatically get the valid number of concurrent jobs and %d is used.\n", DEFAULT_THREADS);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   239
						gThreadNum = DEFAULT_THREADS;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   240
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   241
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   242
			}
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   243
			else if(strnicmp(argv[i], "-OBY-CHARSET=", 13) == 0)
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   244
			{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   245
				if((stricmp(&argv[i][13], "UTF8")==0) || (stricmp(&argv[i][13], "UTF-8")==0))
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   246
					gIsOBYUTF8 = ETrue;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   247
				else
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 708
diff changeset
   248
					Print(EError, "Invalid encoding %s, default system internal encoding will be used.\n", &argv[i][13]);
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   249
			}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   250
			else if (stricmp(argv[i], "-UNCOMPRESS") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   251
				gCompress = ECompressionUncompress;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   252
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   253
			else if( stricmp(argv[i], "-COMPRESSIONMETHOD") == 0 ) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   254
				// next argument should a be method
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   255
				if( (i+1) >= argc || argv[i+1][0] == '-') {
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 708
diff changeset
   256
					Print (EError, "Missing compression method! Set it to default (no compression)!");
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   257
					gCompressionMethod = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   258
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   259
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   260
					i++;					
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   261
					if( stricmp(argv[i], "NONE") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   262
						gCompress = ECompressionUncompress;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   263
						gCompressionMethod = 0;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   264
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   265
					else if( stricmp(argv[i], "INFLATE") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   266
						gCompress = ECompressionCompress;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   267
						gCompressionMethod = KUidCompressionDeflate;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   268
					}	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   269
					else if( stricmp(argv[i], "BYTEPAIR") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   270
						gCompress = ECompressionCompress;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   271
						gCompressionMethod = KUidCompressionBytePair;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   272
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   273
					else {
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 708
diff changeset
   274
						Print (EError, "Unknown compression method! Set it to default (no compression)!");
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   275
						gCompress = ECompressionUnknown;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   276
						gCompressionMethod = 0;		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   277
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   278
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   279
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   280
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   281
			else if (stricmp(argv[i], "-COREIMAGE") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   282
				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   283
				gUseCoreImage = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   284
				// next argument should be image filename
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   285
				if ((i+1 >= argc) || argv[i+1][0] == '-')
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 708
diff changeset
   286
					Print (EError, "Missing image file name");
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   287
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   288
					i++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   289
					gImageFilename.assign(argv[i]);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   290
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   291
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   292
			else if (strnicmp(argv[i], "-DATADRIVE=",11) == 0){  
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   293
				if(argv[i][11])	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   294
					gDriveImage = ETrue; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   295
					gDriveFilename.assign(&argv[i][11]);	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   296
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   297
				else {
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 708
diff changeset
   298
					Print (EError, "Drive obey file is missing\n"); 
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   299
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   300
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   301
			else if (argv[i][1] == '?') {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   302
				reallyHelp = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   303
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   304
			else if (stricmp(argv[i], "-WSTDPATH") == 0)	{	// Warn if destination path provided for a executables are incorrect as per platsec.		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   305
				gEnableStdPathWarning = ETrue;						
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   306
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   307
			else if( stricmp(argv[i], "-LOGLEVEL") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   308
				// next argument should a be loglevel
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   309
				if( (i+1) >= argc || argv[i+1][0] == '-') {
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 708
diff changeset
   310
					Print (EError, "Missing loglevel!");
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   311
					gLogLevel = DEFAULT_LOG_LEVEL;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   312
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   313
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   314
					i++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   315
					if (strcmp(argv[i], "2") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   316
						gLogLevel = (LOG_LEVEL_FILE_DETAILS | LOG_LEVEL_FILE_ATTRIBUTES);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   317
					if (strcmp(argv[i], "1") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   318
						gLogLevel = LOG_LEVEL_FILE_DETAILS;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   319
					else if (strcmp(argv[i], "0") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   320
						gLogLevel = DEFAULT_LOG_LEVEL;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   321
					else
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 708
diff changeset
   322
						Print(EError, "Only loglevel 0, 1 or 2 is allowed!");
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   323
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   324
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   325
			else if( stricmp(argv[i], "-LOGLEVEL2") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   326
				gLogLevel = (LOG_LEVEL_FILE_DETAILS | LOG_LEVEL_FILE_ATTRIBUTES);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   327
			else if( stricmp(argv[i], "-LOGLEVEL1") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   328
				gLogLevel = LOG_LEVEL_FILE_DETAILS;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   329
			else if( stricmp(argv[i], "-LOGLEVEL0") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   330
				gLogLevel = DEFAULT_LOG_LEVEL;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   331
			else if (stricmp(argv[i], "-LOWMEM") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   332
				gLowMem = ETrue;
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   333
			else if (strnicmp(argv[i], "-logfile=",9) ==0) {
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   334
				cmdlogfile = argv[i] + 9;
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   335
			}
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   336
			else if (strnicmp(argv[i], "-loginput=", 10) == 0) {
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   337
				loginput = argv[i] + 10;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   338
			}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   339
			else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   340
#ifdef WIN32
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 708
diff changeset
   341
				Print (EWarning, "Unrecognised option %s\n",argv[i]);
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   342
#else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   343
				if(0 == access(argv[i],R_OK)){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   344
					filename.assign(argv[i]);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   345
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   346
				else {
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 708
diff changeset
   347
					Print (EWarning, "Unrecognised option %s\n",argv[i]);
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   348
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   349
#endif				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   350
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   351
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   352
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   353
		else // Must be the obey filename
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   354
			filename.assign(argv[i]);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   355
		i++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   356
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   357
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   358
	if (paramFileFlag)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   359
		return;
694
c3fbb20e86f0 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents: 691
diff changeset
   360
	if(gGenSymbols && gGenBsymbols)
c3fbb20e86f0 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents: 691
diff changeset
   361
	{
698
e3ee96a3961c fix ou1cimx1#651819 rofsbiuld fails to generate correct log info when using multi-thread
marvin shi <marvin.shi@nokia.com>
parents: 694
diff changeset
   362
		printf("WARNING: Options symbols and bsymbols cannot be used at the same time, the common symbols file will be created this time!\n");
694
c3fbb20e86f0 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents: 691
diff changeset
   363
		gGenBsymbols = EFalse;
c3fbb20e86f0 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents: 691
diff changeset
   364
	}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   365
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   366
	if((gDriveImage == EFalse) && (gSmrImage ==  EFalse) && 
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   367
		(filename.empty() || (gUseCoreImage && gImageFilename.length() == 0)) && (loginput.length() == 0)){
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   368
			Print (EAlways, HelpText);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   369
			if (reallyHelp) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   370
				ObeyFileReader::KeywordHelp();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   371
				Print (EAlways, ReallyHelpText);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   372
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   373
			else if (filename.empty()){
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 708
diff changeset
   374
				Print(EAlways, "Obey filename is missing\n");
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   375
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   376
	}	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   377
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   378
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   379
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   380
Function to process parameter-file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   381
@param aFileName parameter-file name.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   382
*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   383
void processParamfile(const string& aFileName) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   384
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   385
	CParameterFileProcessor parameterFile(aFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   386
	// Invoke fuction "ParameterFileProcessor" to process parameter-file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   387
	if(parameterFile.ParameterFileProcessor()) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   388
		TUint noOfParameters = parameterFile.GetNoOfArguments();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   389
		char** parameters = parameterFile.GetParameters();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   390
		TBool paramFileFlag = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   391
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   392
		// Invoke function "processCommandLine" to process parameters read from parameter-file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   393
		processCommandLine(noOfParameters,parameters,paramFileFlag);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   394
	}	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   395
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   396
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   397
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   398
Main logic for data drive image creation. Called many types depending on no. of drive obey files.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   399
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   400
@param aobeyFileName - Drive obey file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   401
@param alogfile      - log file name required for file system module.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   402
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   403
@return - returns the status, after processing the drive obey file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   404
*/ 
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   405
TInt ProcessDataDriveMain(char* aobeyFileName, const char* alogfile) {
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   406
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   407
	ObeyFileReader *reader = new ObeyFileReader(aobeyFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   408
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   409
	if(!reader)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   410
		return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   411
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   412
	if(!reader->Open())
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   413
		return KErrGeneral; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   414
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   415
	CObeyFile* mainObeyFile = new CObeyFile(*reader);    
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   416
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   417
	if(!mainObeyFile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   418
		return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   419
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   420
	// Process data drive image.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   421
	// let's clear the TRomNode::sDefaultInitialAttr first, 'cause data drive is different from rom image
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   422
	TRomNode::sDefaultInitialAttr = 0; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   423
	TInt retstatus = mainObeyFile->ProcessDataDrive();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   424
	if (retstatus == KErrNone) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   425
		// Build a Data drive image using the description compiled into the CObeyFile object
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   426
		CDriveImage* userImage = new CDriveImage(mainObeyFile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   427
		if(userImage) {	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   428
			// Drive image creation.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   429
			retstatus = userImage->CreateImage(alogfile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   430
			if(retstatus == KErrNone) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   431
				Print (EAlways, "\nSuccessfully generated the Drive image : %s \n",mainObeyFile->iDriveFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   432
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   433
			else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   434
				Print (EError, "Failed to generate the Image : %s\n",mainObeyFile->iDriveFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   435
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   436
			delete userImage; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   437
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   438
		else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   439
			retstatus = KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   440
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   441
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   442
	// restore
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   443
	TRomNode::sDefaultInitialAttr = (TUint8)KEntryAttReadOnly;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   444
	cout << "\n-----------------------------------------------------------\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   445
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   446
	delete mainObeyFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   447
	delete reader;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   448
	return retstatus;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   449
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   450
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   451
TInt ProcessSmrImageMain(char* aObeyFileName, const char* /* alogfile */) {
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   452
	ObeyFileReader *reader = new ObeyFileReader(aObeyFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   453
	if(!reader)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   454
		return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   455
	if(!reader->Open())
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   456
		return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   457
	TInt retstatus = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   458
	CObeyFile* mainObeyFile = new CObeyFile(*reader);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   459
	CSmrImage* smrImage = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   460
	if(!mainObeyFile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   461
		return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   462
	if(mainObeyFile->Process()) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   463
		smrImage = new CSmrImage(mainObeyFile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   464
		if(smrImage) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   465
			if((retstatus = smrImage->Initialise()) == KErrNone) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   466
				retstatus = smrImage->CreateImage();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   467
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   468
			if(retstatus == KErrNone) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   469
				Print (EAlways,  "\nSuccessfully generated the SMR image : %s\n" ,smrImage->GetImageName().c_str());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   470
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   471
			else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   472
				Print (EError, "\nFailed to generate the Image : %s\n" ,smrImage->GetImageName().c_str());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   473
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   474
			delete smrImage;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   475
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   476
		else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   477
			retstatus = KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   478
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   479
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   480
	delete mainObeyFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   481
	delete reader;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   482
	return retstatus;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   483
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   484
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   485
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   486
Rofsbuild Main function, which creates both Rofs and Data drive image.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   487
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   488
@param argc    - No. of argument.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   489
@param *argv[] - Arguments value.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   490
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   491
@return - returns the status to caller.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   492
*/ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   493
TInt main(int argc, char *argv[]){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   494
	TInt r =0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   495
#ifdef __LINUX__
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   496
	gCPUNum = sysconf(_SC_NPROCESSORS_CONF);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   497
#else	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   498
	char* pCPUNum = getenv ("NUMBER_OF_PROCESSORS");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   499
	if (pCPUNum != NULL)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   500
		gCPUNum = atoi(pCPUNum);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   501
#endif		
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 708
diff changeset
   502
	if(gCPUNum > MAXIMUM_THREADS >> 1)
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 708
diff changeset
   503
		gCPUNum = MAXIMUM_THREADS >> 1;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   504
	PrintVersion();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   505
	processCommandLine(argc, argv);
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   506
	if(gThreadNum == 0) {
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   507
		if(gCPUNum > 0) {
694
c3fbb20e86f0 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents: 691
diff changeset
   508
			printf("The double number of processors (%d) is used as the number of concurrent jobs.\n", gCPUNum * 2);
c3fbb20e86f0 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents: 691
diff changeset
   509
			gThreadNum = gCPUNum * 2;
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   510
		}
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   511
		else {
694
c3fbb20e86f0 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents: 691
diff changeset
   512
			printf("Can't automatically get the valid number of concurrent jobs and %d is used.\n", DEFAULT_THREADS);
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   513
			gThreadNum = DEFAULT_THREADS;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   514
		}
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   515
	}
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   516
	if(loginput.length() >= 1)
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   517
	{
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   518
		try
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   519
		{
694
c3fbb20e86f0 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents: 691
diff changeset
   520
			LogParser::GetInstance(ERofsImage)->ParseSymbol(loginput.c_str());
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   521
		}
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   522
		catch(LoggingException le)
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   523
		{
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   524
			printf("ERROR: %s\r\n", le.GetErrorMessage());
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   525
			return 1;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   526
		}
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   527
		return 0;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   528
	}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   529
	//if the user wants to clean up the cache, do it only.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   530
	if(gCleanCache){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   531
		try {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   532
			CacheManager::GetInstance()->CleanCache();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   533
			Print (EAlways, "Cache has been deleted successfully.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   534
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   535
		catch(CacheException& ce){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   536
			Print (EError, "%s\n", ce.GetErrorMessage());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   537
			return (TInt)1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   538
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   539
		return r;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   540
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   541
	//initialize cache if the user switches on.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   542
	if(gCache) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   543
		try {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   544
			CacheManager::GetInstance();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   545
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   546
		catch(CacheException ce){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   547
			Print (EError, "%s\n", ce.GetErrorMessage());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   548
			return (TInt)1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   549
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   550
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   551
	const char *obeyFileName = 0;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   552
	if(!filename.empty())
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   553
		obeyFileName = filename.c_str(); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   554
	if ((!obeyFileName) && (!gDriveFilename.empty()) && (!gSmrFileName.empty())){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   555
		return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   556
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   557
	// Process drive obey files.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   558
	if(gDriveImage) {  
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   559
		char temp = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   560
		char *driveobeyFileName = (char*)_alloca(gDriveFilename.length() + 1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   561
		memcpy(driveobeyFileName,gDriveFilename.c_str(),gDriveFilename.length() + 1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   562
		char* ptr = driveobeyFileName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   563
		do {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   564
			while(((temp = *ptr++) != ',') && (temp != 0));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   565
			*(--ptr)++ = 0; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   566
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   567
			if(*driveobeyFileName) {
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   568
				string logfile = Getlogfile(driveobeyFileName, cmdlogfile);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   569
				if(logfile.size() > 0) {
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   570
					H.SetLogFile(logfile.c_str());
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   571
					GetLocalTime();
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   572
					r = ProcessDataDriveMain(driveobeyFileName,logfile.c_str());   
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   573
					H.CloseLogFile();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   574
					if(r == KErrNoMemory)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   575
						return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   576
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   577
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   578
					Print(EError,"Invalid obey file name : %s\n", driveobeyFileName);   
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   579
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   580
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   581
			driveobeyFileName = ptr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   582
		} while(temp != 0); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   583
		gDriveImage = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   584
	} 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   585
	if(gSmrImage){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   586
		char temp = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   587
		char *smrImageObeyFileName = (char*)_alloca(gSmrFileName.length() + 1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   588
		memcpy(smrImageObeyFileName,gSmrFileName.c_str(),gSmrFileName.length() + 1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   589
		char* ptr = smrImageObeyFileName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   590
		do {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   591
			while(((temp = *ptr++) != ',') && (temp != 0));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   592
			*(--ptr)++ = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   593
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   594
			if(*smrImageObeyFileName){	
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   595
				string logfile = Getlogfile(smrImageObeyFileName, cmdlogfile);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   596
				if(logfile.size() > 0) {
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   597
					H.SetLogFile(logfile.c_str());
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   598
					GetLocalTime();
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   599
					r = ProcessSmrImageMain(smrImageObeyFileName, logfile.c_str());
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   600
					H.CloseLogFile();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   601
					if(r == KErrNoMemory)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   602
						return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   603
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   604
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   605
					Print(EError,"Invalid obey file name: %s", smrImageObeyFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   606
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   607
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   608
			smrImageObeyFileName = ptr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   609
		} while(temp != 0);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   610
		gSmrImage = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   611
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   612
	// Process Rofs Obey files.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   613
	if(obeyFileName) {
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   614
		if (cmdlogfile.empty() || cmdlogfile[cmdlogfile.size()-1] == '\\' || cmdlogfile[cmdlogfile.size()-1] == '/')
655
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 647
diff changeset
   615
			cmdlogfile += "ROFSBUILD.LOG" ;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 647
diff changeset
   616
			
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   617
	 	H.SetLogFile(cmdlogfile.c_str());
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   618
		ObeyFileReader *reader = new ObeyFileReader(obeyFileName); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   619
		if (!reader->Open())
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   620
			return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   621
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   622
		E32Rofs* RofsImage = 0;		// for image from obey file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   623
		CCoreImage *core = 0;		// for image from core image file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   624
		MRofsImage* imageInfo = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   625
		CObeyFile *mainObeyFile = new CObeyFile(*reader);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   626
		// need check if obey file has coreimage keyword
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   627
		char *file = mainObeyFile->ProcessCoreImage();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   628
		if (file) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   629
			// hase coreimage keyword but only use if command line option
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   630
			// for coreimage not already selected
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   631
			if (!gUseCoreImage){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   632
				gUseCoreImage = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   633
				gImageFilename = file;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   634
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   635
			delete []file ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   636
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   637
		if (!gUseCoreImage) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   638
			r = mainObeyFile->ProcessRofs();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   639
			if (r == KErrNone) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   640
				// Build a ROFS image using the description compiled into the CObeyFile object
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   641
				RofsImage = new E32Rofs( mainObeyFile );
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   642
				if( !RofsImage ) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   643
					if(gCache || gCleanCache)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   644
						delete CacheManager::GetInstance();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   645
					return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   646
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   647
				r = RofsImage->Create();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   648
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   649
				if( KErrNone == r )	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   650
					RofsImage->WriteImage( gHeaderType );
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   651
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   652
				imageInfo = RofsImage;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   653
				mainObeyFile->Release();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   654
				if(gCache || gCleanCache)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   655
					delete CacheManager::GetInstance();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   656
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   657
			else if (r != KErrNotFound){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   658
				return r;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   659
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   660
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   661
		else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   662
			// need to use core image
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   663
			RCoreImageReader *reader = new RCoreImageReader(gImageFilename.c_str());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   664
			if (!reader) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   665
				return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   666
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   667
			core = new CCoreImage(reader);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   668
			if (!core) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   669
				return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   670
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   671
			r = core->ProcessImage();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   672
			if (r != KErrNone) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   673
				return r;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   674
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   675
			imageInfo = core;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   676
			mainObeyFile->SkipToExtension();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   677
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   678
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   679
		do {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   680
			CObeyFile* extensionObeyFile = new CObeyFile(*reader);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   681
			r = extensionObeyFile->ProcessExtensionRofs(imageInfo);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   682
			if (r == KErrEof){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   683
				if(RofsImage){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   684
					delete RofsImage;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   685
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   686
				if(core){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   687
					delete core;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   688
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   689
				delete extensionObeyFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   690
				return KErrNone;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   691
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   692
			if (r != KErrNone){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   693
				break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   694
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   695
			E32Rofs* extensionRofs = new E32Rofs(extensionObeyFile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   696
			r = extensionRofs->CreateExtension(imageInfo);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   697
			if (r!= KErrNone){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   698
				delete extensionRofs;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   699
				delete extensionObeyFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   700
				break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   701
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   702
			r = extensionRofs->WriteImage(0);	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   703
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   704
			delete extensionRofs;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   705
			extensionRofs = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   706
		} while (r == KErrNone);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   707
		if(RofsImage) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   708
			delete RofsImage;									
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   709
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   710
		if(core){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   711
			delete core;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   712
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   713
		delete mainObeyFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   714
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   715
	return r;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   716
}//end of main.