imgtools/romtools/rofsbuild/rofsbuild.cpp
author Zheng Shen <zheng.shen@nokia.com>
Wed, 27 Oct 2010 19:16:18 +0800
changeset 663 8e27d440923e
parent 662 60be34e1b006
child 671 ff8ff850b0cf
permissions -rw-r--r--
revert to 7c11c3d8d025
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"
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
    37
#include "logging/loggingexception.hpp"
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
    38
#include "logging/logparser.hpp"
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    39
#include <malloc.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    40
 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    41
#ifndef WIN32
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    42
#include <unistd.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    43
#include <strings.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    44
#include <fstream>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    45
#define strnicmp strncasecmp
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    46
#define stricmp strcasecmp
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    47
#define _alloca alloca
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    48
#endif
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    49
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    50
static const TInt RofsbuildMajorVersion=2;
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
    51
static const TInt RofsbuildMinorVersion=16;
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
    52
static const TInt RofsbuildPatchVersion=1;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    53
static TBool SizeSummary=EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    54
static TPrintType SizeWhere=EAlways;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    55
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    56
static TInt gHeaderType=1;			// EPOC header
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    57
static TInt MAXIMUM_THREADS = 128;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    58
static TInt DEFAULT_THREADS = 8;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    59
ECompression gCompress=ECompressionUnknown;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    60
TUint  gCompressionMethod=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    61
TInt gThreadNum = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    62
TInt gCPUNum = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    63
TBool gGenSymbols = EFalse;
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() {
631
9435b9008a58 ROM Tools 13.1.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
    92
	printf("\nROFSBUILD - Rofs/Datadrive image builder");
9435b9008a58 ROM Tools 13.1.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
    93
	printf(" V%d.%d.%d\n", RofsbuildMajorVersion, RofsbuildMinorVersion, RofsbuildPatchVersion);
9435b9008a58 ROM Tools 13.1.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
    94
	printf("%s\n\n", "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"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   104
	"        -compressionmethod none|inflate|bytepair to set the compression\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   105
	"              none     uncompress the image.\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   106
	"              inflate  compress the image.\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   107
	"              bytepair compress the image.\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   108
	"        -coreimage <core image file>\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   109
	"        -cache allow the ROFSBUILD to reuse/generate cached executable files\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   110
	"        -nocache force the ROFSBUILD not to reuse/generate cached executable files\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   111
	"        -cleancache permanently remove all cached executable files\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   112
	"        -datadrive=<drive obyfile1>,<drive obyfile2>,... for driveimage creation\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   113
	"              user can also input rofs oby file if required to generate both.\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   114
	"        -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
   115
	"        -oby-charset=<charset> used character set in which OBY was written\n"
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   116
	"        -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
   117
	"        -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
   118
	"        -argfile=<FileName>   specify argument-file name containing list of command-line arguments\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   119
"        -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
   120
"        -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
   121
"        -logfile=<fileName>           specify log file\n"
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   122
"        -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
   123
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   124
char ReallyHelpText[] =
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   125
"Log Level:\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   126
"        0  produce the default logs\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   127
"        1  produce file detail logs in addition to the default logs\n"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   128
"        2  logs e32 header attributes in addition to the level 1 details\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   129
void processParamfile(const string& aFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   130
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   131
Process the command line arguments and prints the helpful message if none are supplied.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   132
@param argc    - No. of argument.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   133
@param *argv[] - Arguments value.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   134
*/ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   135
void processCommandLine(int argc, char *argv[], TBool paramFileFlag = EFalse) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   136
	// If "-argfile" option is passed to rofsbuild, then process the parameters
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   137
	// specified in parameter-file first and then the options passed from the command-line.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   138
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   139
	string ParamFileArg("-ARGFILE=");	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   140
	if(paramFileFlag == EFalse) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   141
		for (int count = 1; count<argc; count++) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   142
			string paramFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   143
			//strupr(argv[count]);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   144
			if(strnicmp(argv[count],ParamFileArg.c_str(),ParamFileArg.length()) == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   145
				paramFile.assign(&argv[count][ParamFileArg.length()]);									
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   146
				processParamfile(paramFile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   147
			}
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
	int i = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   152
	while (i<argc) {		 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   153
#ifdef __LINUX__	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   154
		if (argv[i][0] == '-') 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   155
#else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   156
		if ((argv[i][0] == '-') || (argv[i][0] == '/'))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   157
#endif
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   158
		{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   159
			// switch
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   160
			if ((argv[i][1] & 0x20) == 'v')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   161
				H.iVerbose = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   162
			else if(strnicmp (argv[i], "-SMR=", 5) == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   163
				if(argv[i][5]) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   164
					gSmrImage = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   165
					gSmrFileName.assign(&argv[i][5]);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   166
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   167
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   168
					Print (EError, "SMR obey file is missing\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   169
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   170
			} else if (stricmp(argv[i], "-K") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   171
				gKeepGoing = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   172
			}else if (stricmp(argv[i], "-SYMBOLS") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   173
				gGenSymbols = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   174
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   175
			else if (((argv[i][1] | 0x20) == 's') &&  
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   176
				(((argv[i][2]| 0x20) == 'l')||((argv[i][2] | 0x20) == 's'))) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   177
					SizeSummary = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   178
					if ((argv[i][2]| 0x20) == 'l')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   179
						SizeWhere = ELog;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   180
					else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   181
						SizeWhere = EScreen;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   182
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   183
			else if (strnicmp(argv[i],ParamFileArg.c_str(),ParamFileArg.length()) == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   184
				if (paramFileFlag){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   185
					string paramFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   186
					paramFile.assign(&argv[i][ParamFileArg.length()]);		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   187
					processParamfile(paramFile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   188
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   189
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   190
					i++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   191
					continue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   192
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   193
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   194
			else if (stricmp(argv[i], "-COMPRESS") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   195
				gCompress = ECompressionCompress;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   196
				gCompressionMethod = KUidCompressionDeflate;
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], "-CACHE") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   199
				gCache = true;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   200
				if(gCleanCache || gNoCache) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   201
					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
   202
					exit(1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   203
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   204
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   205
			else if(stricmp(argv[i], "-NOCACHE") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   206
				gNoCache = true;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   207
				if(gCleanCache || gCache) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   208
					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
   209
					exit(1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   210
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   211
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   212
			else if(stricmp(argv[i], "-CLEANCACHE") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   213
				gCleanCache = true;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   214
				if(gCache || gNoCache)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   215
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   216
					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
   217
					exit(1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   218
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   219
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   220
			else if (strnicmp(argv[i], "-J",2) == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   221
				if(argv[i][2])
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   222
					gThreadNum = atoi(&argv[i][2]);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   223
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   224
					printf("WARNING: The option should be like '-j4'.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   225
					gThreadNum = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   226
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   227
				if(gThreadNum <= 0 || gThreadNum > MAXIMUM_THREADS) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   228
					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
   229
					if(gCPUNum > 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   230
						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
   231
						gThreadNum = gCPUNum;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   232
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   233
					else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   234
						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
   235
						gThreadNum = DEFAULT_THREADS;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   236
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   237
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   238
			}
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   239
			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
   240
			{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   241
				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
   242
					gIsOBYUTF8 = ETrue;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   243
				else
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   244
					Print(EError, "Invalid encoding %s, default system internal encoding will be used.\n", &argv[i][13]);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   245
			}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   246
			else if (stricmp(argv[i], "-UNCOMPRESS") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   247
				gCompress = ECompressionUncompress;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   248
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   249
			else if( stricmp(argv[i], "-COMPRESSIONMETHOD") == 0 ) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   250
				// next argument should a be method
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   251
				if( (i+1) >= argc || argv[i+1][0] == '-') {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   252
					Print (EError, "Missing compression method! Set it to default (no compression)!");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   253
					gCompressionMethod = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   254
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   255
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   256
					i++;					
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   257
					if( stricmp(argv[i], "NONE") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   258
						gCompress = ECompressionUncompress;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   259
						gCompressionMethod = 0;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   260
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   261
					else if( stricmp(argv[i], "INFLATE") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   262
						gCompress = ECompressionCompress;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   263
						gCompressionMethod = KUidCompressionDeflate;	
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], "BYTEPAIR") == 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 = KUidCompressionBytePair;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   268
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   269
					else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   270
						Print (EError, "Unknown compression method! Set it to default (no compression)!");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   271
						gCompress = ECompressionUnknown;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   272
						gCompressionMethod = 0;		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   273
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   274
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   275
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   276
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   277
			else if (stricmp(argv[i], "-COREIMAGE") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   278
				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   279
				gUseCoreImage = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   280
				// next argument should be image filename
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   281
				if ((i+1 >= argc) || argv[i+1][0] == '-')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   282
					Print (EError, "Missing image file name");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   283
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   284
					i++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   285
					gImageFilename.assign(argv[i]);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   286
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   287
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   288
			else if (strnicmp(argv[i], "-DATADRIVE=",11) == 0){  
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   289
				if(argv[i][11])	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   290
					gDriveImage = ETrue; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   291
					gDriveFilename.assign(&argv[i][11]);	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   292
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   293
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   294
					Print (EError, "Drive obey file is missing\n"); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   295
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   296
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   297
			else if (argv[i][1] == '?') {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   298
				reallyHelp = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   299
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   300
			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
   301
				gEnableStdPathWarning = ETrue;						
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   302
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   303
			else if( stricmp(argv[i], "-LOGLEVEL") == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   304
				// next argument should a be loglevel
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   305
				if( (i+1) >= argc || argv[i+1][0] == '-') {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   306
					Print (EError, "Missing loglevel!");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   307
					gLogLevel = DEFAULT_LOG_LEVEL;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   308
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   309
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   310
					i++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   311
					if (strcmp(argv[i], "2") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   312
						gLogLevel = (LOG_LEVEL_FILE_DETAILS | LOG_LEVEL_FILE_ATTRIBUTES);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   313
					if (strcmp(argv[i], "1") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   314
						gLogLevel = LOG_LEVEL_FILE_DETAILS;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   315
					else if (strcmp(argv[i], "0") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   316
						gLogLevel = DEFAULT_LOG_LEVEL;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   317
					else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   318
						Print(EError, "Only loglevel 0, 1 or 2 is allowed!");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   319
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   320
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   321
			else if( stricmp(argv[i], "-LOGLEVEL2") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   322
				gLogLevel = (LOG_LEVEL_FILE_DETAILS | LOG_LEVEL_FILE_ATTRIBUTES);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   323
			else if( stricmp(argv[i], "-LOGLEVEL1") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   324
				gLogLevel = LOG_LEVEL_FILE_DETAILS;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   325
			else if( stricmp(argv[i], "-LOGLEVEL0") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   326
				gLogLevel = DEFAULT_LOG_LEVEL;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   327
			else if (stricmp(argv[i], "-LOWMEM") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   328
				gLowMem = ETrue;
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   329
			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
   330
				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
   331
			}
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   332
			else if (strnicmp(argv[i], "-loginput=", 10) == 0) {
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   333
				loginput = argv[i] + 10;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   334
			}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   335
			else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   336
#ifdef WIN32
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   337
				Print (EWarning, "Unrecognised option %s\n",argv[i]);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   338
#else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   339
				if(0 == access(argv[i],R_OK)){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   340
					filename.assign(argv[i]);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   341
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   342
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   343
					Print (EWarning, "Unrecognised option %s\n",argv[i]);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   344
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   345
#endif				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   346
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   347
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   348
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   349
		else // Must be the obey filename
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   350
			filename.assign(argv[i]);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   351
		i++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   352
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   353
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   354
	if (paramFileFlag)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   355
		return;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   356
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   357
	if((gDriveImage == EFalse) && (gSmrImage ==  EFalse) && 
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   358
		(filename.empty() || (gUseCoreImage && gImageFilename.length() == 0)) && (loginput.length() == 0)){
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   359
			Print (EAlways, HelpText);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   360
			if (reallyHelp) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   361
				ObeyFileReader::KeywordHelp();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   362
				Print (EAlways, ReallyHelpText);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   363
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   364
			else if (filename.empty()){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   365
				Print(EAlways, "Obey filename is missing\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   366
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   367
	}	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   368
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   369
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   370
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   371
Function to process parameter-file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   372
@param aFileName parameter-file name.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   373
*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   374
void processParamfile(const string& aFileName) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   375
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   376
	CParameterFileProcessor parameterFile(aFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   377
	// Invoke fuction "ParameterFileProcessor" to process parameter-file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   378
	if(parameterFile.ParameterFileProcessor()) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   379
		TUint noOfParameters = parameterFile.GetNoOfArguments();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   380
		char** parameters = parameterFile.GetParameters();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   381
		TBool paramFileFlag = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   382
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   383
		// Invoke function "processCommandLine" to process parameters read from parameter-file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   384
		processCommandLine(noOfParameters,parameters,paramFileFlag);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   385
	}	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   386
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   387
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   388
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   389
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
   390
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   391
@param aobeyFileName - Drive obey file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   392
@param alogfile      - log file name required for file system module.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   393
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   394
@return - returns the status, after processing the drive obey file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   395
*/ 
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   396
TInt ProcessDataDriveMain(char* aobeyFileName, const char* alogfile) {
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   397
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   398
	ObeyFileReader *reader = new ObeyFileReader(aobeyFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   399
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   400
	if(!reader)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   401
		return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   402
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   403
	if(!reader->Open())
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   404
		return KErrGeneral; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   405
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   406
	CObeyFile* mainObeyFile = new CObeyFile(*reader);    
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   407
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   408
	if(!mainObeyFile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   409
		return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   410
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   411
	// Process data drive image.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   412
	// 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
   413
	TRomNode::sDefaultInitialAttr = 0; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   414
	TInt retstatus = mainObeyFile->ProcessDataDrive();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   415
	if (retstatus == KErrNone) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   416
		// Build a Data drive image using the description compiled into the CObeyFile object
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   417
		CDriveImage* userImage = new CDriveImage(mainObeyFile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   418
		if(userImage) {	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   419
			// Drive image creation.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   420
			retstatus = userImage->CreateImage(alogfile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   421
			if(retstatus == KErrNone) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   422
				Print (EAlways, "\nSuccessfully generated the Drive image : %s \n",mainObeyFile->iDriveFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   423
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   424
			else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   425
				Print (EError, "Failed to generate the Image : %s\n",mainObeyFile->iDriveFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   426
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   427
			delete userImage; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   428
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   429
		else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   430
			retstatus = KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   431
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   432
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   433
	// restore
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   434
	TRomNode::sDefaultInitialAttr = (TUint8)KEntryAttReadOnly;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   435
	cout << "\n-----------------------------------------------------------\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   436
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   437
	delete mainObeyFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   438
	delete reader;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   439
	return retstatus;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   440
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   441
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   442
TInt ProcessSmrImageMain(char* aObeyFileName, const char* /* alogfile */) {
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   443
	ObeyFileReader *reader = new ObeyFileReader(aObeyFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   444
	if(!reader)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   445
		return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   446
	if(!reader->Open())
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   447
		return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   448
	TInt retstatus = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   449
	CObeyFile* mainObeyFile = new CObeyFile(*reader);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   450
	CSmrImage* smrImage = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   451
	if(!mainObeyFile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   452
		return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   453
	if(mainObeyFile->Process()) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   454
		smrImage = new CSmrImage(mainObeyFile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   455
		if(smrImage) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   456
			if((retstatus = smrImage->Initialise()) == KErrNone) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   457
				retstatus = smrImage->CreateImage();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   458
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   459
			if(retstatus == KErrNone) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   460
				Print (EAlways,  "\nSuccessfully generated the SMR image : %s\n" ,smrImage->GetImageName().c_str());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   461
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   462
			else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   463
				Print (EError, "\nFailed to generate the Image : %s\n" ,smrImage->GetImageName().c_str());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   464
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   465
			delete smrImage;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   466
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   467
		else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   468
			retstatus = KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   469
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   470
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   471
	delete mainObeyFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   472
	delete reader;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   473
	return retstatus;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   474
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   475
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   476
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   477
Rofsbuild Main function, which creates both Rofs and Data drive image.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   478
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   479
@param argc    - No. of argument.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   480
@param *argv[] - Arguments value.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   481
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   482
@return - returns the status to caller.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   483
*/ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   484
TInt main(int argc, char *argv[]){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   485
	TInt r =0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   486
#ifdef __LINUX__
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   487
	gCPUNum = sysconf(_SC_NPROCESSORS_CONF);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   488
#else	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   489
	char* pCPUNum = getenv ("NUMBER_OF_PROCESSORS");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   490
	if (pCPUNum != NULL)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   491
		gCPUNum = atoi(pCPUNum);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   492
#endif		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   493
	if(gCPUNum > MAXIMUM_THREADS)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   494
		gCPUNum = MAXIMUM_THREADS;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   495
	PrintVersion();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   496
	processCommandLine(argc, argv);
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   497
	if(gThreadNum == 0) {
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   498
		if(gCPUNum > 0) {
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   499
			printf("WARNING: The number of processors (%d) is used as the number of concurrent jobs.\n", gCPUNum);
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   500
			gThreadNum = gCPUNum;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   501
		}
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   502
		else {
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   503
			printf("WARNING: Can't automatically get the valid number of concurrent jobs and %d is used.\n", DEFAULT_THREADS);
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   504
			gThreadNum = DEFAULT_THREADS;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   505
		}
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   506
	}
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   507
	if(loginput.length() >= 1)
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   508
	{
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   509
		try
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
			LogParser::GetInstance()->ParseSymbol(loginput.c_str());
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   512
		}
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   513
		catch(LoggingException le)
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
			printf("ERROR: %s\r\n", le.GetErrorMessage());
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   516
			return 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
		return 0;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   519
	}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   520
	//if the user wants to clean up the cache, do it only.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   521
	if(gCleanCache){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   522
		try {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   523
			CacheManager::GetInstance()->CleanCache();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   524
			Print (EAlways, "Cache has been deleted successfully.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   525
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   526
		catch(CacheException& ce){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   527
			Print (EError, "%s\n", ce.GetErrorMessage());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   528
			return (TInt)1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   529
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   530
		return r;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   531
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   532
	//initialize cache if the user switches on.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   533
	if(gCache) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   534
		try {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   535
			CacheManager::GetInstance();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   536
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   537
		catch(CacheException ce){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   538
			Print (EError, "%s\n", ce.GetErrorMessage());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   539
			return (TInt)1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   540
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   541
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   542
	const char *obeyFileName = 0;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   543
	if(!filename.empty())
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   544
		obeyFileName = filename.c_str(); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   545
	if ((!obeyFileName) && (!gDriveFilename.empty()) && (!gSmrFileName.empty())){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   546
		return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   547
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   548
	// Process drive obey files.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   549
	if(gDriveImage) {  
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   550
		char temp = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   551
		char *driveobeyFileName = (char*)_alloca(gDriveFilename.length() + 1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   552
		memcpy(driveobeyFileName,gDriveFilename.c_str(),gDriveFilename.length() + 1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   553
		char* ptr = driveobeyFileName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   554
		do {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   555
			while(((temp = *ptr++) != ',') && (temp != 0));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   556
			*(--ptr)++ = 0; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   557
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   558
			if(*driveobeyFileName) {
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   559
				string logfile = Getlogfile(driveobeyFileName, cmdlogfile);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   560
				if(logfile.size() > 0) {
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   561
					H.SetLogFile(logfile.c_str());
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   562
					GetLocalTime();
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   563
					r = ProcessDataDriveMain(driveobeyFileName,logfile.c_str());   
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   564
					H.CloseLogFile();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   565
					if(r == KErrNoMemory)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   566
						return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   567
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   568
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   569
					Print(EError,"Invalid obey file name : %s\n", driveobeyFileName);   
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   570
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   571
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   572
			driveobeyFileName = ptr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   573
		} while(temp != 0); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   574
		gDriveImage = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   575
	} 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   576
	if(gSmrImage){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   577
		char temp = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   578
		char *smrImageObeyFileName = (char*)_alloca(gSmrFileName.length() + 1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   579
		memcpy(smrImageObeyFileName,gSmrFileName.c_str(),gSmrFileName.length() + 1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   580
		char* ptr = smrImageObeyFileName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   581
		do {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   582
			while(((temp = *ptr++) != ',') && (temp != 0));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   583
			*(--ptr)++ = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   584
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   585
			if(*smrImageObeyFileName){	
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   586
				string logfile = Getlogfile(smrImageObeyFileName, cmdlogfile);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   587
				if(logfile.size() > 0) {
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   588
					H.SetLogFile(logfile.c_str());
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   589
					GetLocalTime();
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   590
					r = ProcessSmrImageMain(smrImageObeyFileName, logfile.c_str());
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   591
					H.CloseLogFile();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   592
					if(r == KErrNoMemory)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   593
						return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   594
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   595
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   596
					Print(EError,"Invalid obey file name: %s", smrImageObeyFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   597
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   598
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   599
			smrImageObeyFileName = ptr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   600
		} while(temp != 0);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   601
		gSmrImage = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   602
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   603
	// Process Rofs Obey files.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   604
	if(obeyFileName) {
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   605
		if (cmdlogfile.empty() || cmdlogfile[cmdlogfile.size()-1] == '\\' || cmdlogfile[cmdlogfile.size()-1] == '/')
655
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 647
diff changeset
   606
			cmdlogfile += "ROFSBUILD.LOG" ;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents: 647
diff changeset
   607
			
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 631
diff changeset
   608
	 	H.SetLogFile(cmdlogfile.c_str());
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   609
		ObeyFileReader *reader = new ObeyFileReader(obeyFileName); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   610
		if (!reader->Open())
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   611
			return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   612
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   613
		E32Rofs* RofsImage = 0;		// for image from obey file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   614
		CCoreImage *core = 0;		// for image from core image file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   615
		MRofsImage* imageInfo = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   616
		CObeyFile *mainObeyFile = new CObeyFile(*reader);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   617
		// need check if obey file has coreimage keyword
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   618
		char *file = mainObeyFile->ProcessCoreImage();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   619
		if (file) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   620
			// hase coreimage keyword but only use if command line option
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   621
			// for coreimage not already selected
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   622
			if (!gUseCoreImage){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   623
				gUseCoreImage = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   624
				gImageFilename = file;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   625
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   626
			delete []file ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   627
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   628
		if (!gUseCoreImage) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   629
			r = mainObeyFile->ProcessRofs();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   630
			if (r == KErrNone) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   631
				// Build a ROFS image using the description compiled into the CObeyFile object
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   632
				RofsImage = new E32Rofs( mainObeyFile );
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   633
				if( !RofsImage ) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   634
					if(gCache || gCleanCache)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   635
						delete CacheManager::GetInstance();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   636
					return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   637
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   638
				r = RofsImage->Create();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   639
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   640
				if( KErrNone == r )	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   641
					RofsImage->WriteImage( gHeaderType );
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   642
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   643
				imageInfo = RofsImage;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   644
				mainObeyFile->Release();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   645
				if(gCache || gCleanCache)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   646
					delete CacheManager::GetInstance();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   647
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   648
			else if (r != KErrNotFound){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   649
				return r;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   650
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   651
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   652
		else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   653
			// need to use core image
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   654
			RCoreImageReader *reader = new RCoreImageReader(gImageFilename.c_str());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   655
			if (!reader) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   656
				return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   657
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   658
			core = new CCoreImage(reader);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   659
			if (!core) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   660
				return KErrNoMemory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   661
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   662
			r = core->ProcessImage();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   663
			if (r != KErrNone) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   664
				return r;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   665
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   666
			imageInfo = core;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   667
			mainObeyFile->SkipToExtension();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   668
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   669
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   670
		do {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   671
			CObeyFile* extensionObeyFile = new CObeyFile(*reader);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   672
			r = extensionObeyFile->ProcessExtensionRofs(imageInfo);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   673
			if (r == KErrEof){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   674
				if(RofsImage){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   675
					delete RofsImage;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   676
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   677
				if(core){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   678
					delete core;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   679
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   680
				delete extensionObeyFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   681
				return KErrNone;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   682
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   683
			if (r != KErrNone){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   684
				break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   685
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   686
			E32Rofs* extensionRofs = new E32Rofs(extensionObeyFile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   687
			r = extensionRofs->CreateExtension(imageInfo);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   688
			if (r!= KErrNone){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   689
				delete extensionRofs;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   690
				delete extensionObeyFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   691
				break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   692
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   693
			r = extensionRofs->WriteImage(0);	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   694
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   695
			delete extensionRofs;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   696
			extensionRofs = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   697
		} while (r == KErrNone);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   698
		if(RofsImage) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   699
			delete RofsImage;									
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   700
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   701
		if(core){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   702
			delete core;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   703
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   704
		delete mainObeyFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   705
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   706
	return r;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   707
}//end of main.