imgtools/buildrom/tools/buildrom.pm
author marvin shi <marvin.shi@nokia.com>
Tue, 30 Nov 2010 17:14:57 +0800
changeset 714 e5a58c351011
parent 713 7b7f0409fc00
permissions -rw-r--r--
feature bsym format symbol rombuild support
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) 2006-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
# This package is to build rom image
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    16
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    17
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    18
package buildrom;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    19
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    20
require Exporter;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    21
@ISA=qw(Exporter);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    22
@EXPORT=qw(
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    23
	image_content_processing_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    24
	process_cmdline_arguments
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    25
	preprocessing_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    26
	substitution_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    27
	reorganize_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    28
	plugin_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    29
	multlinguify_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    30
	spi_creation_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    31
	suppress_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    32
	bitmap_aif_converison_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    33
	cleaning_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    34
	create_dumpfile
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    35
	create_dirlisting
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    36
	suppress_image_generation
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    37
	invoke_rombuild
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    38
	getOBYDataRef
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    39
	isobystatement
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    40
	isdatastatement
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    41
	isspidatastatement
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    42
	isexecutablefile
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    43
	isdirectorymetadata
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    44
	isbitmap
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    45
	isaif
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    46
	isresource
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    47
	hardwarevariant
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    48
	executableextension
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    49
	executabletype
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    50
	getSourceFile
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    51
	getDestFile
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    52
	getOBYAttributes
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    53
	getHardwareVariant
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    54
	getObyCommand
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    55
	process_dlldata
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    56
	featurefile_creation_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    57
	processData
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    58
	create_smrimage
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
    59
	getWorkdir
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
    60
	isIgnoreConfig
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    61
);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    62
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    63
my $useinterpretsis = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    64
if ($^O !~ /^MSWin32$/i){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    65
	$useinterpretsis = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    66
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    67
my $enforceFeatureManager = 0; # Flag to make Feature Manager mandatory if SYMBIAN_FEATURE_MANAGER macro is defined. 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    68
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    69
my $BuildromMajorVersion = 3 ;
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
    70
my $BuildromMinorVersion = 33;
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
    71
my $BuildromPatchVersion = 0;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    72
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    73
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    74
sub print_usage
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    75
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    76
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    77
	# Option "-fm" will be supported instead of option "-f|fr" if SYMBIAN_FEATURE_MANAGER macro is defined.
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
    78
	my $featuresOptionUsage = "-ffeatureuids or -fr=featureuids -- [obsolete] Feature registry database XML file name\n". 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
    79
							   "                                       Please use featureconfigurator.pl to configurate features.\n\n".
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
    80
							   "   -nofm                            -- Don't perform feature configuration \n\n"; 
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    81
	if ($enforceFeatureManager) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    82
	{
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
    83
		$featuresOptionUsage = "-fm=featuredatabasefile          -- [obsolete] Feature manager/feature registry database XML file name.\n".
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
    84
							   "                                       Multiple XML files can be passed seperated by commas.\n". 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
    85
							   "                                       Please use featureconfigurator.pl to configurate features.\n\n".				
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
    86
							   "   -nofm=featuresdatafile           -- [obsolete] Don't generate features data file.\n".
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
    87
							   "                                       Use pre-built features data file instead.\n". 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
    88
							   "                                       Please use featureconfigurator.pl to configurate features.\n\n".
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
    89
							   "   -nofm                            -- Don't perform feature configuration\n\n";							  
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    90
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    91
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    92
#........1.........2.........3.........4.........5.........6.........7.....
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    93
	print <<USAGE_EOF;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    94
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    95
BUILDROM - ROM configuration tool V$BuildromMajorVersion.$BuildromMinorVersion.$BuildromPatchVersion
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    96
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    97
Usage:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    98
  buildrom [options] obyfile [obyfile2 ...]   
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    99
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   100
Build a ROM according to the specification defined by concatenating the
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   101
specified obyfiles.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   102
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   103
The initial specification is modified by C++ preprocessor directives,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   104
and subsequently adjusted by statements in the ROM specification language.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   105
The final specification is in the subset of the specification language
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   106
which is understood directly by ROMBUILD.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   107
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   108
Each obyfile parameter specifies a file via a search path: if the
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   109
filename is not matched then buildrom will look in \/epoc32\/rom\/include.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   110
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   111
Buildrom invokes ROMBUILD to generate the ROM image, and produces a
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   112
number of related files such as the ROM symbol file. The name of the
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   113
image file is specified directly by the -o option, or determined by 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   114
scanning the final specification for the "romname" keyword. If there is 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   115
more than one "romname" statement, the last one takes precedence.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   116
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   117
The available options are
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   118
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   119
   -Dxxx                            -- C++ preprocessor arguments
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   120
   -oimagename                      -- ROM image name, overriding any ROMNAME statement
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   121
   -s                               -- strict option, any missing files will stop buildrom 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   122
   -p                               -- preserves the intermediate files pertaining to data drive, Z drive and BMCONV
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   123
   -spi                             -- enable producing SPI files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   124
   -spiplacement                    -- enable positioning of spi file
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   125
   -w                               -- warn if file has been selected from a different directory
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   126
   
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   127
   $featuresOptionUsage
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   128
   -etool                           -- external tool specification (xx is tool's perl module)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   129
   -compress                        -- compression type of ROM image:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   130
                                       -compress compress whole ROM image.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   131
                                       -compress=paged compress paged section in the ROM image only.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   132
                                       -compress=unpaged compress unpaged section in the ROM image only. 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   133
   -ccomprmethod                    -- compression method: none|inflate|bytepair
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   134
   -geninc                          -- generate INC file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   135
   -gendep                          -- generate dependence graph for rom image
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   136
   -nosymbols                       -- disable creation of symbol file
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
   137
   -bsymbols                        -- create symbol file in bsym format
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   138
   -noimage                         -- disable creation of ROM/ROFS/DataDrive Image
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   139
   -j<digit>                        -- do the main job with <digit> threads
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   140
   -cache                           -- allow the ROFSBUILD to reuse/generate cached executable files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   141
   -nocache                         -- force the ROFSBUILD not to reuse/generate cached executable files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   142
   -cleancache                      -- permanently remove all cached executable files
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   143
   -oby-charset=<charset>	        -- used character set in which OBY was written
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   144
   -loglevel<level>                 -- Level of information logging where loglevel is 0,1,2
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   145
                                       0 default level of information
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   146
                                       1 host/ROM filenames, file size and the hidden attribute along with level0 log
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   147
                                       2 E32 file header attributes along with level1 log
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   148
   -z=xxx or -zdrivepath=xxx        -- specify a location to create Z drive directory. 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   149
   -d=xxx or -datadrivepath=xxx     -- specify a location to create data drive directory.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   150
   -k or -keepgoing                 -- enable keepgoing,continue to create the data drive image even
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   151
                                    if the non-sis, sis or zdrive image file(s) are missing or corrupt; create rom/rofs
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   152
									image even some oby files missing and/or duplicated definitions in oby files .
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   153
   -r or -retainfolder              -- enable retainfolder,would retain pre-existence of z & data drive folder. 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   154
   -zdriveimage=xxx                 -- specify Z drive image (ROM, CORE, ROFS or Ext-ROFS image).
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   155
   -pfile=xxx                       -- specify a parameter file for interpretsis to take additional parameters.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   156
   -argforinterpretsis=xxx          -- specify command line argument(s) for interpretsis which will override the 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   157
                                    parameter file contents.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   158
   -l=xxx or -logimagecontents=xxx  -- extract all stub-sis and SWI certificate store file(s) only 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   159
                                    and log all the file(s) that are part of the Z drive image on to a log file.  
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   160
   -I<directory>                    -- Use <directory> for the referenced IBY/OBY files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   161
   -argfile=xxx                     -- specify argument-file name containing list of command-line arguments to buildrom   
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   162
   -lowmem                          -- use memory-mapped file for image build to reduce physical memory consumption   
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   163
   -checkcase                       -- check character case of path/name in oby/iby files, 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   164
                                    the result will be checkcase.log, this option is only valid on windows.
609
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
   165
   -workdir=xxx                     -- specify a directory to contain generated files. 
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
   166
   -prependepocroot                 -- if there is no EPOCROOT## before /epoc32/, prepend EPOCROOT## to epoc32.
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   167
   -stdcpp                          -- ignore symbian customized cpp and try to find another cpp in the PATH.(for Windows only)
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   168
   -cpp=xxx                         -- specify a CPP preprocessor used by Buildrom.
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   169
   -xiponly                         -- just create the XIP ROM image without creating the ROFS image.
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   170
   -nopreprocess                    -- Input oby files have been or don't need to be preprocessed,
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   171
                                       don't preprocess the input oby files.
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   172
   -inputoby=<finalOBYfile>         -- Ignore BUILDROM config phase, invoke Rombuild/Rofsbuild using <finalOBYfile>.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   173
                                    <finalOBYfile> must contain one and ONLY one of romsize/rofssize/dataimagename/imagename keywords,
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   174
                                    The keywords will be used to identify the OBY type.
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   175
   
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   176
Popular -D defines to use include
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   177
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   178
   -D_DEBUG         -- select debug versions of some files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   179
   -D_FULL_DEBUG    -- select debug versions of all files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   180
   -D_ARM4          -- specify the target platform
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   181
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   182
   -D_EABI=xxxx     -- specify target for all files (e.g. armv5)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   183
   -D_KABI=xxxx     -- specify the target platform for the Kernel (e.g. armv5)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   184
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   185
Other defines may be useful for particular OBY files.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   186
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   187
USAGE_EOF
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   188
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   189
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   190
use strict;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   191
use romutl;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   192
use romosvariant;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   193
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   194
my $PerlEPOCPath = &get_epocroot()."epoc32\/tools\/";   # fully qualified pathname of the directory containing EPOC Perl modules
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   195
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   196
sub ExportDirs ($);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   197
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   198
my $xmlrequired = 0; # assume xml required is false. Used to determine if xml
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   199
                     # modules should be loaded.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   200
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   201
use flexmodload;	     # To load modules dynamically
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   202
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   203
# Work out the relative path to the epoc32 directory
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   204
use spitool qw(&createSpi);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   205
use Cwd;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   206
use externaltools; 	#To invoke External Tools
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   207
use File::Basename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   208
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   209
my @tempfiles;  	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   210
my $preserve = 0; 	#flag to indicate if temporary files should be preserved
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   211
my $uppath="x";	    	# will be initialised when first needed
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   212
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   213
my $epocroot = &get_epocroot;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   214
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   215
my @obyfiles;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   216
my $cppargs = "-nostdinc -undef";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   217
my $opt_v = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   218
my $opt_o = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   219
my $strict = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   220
my $warnSelection = 0; # default is not warn about selecting files from 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   221
		       # different directories when the file is missing from
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   222
		       # the specified directory
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   223
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   224
my $createspi = 0; # don't create SPI files by default
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   225
my $spiset=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   226
my $spiplacement = 0; # enable the placement of spi file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   227
my %spipositionflag = (); # map of Image index at which the keyword SPI_POSITION is used.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   228
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   229
use constant NONE => 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   230
use constant INFLATE => 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   231
use constant BYTEPAIR => 2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   232
my $opt_compression;  # Default compression method parameter undefined
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   233
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   234
use constant UNCOMPRESSED   => 0;        # Indicates the ROM image will not be compressed.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   235
use constant ALLSECTIONS    => 1;        # Indicates both paged section and unpaged section will be compressed.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   236
use constant PAGEDSECTION   => 2;        # Indicates only paged section will be compressed.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   237
use constant UNPAGEDSECTION => 3;        # Indicates only unpaged section will be compressed.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   238
my $opt_compression_type = UNCOMPRESSED; # Leave the ROM image uncompressed by default.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   239
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   240
#Variables to store cache command line options
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   241
my $opt_cache      = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   242
my $opt_nocache    = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   243
my $opt_cleancache = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   244
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   245
my $thisdir=cwd;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   246
$thisdir=~s-\\-\/-go;		    # separator from Perl 5.005_02+ is forward slash
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   247
$thisdir.= "\/" unless $thisdir =~ /\/$/;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   248
$thisdir =~ s-\/-\\-g if (&is_windows);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   249
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   250
my $rominclude = $epocroot."epoc32\/rom\/include\/";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   251
$rominclude = &get_epocdrive().$rominclude unless $rominclude =~ /^.:/;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   252
$rominclude =~s-\\-\/-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   253
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   254
my %plugintypes; #hash of plugin types and their SPI files' destinations in ROM
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   255
$plugintypes{"ECOM"} = "\/private\/10009d8f\/"; #ECOM SPI files' destination in ROM image
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   256
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   257
my @obydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   258
my @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   259
my %substitutionData;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   260
my @substitutionOrder;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   261
my %languageCodes;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   262
my $defaultLanguageCode;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   263
my %multiLinguifyAlias;  # to by-pass the 'mustbesysbin' option for multilinguify 'alias'es. 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   264
my $abiDowngrade = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   265
my @binarySelectionOrder;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   266
my $fromDIR;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   267
my %rombuildOptions = ("-type-safe-link" => 1 );
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   268
my $enforceSysBin = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   269
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   270
my $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   271
my $errors = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   272
my @romimage;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   273
my $rombasename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   274
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   275
my $sourcefile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   276
my $sourceline;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   277
#my $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   278
my %romfiles;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   279
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   280
# To handle BINARY_SELECTION_ORDER macro.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   281
my $firstDIR;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   282
my $binarySelectionOrderFlag = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   283
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   284
my %DllDataMap = ();	#Map to keep track of DLL Data patch statements.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   285
my $patchDataStmtFlag = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   286
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   287
my $featuremanager = 0; #Flag to enable support for feature manager database XML file and to generate  
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   288
			# features data file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   289
my $noFeatureManager = 0; # Flag to stop the generation of features.dat file and use pre-built features.dat if provided.
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   290
my $noFeatureConf  = 0 ;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   291
my $preBuiltFeaturesDataFile  = ''; # To store the name of pre-built features.dat file provided with "-nofm" option.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   292
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   293
#Image Content XML file that supports specific feature to be added
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   294
my $image_content = undef;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   295
#Feature list XML file that acts as database containing all features details
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   296
my $featureXml = undef;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   297
my $geninc = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   298
my $gendep = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   299
my $nosymbols = "";
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
   300
my $bsymbols = "";
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   301
my $noimage = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   302
my $customizedPlat = undef;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   303
my $opt_jobs= "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   304
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   305
#Summary of files(both executables and data files) currently includes 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   306
#	host and ROM file names, 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   307
#	size of the file in ROM
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   308
#	whether the file is hidden
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   309
# This option is added so that the above additional information is emitted by rombuild/rofsbuild tools
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   310
# only when supplied with this option so that the existing tools don't get affected.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   311
my $logLevel="";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   312
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   313
# This option is used to pass -lowmem argument to rombuild/rofsbuild tools
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   314
my $lowMem="";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   315
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   316
# Feature Variation modules and data
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   317
my %featureVariant;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   318
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   319
# global variables specific to data drive image generation. 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   320
use File::Path;					# Module to provide functions to remove or create directories in a convenient way.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   321
use File::Copy;					# Module to provide functions to copy file(s) from source to destination.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   322
use File::Find;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   323
use datadriveimage;				# module which provides all necessary functions to create data drive image.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   324
my $ZDirloc = "";				# location of Z drive directory.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   325
my $DataDriveDirloc = "";		# location of data drive directory.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   326
my @sisfilelist;				# an array to hold sis file(s).
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   327
my @zDriveImageList;			# an array to hold z drive image name.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   328
my @datadiveobydata;			# an array to hold data drive oby data.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   329
my @datadriveimage;				# array which holds data drive image attribute.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   330
my $rootdir = "";				# which holds root directory information.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   331
my @datadrivedata;				# array to maintain list of lines taken from processed data drive oby file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   332
my @nonsisFilelist;				# array to maintain list of nonsis file(s). 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   333
my @sisobydata;					# array to maintain all list of files(s) got by installing sis files. 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   334
my @renameList;					# array to maintain list of file(s) that has to be renamed.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   335
my @aliaslist;					# array to maintain list of file(s) that has to be made alias.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   336
my @hideList;					# array to maintain list of file(s) that has to be made hidden.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   337
my $sisfilepresent = 0;			# enable if sis file(s) are present.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   338
my $stubsisfilepresent = 0;		# enable if stub-sis file(s) are present.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   339
my $opt_k = 0;					# enable if keepgoing option is specified by the user.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   340
my $opt_r = 0;					# enable if retain pre-existence of folder is specified by the user.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   341
my $dataImageCount = 0;			# no of data drive image that has to generated.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   342
my @zdriveImageName;			# list of Z drive image name(s) specified using zdriveimagename in oby/iby file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   343
my $opt_zimage = 0;				# enable if z drive image is found.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   344
my $zDrivePresent = 0;			# flag to check whether Z drive needs to be created.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   345
my @dataDriveFileList;			# list of processed data drive related files.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   346
my $paraFile = undef;			# parameter file for interpretsis.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   347
my @romImages;					# list of generated z drive image(s)(rom/rofs). 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   348
my $imageEntryLogFile = undef;	# a log file to log all the z drive image contents.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   349
my $opt_logFile = 0;			# enable if z drive entries has to be logged on to a log file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   350
my %dataIndexHash = ();			# a hash which holds key-value pair between datadrive index and datadrive image count.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   351
my $interpretsisOpt = undef;	# enable if command line arguments are specified by the user to INTERPRETSIS.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   352
my @interpretsisOptList;		# an array which holds all the list of option(s) that needs to passed to INTERPRETSIS. 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   353
my @Global_BPABIPlats;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   354
my @Global_PlatList;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   355
my @smrImageFileList;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   356
my $needSmrImage = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   357
my %smrPartitions;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   358
my %smrNameInfo;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   359
my @obeyFileList;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   360
my $smrNoImageName = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   361
my $onlysmrimage = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   362
my $checkcase = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   363
my $checkcase_platform = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   364
my $checkcase_test = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   365
my $opt_workdir = 0;
609
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
   366
my $prependepocroot = 0;
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   367
my $stdcpp = 0;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   368
my $obycharset;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   369
my $cppoption = 0;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   370
my $preprocessor = "cpp";
633
a4eca1f021ac ROMTools-13.1.0.2
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
   371
my $opt_xiponly = 0;
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   372
my $ignoreconfig = 0;
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   373
my $nopreprocess = 0;
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   374
my $romcount = 0;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   375
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   376
sub match_obyfile
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   377
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   378
	my ($obyfile) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   379
	if (-f $obyfile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   380
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   381
		push @obyfiles, $obyfile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   382
		return 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   383
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   384
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   385
	# search for the oby file in the list of include directories
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   386
	my @otherDirs = ($rominclude);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   387
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   388
	if ($featureVariant{'VALID'})
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   389
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   390
		my $dirRef = $featureVariant{'ROM_INCLUDES'};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   391
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   392
		@otherDirs = @$dirRef if ($dirRef);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   393
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   394
	foreach my $dir (@otherDirs)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   395
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   396
		print "$dir/$obyfile\n" if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   397
		if (-f "$dir/$obyfile")
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   398
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   399
		    push @obyfiles, "$dir/$obyfile";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   400
		    return 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   401
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   402
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   403
	return 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   404
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   405
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   406
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   407
# This function invokes ROFSBUILD tool with appropriate parameters to generate data drive image.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   408
# It also deletes zdrive and datadrive folder after all the image has been processed and generated
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   409
# if and only if preserve(-p) option is disabled.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   410
sub create_datadriveImage
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   411
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   412
	for (my $dataidx=0; $dataidx < $dataImageCount; $dataidx++)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   413
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   414
		my $driveIndex = $dataIndexHash{$dataidx};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   415
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   416
		if(defined($driveIndex))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   417
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   418
			my $obeyfile=$datadriveimage[$driveIndex]{obeyfile};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   419
			my $compress=$datadriveimage[$driveIndex]{compress};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   420
			my $uncompress=$datadriveimage[$driveIndex]{uncompress};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   421
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   422
			if ($obeyfile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   423
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   424
				if(!defined $opt_compression)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   425
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   426
					if ($compress ne 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   427
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   428
						$compress=" -compress";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   429
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   430
					elsif($uncompress ne 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   431
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   432
						$compress=" -uncompress";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   433
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   434
					elsif($compress eq 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   435
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   436
						$compress=" ";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   437
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   438
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   439
				else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   440
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   441
					$compress = $opt_compression;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   442
					$compress =~m/\s-(compression)(method)\s(none|inflate|bytepair)/;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   443
					print "* ".$1." ".$2.": ".$3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   444
				}
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   445
				my $command = "rofsbuild -slog".$compress." -datadrive=$obeyfile.oby -logfile=$thisdir";
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   446
				$command .= " -k" if($opt_k);      
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   447
				print "* Executing $command\n" if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   448
				system($command);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   449
				if ($? != 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   450
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   451
					&datadriveimage::reportError("* ROFSBUILD failed to generate data drive image",$opt_k);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   452
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   453
				else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   454
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   455
					push(@dataDriveFileList,$obeyfile.".img");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   456
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   457
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   458
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   459
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   460
	# after processing all the data drive image(s) delete zdrive and datadrive directory 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   461
	# if and only if preserve(-p) option is disabled.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   462
	if($dataImageCount)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   463
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   464
		# delete Z drive directory if and only if preserve(-p) option is disabled.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   465
		my $retVal = &deleteDirectory($ZDirloc,$opt_v)if(!($preserve));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   466
		if($retVal)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   467
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   468
			&datadriveimage::reportError("* Warning could not delete $ZDirloc",$opt_k);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   469
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   470
		# delete data drive directory if and only if preserve(-p) option is disabled.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   471
		$retVal = &deleteDirectory($DataDriveDirloc,$opt_v)if(!($preserve));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   472
		if($retVal)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   473
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   474
			&datadriveimage::reportError("* Warning could not delete $DataDriveDirloc",$opt_k);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   475
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   476
		# reset image count to zero.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   477
		$dataImageCount = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   478
		# reset z drive present to zero.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   479
		$zDrivePresent = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   480
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   481
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   482
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   483
sub tidy_exit
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
	# Tidy and exit
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   487
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   488
	if (!$preserve)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   489
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   490
	    foreach my $tempfiles (@tempfiles)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   491
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   492
	    print "remove $tempfiles\n" if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   493
			unlink "$tempfiles";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   494
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   495
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   496
	if($rombasename)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   497
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   498
		system("dir $rombasename.*");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   499
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   500
	if(@dataDriveFileList)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   501
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   502
		print "\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   503
		print " ----------------------------------------------------------\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   504
		print "| List of file(s) generated pertaining to data drive image |\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   505
		print " ----------------------------------------------------------\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   506
		my $arraySize = scalar(@dataDriveFileList);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   507
		for( my $i=0; $i < $arraySize; $i++ )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   508
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   509
			# remove the first element from an array and return it 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   510
			my $element = shift(@dataDriveFileList);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   511
			# get the size of the file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   512
			my $size = -s $element;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   513
			print "Size = ".$size." bytes"."\t"."File = ".$element."\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   514
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   515
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   516
	exit(0);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   517
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   518
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   519
# This is the main function which is responsible for processing data drive image.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   520
# This function internally calls other functions to create datadrive folder,zdrive folder
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   521
# and external tools such as INTERPRETSIS, READIMAGE and finally ROFSBUILD to generate 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   522
# appropriate data drive image.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   523
sub processData		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   524
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   525
	if($dataImageCount)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   526
	{
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   527
		if(!$ignoreconfig)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   528
		{
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   529
			# set the default path for Z drive and Data drive directory,
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   530
			# if and only if, path is not specified by the user. 
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   531
			$ZDirloc = $thisdir."zdrive" unless ($ZDirloc);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   532
			$DataDriveDirloc = $thisdir."datadrive" unless ($DataDriveDirloc);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   533
			#delete any existing Z drive directory.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   534
			my $retVal = &datadriveimage::deleteDirectory($ZDirloc,$opt_v)if(!$opt_r);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   535
			if($retVal)
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   536
			{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   537
				exit(1) if(!$opt_k);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   538
			}
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   539
			# delete pre-existence of data drive folder, if and only if -r option is not enabled.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   540
			$retVal = &datadriveimage::deleteDirectory($DataDriveDirloc,$opt_v) if(!$opt_r);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   541
			if($retVal)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   542
			{
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   543
				exit(1) if(!$opt_k);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   544
			}
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   545
			if($opt_logFile)
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   546
			{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   547
				# clean any pre-existance of log file.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   548
				unlink($ZDirloc."\/".$imageEntryLogFile);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   549
			}
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   550
			
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   551
			for (my $datadriveidx=0; $datadriveidx < $dataImageCount; $datadriveidx++)
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   552
			{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   553
				my $driveIndex = $dataIndexHash{$datadriveidx};
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   554
				# get the data drive name.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   555
				if( defined( $driveIndex ) )
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   556
				{
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   557
					my $datadrivename=$datadriveimage[$driveIndex]{obeyfile};
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   558
					# get the size of the data drive.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   559
					my $size = $datadriveimage[$driveIndex]{size};
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   560
					if( $datadrivename )
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   561
					{
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   562
						# set data drive oby file.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   563
						my $datadriveobyfile = $datadrivename.".oby";
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   564
						# final location of prototype data drive.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   565
						my $proDataDriveDirloc;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   566
						# Location of stub-sis file(s) inside Z Drive folder.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   567
						my $zDriveSisFileLoc;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   568
						# check if more than one data drive image needs to be generated. 
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   569
						if ($datadrivename =~ /.*[\\\/]([^\\\/]+)$/)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   570
						{
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   571
							$datadrivename = $1;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   572
						}
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   573
						if( $dataImageCount > 1 )
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   574
						{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   575
							# if yes, then set the location of prototype data drive folder as 
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   576
							# DataDriveDirloc + datadrivename
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   577
							$proDataDriveDirloc = $DataDriveDirloc."\/".$datadrivename;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   578
						}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   579
						else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   580
						{
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   581
							# else, then set the location of prototype data drive folder as DataDriveDirloc 
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   582
							$proDataDriveDirloc = $DataDriveDirloc;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   583
						}
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   584
	
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   585
						# create prototype data drive folder.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   586
						print "creating data drive folder\n" if ($opt_v);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   587
						&datadriveimage::createDirectory($proDataDriveDirloc);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   588
	
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   589
						# check for sis file keyword in ROM description file.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   590
						# if found,then locate for stub-sisfile.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   591
						# create Z drive( if and only if stub-sis files are present in ROM description file )
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   592
						# and dump all the non-sis files on to the Z drive folder. 
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   593
						if(&datadriveimage::checkForSisFile($datadriveobyfile,\@sisfilelist,\$sisfilepresent))
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   594
						{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   595
							my $zDriveImagePresent = 0; # flag to check whether z drive image is Present;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   596
							if(&datadriveimage::checkForZDriveImageKeyword($datadriveobyfile,\@zDriveImageList,\$zDriveImagePresent) )
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   597
							{
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   598
								# find out size of the array
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   599
								my $arraysize = scalar(@zDriveImageList);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   600
								for( my $i=0; $i < $arraysize; $i++ )
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   601
								{
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   602
									$zDriveSisFileLoc =  $ZDirloc."\/".$datadrivename;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   603
									&datadriveimage::invokeReadImage(pop(@zDriveImageList),$zDriveSisFileLoc,$opt_v,$imageEntryLogFile,$opt_k);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   604
								}
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   605
							}
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   606
							else
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   607
							{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   608
								$zDriveSisFileLoc = $ZDirloc;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   609
								# locate and copy stub-sis file(s),for the first time.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   610
								if( !$zDrivePresent )
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   611
								{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   612
									# check for image file.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   613
									if( $opt_zimage )
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   614
									{
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   615
										# image(s)supplied to BUILDROM(like rom,rofs,extrofs or core) using "-zdriveimage" option, 
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   616
										# are maintained in a seperate array and the element from the array is fetched one by one and is 
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   617
										# fed to READIMAGE as an input.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   618
										foreach my $element (@zdriveImageName)
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   619
										{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   620
											# invoke READIMAGE to extract all /swi stub sis file(s) from the given image.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   621
											$zDrivePresent = &datadriveimage::invokeReadImage($element,$zDriveSisFileLoc,$opt_v,$imageEntryLogFile,$opt_k);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   622
										}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   623
									}
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   624
									else
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   625
									{
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   626
										# if zdrive image(s) such as (rom,core,rofs or extrofs) are generated ealier to the data drive image processing
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   627
										# then these images are maintained in an array and the element from the array is fetched one by one and is 
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   628
										# fed to READIMAGE as an input.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   629
										foreach my $element (@romImages)
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   630
										{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   631
											# invoke READIMAGE to extract all /swi stub sis file(s) from the given image.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   632
											$zDrivePresent = &datadriveimage::invokeReadImage($element,$zDriveSisFileLoc,$opt_v,$imageEntryLogFile,$opt_k);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   633
										}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   634
									}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   635
								}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   636
							}
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   637
							# invoke INTERPRETSIS tool with z drive folder location.
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   638
							if ($useinterpretsis)
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   639
							{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   640
								&datadriveimage::invokeInterpretsis( \@sisfilelist,$proDataDriveDirloc,$opt_v,$zDriveSisFileLoc,$paraFile,$opt_k,\@interpretsisOptList,$thisdir)if($sisfilepresent);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   641
							}else
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   642
							{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   643
								print "Warning: interpretsis is not ready on linux.\n";
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   644
							}	
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   645
						}
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   646
	
712
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
   647
						# create an oby file by traversing through upated prototype data drive directory. 
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   648
						&datadriveimage::dumpDatadriveObydata( $proDataDriveDirloc,$datadriveobyfile,$size,\@nonsisFilelist,
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   649
											\@renameList,\@aliaslist,\@hideList,\@sisobydata,\@datadrivedata,$opt_k,$opt_v );
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   650
						#reset sisfilepresent flag to zero;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   651
						$sisfilepresent =0;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   652
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   653
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   654
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   655
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   656
		create_datadriveImage();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   657
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   658
	tidy_exit;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   659
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   660
#Parse and process image content xml file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   661
#Gets the oby files listed in the xml file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   662
# Pushes all the oby files found to an array
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   663
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   664
sub image_content_processing_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   665
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   666
	if(!defined ($image_content))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   667
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   668
		return;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   669
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   670
	&ImageContentHandler::ParseImageContentXML($image_content);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   671
	&ImageContentHandler::ProcessImageContent;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   672
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   673
	if(defined ($image_content) )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   674
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   675
#		Collect the oby files if any in the Image content file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   676
		my $files = &ImageContentHandler::GetObyFiles;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   677
		foreach my $obeyfile (@$files)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   678
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   679
			next if match_obyfile($obeyfile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   680
			next if (match_obyfile("$obeyfile.oby"));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   681
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   682
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   683
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   684
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   685
# Subroutine to process parameter-file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   686
sub parameterFileProcessor
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   687
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   688
	my $paramFile = shift(@_);	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   689
	my @paramFileParamaters = ();	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   690
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   691
	my $fileOpenFlag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   692
	open FILE,"<", $paramFile or $fileOpenFlag = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   693
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   694
	if(!$fileOpenFlag)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   695
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   696
		print "Error: Could not open parameter-file \"$paramFile\" for reading.\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   697
		return;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   698
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   699
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   700
	# Parse parameter-file and collect all the parameters in an array
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   701
	while(my $line = <FILE>)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   702
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   703
		# Read the line till character ';'(used for providing comments in the file) or EOL
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   704
		$line = $1 if ($line =~ /(.*);/); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   705
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   706
		# Split the parameters specified in a line based on white-spaces		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   707
		my @paramaters = split(/(\s)/,$line);	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   708
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   709
		my $flag = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   710
		my $argWithQuotes='';
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   711
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   712
		foreach my $value (@paramaters) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   713
		{	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   714
			# If the parameter doesn't conatian double quotes then push it 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   715
			# to the list of parameters.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   716
			if(($value !~ /\"/) && (!$argWithQuotes)) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   717
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   718
				if ($value !~ /^\s*$/) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   719
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   720
					push @paramFileParamaters,$value;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   721
				}		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   722
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   723
			# If the parameter is in the form  -fm="faturedb.xml" then remove
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   724
			# double quotes and push it to the list of parameters.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   725
			elsif(($value =~ /\".*\"/))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   726
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   727
				$value =~ s/\"//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   728
				push @paramFileParamaters,$value;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   729
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   730
			# If the parameter is in the form  -fm="fature  db.xml" then read
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   731
			# the parameter starting from opening quote till the closing quote.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   732
			elsif( ($value =~ /\"/) && $argWithQuotes) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   733
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   734
				$argWithQuotes .= $value;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   735
				$argWithQuotes =~ s/\"//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   736
				push @paramFileParamaters,$argWithQuotes;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   737
				$argWithQuotes='';		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   738
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   739
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   740
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   741
				$argWithQuotes .= $value;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   742
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   743
		}		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   744
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   745
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   746
	close FILE;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   747
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   748
	if (!@paramFileParamaters)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   749
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   750
		print "Warning: No parameters specified in paramer-file \"$paramFile\".\n";		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   751
		return;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   752
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   753
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   754
	my $paramFileFlag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   755
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   756
	# Invoke subroutine "process_cmdline_arguments" to process the parameters read from
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   757
	# the parameter file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   758
	&process_cmdline_arguments($paramFileFlag, @paramFileParamaters);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   759
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   760
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   761
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   762
# Processes the command line arguments passed to buildrom tool
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   763
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   764
sub process_cmdline_arguments
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   765
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   766
   	my %tmpBldRomOpts;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   767
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   768
	my ($paramFileFlag, @argList); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   769
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   770
	if (defined @_ && scalar(@_) > 0) {
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   771
		($paramFileFlag, @argList) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   772
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   773
	else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   774
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   775
		@argList = @ARGV;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   776
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   777
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   778
	if (!defined $paramFileFlag) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   779
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   780
		# Enforce Feature Manager if macro SYMBIAN_FEATURE_MANAGER is defined in the HRH file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   781
		my @hrhMacros = &get_variantmacrolist;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   782
		if (grep /^SYMBIAN_FEATURE_MANAGER\s*$/, @hrhMacros)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   783
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   784
			$enforceFeatureManager = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   785
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   786
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   787
		# Process the parameters of parameter-file if passed.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   788
		foreach my $arg (@argList)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   789
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   790
			if ($arg =~ /^-argfile=(.*)/) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   791
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   792
				&parameterFileProcessor($1);				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   793
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   794
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   795
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   796
	# first searching argList for keepgoing option
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   797
	my @newArgList = ();
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   798
	foreach my $arg (@argList) {
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   799
		if ( $arg =~ /^-k$/i || $arg =~ /^-keepgoing$/i ) {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   800
			$opt_k = 1;	 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   801
		}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   802
		elsif($arg =~ /^-nopreprocess$/i ) {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   803
			$nopreprocess = 1 ; 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   804
		}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   805
		elsif ($arg =~ /^-workdir=(.*)/)
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   806
		{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   807
			my $workdir = $1;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   808
			if (!-d $workdir)
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   809
			{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   810
				die "directory $workdir does not exist\n";
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   811
			}
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   812
			my $currentdir = cwd;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   813
			chdir "$workdir" or die "cannot change to directory $workdir\n";
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   814
			$thisdir=cwd;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   815
			$thisdir=~s-\\-\/-go;		    # separator from Perl 5.005_02+ is forward slash
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   816
			$thisdir.= "\/" unless $thisdir =~ /\/$/;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   817
			if(&is_windows)
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   818
			{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   819
				$thisdir =~ s-\/-\\-g;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   820
			}
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   821
			$opt_workdir = 1;
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   822
			chdir "$currentdir"; 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   823
		}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   824
		else {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   825
			push @newArgList, $arg ;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   826
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   827
	}
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   828
	foreach my $arg (@newArgList)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   829
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   830
	    if ($arg =~ /^-argfile=(.*)/) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   831
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   832
			&parameterFileProcessor($1) if (defined $paramFileFlag);						
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   833
			next;			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   834
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   835
		if ($arg =~ /^-[DI]/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   836
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   837
		$cppargs .= " $arg";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   838
		#Set 'udeb' for debug option 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   839
		if($arg =~ /^-D_FULL_DEBUG/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   840
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   841
		    $tmpBldRomOpts{"BUILD_DIR"} = "udeb";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   842
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   843
		#Set specific platform supplied from the command option 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   844
		elsif($arg =~ /^-D_PLAT=(.*)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   845
		{
712
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
   846
		    $tmpBldRomOpts{"ABI_DIR"} = $1; 
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
   847
			
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   848
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   849
		# Check for a Feature Variant
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   850
		elsif ($arg =~ /^-DFEATUREVARIANT=(.*)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   851
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   852
			my $varname = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   853
			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   854
			if ($varname =~ /^\.(.*)$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   855
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   856
				# for testing, locate the VAR file in the current directory
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   857
				%featureVariant = get_variant($1, ".");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   858
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   859
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   860
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   861
				%featureVariant = get_variant($varname);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   862
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   863
			if (!$featureVariant{'VALID'})
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   864
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   865
			    print "FEATUREVARIANT $varname is not VALID\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   866
				$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   867
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   868
			if ($featureVariant{'VIRTUAL'})
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   869
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   870
			    print "FEATUREVARIANT $varname is VIRTUAL\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   871
				$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   872
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   873
			addDrivesToFeatureVariantPaths();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   874
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   875
		next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   876
	    }
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   877
	    if ($arg =~/^-oby-charset=(.*)$/i)
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   878
	    {
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   879
		$obycharset = $1;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   880
		next;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   881
	    }
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   882
	    if (($arg =~ /^-o(.*)/i) && ($arg !~ /^-oby-charset/i))
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   883
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   884
		$opt_o = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   885
		next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   886
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   887
	    if ($arg =~ /^-j(\d+)$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   888
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   889
		    $opt_jobs = "-j".$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   890
		    next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   891
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   892
	    if ($arg =~ /^-v$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   893
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   894
		$opt_v =1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   895
		next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   896
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   897
	    if ($arg =~ /^-s$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   898
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   899
		$strict = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   900
		next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   901
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   902
	    if ($arg =~ /^-w$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   903
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   904
		$warnSelection = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   905
		next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   906
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   907
	    if ($arg =~ /^-p$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   908
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   909
		$preserve = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   910
		next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   911
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   912
	    if ($arg =~ /^-nospi$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   913
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   914
		$createspi=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   915
		$spiset=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   916
		next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   917
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   918
	    if ($arg =~ /^-spi$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   919
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   920
		$createspi=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   921
		$spiset=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   922
		next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   923
	    }	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   924
	    #Process External Tool
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   925
	    if ($arg =~/^-e(.*)/)#Match to get the tool perl module files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   926
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   927
		&externaltools::loadTools($1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   928
		next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   929
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   930
   		#Process imagecontent file 
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
   931
	    if( $arg =~ /^-i(.*)/ && $arg !~ /^-input(.*)/)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   932
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   933
# Disabling -i option
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   934
		print "Warning: Ignoring invalid Option $arg \n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   935
		next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   936
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   937
		#Process feature manager database xml file 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   938
	    if($arg =~ /^-fm=(.*)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   939
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   940
			if (!$enforceFeatureManager) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   941
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   942
				print "Unknown arg: $arg\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   943
				$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   944
				next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   945
			}
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   946
			$noFeatureConf = 0;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   947
			$featureXml = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   948
			$xmlrequired = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   949
			$featuremanager = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   950
			if ($featureXml =~ /^$/) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   951
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   952
				print "Error: No filename specified with \"-fm=\" option.\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   953
			}			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   954
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   955
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   956
		#Process Cache command line options.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   957
		if($arg =~ /^-cache/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   958
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   959
			$opt_cache = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   960
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   961
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   962
		if($arg =~ /^-nocache/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   963
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   964
			$opt_nocache = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   965
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   966
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   967
		if($arg =~ /^-cleancache/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   968
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   969
			$opt_cleancache = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   970
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   971
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   972
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   973
	    #Process ROM image compression type if it's specified through command line option.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   974
	    if($arg =~ /^-compress(.*)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   975
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   976
	    	if($1 eq '')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   977
	    	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   978
	    		$opt_compression_type = ALLSECTIONS;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   979
	    		print "Whole ROM image will be compressed.\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   980
	    	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   981
	    	elsif($1 eq '=paged')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   982
	    	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   983
	    		$opt_compression_type = PAGEDSECTION;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   984
	    		print "Paged section of the ROM image will be compressed.\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   985
	    	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   986
	    	elsif($1 eq '=unpaged')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   987
	    	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   988
	    		$opt_compression_type = UNPAGEDSECTION;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   989
	    		print "Unpaged section of the ROM image will be compressed.\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   990
	    	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   991
	    	else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   992
	    	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   993
	    		print "Unknown compression type: $1\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   994
	    		$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   995
	    	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   996
	    	next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   997
	    }
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   998
		if ($arg =~ /^-nofm(=(.*))?$/) {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
   999
			if(!$1) {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1000
                $noFeatureConf = 1 ;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1001
				next ;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1002
            }
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1003
			 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1004
			if (!$enforceFeatureManager)  {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1005
				print "Unsupported option: $arg\n";
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1006
				$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1007
				next;
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1008
			} 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1009
			$noFeatureConf = 0;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1010
   			$noFeatureManager = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1011
            #DEF125375 If caller is simply giving -nofm without any parameter, a warning message will be given.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1012
            if(!$2)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1013
            {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1014
                print "Warning: No filename specified with \"-nofm=\" option, feature data file might not be included.\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1015
            }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1016
            else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1017
            {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1018
                $preBuiltFeaturesDataFile = $2;						
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1019
            }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1020
			next;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1021
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1022
		#Process feature registry database xml file 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1023
	    if($arg =~ /^-fr=(.*)/ || $arg =~ /^-f(.*)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1024
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1025
			if ($enforceFeatureManager)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1026
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1027
				print "Error: Option \"-f|-fr\" is no longer supported.\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1028
				$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1029
				next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1030
			}			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1031
			$featureXml = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1032
			$xmlrequired = 1;			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1033
			if ($featureXml =~ /^$/) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1034
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1035
				print "Error: No filename specified with \"-f|-fr\" option.\n";				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1036
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1037
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1038
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1039
	    if ($arg =~ /^-spiplacement$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1040
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1041
			$spiplacement = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1042
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1043
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1044
		if ($arg =~ /^-noimage$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1045
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1046
			$noimage=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1047
			next;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1048
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1049
		if ($arg =~ /^-nosymbols$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1050
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1051
			$nosymbols=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1052
			next;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1053
		}
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  1054
		if ($arg =~ /^-bsymbols$/)
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  1055
		{
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  1056
			$bsymbols=1;
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  1057
			next;	
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  1058
		}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1059
		if ($arg =~ /^-geninc$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1060
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1061
			$geninc=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1062
			next;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1063
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1064
		if($arg =~ /^-gendep$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1065
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1066
			$gendep=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1067
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1068
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1069
		if ($arg =~ /^-checkcase$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1070
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1071
			$checkcase=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1072
			next;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1073
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1074
		if ($arg =~ /^-checkcase_test$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1075
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1076
			$checkcase_test=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1077
			next;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1078
		}
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1079
		 
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1080
		if ($arg =~ /^-stdcpp$/)
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1081
		{	
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1082
			if($nopreprocess) {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1083
				print STDERR "Warning: -stdcpp option is invalid because the -nopreprocess option set.\n";
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1084
			}
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1085
			else {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1086
				if (&is_linux)
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1087
				{
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1088
					print "Warning: option -stdcpp only apply for Windows\n";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1089
					next;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1090
				}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1091
				if ($cppoption)
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1092
				{
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1093
					die "Error: -stdcpp option and -cpp=xxx option cannot be used at the same time.\n";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1094
				}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1095
				$stdcpp = 1;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1096
			}
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1097
			next;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1098
		}
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1099
		if ($arg =~ /^-cpp=(.*)/)
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1100
		{
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1101
			if($nopreprocess) {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1102
				print STDERR "Warning: -cpp option is invalid because the -nopreprocess option set.\n";
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1103
			}
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1104
			else {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1105
				if ($stdcpp)
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1106
				{
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1107
					die "Error: -stdcpp option and -cpp=xxx option cannot be used at the same time.\n";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1108
				}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1109
				if ($cppoption)
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1110
				{
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1111
					print "Warning: -cpp option has been set before. The previous configuration will be overwritten!\n";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1112
				}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1113
				$cppoption = 1;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1114
				$preprocessor = $1;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1115
				$preprocessor =~ s-\\-\/-g;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1116
				$preprocessor =~ s-EPOCROOT##\/?-$epocroot-g;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1117
				if (-d $preprocessor)
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1118
				{
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1119
					$preprocessor .= "\/" unless $preprocessor =~ /\/$/;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1120
					$preprocessor .= "cpp";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1121
				}
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1122
			}
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1123
			next;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1124
		}
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1125
609
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
  1126
		if ($arg =~ /^-prependepocroot$/)
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
  1127
		{
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
  1128
			$prependepocroot = 1;
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
  1129
			next;
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
  1130
		}
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
  1131
		    if($arg =~/^-c(.*)/)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1132
        {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1133
          if($1 eq 'none' )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1134
          {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1135
              $opt_compression = " -compressionmethod none";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1136
          }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1137
          elsif($1 eq 'inflate' )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1138
          {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1139
              $opt_compression = " -compressionmethod inflate";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1140
          }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1141
          elsif($1 eq 'bytepair' )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1142
          {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1143
              $opt_compression = " -compressionmethod bytepair";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1144
          }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1145
          else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1146
          {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1147
              print "Unknown compression method: $1\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1148
              $errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1149
          }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1150
          next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1151
        }
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1152
		if ($arg =~ /^-inputoby=(.*)/)
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1153
		{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1154
			$ignoreconfig =1;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1155
			my $ignoreoby = $1;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1156
			$ignoreoby .= ".oby" unless $ignoreoby =~ /\.oby$/i;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1157
			die "$ignoreoby file does not exist!!\n" if (!-e $ignoreoby);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1158
			open IGNORE, "$ignoreoby" or die("* Can't open $ignoreoby\n");
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1159
			my @lines = <IGNORE>;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1160
			close IGNORE;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1161
			my $keywordcount = 0;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1162
			my $romimgcount = 0;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1163
			my $rofsimgcount = 0;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1164
			my $fatcount = 0;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1165
			my $smrcount = 0;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1166
			foreach my $line (@lines)
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1167
			{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1168
				if ($line =~ /^\s*romsize\s*=/)
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1169
				{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1170
					next if ($romimgcount);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1171
					$romimgcount = 1;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1172
					$keywordcount ++;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1173
					$ignoreoby =~ s/\.oby$//i;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1174
					$romimage[$romcount] = {xip=>1, obeyfile=>$ignoreoby, compress=>0, extension=>0, composite=>"none",uncompress=>0 };
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1175
					$romcount ++;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1176
				}elsif ($line =~ /^\s*rofssize\s*=/)
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1177
				{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1178
					next if ($rofsimgcount);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1179
					$rofsimgcount = 1;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1180
					$keywordcount ++;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1181
					$ignoreoby =~ s/\.oby$//i;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1182
					$romimage[$romcount] = {xip=>0, obeyfile=>$ignoreoby, compress=>0, extension=>0, composite=>"none",uncompress=>0 };
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1183
					$romcount ++;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1184
				}elsif ($line =~ /^\s*dataimagename\s*=/)
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1185
				{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1186
					next if ($fatcount);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1187
					$fatcount = 1;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1188
					$keywordcount ++;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1189
					$ignoreoby =~ s/\.oby$//i;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1190
					$datadriveimage[$dataImageCount] = {obeyfile=>$ignoreoby, compress=>0, uncompress=>0};
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1191
					$dataImageCount ++;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1192
					$dataIndexHash{0} = 0;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1193
				}elsif ($line =~ /^\s*imagename\s*=/)
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1194
				{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1195
					next if ($smrcount);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1196
					$smrcount = 1;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1197
					$keywordcount ++;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1198
					$ignoreoby =~ s/\.oby$//i;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1199
					$needSmrImage = 1;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1200
					push @obeyFileList, $ignoreoby;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1201
				}
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1202
			}
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1203
			die "$ignoreoby file does not contain keywords romsize/rofssize/dataimagename/imagename, cannot identify the oby type!\n" if ($keywordcount == 0);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1204
			die "$ignoreoby file contains $keywordcount keywords of romsize/rofssize/dataimagename/imagename, cannot identify the oby type! Maybe $ignoreoby is not a final oby file.\n" if ($keywordcount > 1);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1205
			next;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1206
		}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1207
		if( $arg =~ /^-loglevel\d+$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1208
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1209
			$logLevel= $arg;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1210
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1211
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1212
		# get Z directory location if specified by the user.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1213
		# if yes, then extract directory location from the given array element. 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1214
		if( $arg =~ /^-z=(.*)/  || $arg =~ /^-zdrivepath=(.*)/i )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1215
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1216
			# check for white space in the specified folder path
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1217
			# if "yes" then warn the user saying folder will be created under default location.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1218
			# else set the path specified by the user.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1219
			if(&datadriveimage::checkForWhiteSpace($1,"zdrive"))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1220
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1221
				next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1222
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1223
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1224
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1225
				$ZDirloc  = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1226
				$ZDirloc =~ s-\\-\/-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1227
				if( $ZDirloc !~ m/\/(\Z)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1228
				{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1229
					$ZDirloc .= "\/"; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1230
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1231
				if( $ZDirloc !~ m/:/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1232
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1233
					print "drive letter not specified\n";
712
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  1234
					my $dir = $thisdir ;
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  1235
					my $file = $ZDirloc ;
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  1236
					while( $file =~ /^(\.+\/)(.+)/) {
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  1237
						$file = $2 ; 
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  1238
						if( $1 eq "../" ) {
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  1239
							if($dir =~ /(.*[\\\/])([^\\\/]+[\\\/]$)/) {
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  1240
								$dir = $1 ; 
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  1241
							} 
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  1242
						}
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  1243
					}
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  1244
					$ZDirloc = $dir.$file;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1245
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1246
				print "Z Drive directory location = $ZDirloc\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1247
				#set the location of Z Drive directory.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1248
				$ZDirloc .= "zdrive";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1249
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1250
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1251
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1252
		# get data directory location if specified by the user.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1253
		# if yes, then extract directory location from the given array element. 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1254
		if( $arg =~ /^-d=(.*)/ || $arg =~ /^-datadrivepath=(.*)/i )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1255
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1256
			# check for white space in the specified folder path
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1257
			# if "yes" then warn the user saying folder will be created under default location.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1258
			# else set the path specified by the user.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1259
			if(&datadriveimage::checkForWhiteSpace($1,"datadrive"))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1260
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1261
				next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1262
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1263
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1264
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1265
				$DataDriveDirloc = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1266
				$DataDriveDirloc =~ s-\\-\/-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1267
				if( $DataDriveDirloc !~ m/\/(\Z)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1268
				{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1269
					$DataDriveDirloc .= "\/"; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1270
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1271
				if( $DataDriveDirloc !~ m/:/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1272
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1273
					print "drive not specified\n";
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1274
					$DataDriveDirloc = $thisdir.$DataDriveDirloc;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1275
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1276
				print "Data Drive directory location = $DataDriveDirloc\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1277
				#set the location of Data Drive directory.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1278
				$DataDriveDirloc .= "datadrive";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1279
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1280
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1281
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1282
		# get Z dive image if specified by the user.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1283
		if( $arg =~ /^-zdriveimage=(.*)/i )	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1284
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1285
			my $imageName = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1286
			if( $imageName =~ m/\,/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1287
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1288
				@zdriveImageName = split(/\,/,$imageName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1289
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1290
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1291
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1292
				push(@zdriveImageName,$imageName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1293
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1294
			$opt_zimage = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1295
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1296
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1297
		# get command line arguments which needs to be passed to INTERPRETSIS, if specified by the user.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1298
		if( $arg =~ /^-argforinterpretsis=(.*)/i )	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1299
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1300
			my $interpretsisOpt = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1301
			if( $interpretsisOpt =~ m/\,/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1302
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1303
				@interpretsisOptList = split(/\,/,$interpretsisOpt);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1304
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1305
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1306
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1307
				push(@interpretsisOptList,$interpretsisOpt);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1308
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1309
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1310
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1311
		if ( $arg =~ /^-r$/i || $arg =~ /^-retainfolder$/i )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1312
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1313
			$opt_r = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1314
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1315
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1316
		if ( $arg =~ /^-pfile=(.*)/i )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1317
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1318
			$paraFile = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1319
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1320
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1321
		if ( $arg =~ /^-l=(.*)/i || $arg =~ /^-logimageentry=(.*)/i )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1322
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1323
			if( $1 =~/[\/\\]/ || $1 =~ m/:/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1324
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1325
				print "* Warning: Invalid log file extension try filename.txt\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1326
				next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1327
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1328
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1329
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1330
				$opt_logFile = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1331
				$imageEntryLogFile = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1332
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1333
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1334
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1335
		if ( $arg =~ /^-lowmem/i )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1336
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1337
			$lowMem = $arg;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1338
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1339
		}
633
a4eca1f021ac ROMTools-13.1.0.2
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
  1340
		if( $arg =~ /^-xiponly$/i)
a4eca1f021ac ROMTools-13.1.0.2
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
  1341
		{
a4eca1f021ac ROMTools-13.1.0.2
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
  1342
			$opt_xiponly = 1;
a4eca1f021ac ROMTools-13.1.0.2
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
  1343
			next;
a4eca1f021ac ROMTools-13.1.0.2
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
  1344
		}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1345
	    if ($arg =~ /^-/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1346
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1347
		print "Unknown arg: $arg\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1348
		$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1349
		next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1350
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1351
	    # It's an OBY file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1352
	    next if (match_obyfile($arg));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1353
	    next if (match_obyfile("$arg.oby"));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1354
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1355
	    print "Cannot find oby file: $arg\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1356
	    $errors++ if(!$opt_k);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1357
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1358
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1359
	if (defined $paramFileFlag) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1360
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1361
		return;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1362
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1363
	
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1364
	$preserve = 1 if ($ignoreconfig);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  1365
	if (@obyfiles<1 && !$ignoreconfig)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1366
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1367
	    print "Missing obyfile argument\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1368
	    $errors++ if(!$opt_k);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1369
	}
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1370
	if(defined($obycharset))
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1371
	{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1372
		unless($obycharset =~ /utf-?8/i)
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1373
		{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1374
			print "Warning: Ignoring not supportted charset $obycharset, local charset will be used as default!\n";
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1375
		}
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1376
	}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1377
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1378
	if ($errors)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1379
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1380
	    print_usage();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1381
	    exit 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1382
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1383
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1384
	if ($noFeatureManager && $featuremanager) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1385
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1386
		print "Warning: Ignoring \"-nofm\" option, as both \"-nofm\" and \"-fm\" options are provided.\n";			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1387
		$noFeatureManager = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1388
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1389
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1390
	# Adding variant specific macros by including a HRH file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1391
	# (only required if no Feature Variant is used)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1392
	if (!$featureVariant{'VALID'})
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1393
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1394
	    my $variantMacroHRHFile = get_variantmacroHRHfile();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1395
	    if($variantMacroHRHFile){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1396
	        my $variantFilePath = split_path('Path',$variantMacroHRHFile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1397
	        $cppargs .= " -I " . &append_driveandquote($variantFilePath) . " -include " . &append_driveandquote($variantMacroHRHFile); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1398
	        print "in cmd process $cppargs\n" if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1399
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1400
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1401
	# load the required modules if xml is required
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1402
	if ($xmlrequired == 1)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1403
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1404
	    if (defined ($featureXml))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1405
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1406
			load_featuresutil();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1407
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1408
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1409
	    if ($image_content)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1410
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1411
	    	&FlexLoad_ModuleL("ImageContentHandler");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1412
	    	# some variables for ImageContentHandler may have been setup
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1413
	    	my ($key, $value);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1414
	    	&ImageContentHandler::SetBldRomOpts; # Defaults to armv5 platform
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1415
	    	while (($key,$value) = each %tmpBldRomOpts)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1416
	    	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1417
			&ImageContentHandler::SetBldRomOpts($key, $value);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1418
	    	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1419
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1420
	    
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1421
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1422
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1423
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1424
#----------------------------------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1425
# Preprocessing phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1426
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1427
# Concatentate the specified .oby files and pass them through cpp
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1428
# to get the raw ROM specification in tmp1.oby
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1429
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1430
sub preprocessing_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1431
{
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1432
	if($nopreprocess == 0) {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1433
		my $temp1OBYFile = $thisdir."tmp1.oby";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1434
		unlink "$temp1OBYFile";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1435
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1436
	#	Macro "ROM_FEATURE_MANAGEMENT" is defined when "-f|fr" or "-fm" is used
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1437
		if (defined ($featureXml))
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1438
		{
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1439
			$cppargs .= " -DROM_FEATURE_MANAGEMENT ";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1440
		}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1441
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1442
		# add pre-include file and include directories for feature variants
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1443
		if ($featureVariant{'VALID'})
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1444
		{
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1445
			$cppargs .= " -I.";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1446
			my $incRef = $featureVariant{'ROM_INCLUDES'};
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1447
			if ($incRef)
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1448
			{
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1449
				foreach (@$incRef)
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1450
				{
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1451
					$cppargs .= " -I \"$_\"";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1452
				}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1453
			}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1454
			my $HRH = $featureVariant{'VARIANT_HRH'};
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1455
			if ($HRH)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1456
			{
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1457
				$cppargs .= " -include \"$HRH\"";
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1458
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1459
		}
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1460
		else
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1461
		{
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1462
			# no feature variant so use the standard includes
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1463
			$cppargs .= " -I. -I \"$rominclude\"";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1464
		}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1465
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1466
		if ($stdcpp)
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1467
		{
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1468
			$preprocessor = find_stdcpp();
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1469
		}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1470
		print "* $preprocessor -Wno-endif-labels -o $temp1OBYFile $cppargs\n" if ($opt_v);
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1471
		
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1472
		is_existinpath("$preprocessor", romutl::DIE_NOT_FOUND);
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1473
		$errors = 0;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1474
		open CPP, "| $preprocessor -Wno-endif-labels -o $temp1OBYFile $cppargs" or die "* Can't execute cpp";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1475
		foreach my $arg (@obyfiles)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1476
		{
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1477
			print CPP "\n#line 1 \"$arg\"\n";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1478
		
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1479
			if(open(OBY, $arg)) {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1480
				print "* reading $arg\n" if ($opt_v);
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1481
				while ($line=<OBY>) {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1482
					print CPP $line;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1483
				}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1484
				close OBY;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1485
			}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1486
			else {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1487
				print STDERR "* Can't open $arg\n";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1488
				if(!$opt_k){			
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1489
					close CPP;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1490
					exit(1);
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1491
				}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1492
			}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1493
		}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1494
		close CPP;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1495
		my $cpp_status = $?;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1496
		die "* cpp failed\n" if ($cpp_status != 0 || !-f "$temp1OBYFile");
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1497
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1498
		if( defined ($image_content))
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1499
		{
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1500
			#Read the OBY file that was generated by the pre-processor
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1501
			&ReadPreprocessedFile($temp1OBYFile);
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1502
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1503
	#		Check if the static dependencies of the OBY binaries are resolved.
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1504
			&ImageContentHandler::UpdateObyBinaryStaticDep();
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1505
			
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1506
			#Now append the files collected from cdfs.
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1507
			&ImageContentHandler::GenObyFile($temp1OBYFile);
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1508
		}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1509
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1510
		if($obycharset =~ /utf-?8/i)
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1511
		{
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1512
			my $utf8file = $thisdir."tmp1utf8.oby";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1513
			open INFILE, "<$temp1OBYFile" or die "* Can't open file $temp1OBYFile";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1514
			open CHARSETTRAN, "| charsettran -to=hostcharset > $utf8file" or die "* Can't execute charsetran";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1515
			while(<INFILE>)
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1516
			{
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1517
				print CHARSETTRAN $_;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1518
			}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1519
			close CHARSETTRAN;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1520
			close INFILE;	
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1521
			unlink $temp1OBYFile  or die "* Can't remove file $temp1OBYFile";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1522
			rename 	$utf8file, $temp1OBYFile or die "* Can't rename file $utf8file to file $temp1OBYFile";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1523
		}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1524
		@obydata = ();
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1525
		# load tmp1.oby here
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1526
		open TMP1, "$temp1OBYFile" or die("* Can't open $temp1OBYFile\n");
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1527
		while(<TMP1>) { 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1528
			push @obydata,$_;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1529
		}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1530
		close TMP1 ;
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1531
	}
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1532
	else {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1533
		foreach my $arg (@obyfiles) {		
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1534
			if(open(OBY, $arg)) {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1535
				print "* reading $arg\n" if ($opt_v);
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1536
				while (<OBY>) {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1537
					push @obydata,$_;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1538
				}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1539
				close OBY;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1540
			}
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1541
			else {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1542
				print STDERR "* Can't open $arg\n";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1543
				if(!$opt_k){	 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1544
					exit(1);
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1545
				}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1546
			}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1547
		}
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  1548
	}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1549
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1550
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1551
sub ReadPreprocessedFile
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1552
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1553
#	Read the OBY file that was generated by the pre-processor. This OBY is a conglomeration of all the OBYs
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1554
#	passed directly to buildrom and/or the ones passed through Image Content XML.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1555
#	It marks the binaries coming from OBY. This is required to be able to point out the binaries that are 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1556
#	mentioned neither in the OBY nor in the CDF. Such binaries are arrived at through static dependencies
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1557
#	and need to be included in ROM.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1558
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1559
	my $temp1OBYFile = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1560
	my $tmpline;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1561
	my $srcFileName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1562
	my $srcFilePath;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1563
	my $dstFileName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1564
	my $dstFilePath;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1565
	open (OBYFH, "$temp1OBYFile") or die("* Can't open $temp1OBYFile\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1566
	while($tmpline =<OBYFH>) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1567
		if ($tmpline=~/(\S+)\s*=\s*(\S+)\s+(\S+)/) {#Get the first parameter (source File path) from oby line
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1568
			$srcFilePath = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1569
			$dstFilePath = $3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1570
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1571
			if ($srcFilePath=~/.*[\/\\](\S+)/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1572
				$srcFileName = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1573
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1574
			if ($dstFilePath=~/.*[\/\\](\S+)/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1575
				$dstFileName = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1576
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1577
			my $binaryInfoRef = &cdfparser::GetBinaryInfo($dstFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1578
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1579
			if(defined($binaryInfoRef)) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1580
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1581
				#Found in CDF file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1582
				if($binaryInfoRef->{IsFoundInCDF})
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1583
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1584
					print "Warning: File $srcFileName mentioned in OBY as well as CDF file\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1585
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1586
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1587
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1588
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1589
				#Found in OBY file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1590
				&ImageContentHandler::AddBinaryFromOby($dstFileName, $srcFilePath);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1591
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1592
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1593
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1594
	close OBYFH;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1595
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1596
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1597
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1598
#----------------------------------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1599
# Substitution phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1600
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1601
# Handle the "define XXX YYY" lines, perform the substitutions.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1602
# Print out any ECHO lines or ERROR lines. 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1603
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1604
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1605
# Predefined substitutions: 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1606
#   TODAY means todays' date
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1607
#   RIGHT_NOW means the exact time
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1608
#   EPOCROOT taken from the environment
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1609
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1610
sub substitution_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1611
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1612
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1613
		my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1614
		$substitutionData{"TODAY"} = sprintf("%02d/%02d/%04d", $mday, $mon+1, $year+1900);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1615
		$substitutionData{"RIGHT_NOW"} = sprintf("%02d/%02d/%04d %02d:%02d:%02d", $mday, $mon+1, $year+1900, $hour, $min, $sec);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1616
		$substitutionData{"EPOCROOT"} = $epocroot;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1617
		@substitutionOrder = ("TODAY", "RIGHT_NOW", "EPOCROOT");
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1618
	}	 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1619
	 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1620
	foreach $line(@obydata) {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1621
		if(($line =~ /^\s*romsize\s*=/i) || ( $line=~ /^\s*rom_image/i) || ($line =~ /^\s*data_image/i)) {
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1622
			$onlysmrimage = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1623
			last;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1624
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1625
	}
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1626
	if($noFeatureConf == 0) { 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1627
		if ($enforceFeatureManager && (!$featuremanager) && (!$noFeatureManager) ) {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1628
			my $defaultFeatureDbFlag = 0;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1629
			foreach $line(@obydata) { 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1630
				if ($line=~/^\s*defaultfeaturedb\s*=?\s*(\S+)/i)
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1631
				{	
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1632
					# Get the default value for featuredatabasefile
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1633
					
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1634
					$featureXml = "$epocroot$1";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1635
					$featureXml =~ s-\\-\/-g;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1636
					$featuremanager = 1;				
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1637
					$defaultFeatureDbFlag = 1;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1638
					load_featuresutil();				
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1639
					last;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1640
				}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1641
			}
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1642
		 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1643
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1644
			if(!$defaultFeatureDbFlag && !$onlysmrimage)
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1645
			{
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1646
				print "Error: Neither option \"-fm|-nofm\" nor default value for featuredatabase file is provided.\n";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1647
				exit(1);			
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1648
			}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1649
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1650
	}
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1651
	
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1652
	# Setup default rom configuration
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1653
	$romimage[0] = {xip=>1, compress=>0, extension=>0, composite=>"none",uncompress=>0 }; 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1654
		
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1655
	my @savedObyData = @obydata;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1656
	@obydata = ();
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1657
	foreach  $line(@savedObyData) {
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1658
		track_source($line);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1659
		$line =~ s-\\-\/-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1660
609
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
  1661
		if ($prependepocroot)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1662
		{
609
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
  1663
			my $tempstring = $epocroot."epoc32\/";
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
  1664
			if(($line !~ /^\s*\#/) && ($line =~ /\/epoc32\//i) 
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
  1665
			 && ($line !~ /EPOCROOT##\/?epoc32\//i) && ($line !~ /$tempstring/i))
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
  1666
			{
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
  1667
				print "add EPOCROOT for line: $line\n" if ($opt_v);
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
  1668
		  	$line =~ s-\/epoc32-EPOCROOT##epoc32-ig;
f76e0f94b7ab Minor change: update package_definition.xml
jjkang
parents: 607
diff changeset
  1669
			}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1670
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1671
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1672
		# Recognise keywords in lines that we process before substitution
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1673
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1674
		# # lineno "file" flagno
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1675
		# DEFINE name replacement-with-0-spaces
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1676
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1677
		if($line=~/^\s*$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1678
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1679
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1680
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1681
		if ($line=~/^# (\d+) "(.*)" (\d+)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1682
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1683
			push @obydata, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1684
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1685
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1686
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1687
		if ($line=~/^\s*defaultfeaturedb\s*=?\s*(\S+)/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1688
		{	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1689
			push @obydata, "REM $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1690
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1691
		}		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1692
		#process the External tool invocation using IBY file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1693
		if ($line=~/externaltool=(.*),?/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1694
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1695
			&externaltools::loadTools($1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1696
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1697
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1698
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1699
		#Process the patch statement
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1700
		if($line =~ /^\s*patchdata\s*(.*)/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1701
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1702
			$patchDataStmtFlag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1703
			my $new_line = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1704
 			# syntax "<DLLnamewithpath> addr <variableaddress> <variablesize> <newvalue>"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1705
 			# If the line matches with above syntax, just add the line into oby file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1706
 			if($new_line !~ /^\s*(\S+)\s+addr\s+(\S+)\s+(\S+)\s+(\S+)\s*$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1707
 			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1708
 				if(AddDllDataInfo($new_line))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1709
 				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1710
 					$line = "REM $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1711
 				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1712
 			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1713
		}
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1714
		if($noFeatureConf == 0) { 
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1715
			if($line =~ /^\s*FEATURE\s*(.*)/i || $line =~ /^\s*EXCLUDE_FEATURE\s*(.*)/i) {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1716
				# Process the feature keywords only when "-f|fr" or "-fm" is passed to buildrom
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1717
				if(defined ($featureXml))
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1718
				{
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1719
					push @obydata, "$line";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1720
				}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1721
				else
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1722
				{
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1723
					push @obydata, "REM handled $line";
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1724
				}
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  1725
				next;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1726
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1727
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1728
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1729
		if ($line=~/^\s*DEFINE\s+(\w+)\s+(\S+)/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1730
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1731
			my $key=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1732
			my $value=$2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1733
			foreach my $wordToSubstitute (@substitutionOrder)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1734
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1735
				my $whatToSubstituteItWith=$substitutionData{$wordToSubstitute};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1736
				$value=~s/$wordToSubstitute/$whatToSubstituteItWith/g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1737
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1738
			$value=~s/##//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1739
			if (defined $substitutionData{$key})
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1740
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1741
				# If the key is redefined, apply it at the new position rather
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1742
				# than the old one.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1743
				push @obydata, "REM redefined $key as $value\n";# Leave a record of the definition
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1744
				@substitutionOrder = grep !/^$key$/, @substitutionOrder;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1745
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1746
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1747
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1748
				push @obydata, "REM defined $key as $value\n";	# Leave a record of the definition
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1749
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1750
			$substitutionData{$key}=$value;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1751
			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1752
			foreach my $wordToSubstitute (@substitutionOrder)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1753
		    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1754
	   	        if ($key =~ /$wordToSubstitute/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1755
	   	        {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1756
				   print_source_error("Warning: $key is masked by earlier definition of $wordToSubstitute");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1757
			 	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1758
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1759
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1760
			push @substitutionOrder, $key;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1761
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1762
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1763
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1764
		# Do the substitutions in strict order of definition, 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1765
		# then eliminate any old-fashioned ## things which may be left
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1766
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1767
		foreach my $wordToSubstitute (@substitutionOrder)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1768
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1769
			my $whatToSubstituteItWith=$substitutionData{$wordToSubstitute};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1770
			$line=~s/$wordToSubstitute/$whatToSubstituteItWith/g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1771
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1772
		$line=~s/##//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1773
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1774
		# Recognise keywords in lines that we process after substitution
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1775
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1776
		# ECHO  anything at all
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1777
		# WARNING anything at all
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1778
		# ERROR anything at all
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1779
		# LANGUAGE_CODE nnn
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1780
		# DEFAULT_LANGUAGE nnn
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1781
		# ABI_DOWNGRADE from to
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1782
		# ROMBUILD_OPTION command-line-option
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1783
		# ROM_IMAGE
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1784
		# PlatSecEnforceSysBin on|off
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1785
		# ENABLE_SPI/DISABLE_SPI
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1786
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1787
		if ($line=~/^\s*ECHO\s+(.*?)\s*$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1788
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1789
			print "$1\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1790
			push @obydata, "REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1791
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1792
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1793
		if ($line=~/^\s*(ERROR|WARNING)\s+(.*?)\s*$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1794
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1795
			print_source_error("$1 $2");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1796
			$errors++ if ($1 =~ /ERROR/i);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1797
			push @obydata, "REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1798
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1799
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1800
		if ($line=~/^\s*(PlatSecEnforceSysBin)\s+(\S+)\s*$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1801
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1802
			$enforceSysBin = ($2 =~ /ON/i);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1803
			push @obydata, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1804
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1805
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1806
		if ($line=~/^\s*LANGUAGE_CODE\s+(\S+)\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1807
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1808
			my $code = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1809
			if ($code !~ /^\d\d+$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1810
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1811
				print_source_error("bad language code $code");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1812
				$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1813
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1814
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1815
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1816
				$languageCodes{$code} = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1817
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1818
			push @obydata, "REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1819
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1820
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1821
		if ($line=~/^\s*DEFAULT_LANGUAGE\s+(\S+)\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1822
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1823
			my $code = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1824
			if ($code !~ /^\d\d+$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1825
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1826
				print_source_error("bad default language code $code");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1827
				$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1828
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1829
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1830
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1831
				$defaultLanguageCode = $code;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1832
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1833
			push @obydata, "REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1834
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1835
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1836
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1837
		if ($line=~/^\s*ABI_DOWNGRADE\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1838
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1839
			if ($line =~ /\s(.+)\s*->\s*(.+)\s*$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1840
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1841
				$abiDowngrade = "$1 $2";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1842
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1843
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1844
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1845
				print_source_error("bad ABI downgrade : $line");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1846
				$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1847
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1848
			push @obydata, "REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1849
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1850
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1851
		if ($line=~/^\s*BINARY_SELECTION_ORDER\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1852
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1853
	 		if ($line =~ /\s([^,]+)\s*,\s*(.+)\s*$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1854
   			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1855
  				$binarySelectionOrderFlag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1856
 				$firstDIR = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1857
   				# remove whitespaces
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1858
 				$firstDIR = trim($firstDIR); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1859
   				@binarySelectionOrder = split(',', $2);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1860
   				@binarySelectionOrder = trim(@binarySelectionOrder);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1861
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1862
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1863
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1864
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1865
				print_source_error("bad order specified: $line");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1866
				$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1867
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1868
			push @obydata, "REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1869
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1870
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1871
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1872
		if ($line=~/^\s*ROMBUILD_OPTION\s+(\S+)\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1873
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1874
			$rombuildOptions{$1} = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1875
			push @obydata, "REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1876
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1877
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1878
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1879
		if ($line=~/^\s*enable_spi\s*$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1880
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1881
			if(!($spiset)) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1882
				$createspi=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1883
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1884
			push @obydata, "REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1885
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1886
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1887
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1888
		if ($line=~/^\s*disable_spi\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1889
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1890
			if(!($spiset)) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1891
				$createspi=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1892
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1893
			push @obydata, "REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1894
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1895
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1896
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1897
		if ($line=~/^\s*DATA_IMAGE\s+/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1898
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1899
			if ($line =~ /\s+(\d+)\s+(\S+)\s+/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1900
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1901
				my $datadriveidx = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1902
				my $datadriveimagename = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1903
				# have a count on number of data drive images that needs to be created
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1904
				print "data drive partion name = $datadriveimagename\n " if($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1905
				my $dataimagesize = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1906
				if ($line =~ /\s+size=(\S+)\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1907
				{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1908
					$dataimagesize=$1; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1909
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1910
				my $fstype = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1911
				my $compress=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1912
				my $uncompress=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1913
				if ($line =~ /\s+compress\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1914
				{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1915
					$compress=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1916
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1917
				elsif($line =~ /\s+uncompress\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1918
				{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1919
					$uncompress=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1920
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1921
				if ($line =~ /\s+fat16\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1922
				{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1923
					$fstype = "fat16"; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1924
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1925
				if ($line =~ /\s+fat32\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1926
				{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1927
					$fstype = "fat32"; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1928
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1929
				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1930
				$datadriveimage[$datadriveidx] = {name=>$datadriveimagename, size=>$dataimagesize, compress=>$compress, uncompress=>$uncompress, fstype=>$fstype};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1931
				print "DATA_IMAGE[$datadriveidx] $datadriveimage[$datadriveidx]{name} size=$datadriveimage[$datadriveidx]{size} compress=$compress uncompress=$uncompress fstype=$fstype\n" if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1932
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1933
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1934
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1935
				print_source_error("bad DATA_IMAGE specification : $line");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1936
				$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1937
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1938
			push @obydata, "REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1939
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1940
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1941
		if ($line=~/^\s*ROM_IMAGE\s+/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1942
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1943
			if ($line =~ /\s+(\d+)\s+(\S+)\s+/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1944
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1945
				my $romidx=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1946
				my $rompartitionname=$2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1947
				my $rompartitionsize=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1948
				if ($line =~ /\s+size=(\S+)\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1949
					{ $rompartitionsize=$1; }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1950
				my $xip=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1951
				my $compress=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1952
				my $uncompress=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1953
				my $extend=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1954
				my $composite="none";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1955
				if ($line =~ /\s+non-xip\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1956
					{ $xip=0; }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1957
				if ($line =~ /\s+compress\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1958
					{ $compress=1; }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1959
				elsif($line =~ /\s+uncompress\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1960
					{ $uncompress=1;} # This option is passed to rofsbuild. For rombuild, not saying --compress means to uncompress
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1961
				if ($line =~ /\s+extension\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1962
					{ $extend=1; }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1963
				if ($line =~ /\s+composite_primary\s*/i) # added to support new composite_primary keyword in obey files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1964
				{	if (!($extend))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1965
						{ $composite="composite_primary"; }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1966
					else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1967
						{ print "Error: composite_primary keyword must be used with a core image\n"; }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1968
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1969
				if ($line =~ /\s+composite_secondary\s*/i) # added to support new composite_secondary keyword in obey files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1970
				{ if (!($extend))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1971
						{ $composite="composite_secondary"; }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1972
					else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1973
						{ print "Error: composite_secondary keyword must be used with core image\n"; }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1974
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1975
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1976
				#	Compress and Uncompress are 2 different options and
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1977
				#	not mentioning one of them doesn't necessarily mean the other.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1978
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1979
				$romimage[$romidx] = {name=>$rompartitionname, size=>$rompartitionsize, xip=>$xip, compress=>$compress, extension=>$extend, composite=>$composite, uncompress=>$uncompress};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1980
				print "ROM_IMAGE[$romidx] $romimage[$romidx]{name} size=$romimage[$romidx]{size} xip=$xip compress=$compress extension=$extend composite=$composite uncompress=$uncompress \n" if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1981
				check_romimage($romidx, $line);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1982
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1983
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1984
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1985
				print_source_error("bad ROM_IMAGE specification : $line");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1986
				$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1987
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1988
			push @obydata, "REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1989
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1990
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1991
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1992
		push @obydata, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1993
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1994
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1995
	close TMP1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1996
	exit(1) if ($errors);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1997
	dump_obydata("tmp2.oby", "result of substitution phase") if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1998
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1999
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2000
sub check_romimage
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2001
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2002
	my ($idx, $line) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2003
	if ($idx gt 7)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2004
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2005
		print_source_error("too many roms : $line");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2006
		$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2007
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2008
	if ($romimage[$idx]{xip} eq 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2009
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2010
		if ($romimage[$idx]{size} eq 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2011
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2012
			print_source_error("must specify a size for non-xip ROM : $line");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2013
			$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2014
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2015
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2016
	if ($romimage[$idx]{extension} ne 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2017
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2018
		if ($romimage[$idx-1]{extension} ne 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2019
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2020
			print_source_error("cannot extend ROM image multiple times : $line");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2021
			$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2022
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2023
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2024
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2025
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2026
sub dump_obydata
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2027
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2028
	my ($dumpfile, $comment) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2029
	$dumpfile = $thisdir.$dumpfile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2030
	unlink($dumpfile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2031
	open DUMPFILE, ">$dumpfile" or die("* Can't create $dumpfile\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2032
	print "* Writing $dumpfile - $comment\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2033
	my $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2034
	foreach $line (@obydata)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2035
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2036
		print DUMPFILE $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2037
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2038
	close DUMPFILE;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2039
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2040
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2041
sub track_source
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2042
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2043
	my ($line) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2044
	if ($line=~/^# (\d+) "(.*)"/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2045
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2046
		$sourceline=$1-1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2047
		$sourcefile=$2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2048
		$sourcefile=~ s/\\\\/\\/g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2049
		$sourcefile=~ s/\\/\//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2050
		return;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2051
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2052
	$sourceline++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2053
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2054
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2055
sub print_source_error
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2056
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2057
	my ($message) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2058
	print "$sourcefile($sourceline): $message\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2059
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2060
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2061
sub reassert_sourceline
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2062
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2063
	my ($offset) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2064
	return sprintf "# %d \"$sourcefile\" \n", $sourceline+1+$offset;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2065
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2066
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2067
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2068
#----------------------------------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2069
# Reorganisation phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2070
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2071
# Group lines beginning with "rom_image[<id>]" and deposit them in the appropriate
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2072
# order.  Truncate the description at the "stop" line, if there is one.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2073
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2074
sub reorganize_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2075
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2076
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2077
	undef @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2078
	my @section2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2079
	my @part3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2080
	my @part4;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2081
	my @part5;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2082
	my @part6;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2083
	my @part7;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2084
	my @part8;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2085
	my @partitions = ( \@newobydata, \@section2, \@part3, \@part4, \@part5, \@part6, \@part7, \@part8 );
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2086
	my @currentpartition;	# partition stack
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2087
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2088
	my @processedImageIdx;		# list of proccesed data drive image index. 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2089
	my $dataDriveStartRegion = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2090
	my $dataDriveEndRegion = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2091
	my $dataDriveIdx;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2092
	my @datapartition;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2093
	my @linesArray;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2094
	my $curlyBraceShouldFollow;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2095
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2096
	my $collect_section2=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2097
	my $smrImageStartRegion = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2098
	my $smrImageEndRegion = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2099
	my $smrImageIndex = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2100
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2101
	foreach $line (@obydata)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2102
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2103
		track_source($line);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2104
		if ($line=~/^\s*stop/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2105
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2106
			last;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2107
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2108
		if ($line =~ /^\s*ROM_IMAGE\[(\S+)\]\s+\{(.*)$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2109
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2110
			# ROM_IMAGE[n] {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2111
			my $idx=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2112
			my $partition=$partitions[$idx];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2113
			push @currentpartition, $partition;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2114
			$line="REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2115
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2116
		elsif( ($line =~ /^\s*DATA_IMAGE\[(\S+)\]\s*$/i) || ($line =~ /^\s*DATA_IMAGE\[(\S+)\]\s*\{\s*$/i))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2117
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2118
			# DATA_IMAGE[n] or DATA_IMAGE[n] {  is specified.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2119
			# get the index.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2120
			$dataDriveIdx=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2121
 			if($line !~ /\s*\{\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2122
 			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2123
 				$curlyBraceShouldFollow = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2124
 			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2125
			# make a check if dataDriveIdx exists in the processedImageIdx array.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2126
			# if no, then push the dataDriveIdx on the processedImageIdx array.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2127
			# if yes,then dont execute the loop.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2128
			if(&datadriveimage::checkInArray(\@processedImageIdx,$dataDriveIdx))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2129
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2130
				# push the index on to the array.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2131
				push(@processedImageIdx,$dataDriveIdx);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2132
				# increment the image count. 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2133
				++$dataImageCount;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2134
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2135
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2136
			$dataIndexHash{($dataImageCount-1)} = $dataDriveIdx;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2137
			# set start of the image section.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2138
			$dataDriveStartRegion = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2139
			# set end of image section to zero.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2140
			$dataDriveEndRegion = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2141
			push (@linesArray,"\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2142
			$line="REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2143
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2144
		elsif( $line =~ /^\s*SMR_IMAGE\s*\{\s*$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2145
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2146
			$smrImageStartRegion = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2147
			$smrImageEndRegion = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2148
			$needSmrImage = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2149
			push (@linesArray, "\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2150
			$line="REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2151
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2152
 		elsif((defined $curlyBraceShouldFollow) && ($line !~ /^\s*$/i))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2153
 		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2154
			undef $curlyBraceShouldFollow;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2155
 			if($line !~ /^\s*\{\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2156
 			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2157
 				print "Error: Symbol '{' not followed after the keyword DATA_IMAGE\[".$dataDriveIdx."\]\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2158
 				$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2159
 			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2160
 			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2161
 		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2162
		# data drive specific keywords.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2163
		elsif( $line =~/^\s*dataimagename\s*\=\s*(\S+)/i )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2164
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2165
			# set the name for the image, if image name is specified using driveimagename keyword.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2166
			$datadriveimage[$dataDriveIdx]{name} = $1 if($dataDriveStartRegion && !$dataDriveEndRegion);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2167
			print"datadriveimagename = $datadriveimage[$dataDriveIdx]{name}\n" if($dataDriveStartRegion && !$dataDriveEndRegion && $opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2168
			# skip the line.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2169
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2170
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2171
		elsif( $line =~/^\s*dataimagesize\s*\=\s*(\S+)/i )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2172
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2173
			# set the size for the image, if image size is specified using driveimagesize keyword.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2174
			$datadriveimage[$dataDriveIdx]{size} = $1 if($dataDriveStartRegion && !$dataDriveEndRegion);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2175
			print"datadriveimagesize = $datadriveimage[$dataDriveIdx]{size}\n" if($dataDriveStartRegion && !$dataDriveEndRegion && $opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2176
			# skip the line.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2177
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2178
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2179
		elsif( $line =~/^\s*dataimagefilesystem\s*\=\s*(\S+)/i )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2180
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2181
			# set the file system type for the image, if image file system is specified using dataimagefilesystem keyword.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2182
			$datadriveimage[$dataDriveIdx]{fstype} = $1 if($dataDriveStartRegion && !$dataDriveEndRegion);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2183
			print"datadriveimagefstype = $datadriveimage[$dataDriveIdx]{fstype}\n" if($dataDriveStartRegion && !$dataDriveEndRegion && $opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2184
			# skip the line.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2185
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2186
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2187
		elsif( $line =~/^\s*compress/i )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2188
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2189
			# Compresses the resulting data drive image using the Deflate, Huffman+LZ77 algorithm.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2190
			if($dataDriveStartRegion && !$dataDriveEndRegion)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2191
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2192
				$datadriveimage[$dataDriveIdx]{compress} = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2193
				$datadriveimage[$dataDriveIdx]{uncompress} = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2194
				print"datadriveimage[$dataDriveIdx] compress = $datadriveimage[$dataDriveIdx]{compress}\n" if($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2195
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2196
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2197
		elsif( $line =~/^\s*uncompress/i )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2198
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2199
			# Uncompresses the resulting data drive image.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2200
			if($dataDriveStartRegion && !$dataDriveEndRegion)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2201
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2202
				$datadriveimage[$dataDriveIdx]{uncompress} = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2203
				$datadriveimage[$dataDriveIdx]{compress} = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2204
				print"datadriveimage[$dataDriveIdx] uncompress = $datadriveimage[$dataDriveIdx]{uncompress}\n" if($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2205
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2206
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2207
		elsif ($line =~ /^\s*ROM_IMAGE\[(\S+)\](.*)$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2208
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2209
			# ROM_IMAGE[n] file=...
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2210
			my $origline=$line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2211
			$line="$2\n";	# remove the ROM_IMAGE[.] keyword
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2212
			my $idx=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2213
			my $partition=$partitions[$idx];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2214
			push @$partition, reassert_sourceline(-1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2215
			push @$partition, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2216
			$line="REM handled $origline";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2217
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2218
		elsif ($line =~ /^\s*DATA_IMAGE\[(\S+)\](.*)$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2219
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2220
			# DATA_IMAGE[n] file=...
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2221
			my $origline=$line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2222
			# remove the DATA_IMAGE[.] keyword
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2223
			$line="$2\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2224
			# get the index value
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2225
			my $idx=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2226
			# iterate through the hash to get corresponding 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2227
			# key from the value(i.e idx) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2228
			while (my($key, $value) = each(%dataIndexHash))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2229
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2230
				if ($value eq $idx ) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2231
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2232
					$idx = $key;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2233
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2234
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2235
			push @{$datapartition[$idx]}, reassert_sourceline(-1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2236
			push @{$datapartition[$idx]}, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2237
			$line="REM handled $origline";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2238
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2239
		elsif ($line =~ /^\s*\}.*$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2240
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2241
			if($dataDriveStartRegion)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2242
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2243
				# since "}" brace is encountered
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2244
				# reset the start of DATA_IMAGE to zero.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2245
				$dataDriveStartRegion = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2246
				# mark the the end of the DATA_IMAGE.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2247
				$dataDriveEndRegion = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2248
				if(!$datadriveimage[$dataDriveIdx]{name})
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2249
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2250
					# image name is not defined, define a default name.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2251
					$datadriveimage[$dataDriveIdx]{name} = "dataImage".$dataDriveIdx;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2252
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2253
				if(!$datadriveimage[$dataDriveIdx]{fstype})
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2254
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2255
					# image name is not defined, define a default name.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2256
					$datadriveimage[$dataDriveIdx]{fstype} = "fat16";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2257
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2258
				foreach my $file (@linesArray)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2259
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2260
					push @{$datapartition[($dataImageCount-1)]},$file;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2261
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2262
				## if end of the DATA_IMAGE is true,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2263
				## make room for next DATA_IMAGE if any.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2264
				undef(@linesArray); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2265
				#un define $dataDriveIdx;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2266
				undef($dataDriveIdx);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2267
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2268
			elsif($smrImageStartRegion)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2269
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2270
				$smrImageStartRegion = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2271
				$smrImageEndRegion = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2272
				foreach my $file (@linesArray)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2273
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2274
					push @{$smrPartitions{$smrImageIndex}}, $file;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2275
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2276
				undef(@linesArray);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2277
				$smrImageIndex++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2278
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2279
			elsif (scalar @currentpartition > 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2280
			{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2281
				pop @currentpartition; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2282
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2283
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2284
			{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2285
				print "WARNING: closing '}' found with no matching 'ROM_IMAGE[<n>]/DATA_IMAGE[<n>] {'\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2286
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2287
			$line="REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2288
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2289
		elsif ($line=~/^\s*section2(.*)$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2290
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2291
			my $origline=$line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2292
			$line="$1\n";	# remove the section2 keyword
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2293
			if ($collect_section2)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2294
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2295
				push @section2, reassert_sourceline(-1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2296
				push @section2, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2297
				$line="REM handled $origline";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2298
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2299
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2300
		elsif ($line=~/^\s*section/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2301
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2302
			push @newobydata, $line;		# insert the section statement
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2303
			if (@section2 != 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2304
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2305
				push @newobydata, "REM accumulated section2 lines\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2306
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2307
			foreach $line (@section2)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2308
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2309
				push @newobydata, $line;	# insert accumulated section2 lines
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2310
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2311
			$collect_section2=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2312
			$line = reassert_sourceline();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2313
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2314
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2315
		elsif ($line=~/^\s*extensionrom/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2316
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2317
			# end of ROM description, so deposit accumulated lines
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2318
			if (@section2 != 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2319
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2320
				push @newobydata, "REM accumulated section2 lines\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2321
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2322
			foreach $line (@section2)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2323
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2324
				push @newobydata, $line;	# insert accumulated section2 lines
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2325
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2326
			$collect_section2=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2327
			push @newobydata, reassert_sourceline();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2328
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2329
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2330
		elsif ( scalar(@linesArray) )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2331
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2332
			if($dataDriveStartRegion && !$dataDriveEndRegion)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2333
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2334
				my $modifiedLine = $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2335
				push @linesArray, $modifiedLine;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2336
				$line = "REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2337
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2338
			elsif($smrImageStartRegion && !$smrImageEndRegion)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2339
			{
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  2340
				if($line =~ /^(\s*IMAGENAME\s*=\s*)(\S+)/i)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2341
				{
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  2342
					my $front = $1;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  2343
					my $smrimagename = $2;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  2344
					if ($smrimagename !~ /^.:/ && $smrimagename !~ /^[\\\/]/)
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  2345
					{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  2346
						$smrimagename = $thisdir.$smrimagename;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  2347
					}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2348
					$smrimagename =~s/(\.img)//i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2349
					if(exists($smrNameInfo{$smrimagename}))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2350
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2351
						$smrNameInfo{$smrimagename}++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2352
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2353
					else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2354
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2355
						$smrNameInfo{$smrimagename} = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2356
					}
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  2357
					push @linesArray, "$front$smrimagename\n";
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  2358
				}else
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  2359
				{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  2360
					push @linesArray, $line;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2361
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2362
				$line = "REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2363
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2364
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2365
		elsif (scalar @currentpartition)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2366
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2367
			my $modifiedLine = $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2368
			if ($line =~ /^\s*SPI_POSITION/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2369
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2370
				if(!($createspi && $spiplacement))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2371
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2372
					# comment the line if the spi placement flag is not enabled or if the spi creation is not enabled.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2373
					$modifiedLine = "REM SPI creation/placement flag not enabled. Ignoring SPI_POSITION\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2374
					print ("Warning: SPI creation/placement flag not enabled. Ignoring SPI_POSITION\n" ) if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2375
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2376
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2377
			# a partition is specified
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2378
			# push this line into the currently selected partition
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2379
			my $partition=$currentpartition[-1];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2380
			push @$partition, $modifiedLine;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2381
			$line="REM handled $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2382
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2383
		elsif ($line =~ /^\s*SPI_POSITION/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2384
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2385
			if(!($createspi && $spiplacement))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2386
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2387
                # comment the line if the spi placement flag is not enabled or if the spi creation is not enabled.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2388
                $line = "REM SPI creation/placement flag not enabled. Ignoring SPI_POSITION\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2389
                print ("Warning: SPI creation/placement flag not enabled. Ignoring SPI_POSITION\n" ) if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2390
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2391
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2392
		push @newobydata, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2393
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2394
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2395
	# output the grouped data
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2396
	my $partitionidx=2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2397
	if ($collect_section2)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2398
		{ $partitionidx=1; } # output old "section2" if not done already
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2399
	for (; $partitionidx<8; $partitionidx++)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2400
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2401
		my $partition=$partitions[$partitionidx];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2402
		if (@$partition != 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2403
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2404
			push @newobydata, "REM ROM_IMAGE[$partitionidx]\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2405
			foreach $line (@$partition)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2406
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2407
				push @newobydata, $line;	# insert accumulated section2 lines
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2408
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2409
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2410
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2411
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2412
	for ( my $datapartitionidx=0; $datapartitionidx < $dataImageCount; $datapartitionidx++ )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2413
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2414
		if( defined( @{ $datapartition[$datapartitionidx] } ) )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2415
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2416
			push @newobydata, "REM DATA_IMAGE[$dataIndexHash{$datapartitionidx}]\n" ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2417
			foreach my $file (@{$datapartition[$datapartitionidx]})
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2418
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2419
				push @newobydata, $file;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2420
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2421
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2422
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2423
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2424
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2425
	foreach my $imageIndex (keys(%smrPartitions))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2426
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2427
		my $imagename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2428
		my @obeyfile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2429
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2430
		foreach (@{$smrPartitions{$imageIndex}})
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2431
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2432
			if(/^\s*imagename\s*=\s*(\S+)/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2433
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2434
				$imagename = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2435
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2436
			push @obeyfile, $_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2437
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2438
		if($smrNameInfo{$imagename} == 1)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2439
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2440
			push @obeyFileList, $imagename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2441
			push @newobydata, "REM SMR_IMAGE \n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2442
			push @newobydata, @obeyfile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2443
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2444
		if(! defined($imagename))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2445
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2446
			$smrNoImageName = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2447
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2448
		undef $imagename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2449
		undef @obeyfile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2450
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2451
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2452
	@obydata = @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2453
	exit(1) if ($errors);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2454
	dump_obydata("tmp3.oby", "result of reorganisation phase") if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2455
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2456
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2457
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2458
#----------------------------------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2459
# Plugin phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2460
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2461
# Process any plugin annotation lines
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2462
# Note: This expands resource lines to include MULTI_LINGUIFY so must be done before
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2463
# the Multilinguify phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2464
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2465
# hash of SPI file target directories is located near the start of this file, before sub match_obyfile
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2466
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2467
sub plugin_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2468
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2469
	undef @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2470
	foreach $line (@obydata)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2471
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2472
		track_source($line);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2473
	 	if ($line =~ /^\s*REM/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2474
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2475
		# ignore REM statements, to avoid processing "REM ECOM_PLUGIN(xxx,yyy)"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2476
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2477
		elsif(plugin_match($line)) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2478
			$line = reassert_sourceline();		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2479
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2480
		push @newobydata, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2481
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2482
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2483
	@obydata = @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2484
	dump_obydata("tmp4.oby", "result of Plugin stage") if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2485
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2486
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2487
sub plugin_match ()
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2488
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2489
	my ($line) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2490
	foreach my $plugintype (keys(%plugintypes)) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2491
	  if ($line =~ m/^.*__$plugintype\_PLUGIN\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2492
	  	# __<plugin-type>_PLUGIN(emulator directory, file rom dir, dataz_, resource rom dir, filename, resource filename)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2493
	  {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2494
		    my $emulatorDir=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2495
		    my $fileRomDir=$2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2496
		    my $dataz_= $3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2497
		    my $resourceDir=$4;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2498
		    my $pluginFileName=$5;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2499
		    my $pluginResourceName=$6;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2500
		    my $spidatahide = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2501
			my $paged_data = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2502
  
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2503
			if ($line =~ m/paged\s*$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2504
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2505
				$line =~ m/\s+(\S+)\s*$/;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2506
				$paged_data = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2507
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2508
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2509
		    if ($line =~ m/^\s*(_hide)/i )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2510
		    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2511
		    	$spidatahide = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2512
		    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2513
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2514
		    # for resource files strip the .rsc or .dll from the end   (will be .dll where we use
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2515
		    # SYMBIAN_SECURE_ECOM and are building resources to  the same name as ecom plugin dlls)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2516
		    
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2517
		    if ($pluginResourceName =~ m/^(.+)\./)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2518
		    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2519
		      $pluginResourceName = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2520
		    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2521
		    else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2522
		    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2523
		      print_source_error("Invalid Resource name: $pluginResourceName in " . $plugintype . "_PLUGIN :$line");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2524
		      #treat as error if strict option selected;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2525
		      $errors++ if ($strict);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2526
		    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2527
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2528
		    if ($spidatahide)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2529
		    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2530
			push @newobydata, "hide=$fileRomDir\/$pluginFileName\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2531
		    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2532
		    else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2533
		    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2534
		    	push @newobydata, "file=$emulatorDir\/$pluginFileName $fileRomDir\/$pluginFileName $paged_data\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2535
		    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2536
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2537
		    if($createspi) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2538
		    	    if ($spidatahide)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2539
			    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2540
			    	push @newobydata, "spidatahide=MULTI_LINGUIFY(RSC $dataz_\/$resourceDir\/$pluginResourceName $resourceDir\/$pluginResourceName) " . lc($plugintype) . "\.spi " . $plugintypes{$plugintype} . "\n";      
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2541
			    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2542
			    else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2543
			    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2544
			    	push @newobydata, "spidata=MULTI_LINGUIFY(RSC $dataz_\/$resourceDir\/$pluginResourceName $resourceDir\/$pluginResourceName) " . lc($plugintype) . "\.spi " . $plugintypes{$plugintype} . "\n";      
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2545
			    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2546
		  	} else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2547
		    	    if ($spidatahide)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2548
			    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2549
			    	push @newobydata, "hide=MULTI_LINGUIFY(RSC $dataz_\/$resourceDir\/$pluginResourceName $resourceDir\/$pluginResourceName)\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2550
			    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2551
			    else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2552
			    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2553
			    	push @newobydata, "data=MULTI_LINGUIFY(RSC $dataz_\/$resourceDir\/$pluginResourceName $resourceDir\/$pluginResourceName)\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2554
			    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2555
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2556
				return 1; #successful match
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2557
	   }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2558
     }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2559
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2560
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2561
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2562
#----------------------------------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2563
# Multilinguify phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2564
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2565
# Process the MULTILINGUIFY() lines
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2566
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2567
sub multlinguify_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2568
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2569
	if ((scalar keys %languageCodes) == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2570
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2571
		print "* No language codes specified, defaulting to 01\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2572
		$defaultLanguageCode = "01";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2573
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2574
	$languageCodes{$defaultLanguageCode} = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2575
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2576
	undef @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2577
	foreach $line (@obydata)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2578
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2579
		track_source($line);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2580
		if ($line =~ /^\s*REM/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2581
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2582
			# ignore REM statements, to avoid processing "REM data=xxx yyy"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2583
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2584
		elsif ($line=~/^(.*?)\bMULTI_LINGUIFY\s*\(\s*(\S+)\s+(\S+)\s+(\S+)\s*\)(.*)$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2585
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2586
			my $initialStuff=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2587
			$initialStuff = lc ($initialStuff);# if ($enableLowercaseTransfer);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2588
			my $defaultFileNameExtension=$2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2589
			$defaultFileNameExtension = lc ($defaultFileNameExtension);# if ($enableLowercaseTransfer);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2590
			my $sourceFileNameWithoutExtension=$3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2591
			$sourceFileNameWithoutExtension = ($sourceFileNameWithoutExtension);# if ($enableLowercaseTransfer);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2592
			my $targetFileNameWithoutExtension=$4;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2593
			my $finalStuff=$5;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2594
			my $spidataflag = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2595
			my $spidatahide = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2596
			my $datahide = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2597
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2598
			if ($initialStuff=~/\w$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2599
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2600
				$initialStuff.=" ";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2601
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2602
			if ($finalStuff=~/^\w/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2603
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2604
				$finalStuff=" ".$finalStuff;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2605
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2606
			if ($initialStuff =~ /^\s*spidata/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2607
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2608
				$spidataflag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2609
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2610
			if ($initialStuff =~ /^\s*spidatahide/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2611
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2612
				$spidataflag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2613
				$spidatahide = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2614
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2615
			if ($initialStuff =~ /^\s*hide/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2616
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2617
				$datahide = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2618
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2619
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2620
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2621
# ecom.spi should contain the .RSC files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2622
			if ($spidataflag)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2623
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2624
				my $sourceFileNameExtension = $defaultFileNameExtension;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2625
				my $targetFileNameExtension = $defaultFileNameExtension;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2626
				if (-e ("$sourceFileNameWithoutExtension.$sourceFileNameExtension"))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2627
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2628
					if ($spidatahide)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2629
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2630
						push @newobydata, "$initialStuff$sourceFileNameWithoutExtension.$sourceFileNameExtension$finalStuff\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2631
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2632
					else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2633
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2634
						push @newobydata, "$initialStuff$sourceFileNameWithoutExtension.$sourceFileNameExtension $targetFileNameWithoutExtension.$targetFileNameExtension$finalStuff\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2635
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2636
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2637
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2638
			my $useDefaultFileNameExtension=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2639
			foreach my $languageCode (keys %languageCodes) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2640
				my $sourceFileNameExtension=$defaultFileNameExtension;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2641
				$sourceFileNameExtension=~s/^(.*).{2}$/$1$languageCode/;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2642
				if (! -e ("$sourceFileNameWithoutExtension.$sourceFileNameExtension"))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2643
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2644
					if (!$spidataflag)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2645
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2646
						next if (!$useDefaultFileNameExtension);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2647
						next if (defined $defaultLanguageCode and !($languageCode eq $defaultLanguageCode));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2648
						$useDefaultFileNameExtension=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2649
						if (!$datahide)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2650
						{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2651
							print "Converting >$sourceFileNameWithoutExtension.$sourceFileNameExtension< to $defaultFileNameExtension\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2652
							$sourceFileNameExtension=$defaultFileNameExtension;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2653
						}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2654
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2655
					else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2656
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2657
						next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2658
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2659
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2660
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2661
				my $targetFileNameExtension;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2662
# ecom.sNN should contain the corresponding language code .RNN files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2663
				if(!$spidataflag and (defined $defaultLanguageCode and ($languageCode eq $defaultLanguageCode)))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2664
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2665
					$targetFileNameExtension = $defaultFileNameExtension;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2666
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2667
				else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2668
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2669
					$targetFileNameExtension = $sourceFileNameExtension;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2670
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2671
				my $modifiedfinalStuff = $finalStuff;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2672
				$modifiedfinalStuff =~ s/\.spi/\.s$languageCode/i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2673
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2674
				if ($spidatahide)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2675
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2676
					push @newobydata, "$initialStuff$sourceFileNameWithoutExtension.$sourceFileNameExtension$modifiedfinalStuff\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2677
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2678
				elsif ($datahide)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2679
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2680
					push @newobydata, "$initialStuff$targetFileNameWithoutExtension.$targetFileNameExtension$modifiedfinalStuff\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2681
					if(!($sourceFileNameExtension eq $targetFileNameExtension))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2682
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2683
						push @newobydata, "$initialStuff$targetFileNameWithoutExtension.$sourceFileNameExtension$modifiedfinalStuff\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2684
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2685
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2686
				else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2687
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2688
					push @newobydata, "$initialStuff$sourceFileNameWithoutExtension.$sourceFileNameExtension $targetFileNameWithoutExtension.$sourceFileNameExtension$modifiedfinalStuff\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2689
					if(!($sourceFileNameExtension eq $targetFileNameExtension))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2690
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2691
						push @newobydata, "alias $targetFileNameWithoutExtension.$sourceFileNameExtension $targetFileNameWithoutExtension.$targetFileNameExtension $modifiedfinalStuff\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2692
						$targetFileNameWithoutExtension =~ s-\\-\/-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2693
						$multiLinguifyAlias{"$targetFileNameWithoutExtension.$sourceFileNameExtension"} = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2694
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2695
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2696
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2697
			$line = reassert_sourceline();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2698
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2699
		push @newobydata, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2700
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2701
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2702
	@obydata = @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2703
	dump_obydata("tmp5.oby", "result of choosing language-specific files") if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2704
	undef @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2705
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2706
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2707
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2708
my @featurefilearray; #2d array storing names and locations of feature files in each rom image
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2709
my @featureslist; #array of hashes, stores all the features which are to go into the feature files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2710
my $featurefilecount=0; #counts number of feature files in each rom image
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2711
my $featurescount=0; #counts number of features
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2712
my $dir; # Stores the ROM image location of features.dat/featreg.cfg files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2713
my $featurefilename; # Stores the name of feature file to be generated(i.e. "features.dat" or "featreg.cfg")
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2714
my @spiarray; #2d array storing names and locations of spi files in each rom image
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2715
my @datafiles; #array of hashes, stores all the data files which are to go into the spi files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2716
my @hidedatafiles; #array of hashes, stores all the data files which are to be hidden in the spi files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2717
my $spicount=0; #counts number of spi files in each rom image
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2718
my $filescount=0; #counts number of data files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2719
my $hidefilescount=0; #counts number of data files to be hidden
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2720
my $romimagecount=0; #number of rom image currently working with
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2721
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2722
sub locateexisting 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2723
{ # if an SPI file of this type exists in a base image then returns name of SPI file from the array
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2724
	my ($index, $spifile, $base) =@_;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2725
	my $i=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2726
	while(defined $spiarray[$base][$i]) {
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2727
		if($spiarray[$base][$i]{spi} eq $spiarray[$index][$spifile]{spi}) {
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2728
			my $spiname;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2729
			my $spiextension;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2730
			if($spiarray[$base][$i]{spifile} =~ /(.*)\.(.*)$/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2731
				$spiname=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2732
				$spiextension=$2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2733
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2734
			if(-e "$spiname-$base-$i\.$spiextension") {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2735
					return "$spiname-$base-$i\.$spiextension";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2736
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2737
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2738
		$i++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2739
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2740
	return "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2741
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2742
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2743
sub create 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2744
{ #called to create SPI file and store in specified directory
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2745
	my ($index, $spifile, $base) =@_; #$index = current rom image number, $spifile = current spifile number, $base=number of rom image basing on
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2746
	my $existingspi = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2747
	if(defined($base)) { # checks core image for an existing SPI file of this type, if an existing file exists then $existingspi is set to -i<name of existing spi file> which will later be passed to spitool.pm
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2748
		$existingspi = locateexisting($index, $spifile, $base);
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2749
		if($existingspi ne "") {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2750
			$existingspi = "-i$existingspi";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2751
			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2752
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2753
	}
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2754
	if($spiarray[$index][$spifile]{spifile} =~ /(.+)\.(.*)$/) {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2755
		my $targetspi="$1-$index-$spifile\.$2"; #add romimage number and identifier for spi file to spi file name to distinguish from other spi files
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2756
		my @dataforspi; # array to store names of data files to include in spi file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2757
		my @hidedatainspi; # array to store names of data files that are to be hidden in spi file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2758
		for(my $k=0;$k<scalar @datafiles;$k++) {
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2759
			if($datafiles[$k]{rom}==$index && $datafiles[$k]{spifile} == $spifile) {
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2760
				push @dataforspi, $datafiles[$k]{data}; #push name of data file onto array if correct romimage and spi type
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2761
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2762
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2763
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2764
		for(my $j=0;$j<scalar @hidedatafiles;$j++) {
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2765
			if($hidedatafiles[$j]{rom}==$index && $hidedatafiles[$j]{spifile} == $spifile)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2766
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2767
				push @hidedatainspi, $hidedatafiles[$j]{data}; #push name of data file to be hidden onto array if correct romimage and spi type
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2768
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2769
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2770
		my @spiargs; #arguments passed to createSpi
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2771
		push @spiargs, ("-t$targetspi", "-d$thisdir", "-hide@hidedatainspi");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2772
		if($existingspi ne "") { push @spiargs, $existingspi; }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2773
		&spitool::createSpi(@spiargs, @dataforspi); # external call to 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2774
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2775
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2776
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2777
#----------------------------------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2778
# SPI file creation phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2779
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2780
# If SPI files for resource (.rsc) are required then creates SPI files for each ROM image
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2781
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2782
sub spi_creation_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2783
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2784
	my $composite_secondary=-1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2785
	if($createspi) { 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2786
		my $secondary=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2787
		for (my $i=1; $i<8; $i++)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2788
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2789
			if($romimage[$i]{composite} eq "composite_secondary") 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2790
				{ $secondary++; }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2791
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2792
		if(!$secondary) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2793
			{ $romimage[0]{composite} = "composite_secondary"; }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2794
		if($secondary>1)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2795
			{ print "Warning, more than one composite_primary specified, using image with lowest ROM_IMAGE number\n"; }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2796
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2797
		foreach $line (@obydata)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2798
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2799
			if ($line=~/^\s*REM \s*ROM_IMAGE\[(\d)\]/) # specify which romimage following lines are part of
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2800
			{
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2801
				$romimagecount=$1;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2802
				$spicount=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2803
			}	elsif ($line =~ /^\s*REM/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2804
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2805
				# ignore any other REM statements
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2806
			} elsif ($line=~/^\s*spidata\s*=\s*(\S+)\s+(\S+)\s+(\S+)\s(\S+)\s*$/)	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2807
				#spidata=\epoc32\data\Z\Resource\Plugins\Obexclasscontroller.RSC Resource\Plugins\Obexclasscontroller.RSC ecom.spi \private\10003a3f\
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2808
				my $targetspi=$4.$3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2809
				my $flag=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2810
				my $i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2811
				for($i=0;$i<$spicount && $flag;$i++) { #loop to see if name of spi file already added to this romimage in array
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2812
					if($spiarray[$romimagecount][$i]{spi} eq $targetspi) {
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2813
						$flag=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2814
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2815
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2816
			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2817
				if($flag) { # adds spi file if not yet listed for this romimage in array
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2818
					$spiarray[$romimagecount][$spicount++]={spifile=>$3, spidir=>$4, spi=>$4.$3};
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2819
					$i=$spicount;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2820
				}
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2821
					$datafiles[$filescount++]= {data=>$1, rom=>$romimagecount, spifile=>$i-1}; 
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2822
                        } elsif ($spiplacement && $line =~/^\s*SPI_POSITION/i){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2823
        			# mark the image index at which the SPI_POSITION keyword has occured in order to avoid writing duplicate
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2824
        			# entries of the spi file.
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2825
        			$spipositionflag{$romimagecount} = 1;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2826
        		} elsif ($line=~/^\s*spidatahide\s*=\s*(\S+)\s+(\S+)\s(\S+)\s*$/)	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2827
				#spidatahide=\epoc32\data\Z\Resource\Plugins\Obexclasscontroller.RSC ecom.spi \private\10003a3f\
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2828
				my $targetspi=$3.$2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2829
				my $flag=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2830
				my $i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2831
				for($i=0;$i<$spicount && $flag;$i++) { #loop to see if name of spi file already added to this romimage in array
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2832
					if($spiarray[$romimagecount][$i]{spi} eq $targetspi) {
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2833
						$flag=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2834
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2835
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2836
			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2837
				if($flag) { # adds spi file if not yet listed for this romimage in array
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2838
					$spiarray[$romimagecount][$spicount++]={spifile=>$2, spidir=>$3, spi=>$3.$2};
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2839
					$i=$spicount;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2840
				}
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  2841
					$hidedatafiles[$hidefilescount++]= {data=>$1, rom=>$romimagecount, spifile=>$i-1}; 
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2842
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2843
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2844
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2845
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2846
		for(my $i=0;$i<8 && $composite_secondary<0;$i++) { # loop to set $composite_secondary value
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2847
			if($romimage[$i]{composite} eq "composite_secondary") {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2848
				$composite_secondary=$i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2849
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2850
		}	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2851
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2852
		for(my $i=0;$i<8;$i++) { #loop to add any spi files to composite_primary roms which are present in composite_secondary rom. spi files in secondary ROMs must be present in primary ROMS, this check rules out the possibility of the spi file in the primary rom not being created because it has no data files to add
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2853
			if($romimage[$i]{composite} eq "composite_primary") {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2854
				my $j=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2855
				while(defined $spiarray[$composite_secondary][$j]) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2856
					my $flag=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2857
					my $k=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2858
					while(defined $spiarray[$i][$k] && $flag) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2859
						if($spiarray[$composite_secondary][$j]{spi} eq $spiarray[$i][$k]{spi}) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2860
							$flag=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2861
						}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2862
						$k++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2863
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2864
					if($flag) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2865
						$spiarray[$i][$k]{spifile}=$spiarray[$composite_secondary][$j]{spifile};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2866
						$spiarray[$i][$k]{spidir}=$spiarray[$composite_secondary][$j]{spidir};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2867
						$spiarray[$i][$k]{spi}=$spiarray[$composite_secondary][$j]{spi};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2868
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2869
					$j++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2870
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2871
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2872
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2873
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2874
		for(my $i=0;$i<8;$i++) { #loop to add any spi files to extension roms which are present in core rom, same situation as in previous loop could potentially occur here
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2875
			if($romimage[$i]{extension}) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2876
				my $j=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2877
				while(defined $spiarray[$i-1][$j]) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2878
					my $flag=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2879
					my $k=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2880
					while(defined $spiarray[$i][$k] && $flag) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2881
						if($spiarray[$i-1][$j]{spi} eq $spiarray[$i][$k]{spi}) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2882
							$flag=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2883
						}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2884
						$k++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2885
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2886
					if($flag) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2887
						$spiarray[$i][$k]{spifile}=$spiarray[$i-1][$j]{spifile};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2888
						$spiarray[$i][$k]{spidir}=$spiarray[$i-1][$j]{spidir};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2889
						$spiarray[$i][$k]{spi}=$spiarray[$i-1][$j]{spi};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2890
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2891
					$j++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2892
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2893
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2894
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2895
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2896
		for(my $i=0;$i<scalar @spiarray;$i++) { #create SPI files for ROMs which are neither composite_primary nor extensions
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2897
			if(!($romimage[$i]{extension}) && $romimage[$i]{composite} ne "composite_primary") {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2898
				my $j=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2899
				while(defined $spiarray[$i][$j]) { 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2900
					create($i,$j++);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2901
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2902
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2903
		}	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2904
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2905
		for(my $i=0;$i<8;$i++) { #create SPI files for ROMs marked as composite_primary
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2906
			if($romimage[$i]{composite} eq "composite_primary") {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2907
				my $j=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2908
				while(defined $spiarray[$i][$j]) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2909
					create($i,$j++,$composite_secondary);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2910
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2911
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2912
		}	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2913
		for(my $i=0;$i<8;$i++) { #create SPI files for ROMs marked as extension
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2914
			if($romimage[$i]{extension}) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2915
				my $j=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2916
				while(defined $spiarray[$i][$j]) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2917
					create($i,$j++,$i-1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2918
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2919
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2920
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2921
			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2922
		undef @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2923
		my $flag=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2924
        	my $imageIdx=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2925
		foreach $line (@obydata) { #add SPI files to ROM image, adds lines to obey file to specify existing locations of SPI files and target locations.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2926
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2927
                        if($spiplacement){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2928
                                $flag = 0;	# Reset the flag since the spi file must be added to the final OBY only on finding SPI_POSITION 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2929
                                                        # keyword when the spiplacement flag is set. If the spiplacement flag is set but SPI_POSITION
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2930
                                                        # is not found in the oby files, then no spi entry is emitted.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2931
                                if($line =~ /^\s*SPI_POSITION/i){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2932
                                        next if (!$spipositionflag{$imageIdx});#This spi has already been entered into OBY.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2933
                                        my $spiIdx=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2934
                                        while(defined $spiarray[$imageIdx][$spiIdx]) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2935
                                                if($spiarray[$imageIdx][$spiIdx]{spifile} =~ /(.+)\.(.*)$/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2936
                                                        my $targetspi="$1-$imageIdx-$spiIdx\.$2";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2937
                                                        push @newobydata, "data=" . "$thisdir" . $targetspi . " \"" . $spiarray[$imageIdx][$spiIdx]{spi} . "\"\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2938
                                                }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2939
                                                $spiIdx++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2940
                                        }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2941
                                        if($spiIdx == 0){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2942
                                                # If there is no plugin in this image, the SPI_POSITION statement is ignore.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2943
                                                print ("Warning: statement SPI_POSTION ignored as no plugin was found at ROM_IMAGE[${imageIdx}]\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2944
                                        }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2945
                                        $spipositionflag{$imageIdx} = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2946
                                }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2947
                                elsif( $line =~ /REM ROM_IMAGE\[(\d)\]/i){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2948
                                        $imageIdx = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2949
                                        push @newobydata, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2950
                                }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2951
                                elsif($line =~ /^\s*spidata/i) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2952
                                } else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2953
                                        push @newobydata, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2954
                                }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2955
                        }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2956
			elsif($line =~/REM ROM_IMAGE\[(\d)\]/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2957
				my $romimage=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2958
				if($flag) { #put in SPI files for ROM_IMAGE[0]
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2959
					$flag=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2960
					my $k=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2961
					while(defined $spiarray[0][$k]) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2962
						if($spiarray[0][$k]{spifile} =~ /(.+)\.(.*)$/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2963
							my $targetspi="$1-0-$k\.$2";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2964
							push @newobydata, "data=" . "$thisdir" . $targetspi . " \"" . $spiarray[0][$k]{spidir} . $targetspi .  "\"\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2965
						}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2966
						$k++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2967
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2968
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2969
				my $j=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2970
				push @newobydata, "\n" . $line . "\n";			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2971
				while(defined $spiarray[$romimage][$j]) { #put in SPI files for current ROM_IMAGE
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2972
					if($spiarray[$romimage][$j]{spifile} =~ /(.+)\.(.*)$/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2973
						my $targetspi="$1-$romimage-$j\.$2";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2974
						push @newobydata, "data=" . "$thisdir" . $targetspi . " \"" . $spiarray[$romimage][$j]{spidir} . $targetspi .  "\"\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2975
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2976
					$j++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2977
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2978
			} elsif($line =~ /^\s*extensionrom/i) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2979
				if($flag) { #put in SPI files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2980
					my $k=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2981
					while(defined $spiarray[0][$k]) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2982
						if($spiarray[0][$k]{spifile} =~ /(.+)\.(.*)$/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2983
							my $targetspi="$1-0-$k\.$2";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2984
							push @newobydata, "data=" . "$thisdir" . $targetspi . " \"" . $spiarray[0][$k]{spidir} . $targetspi . "\"\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2985
						}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2986
						$k++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2987
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2988
					$flag = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2989
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2990
				push @newobydata, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2991
			} elsif($line =~ /^\s*spidata/i) {;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2992
			} else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2993
				push @newobydata, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2994
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2995
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2996
		if($flag) { #put in SPI files for ROM_IMAGE[0] if it is the only ROM_IMAGE
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2997
			my $k=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2998
			while(defined $spiarray[0][$k]) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2999
				if($spiarray[0][$k]{spifile} =~ /(.+)\.(.*)$/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3000
					my $targetspi="$1-0-$k\.$2";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3001
					push @newobydata, "data=" . "$thisdir" . $targetspi . " \"" . $spiarray[0][$k]{spidir} . $targetspi . "\"\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3002
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3003
				$k++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3004
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3005
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3006
		@obydata=@newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3007
	}	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3008
	dump_obydata("tmp6.oby", "result of SPI stage") if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3009
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3010
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3011
sub load_featuresutil
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3012
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3013
	&FlexLoad_ModuleL("featuresutil");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3014
			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3015
	# Parse the feature database XML file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3016
	if(!&featuresutil::parseXMLDatabase($featureXml, $featuremanager, $strict))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3017
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3018
		$featureXml = undef;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3019
		exit(1) if($strict);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3020
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3021
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3022
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3023
#----------------------------------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3024
# Feature registry configuration file/Features data file generation phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3025
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3026
# If feature registry configuration files/features data files are required then creates these files for
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3027
# each ROM/ROFS image
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3028
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3029
sub featurefile_creation_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3030
{
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  3031
	if($onlysmrimage){
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3032
		return;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3033
	}
697
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  3034
	if($noFeatureConf) {
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  3035
		checkcase() if ($checkcase);
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  3036
		return ;
818fe0ed324b Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents: 654
diff changeset
  3037
	}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3038
	# Set the name and Rom Image location of feature file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3039
	if ($enforceFeatureManager) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3040
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3041
		# features data file location
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3042
		$dir = "private\/10205054\/";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3043
		$featurefilename = "features.dat";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3044
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3045
	else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3046
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3047
		# feature registry configuration file location
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3048
		$dir = "private\/102744CA\/"; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3049
		$featurefilename = "featreg.cfg";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3050
	}		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3051
	if (defined ($featureXml)) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3052
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3053
		my $featurefilecount=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3054
		my $romimage=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3055
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3056
		foreach $line (@obydata)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3057
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3058
			# specify which romimage following lines are part of
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3059
			if ($line=~/^\s*REM \s*ROM_IMAGE\[(\d)\]/) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3060
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3061
				$romimage=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3062
				$featurefilecount=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3063
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3064
			elsif ($line =~ /^\s*REM/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3065
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3066
				# ignore any other REM statements
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3067
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3068
			elsif($line =~ /^\s*(FEATURE)\s*(\S*)\s*(.*)/i
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3069
					|| $line =~ /^\s*(EXCLUDE_FEATURE)\s*(\S*)\s*(.*)/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3070
			{				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3071
				# FEATURE  <feature_name>  [ SF  <status falgs> ] [ UD  <user data> ]
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3072
				my $feature = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3073
				my $featurevalue = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3074
				my $featureargs = $3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3075
				my $reservedbit = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3076
				my %featureflags=();				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3077
				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3078
				# Options 'SF' and 'UD' will be supported only for "-fm" option
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3079
				if ($featuremanager) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3080
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3081
					# [ SF  <status falgs> ] [ UD  <user data> ]
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3082
					$featureargs =~	/(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*/ ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3083
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3084
					# Store the values of 'SF' and 'UD', or any invalid option, if provided					
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3085
					if ($1) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3086
					{	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3087
						$featureflags{uc($1)} = $2;						
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3088
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3089
					if ($3) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3090
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3091
						$featureflags{uc($3)} = $4;									
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3092
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3093
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3094
					# Generate a warning if the option provided with Feature/Exclude_Feature keyword is  
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3095
					# not 'SF' or 'UD'.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3096
					foreach my $Key (keys %featureflags)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3097
					{						
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3098
						if ($Key !~ /^(SF|UD)$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3099
						{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3100
							print "Warning: Invalid argument \"$Key\" specified for feature $featurevalue\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3101
							delete $featureflags{$Key};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3102
							next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3103
						}						
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3104
					}							
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3105
				}				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3106
				# In verbose mode, generate warning if "SF|UD" arguments or invalid arguments are specified
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3107
				# for "-f|fr" option.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3108
				elsif ($featureargs && $opt_v)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3109
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3110
					print "Invalid argument(s) \"$featureargs\" provided for feature \"$featurevalue\"\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3111
					foreach my $Key (keys %featureflags)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3112
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3113
						delete $featureflags{$Key};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3114
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3115
				}				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3116
				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3117
				# The feature file name is of the format featreg.cfg[x-y] or features.dat[x-y] 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3118
				# where x is the romimage id, y is always 0, reserved for future use.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3119
				my $targetfeaturefile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3120
				if (($romimage == 0) && ($reservedbit == 0))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3121
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3122
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3123
					# Core image will not have the mangled name
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3124
				 	$targetfeaturefile = $featurefilename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3125
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3126
				else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3127
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3128
				 	$targetfeaturefile = $featurefilename . "\[". $romimage . "\-$reservedbit\]";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3129
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3130
				my $flag=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3131
				my $featureflag;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3132
				if ($feature =~ /^FEATURE$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3133
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3134
					$featureflag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3135
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3136
				else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3137
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3138
					$featureflag = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3139
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3140
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3141
				my $i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3142
 				# loop to see if name of feature file already added to this romimage in array
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3143
				for($i=0;$i<$featurefilecount && $flag;$i++)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3144
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3145
					if($featurefilearray[$romimage][$i]{cfgfile} eq $targetfeaturefile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3146
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3147
						$flag=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3148
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3149
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3150
			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3151
				if($flag) { # adds feature file if not yet listed for this romimage in array
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3152
					$featurefilearray[$romimage][$featurefilecount++]={cfgfile=>$targetfeaturefile, cfgdir=>$dir};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3153
					$i=$featurefilecount;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3154
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3155
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3156
				$featureslist[$featurescount]= {feature=>$featurevalue, include=>$featureflag, rom=>$romimage, cfgfile=>$i-1};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3157
				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3158
				# Store the value of 'SF' in 'featureslist' array
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3159
				if (defined $featureflags{SF}) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3160
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3161
					$featureslist[$featurescount]->{SF} = $featureflags{SF};						
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3162
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3163
				# Store the value of 'UD' in 'featureslist' array
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3164
				if (defined $featureflags{UD}) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3165
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3166
					$featureslist[$featurescount]->{UD} = $featureflags{UD};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3167
				}				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3168
				$featurescount++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3169
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3170
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3171
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3172
		# Create Feature File
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3173
		for(my $i=0;$i<scalar @featurefilearray;$i++)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3174
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3175
			my $j=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3176
			while(defined $featurefilearray[$i][$j])
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3177
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3178
				my $targetfeaturefile = $thisdir.$featurefilearray[$i][$j]{cfgfile};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3179
				if (!(&featuresutil::createFeatureFile($i,$j,$targetfeaturefile,\@featureslist,$featuremanager))) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3180
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3181
					$featurefilearray[$i][$j]{cfgfile}= undef;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3182
					exit(1) if($strict);					
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3183
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3184
				$j++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3185
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3186
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3187
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3188
		undef @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3189
		my $flag=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3190
        	my $imageIdx=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3191
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3192
		# Add feature files to ROM image, adds lines to obey file to specify existing locations
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3193
		# of feature files and target locations.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3194
		foreach $line (@obydata)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3195
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3196
			if($line =~/REM ROM_IMAGE\[(\d)\]/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3197
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3198
				my $romimage=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3199
				if($flag)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3200
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3201
					# Put in feature files for ROM_IMAGE[0]
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3202
					$flag=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3203
					my $k=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3204
					while(defined $featurefilearray[0][$k])
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3205
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3206
						my $targetfeaturefile=$featurefilearray[0][$k]{cfgfile};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3207
						if (defined $targetfeaturefile) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3208
						{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3209
							push @newobydata, "data=" . "$thisdir" . $targetfeaturefile . " \"" . $featurefilearray[0][$k]{cfgdir} . $targetfeaturefile .  "\"\n";							
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3210
						}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3211
						$k++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3212
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3213
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3214
				push @newobydata, "\n" . $line . "\n";			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3215
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3216
				my $j=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3217
				while(defined $featurefilearray[$romimage][$j])
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3218
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3219
					# Put in feature files for current ROM_IMAGE
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3220
					my $targetfeaturefile=$featurefilearray[$romimage][$j]{cfgfile};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3221
					
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3222
					# Rom images will not have mangled name for feature files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3223
				 	my $destinationfeaturefile = $featurefilename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3224
					
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3225
					# Rofsbuild will set attribute 'exattrib=U' in the entry record when this field is used.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3226
					# File Server when asked for a directory listing would notice the attribute and will return the 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3227
					# list with mangled names. Hence, mangled name for feature files should not be put in ROM_IMAGE.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3228
					my $exattribute = "exattrib=U";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3229
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3230
					if (defined $targetfeaturefile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3231
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3232
						push @newobydata, "data=" . "$thisdir" . $targetfeaturefile . " \"" . $featurefilearray[$romimage][$j]{cfgdir} . $destinationfeaturefile .  "\"\t\t" . $exattribute . "\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3233
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3234
					$j++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3235
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3236
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3237
			elsif($line !~ /^\s*(FEATURE)\s*/i && $line !~ /^\s*(EXCLUDE_FEATURE)\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3238
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3239
				# Put in all other lines except the FEATURE and EXCLUDE_FEATURE keywords
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3240
				push @newobydata, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3241
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3242
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3243
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3244
		if($flag)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3245
		{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3246
			# Put in feature files for ROM_IMAGE[0] if it is the only ROM_IMAGE
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3247
			my $k=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3248
			while(defined $featurefilearray[0][$k])
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3249
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3250
				my $targetfeaturefile = $featurefilearray[0][$k]{cfgfile};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3251
				if (defined $targetfeaturefile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3252
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3253
					push @newobydata, "data=" . "$thisdir" . $targetfeaturefile . " \"" . $featurefilearray[0][$k]{cfgdir} . $targetfeaturefile . "\"\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3254
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3255
				$k++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3256
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3257
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3258
		@obydata=@newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3259
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3260
	elsif ($enforceFeatureManager && $noFeatureManager && $preBuiltFeaturesDataFile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3261
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3262
        print "Valid: $preBuiltFeaturesDataFile\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3263
		if (-e $preBuiltFeaturesDataFile) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3264
		{			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3265
			my @newobydata = ();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3266
			my $flag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3267
			foreach my $line (@obydata)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3268
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3269
				# Put in the pre-built features data file in ROM_IMAGE[0] 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3270
				if($line =~/REM ROM_IMAGE\[1\]/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3271
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3272
					push @newobydata, "data=$preBuiltFeaturesDataFile" . " \"" . $dir . $featurefilename . "\"\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3273
					$flag =0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3274
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3275
				push @newobydata, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3276
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3277
			if($flag)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3278
			{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3279
				# Put in the pre-built features data file in ROM_IMAGE[0] if it is the only ROM_IMAGE
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3280
				push @newobydata, "data=$preBuiltFeaturesDataFile" . " \"" . $dir . $featurefilename . "\"\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3281
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3282
			@obydata =  @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3283
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3284
		else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3285
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3286
			print "Error: File \"$preBuiltFeaturesDataFile\" doesn't exist.\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3287
			exit(1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3288
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3289
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3290
	elsif ($enforceFeatureManager)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3291
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3292
	    print "Error: no feature data file or pre-built feature data file is provided!";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3293
	    exit(1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3294
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3295
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3296
	checkcase() if ($checkcase);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3297
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3298
my ($fromABI,$toABI) = split / /,$abiDowngrade;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3299
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3300
#----------------------------------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3301
# Problem suppression phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3302
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3303
# Downgrade files which don't exist for the ABI (if a downgrade path is specified)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3304
# Comment out missing files or report errors if strict option enabled
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3305
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3306
# Detect any references to Feature Variant binaries and substitute in the
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3307
# correct source binary name using the VMAP file mechanism.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3308
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3309
sub suppress_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3310
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3311
	undef @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3312
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3313
	init_plat($PerlEPOCPath);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3314
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3315
	# use the "default" feature variant by default.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3316
	my $varname = $featureVariant{'VALID'} ? $featureVariant{'NAME'} : "default";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3317
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3318
	foreach $line (@obydata)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3319
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3320
		track_source($line);
633
a4eca1f021ac ROMTools-13.1.0.2
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
  3321
		if (($opt_xiponly == 1) && ($line =~ /^\s*REM\s*ROM_IMAGE\[\s*[^0]\s*\]/i))
a4eca1f021ac ROMTools-13.1.0.2
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
  3322
		{
a4eca1f021ac ROMTools-13.1.0.2
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
  3323
			print "Skip all the content for ROFS image\n" if($opt_v);
a4eca1f021ac ROMTools-13.1.0.2
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
  3324
			last;
a4eca1f021ac ROMTools-13.1.0.2
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
  3325
		}
a4eca1f021ac ROMTools-13.1.0.2
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
  3326
		elsif ($line =~ /^\s*REM/i || $line =~ /^\s*TIME\s*=\s*/i)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3327
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3328
			# ignore REM statements, to avoid processing "REM data=xxx yyy"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3329
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3330
		# 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3331
		# thing=some\file 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3332
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3333
		elsif ($line =~ /(\S+)\s*=\s*"?(\S+[\/\\]\S+)"?/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3334
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3335
			my $what = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3336
			my $filename = $2;
712
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3337
			if ($line =~ /(\S+)\s*=\s*"([^"]+)"/){
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3338
				$filename = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3339
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3340
			my $fileExists = 0;
712
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3341
			my $normedFilename = &get_versionedname($filename) ;
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3342
			my @alternatives = ();
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3343
			if( $what =~ /data$/i ) {				
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3344
				if(-e $normedFilename) {
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3345
					$fileExists = $normedFilename ;
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3346
				} 
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3347
				else {
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3348
					if($normedFilename =~ /^\s*"?([\\\/]?)([^"]+)"?/i) {
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3349
						if($1) {
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3350
							$normedFilename = $epocroot.$2 ; 
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3351
						}
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3352
						else {
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3353
							$normedFilename = $2 ; 
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3354
						}
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3355
						
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3356
						$fileExists = $normedFilename if(-e $normedFilename);
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3357
					}
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3358
					 
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3359
				}
712
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3360
				push @alternatives, $normedFilename; 
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3361
			}
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3362
			else { 
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3363
				# find all the alternative file locations
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3364
				@alternatives = fallback($normedFilename);
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3365
				# test the original location first
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3366
				unshift(@alternatives, $normedFilename);				 
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3367
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3368
				# choose the first file location that actually exists
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3369
				
712
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3370
				foreach my $altFile (@alternatives) { 
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3371
					my $tmpFile = "";
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3372
					
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3373
					next if($altFile eq "");
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3374
					if($altFile =~/^\s*"?([\\\/]?)([^"]+)"?/i ) {
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3375
						if($1) {
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3376
							$altFile = $epocroot.$2 ; 
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3377
						}
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3378
						else {
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3379
							$altFile = $2 ;
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3380
						}
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3381
					}
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3382
					
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3383
					if($altFile =~ /(.*[\/\\]arm\w+_?\w+)[\/\\](.+)/i) {						 
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3384
						$tmpFile = $1."\.$varname\/".$2;
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3385
					}
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3386
					else {
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3387
						$tmpFile = $altFile;
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3388
					}					
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3389
					 
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3390
					if (-e $tmpFile){
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3391
						# SBSv2 variant binary exists
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3392
						$fileExists = $tmpFile;
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3393
					}
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3394
					else {
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3395
						# SBSv1 variant binary or invariant binary
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3396
						$fileExists = get_BVbinname($altFile, $varname);
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3397
					} 
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3398
					last if $fileExists;
df89378e9223 Fix these errors:
Ross Qin <ross.qin@nokia.com>
parents: 697
diff changeset
  3399
					 
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3400
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3401
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3402
			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3403
			# edit the OBY line to use the actual file name which we found.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3404
			# (maybe) warn if an alternative to the original was selected.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3405
			if ($fileExists)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3406
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3407
				my $from = $filename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3408
				$from =~ s/\\/\\\\/g;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3409
				$from =~ s/\//\\\//g;		# need to escape backslashes
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3410
				$from =~ s/(\[|\])/\\$1/g;	# need to escape square brackets for file names like "featreg.cfg[x-y]",etc.
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  3411
				$from =~ s/(\{|\})/\\$1/g;	# need to escape brace for file names like "mydll{00010001}.dll",etc.
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3412
				my $into = $fileExists;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3413
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3414
 				$line =~ s/$from/$into/i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3415
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3416
 				if ($warnSelection && ($fileExists ne $normedFilename))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3417
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3418
			    	print "replaced $filename with $fileExists\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3419
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3420
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3421
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3422
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3423
   				# No suitable alternative was found, so comment out the line unless
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3424
				# it is a manatory ROMBUILD keyword, in which case it is better
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3425
				# to let ROMBUILD report the missing file rather than report the
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3426
				# missing keyword.
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  3427
   				if ($what !~ /^bootbinary|variant|primary|secondary|hide|dir|imagename/i)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3428
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3429
   					$line = "REM MISSING " . $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3430
   					print_source_error("Missing file: '$filename' in statement '$what='");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3431
					print "\ttried @alternatives\n"  if ($opt_v && @alternatives > 1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3432
   					# treat as an error if the strict option is selected.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3433
   					$errors++ if ($strict);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3434
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3435
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3436
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3437
			# Once the binary is located in the appropriate ABI directory (e.g.,following the binary 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3438
			# selection order), check if the binary has been used in a patch dll statement. This is
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3439
			# required to find out the source file. In ABIv1, the source file is required to find the
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3440
			# .map file, while, in ABIv2, the destination file gives the dso file name.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3441
			if($line =~ /(\S+)\s*=\s*(\S+)\s+(\S+)\s*(.*)?/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3442
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3443
				my $aSrcfile = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3444
				my $dstFile = $3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3445
				my $dstPath = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3446
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3447
				if($aSrcfile =~ /"?([^"]+)/){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3448
				$aSrcfile = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3449
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3450
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3451
				$aSrcfile = &get_versionedname($aSrcfile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3452
				if($dstFile =~ /"?(.*)[\/\\]([^"]+)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3453
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3454
					$dstPath = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3455
					$dstFile = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3456
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3457
				my $dllMapKey = lc ($dstFile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3458
				if(exists $DllDataMap{$dllMapKey}) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3459
					my $dllSymInfo = \%{$DllDataMap{$dllMapKey}};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3460
					$dllSymInfo->{srcfile} = $aSrcfile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3461
					$dllSymInfo->{dstpath} = $dstPath;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3462
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3463
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3464
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3465
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3466
		push @newobydata, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3467
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3468
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3469
	@obydata = @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3470
	dump_obydata("tmp7.oby", "result of problem-suppression phase") if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3471
	die "ERROR: $errors missing file(s) detected\n" if ($strict && $errors );
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3472
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3473
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3474
# Remove leading and trailing whitespaces from a list of strings or a single string
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3475
sub trim 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3476
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3477
	my @out = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3478
	for (@out) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3479
		s/^\s+//;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3480
		s/\s+$//;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3481
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3482
	return wantarray ? @out : $out[0];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3483
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3484
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3485
# Generate a list of alternative locations for the given filename
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3486
sub fallback
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3487
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3488
   	my $file = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3489
   	my @alternatives = CheckCustomization($file);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3490
 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3491
 	# If BINARY_SELECTION_ORDER macro is specified in the oby file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3492
 	if ($binarySelectionOrderFlag)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3493
   	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3494
 		# Search in the specified binary order 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3495
 		if(scalar(@Global_PlatList) == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3496
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3497
			@Global_PlatList = get_platlist();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3498
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3499
 		my $b;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3500
 		my $e;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3501
 		foreach my $plat (@Global_PlatList) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3502
  		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3503
  			if ($file =~ /^(.*)[\/\\]$plat[\/\\](.*)$/i) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3504
  			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3505
  				$b = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3506
  				$e = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3507
 				last;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3508
 			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3509
 		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3510
 		push(@alternatives, "$b\/$firstDIR\/$e");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3511
 			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3512
 		foreach my $toDIR (@binarySelectionOrder)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3513
   		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3514
 			push(@alternatives, "$b\/$toDIR\/$e");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3515
   		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3516
   	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3517
  	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3518
 	# If the file is not found in the specified ABIV2 platform, then select from armv5 directory.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3519
 	# This is necessary as some of the runtime DLLs will be present only in armv5 directory. 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3520
	# Add the BPABI Platforms to be added
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3521
	if(scalar(@Global_BPABIPlats) == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3522
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3523
		@Global_BPABIPlats = &get_bpabiplatlist;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3524
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3525
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3526
 	foreach my $BpabiPlat (@Global_BPABIPlats)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3527
 	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3528
 		if ($fromABI eq "" && $file =~ /^(.*)[\/\\]$BpabiPlat[\/\\](.*)$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3529
   		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3530
 			push(@alternatives, "$1\/armv5\/$2");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3531
   		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3532
   	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3533
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3534
	if ($customizedPlat && $fromABI eq "" && $file =~ /^(.*)[\/\\]$customizedPlat[\/\\](.*)$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3535
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3536
		my $b = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3537
		my $e = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3538
		# if platform customization 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3539
		my $rootPlat = get_platroot($customizedPlat);		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3540
        
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3541
   		#Check in ARMV7 folder for binaries in case GCCEV7 is used [DEF128457 ]
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3542
   		if($customizedPlat == "GCCEV7")
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3543
   		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3544
   			push(@alternatives,"$b\/armv7\/$e");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3545
   		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3546
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3547
		if( grep /$rootPlat/, @Global_BPABIPlats)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3548
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3549
 			push(@alternatives, "$b\/armv5\/$e");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3550
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3551
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3552
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3553
	if ($fromABI eq "" && $file =~ /^(.*)[\/\\]armv5_abiv1[\/\\](.*)$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3554
   	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3555
 		push(@alternatives, "$1\/armv5\/$2");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3556
   	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3557
  		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3558
   	if ($fromABI ne "" && $file =~ /^(.*)[\/\\]$fromABI[\/\\](.*)$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3559
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3560
 		push(@alternatives, "$1\/$toABI\/$2");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3561
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3562
   
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3563
   	return @alternatives;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3564
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3565
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3566
# Generate a list of alternative locations for the given filename which
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3567
# result from the possible platform customizations.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3568
sub CheckCustomization
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3569
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3570
 	my $file = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3571
 	my @alternatives;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3572
	$customizedPlat = undef;	# global (used in feedback)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3573
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3574
 	if(scalar(@Global_PlatList) == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3575
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3576
		@Global_PlatList = get_platlist();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3577
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3578
 	foreach my $plat (@Global_PlatList) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3579
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3580
 		if ($file =~ /^(.*)[\/\\]$plat[\/\\](.*)$/i) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3581
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3582
 			my $b = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3583
 			my $e = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3584
 			my $root = get_platcustomizes($plat);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3585
 			if ($root) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3586
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3587
				# Preserve the plat that is customized
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3588
				$customizedPlat = $plat;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3589
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3590
				# If a BSF platform customizes another BSF platform (i.e. a
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3591
				# BSF hierarchy exists), look for the file starting from the
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3592
				# child BSF platform and working back to the root BSF platform
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3593
				while ($root)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3594
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3595
					push(@alternatives, "$b\/$root\/$e");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3596
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3597
					# Temporary special case for armv5_abiv1 and armv5_abiv2
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3598
					if ($root =~ /^armv5_abiv[12]$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3599
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3600
						push(@alternatives, "$b\/armv5\/$e");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3601
 					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3602
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3603
					$root = get_platcustomizes($root);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3604
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3605
 			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3606
			return @alternatives;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3607
 		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3608
 	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3609
	return @alternatives;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3610
}		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3611
   
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3612
#----------------------------------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3613
# Bitmap and aif conversion phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3614
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3615
# Convert any "bitmap=" or "compressed-bitmap=" files into ROM format bitmaps
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3616
# Convert any "auto-bitmap=" to handle bitmap appropriately for xip and non-xip images
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3617
# Convert "aif=" files appropriately for xip and non-xip images
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3618
sub bitmap_aif_converison_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3619
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3620
	my $is_xip=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3621
	undef @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3622
	foreach $line (@obydata)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3623
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3624
		track_source($line);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3625
		# keep track of the XIP-ness of this rom partition
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3626
		if ($line =~ /^\s*REM ROM_IMAGE\[(\d+)\]\s+(.*)$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3627
		{ $is_xip=$romimage[$1]{xip}; }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3628
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3629
		# aif=source dest 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3630
		# include aif file - use XIP version for XIP roms if it exists, otherwise use the file specified
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3631
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3632
		if ($line =~ /^\s*aif=/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3633
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3634
			my $xip="_xip";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3635
			my @aif= split(/\s+/,$line);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3636
			my $path=Path_Split('Path',"$aif[0]");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3637
			my $base=Path_Split('Base',"$aif[0]");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3638
			$path =~ s/^....//;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3639
			my $ext=Path_Split('Ext',"$aif[0]");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3640
			if ($is_xip && (-e "$path$base$xip$ext"))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3641
			{ $line="data=$path$base$xip$ext\t\t$aif[1]\n"; }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3642
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3643
			{ $line="data=$path$base$ext\t\t$aif[1]\n"; }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3644
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3645
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3646
		# auto-bitmap=
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3647
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3648
		# if currently in XIP image, then use a compressed-bitmap
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3649
		# otherwise use a RAM format bitmap
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3650
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3651
		if ($line =~ /^\s*auto-bitmap=/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3652
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3653
			if ($is_xip)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3654
			{ $line =~ s/auto-bitmap=/compressed-bitmap=/i }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3655
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3656
			{ $line =~ s/auto-bitmap=/data=/i }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3657
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3658
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3659
		# uncompressed-bitmap
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3660
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3661
		# this is currently just a synonym for 'bitmap'
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3662
		$line =~ s/uncompressed-bitmap=/bitmap=/i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3663
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3664
		# 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3665
		# bitmap=source dest 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3666
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3667
		if ($line =~ /^\s*bitmap=\s*"?(\S+)"?\s+"?(\S+)"?/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3668
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3669
			my $mbm = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3670
			my $dest = $2;            
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3671
			my $rom_mbm = "$1_rom";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3672
			if ($is_xip eq 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3673
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3674
				# non-XIP rom - just include the mbm file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3675
				$line = "data=\"$mbm\"\t\"$dest\"\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3676
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3677
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3678
			{	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3679
		        if (! -e $rom_mbm || -M $rom_mbm >= -M $mbm)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3680
			    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3681
					is_existinpath("bmconv", romutl::DIE_NOT_FOUND);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3682
                    
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3683
                    my $rom_mbm_tmp = $rom_mbm;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3684
                    my $mbm_tmp = $mbm;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3685
                    if ($^O =~ /^MSWIN32$/i){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3686
                        $mbm_tmp =~ s-\/-\\-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3687
                        $rom_mbm_tmp =~ s-\/-\\-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3688
                    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3689
                    
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3690
				    system "bmconv -q -r $rom_mbm_tmp -m$mbm_tmp";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3691
	  		    my $bmconv_status = $?;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3692
				    die "* bmconv failed\n" if ($bmconv_status != 0 || !-f $rom_mbm);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3693
			    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3694
				$line = "data=\"$rom_mbm\"\t\"$dest\"\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3695
				push @tempfiles, $rom_mbm;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3696
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3697
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3698
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3699
		# compressed-bitmap=
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3700
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3701
		# if file is a compressed ROM image file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3702
		elsif ($line =~ /^\s*compressed-bitmap=\s*"?(\S+)"?\s+"?(\S+)"?/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3703
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3704
			my $mbm = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3705
			my $dest = $2;            
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3706
			my $cmprssd_rom_mbm = "$1_rom";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3707
			if ($is_xip eq 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3708
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3709
				# non-XIP rom - just include the mbm file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3710
				$line = "data=\"$mbm\"\t\"$dest\"\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3711
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3712
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3713
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3714
				if (! -e $cmprssd_rom_mbm || -M $cmprssd_rom_mbm >= -M $mbm)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3715
			    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3716
					is_existinpath("bmconv", romutl::DIE_NOT_FOUND);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3717
                    
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3718
                    my $cmprssd_rom_mbm_tmp = $cmprssd_rom_mbm;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3719
                    my $mbm_tmp = $mbm;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3720
                    if ($^O =~ /^MSWIN32$/i){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3721
                        $mbm_tmp =~ s-\/-\\-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3722
                        $cmprssd_rom_mbm_tmp =~ s-\/-\\-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3723
                    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3724
                    
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3725
				    system "bmconv -q -s $cmprssd_rom_mbm_tmp -m$mbm_tmp";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3726
				    my $bmconv_status = $?;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3727
				    die "* bmconv failed\n" if ($bmconv_status != 0 || !-f $cmprssd_rom_mbm);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3728
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3729
				$line = "data=\"$cmprssd_rom_mbm\"\t\"$dest\"\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3730
				push @tempfiles, $cmprssd_rom_mbm;			    
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3731
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3732
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3733
		push @newobydata, $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3734
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3735
	@obydata = @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3736
	dump_obydata("tmp8.oby", "result of bitmap conversion phase") if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3737
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3738
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3739
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3740
sub reformat_line($)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3741
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3742
	my ($line) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3743
	my $type = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3744
	my $variant = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3745
	my $pcfile = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3746
	my $romfile = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3747
	my $tail = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3748
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3749
	# time=21/07/1999 12:00:00
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3750
	# primary[0x09080004]   =\epoc32\release\misa\udeb\ekern.exe
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3751
	# data=\epoc32\wins\C\System\Alarms\churchbell.snd    "System\Alarms\Church bell"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3752
	# file[0x07060001]=\epoc32\release\MAWD\urel\cAkyb1.dll          System\Libs\EKeyb.dll
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3753
	# file=\epoc32\release\marm\urel\eikcore.dll 			System\Libs\Eikcore.dll
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3754
	# alias \System\Bin\DRTRVCT2_2.dll 			\System\Bin\DRTRVCT2_1.dll
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3755
	#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3756
	$line =~ s-\\-\/-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3757
	if ($line =~ /^\s*TIME\s*=\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3758
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3759
		return $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3760
	}
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
  3761
  	elsif($line =~ /^\s*(volume|volumeid)\s*=.*/i)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3762
  	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3763
  		return $line;		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3764
  	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3765
	elsif($line =~ /^\s*kerneltrace\s*=.*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3766
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3767
		return $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3768
	}
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  3769
	elsif($line =~ /^\s*(dir|dircopy)\s*=.*/i)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3770
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3771
		return $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3772
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3773
	elsif($line =~ /^\s*bootbinary\s*=(.*)/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3774
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3775
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3776
	if ($line =~ /^\s*(\S+)\s*=\s*(\S+)\s+"\/?(.*)"(.*)$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3777
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3778
		$type = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3779
		$variant = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3780
		$pcfile = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3781
		$romfile = $3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3782
		$tail = $4;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3783
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3784
	elsif ($line =~ /^\s*(\S+)(\[\S+\])\s*=\s*(\S+)\s+\/?(\S+)(.*)$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3785
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3786
		$type = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3787
		$variant = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3788
		$pcfile = $3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3789
		$romfile = $4;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3790
		$tail = $5;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3791
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3792
	elsif ($line =~ /(\S+)\s*=\s*"([^"]+)"\s+"\/?(.*)"(.*)$/ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3793
			|| $line =~ /(\S+)\s*=\s*"([^"]+)"\s+\/?(\S+)(.*)$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3794
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3795
		if ($line !~ /^REM MISSING/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3796
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3797
			$type = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3798
			$variant = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3799
			$pcfile = "\"$2\"";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3800
			$romfile = $3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3801
			$tail = $4;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3802
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3803
		else{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3804
			return $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3805
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3806
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3807
	elsif ($line =~ /^\s*(\S+)\s*=\s*(\S+)\s+\/?(\S+)(.*)$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3808
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3809
		$type = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3810
		$variant = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3811
		$pcfile = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3812
		$romfile = $3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3813
		$tail = $4;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3814
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3815
	elsif($line =~ /^\s*(patchdata)\s*(\S+)\s*\@\s*(\S+)\s+(\S+)/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3816
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3817
		# Reformat the patchdata statement
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3818
		my $romfilename = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3819
		my $patchdlldatamap_key = lc ($romfilename);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3820
		my $symbolname = $3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3821
		my $value = $4;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3822
		my ($index, $elementSize);		# For when the symbol is an array, and we're patching one element
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3823
		my $scalarSize;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3824
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3825
		if(!defined $DllDataMap{$patchdlldatamap_key}->{dstpath}){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3826
			print_source_error(" File $romfilename has not been included into ROM image");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3827
			$errors++ if($strict);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3828
			$line = "REM $line\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3829
			return $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3830
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3831
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3832
		if ($enforceSysBin)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3833
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3834
			if ($DllDataMap{$patchdlldatamap_key}->{dstpath} !~ /^sys\\bin/i 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3835
			 && $DllDataMap{$patchdlldatamap_key}->{dstpath} !~ /^sys\/bin/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3836
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3837
				$DllDataMap{$patchdlldatamap_key}->{dstpath} = "sys\/bin";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3838
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3839
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3840
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3841
		my $dllfile = $DllDataMap{$patchdlldatamap_key}->{dstpath} . "\/". $romfilename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3842
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3843
		$line = "$1  ";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3844
		$line .= "$dllfile ";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3845
 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3846
		# Convert value into decimal (used to be done in AddDllDataInfo, but that limited us to
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3847
		# one value per symbol, and we now support patching arrays, e.g. the Hal's InitialValue[],
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3848
		# so we can't do it that way any more.)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3849
		if ($value =~ /^0x([0-9a-f]+)$/i) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3850
			$value = hex($1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3851
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3852
		elsif ($value =~ /^(-?\d+)$/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3853
			$value = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3854
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3855
		else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3856
			print_source_error("Attempt to set $symbolname to illegal value $value");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3857
			$errors++ if($strict);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3858
			$line = "REM $line\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3859
			return $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3860
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3861
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3862
		if ($symbolname =~ s/:(\d+)\[((0x)?[0-9a-f]+)\]$//i) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3863
			($index, $elementSize) = ($2, $1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3864
			$index = hex($index) if $index =~ /^0x/i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3865
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3866
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3867
		my $DllSymInfoRef = $DllDataMap{$patchdlldatamap_key}->{$symbolname};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3868
 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3869
		if (!defined($DllSymInfoRef->{size})) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3870
			print_source_error("Size for symbol $symbolname not found");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3871
			$errors++ if($strict);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3872
			$line = "REM $line\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3873
			return $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3874
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3875
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3876
		if (defined($elementSize)) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3877
			$scalarSize = $elementSize / 8;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3878
			if ($scalarSize != 1 && $scalarSize != 2 && $scalarSize != 4) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3879
				print_source_error("Invalid bit size $elementSize for array $symbolname in $romfilename");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3880
				$errors++ if($strict);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3881
				$line = "REM $line\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3882
				return $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3883
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3884
			if (($index + 1) * $scalarSize > $DllSymInfoRef->{size}) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3885
				print_source_error("Invalid index $index into array $symbolname in $romfilename");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3886
				$errors++ if($strict);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3887
				$line = "REM $line\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3888
				return $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3889
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3890
		} else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3891
			$scalarSize = $DllSymInfoRef->{size};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3892
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3893
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3894
		my $max_value = 0xffffffff;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3895
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3896
		if ($scalarSize == 1) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3897
			$max_value = 0xff;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3898
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3899
		elsif ($scalarSize == 2) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3900
			$max_value = 0xffff;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3901
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3902
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3903
		if ($value > $max_value) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3904
			$value &= $max_value;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3905
			print "$DllSymInfoRef->{obyfilename}($DllSymInfoRef->{lineno}): Warning:Value overflow of $symbolname\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3906
			$errors++ if($strict);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3907
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3908
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3909
		if(defined $DllSymInfoRef->{ordinal}) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3910
			if (defined($elementSize)) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3911
				my $ord = $DllSymInfoRef->{ordinal};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3912
				my $offset = $index * $scalarSize;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3913
				$line .= "ordinal $ord+$offset ";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3914
			} else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3915
				$line .= "ordinal ";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3916
				$line .= $DllSymInfoRef->{ordinal} . " ";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3917
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3918
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3919
		elsif(defined $DllSymInfoRef->{dataAddr}) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3920
			if (defined($elementSize)) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3921
				my $addr = $DllSymInfoRef->{dataAddr};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3922
				$addr = hex($addr) if $addr =~ /^0x/i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3923
				$addr = sprintf("0x%08x", $addr + $index * $scalarSize);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3924
				$line .= "addr $addr ";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3925
			} else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3926
				$line .= "addr ";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3927
				$line .= $DllSymInfoRef->{dataAddr} . " ";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3928
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3929
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3930
		else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3931
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3932
			print_source_error("Ordinal or Address for exported symbol $symbolname in $romfilename couldn't be located");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3933
			$errors++ if($strict);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3934
			$line = "REM $line\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3935
			return $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3936
		};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3937
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3938
		$line .= "$scalarSize $value\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3939
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3940
		return $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3941
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3942
	elsif ($line =~ /^\s*(\S+)\s*(\S+)\s+\/?(\S+)(.*)$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3943
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3944
		$type = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3945
		$variant = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3946
		$pcfile = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3947
		$romfile = $3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3948
		$tail = $4;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3949
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3950
		if ($type !~ /^(alias)$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3951
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3952
			# Return now, if it is not an 'alias'.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3953
			return $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3954
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3955
		else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3956
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3957
			# There is no substitution needed for SysBin 'alias'es.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3958
			if ($romfile =~ /^sys\\bin\\/i
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3959
			  ||$romfile =~ /^sys\/bin/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3960
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3961
				return $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3962
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3963
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3964
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3965
	else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3966
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3967
		return $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3968
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3969
 	# Buildrom should generate warning when destination path provided for a file 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3970
 	# is not a standard path(as per platsec) and "PlatSecEnforceSysBin" is turned off. 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3971
 	my $warnFlag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3972
	my $mustBeSysBin = $enforceSysBin;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3973
	if ($type =~ /^(data|compress|nocompress)$/i
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3974
		&& $romfile !~ /^system\/(bin|libs|programs)\//i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3975
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3976
		$mustBeSysBin = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3977
 		$warnFlag = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3978
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3979
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3980
	if ($mustBeSysBin)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3981
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3982
		if ($type =~ /^(alias)$/i
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3983
			&& $romfile !~ /^sys\\bin\\/i
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3984
			&& $romfile !~ /^sys\/bin/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3985
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3986
			# for multilinguify 'alias'es (generally resource files) 'MustBeSysBin' should not be enforced.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3987
			if(defined($multiLinguifyAlias{$pcfile})) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3988
				return $line;  
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3989
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3990
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3991
			my $filename = "\/$romfile";	# in case no path is specified
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3992
			$filename = substr $filename, rindex($filename, "\/");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3993
			$romfile = "sys\/bin".$filename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3994
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3995
			if ($pcfile !~ /^sys\\bin\\/i
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3996
			    && $pcfile !~ /^sys\/bin/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3997
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3998
				my $pcfilename = "\/$pcfile";	# in case no path is specified
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  3999
				$pcfilename = substr $pcfilename, rindex($pcfilename, "\/");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4000
				$pcfile = "sys\/bin".$pcfilename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4001
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4002
			return "$type$variant $pcfile \t$romfile$tail\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4003
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4004
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4005
		if ($romfile !~ /^sys\\bin\\/i
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4006
		    && $romfile !~ /^sys\/bin/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4007
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4008
			my $filename = "\/$romfile";	# in case no path is specified
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4009
			$filename = substr $filename, rindex($filename, "\/");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4010
			$romfile = "sys\/bin".$filename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4011
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4012
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4013
	else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4014
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4015
 		if ($warnFlag && $romfile !~ /^sys\\bin\\/i && $romfile !~ /^sys\/bin/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4016
 		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4017
 			print "Warning: Outside standard path at \"$line\"\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4018
 		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4019
		if ($type =~ /^(alias)$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4020
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4021
			# Return the line as it is for non-MustBeSysBin 'alias'es.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4022
			return $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4023
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4024
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4025
	$romfiles{$romfile} = $variant.$pcfile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4026
	return "$type$variant=$pcfile \t\"$romfile\"$tail\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4027
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4028
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4029
my @hidearray;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4030
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4031
sub mark
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4032
{ # function to mark files in ROMs as hidden
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4033
	my ($base,$ext) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4034
	my $i=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4035
	my @coreimagerange = (-1,-1); #coreimagerange stores the places within @hidearray where the $base files start and end
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4036
	my @extensionimagerange = (-1,-1); #extensionimagerange stores the places within @hidearray where the $ext files start and end
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4037
	for(my $i=0;$i<scalar @hidearray;$i++) { #loop sets values in @coreimagerange and in @extensionimagerange
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4038
		if($hidearray[$i]{rom}==$base) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4039
			if($coreimagerange[0]<0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4040
				$coreimagerange[0]=$i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4041
				$coreimagerange[1]=$i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4042
			} else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4043
				$coreimagerange[1]=$i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4044
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4045
		} elsif($hidearray[$i]{rom}==$ext) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4046
			if($extensionimagerange[0]<0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4047
				$extensionimagerange[0]=$i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4048
				$extensionimagerange[1]=$i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4049
			} else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4050
				$extensionimagerange[1]=$i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4051
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4052
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4053
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4054
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4055
	for(my $i=$extensionimagerange[0];$i<=$extensionimagerange[1];$i++) { #loop marks files which need to be hidden based on the values in @coreimagerange and in @extensionimagerange
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4056
		for(my $j=$coreimagerange[0];$j<=$coreimagerange[1];$j++) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4057
			if($hidearray[$i]{dest} eq $hidearray[$j]{dest}) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4058
				$hidearray[$i]{hide}=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4059
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4060
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4061
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4062
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4063
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4064
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4065
#----------------------------------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4066
# Cleaning phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4067
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4068
# Remove "REM defined", "REM handled"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4069
# Remove the "# lineno" information
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4070
# Collapse multiple blank lines
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4071
# Apply the PlatSecEnforceSysBin setting
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4072
# Produce ROM directory listing
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4073
# Identify the ROM image name
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4074
sub cleaning_phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4075
{	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4076
	my $romname;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4077
	my $skippingBlanks=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4078
	undef @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4079
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4080
    if($opt_v)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4081
    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4082
	  my $logWin = $thisdir."logwin.oby";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4083
	  my $logLinux = $thisdir."loglinux.oby";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4084
	  unlink($logWin);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4085
	  unlink($logLinux);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4086
	  open LOGWIN, ">$logWin" or die("* Can't create $logWin\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4087
	  open LOGLINUX, ">$logLinux" or die("* Can't create $logLinux\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4088
    }	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4089
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4090
	foreach $line (@obydata)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4091
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4092
		track_source($line);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4093
		if ($line=~/^REM (defined|handled)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4094
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4095
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4096
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4097
		if ($line=~/^# (\d+) "(.*)"/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4098
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4099
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4100
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4101
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4102
		# Blank line compression
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4103
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4104
		if ($line=~/^\s*$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4105
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4106
			if ($skippingBlanks==1)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4107
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4108
				next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4109
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4110
			$skippingBlanks=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4111
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4112
		else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4113
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4114
			$skippingBlanks=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4115
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4116
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4117
		# Track ROMNAME, allowing overrides
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4118
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4119
		if ($line=~/romname\s*[=\s]\s*"?(\S+)\.(\S+)"?\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4120
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4121
			if ($romname ne "" && $opt_o eq "")
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4122
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4123
				print_source_error("Overrides previous ROM name $romname");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4124
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4125
			$rombasename = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4126
			$romname = "$1.$2";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4127
			if ($opt_workdir)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4128
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4129
				$rombasename = $thisdir.$rombasename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4130
				$romname = $thisdir.$romname;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4131
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4132
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4133
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4134
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4135
		# ROM directory listing
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4136
		#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4137
		    my $newline = reformat_line($line);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4138
	    if( ($newline !~ /^\s*TIME\s*=\s*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4139
  	      &&($newline !~ /^\s*volume\s*=.*/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4140
	      &&($newline !~ /^\s*kerneltrace\s*=.*/i))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4141
	    {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4142
	        my $tmpline = $newline;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4143
	        if(&is_windows)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4144
	        {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4145
	          $newline =~ s-\/-\\-go;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4146
	          if($opt_v)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4147
	          {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4148
                print LOGWIN $newline;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4149
	            $tmpline =~ s-\\-\/-go;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4150
	            print LOGLINUX $tmpline;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4151
	          }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4152
	        }else #unix os
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4153
	        {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4154
	          $newline =~ s-\\-\/-go;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4155
	          if($opt_v)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4156
	          {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4157
	            print LOGLINUX $newline;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4158
	            $tmpline =~ s-\/-\\-go;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4159
	            print LOGWIN $tmpline;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4160
	          }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4161
	        }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4162
	    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4163
	    
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4164
		push @newobydata, $newline;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4165
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4166
	if($opt_v)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4167
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4168
	  close LOGWIN;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4169
	  close LOGLINUX;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4170
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4171
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4172
	exit(1) if($errors && $strict);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4173
	# Handle ROMNAME and possible -o override
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4174
	if ($opt_o ne "")
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4175
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4176
		if ($opt_workdir && $opt_o !~ /^[\\\/]/ && $opt_o !~ /^.:/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4177
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4178
			$opt_o = $thisdir.$opt_o;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4179
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4180
		if (&is_windows)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4181
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4182
			$opt_o =~ s-\/-\\-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4183
		}else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4184
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4185
			$opt_o =~ s-\\-\/-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4186
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4187
		$romname=$opt_o;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4188
		if ($opt_o=~/(\S+)\.(\S+)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4189
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4190
			$rombasename=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4191
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4192
		else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4193
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4194
			$rombasename=$romname;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4195
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4196
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4197
	if(!$onlysmrimage)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4198
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4199
		unshift @newobydata, "romname=$romname\n";	# first line of final OBY file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4200
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4201
	@obydata = @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4202
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4203
	print "* Removing previous image and logs...\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4204
	unlink glob("$rombasename.*");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4205
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4206
	my $obyrecordline;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4207
	if($createspi) {# section added to mark SPI files in core images as hidden (if appropriate) if extension ROMs are being produced
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4208
		my $imagenum=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4209
		my $count=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4210
		foreach my $line (@obydata) { # fill @hidearray with all file= or data= entries from @obydata, recording which image they are in and their target destination
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4211
			if($line =~/^\s*(file|data)\s*=\s*(\S+)\s+(\S+)\s*$/gi) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4212
				$hidearray[$count] = {rom=>$imagenum, type=>$1, dest=>$3};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4213
				$hidearray[$count]{dest} =~s/\"//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4214
				$count++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4215
			} elsif($line =~/^\s*REM\s+ROM_IMAGE\[(\d)\]\s*$/i ) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4216
				$imagenum=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4217
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4218
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4219
		for(my $i=0;$i<8;$i++) { #loop to mark files in @hidearray as hidden, does not add the hide= lines to the obey files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4220
			if($romimage[$i]{extension}) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4221
				mark($i-1,$i);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4222
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4223
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4224
		undef @newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4225
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4226
		my $hideflag=0; # is set to 1 if there are files which need to be hidden, determines whether to run next section of code 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4227
		for(my $i=0;$i<scalar @hidearray;$i++) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4228
			if($hidearray[$i]{hide}==1) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4229
				$hideflag=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4230
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4231
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4232
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4233
		my $obeyrom=0;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4234
		if($hideflag) { #if there exist files which need hiding
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4235
			my $i=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4236
			my $exitflag=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4237
			$obyrecordline=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4238
			for(;$obyrecordline<scalar @obydata && !$exitflag;) { # nested for loops produce new obey file in @newobydata, including hide= lines
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4239
				print "Line = $obyrecordline $i " . scalar @hidearray . "\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4240
				if($i==scalar @hidearray) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4241
					$exitflag=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4242
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4243
				for(;$i<scalar @hidearray;$i++) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4244
					if($hidearray[$i]{hide}==1) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4245
						my $rom=$hidearray[$i]{rom};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4246
						my $destination=$hidearray[$i]{dest};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4247
						while($obeyrom<$rom && $obyrecordline<scalar @obydata) { #pushes lines to @newobydata until specified rom is reached
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4248
							push @newobydata, $obydata[$obyrecordline];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4249
							if($obydata[$obyrecordline] =~/^\s*REM\s+ROM_IMAGE\[(\d)\]\s*$/i){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4250
								$obeyrom=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4251
							}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4252
							$obyrecordline++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4253
						}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4254
						my $flag=1; #get to here when $obeyrom==$rom
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4255
						while($flag && $obyrecordline<scalar @obydata) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4256
							$destination=~s|\\|/|g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4257
							my $obyline=$obydata[$obyrecordline];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4258
							$obyline=~s|\\|/|g;			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4259
							if($obyline=~m/$destination/) { # if the line in the obeyfile matches the destination of the specified spi file then a hide= line is added before the spi file's data= line
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4260
								push @newobydata, "hide=$hidearray[$i]{dest}\n$obydata[$obyrecordline]";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4261
								$obyrecordline++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4262
								$flag=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4263
							} else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4264
								push @newobydata, $obydata[$obyrecordline++];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4265
							}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4266
						}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4267
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4268
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4269
			}		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4270
		}		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4271
		while($obyrecordline< scalar @obydata) { # add the rest of the lines from @obydata to @newobydata
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4272
			push @newobydata, $obydata[$obyrecordline++];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4273
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4274
		@obydata=@newobydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4275
		undef @newobydata;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4276
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4277
	dump_obydata("tmp9.oby", "result of cleaning phase") if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4278
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4279
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4280
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4281
#----------------------------------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4282
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4283
# Divide the oby file into multiple sections - one for each rom image - ready
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4284
# for the appropriate rom builder.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4285
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4286
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4287
sub generate_romheader
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4288
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4289
	my ($idx) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4290
	if ($romimage[$idx]{xip} ne 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4291
	{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4292
		my $header = "\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4293
		if ($romimage[$idx]{extension})
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4294
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4295
			$header = "extensionrom=$rombasename.$romimage[$idx]{name}.img\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4296
			$header .= "romsize=$romimage[$idx]{size}\n\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4297
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4298
		return $header; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4299
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4300
	# non-xip
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4301
	my $header;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4302
	if ($romimage[$idx]{extension})
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4303
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4304
		$header =  "extensionrofs=$rombasename.$romimage[$idx]{name}.img\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4305
		$header .= "rofssize=$romimage[$idx]{size}\n\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4306
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4307
	else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4308
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4309
		$header="rofsname=$rombasename.$romimage[$idx]{name}.img\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4310
		$header .= "rofssize=$romimage[$idx]{size}\n\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4311
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4312
	return $header;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4313
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4314
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4315
#----------------------------------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4316
# Dump OBY file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4317
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4318
# Creates final OBY file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4319
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4320
sub create_dumpfile
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4321
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4322
	my $romimageidx;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4323
	my $smrimageidx = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4324
	my $dumpfile="$rombasename";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4325
	$romimage[0]{obeyfile}=$dumpfile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4326
	$dumpfile .= ".oby";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4327
	unlink($dumpfile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4328
	if($rombasename && !$onlysmrimage)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4329
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4330
		open DUMPFILE, ">$dumpfile" or die("* Can't create $dumpfile\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4331
		print "* Writing $dumpfile - final OBY file\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4332
		$romimageidx=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4333
		print DUMPFILE generate_romheader($romimageidx);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4334
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4335
	foreach $line (@obydata)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4336
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4337
		if ($line =~ /^\s*REM ROM_IMAGE\[(\d+)\]\s+(.*)$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4338
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4339
			$romimageidx=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4340
			if ($romimage[$romimageidx]{extension} eq '0')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4341
			{ # next rom oby file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4342
				close DUMPFILE;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4343
				$dumpfile="$rombasename.$romimage[$romimageidx]{name}";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4344
				$romimage[$romimageidx]{obeyfile}=$dumpfile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4345
				$dumpfile .= ".oby";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4346
				open DUMPFILE, ">$dumpfile" or die("* Can't create $dumpfile\n");		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4347
				print "* Writing $dumpfile - final OBY file\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4348
				# header
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4349
				print DUMPFILE $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4350
				print DUMPFILE generate_romheader($romimageidx);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4351
				next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4352
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4353
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4354
			{ # extension
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4355
				# header
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4356
				print DUMPFILE $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4357
				print DUMPFILE generate_romheader($romimageidx);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4358
				next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4359
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4360
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4361
		# write data drive oby file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4362
		elsif ($line =~ /^\s*REM DATA_IMAGE\[(\d+)\]\s+(.*)$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4363
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4364
				my $dataimageidx=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4365
				close DUMPFILE;
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  4366
				my $name = $datadriveimage[$dataimageidx]{name};
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  4367
				if ($name !~ /^.:/ && $name !~ /^[\\\/]/)
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  4368
				{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  4369
					$datadriveimage[$dataimageidx]{name} = $thisdir.$name;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  4370
				}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4371
				$dumpfile="$datadriveimage[$dataimageidx]{name}";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4372
				$datadriveimage[$dataimageidx]{obeyfile}=$dumpfile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4373
				$dumpfile .= ".oby";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4374
				open DUMPFILE, ">$dumpfile" or die("* Can't create $dumpfile\n");		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4375
				print "* Writing $dumpfile - intermediate OBY file\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4376
				# header
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4377
				print DUMPFILE $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4378
				print DUMPFILE generate_datadriveheader($dataimageidx,\@datadriveimage);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4379
				push(@dataDriveFileList,$dumpfile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4380
				next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4381
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4382
		elsif ($line =~ /^\s*REM SMR_IMAGE\s*$/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4383
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4384
			close DUMPFILE;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4385
			$dumpfile = $obeyFileList[$smrimageidx];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4386
			$smrimageidx++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4387
			$dumpfile .= ".oby";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4388
			open DUMPFILE, ">$dumpfile" or die("* Can't create $dumpfile\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4389
			print "*Writing $dumpfile - intermediate OBY file\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4390
			print DUMPFILE $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4391
			push(@smrImageFileList, $dumpfile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4392
			next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4393
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4394
		print DUMPFILE $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4395
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4396
	close DUMPFILE;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4397
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4398
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4399
#----------------------------------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4400
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4401
# Full ROM directory listing - use case-insensitive sort
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4402
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4403
sub create_dirlisting
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4404
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4405
	if($rombasename)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4406
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4407
		print "* Writing $rombasename.dir - ROM directory listing\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4408
		open DIRFILE, ">$rombasename.dir" or die("* Can't create ROM directory listing\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4409
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4410
		my $file;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4411
		my $prevdir = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4412
		foreach $file (sort {uc($a) cmp uc($b)} keys %romfiles)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4413
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4414
			my $dir = substr $file,0,rindex($file, "\/");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4415
			if (uc $dir ne uc $prevdir)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4416
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4417
				$prevdir = $dir;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4418
				print DIRFILE "\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4419
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4420
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4421
			my @sources = split /\n/,$romfiles{$file};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4422
			printf DIRFILE "%-40s\t%s\n", $file, shift @sources;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4423
			while (@sources)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4424
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4425
				printf DIRFILE "%39s+\t%s\n", "", shift @sources;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4426
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4427
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4428
		close DIRFILE;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4429
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4430
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4431
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4432
#----------------------------------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4433
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4434
# Suppress Rom/Rofs/DataDrive Image creation if "-noimage" option is provided.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4435
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4436
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4437
sub suppress_image_generation
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4438
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4439
	if($noimage) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4440
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4441
		&tidy_exit;		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4442
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4443
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4444
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4445
#----------------------------------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4446
# Execute rombuild & maksym for each final XIP OBY file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4447
# Execute rofsbuild for each non-XIP oby file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4448
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4449
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4450
sub run_rombuilder
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4451
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4452
	my ($command, $obeyfile, $logfile) = @_;
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  4453
	$command .= " -logfile=$logfile $obeyfile.oby";
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4454
	#CR1258 test cases are depending on the following output.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4455
	print "* Executing $command\n" if ($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4456
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4457
	open DATA, "$command 2>&1 |"   or die "Couldn't execute command: $command";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4458
	while ( defined( my $line = <DATA> ) ) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4459
	chomp($line);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4460
	print "$line\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4461
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4462
	close DATA;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4463
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4464
	if ($? != 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4465
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4466
		$errors++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4467
		$command =~ /^\s*(\S+)\s+-slog/;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4468
		print "* $1 failed\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4469
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4470
	else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4471
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4472
		push(@romImages,$obeyfile.".img");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4473
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4474
	print "\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4475
	rename "$logfile","$obeyfile.log" or die("* Can't rename $logfile\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4476
	exit(1) if ($errors);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4477
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4478
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4479
#----------------------------------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4480
# ROMBUILD AND ROFSBUILD
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4481
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4482
# Invokes rombuild and rofsbuild.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4483
# Creates .log, .symbol files.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4484
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4485
sub invoke_rombuild
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4486
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4487
	#For CR1258, -compress command line option is introduced, and it's being handled as following
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4488
	my $rom_compression_type;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4489
	if($opt_compression_type eq ALLSECTIONS)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4490
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4491
		$rom_compression_type = "-compress";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4492
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4493
	elsif($opt_compression_type eq PAGEDSECTION)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4494
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4495
		$rom_compression_type = "-compress=paged";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4496
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4497
	elsif($opt_compression_type eq UNPAGEDSECTION)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4498
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4499
		$rom_compression_type = "-compress=unpaged";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4500
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4501
	else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4502
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4503
		$rom_compression_type = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4504
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4505
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4506
	#Compose command line options for Cache.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4507
	my $cache_options;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4508
	if($opt_cache == 1)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4509
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4510
		$cache_options = "-cache ";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4511
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4512
	if($opt_nocache == 1)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4513
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4514
		$cache_options .= "-nocache ";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4515
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4516
	if($opt_cleancache == 1)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4517
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4518
		$cache_options .= "-cleancache";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4519
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4520
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4521
	my $rombuild;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4522
	if(!$geninc)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4523
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4524
		$rombuild = "rombuild -slog $rom_compression_type $logLevel $lowMem $opt_jobs";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4525
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4526
	else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4527
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4528
		$rombuild = "rombuild -slog $rom_compression_type -geninc $logLevel $lowMem $opt_jobs";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4529
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4530
	if($gendep)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4531
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4532
		$rombuild .= " -gendep";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4533
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4534
	$rombuild .= " -k" if($opt_k);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4535
	my $rofsbuild = "rofsbuild -slog $logLevel $lowMem $opt_jobs $cache_options";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4536
	foreach my $arg (keys %rombuildOptions)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4537
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4538
		$rombuild .= " $arg";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4539
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4540
	$rofsbuild .= " -k" if($opt_k);        
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4541
	for (my $romidx=0; $romidx<8; $romidx++)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4542
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4543
		my $obeyfile=$romimage[$romidx]{obeyfile};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4544
		my $xip=$romimage[$romidx]{xip};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4545
		my $compress=$romimage[$romidx]{compress};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4546
		my $uncompress=$romimage[$romidx]{uncompress};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4547
		if ($obeyfile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4548
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4549
			if(!defined $opt_compression)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4550
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4551
				if ($compress ne 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4552
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4553
					$compress=" -compress";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4554
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4555
				elsif($uncompress ne 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4556
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4557
					$compress=" -uncompress";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4558
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4559
 				elsif($compress eq 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4560
 				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4561
 					$compress=" ";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4562
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4563
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4564
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4565
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4566
				$compress = $opt_compression;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4567
				$compress =~m/\s-(compression)(method)\s(none|inflate|bytepair)/;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4568
				print "* ".$1." ".$2.": ".$3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4569
			}                        
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4570
			if ($xip)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4571
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4572
				is_existinpath("rombuild", romutl::DIE_NOT_FOUND);
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4573
				unless($nosymbols)
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4574
				{
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4575
					if($bsymbols)
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4576
					{
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4577
						$rombuild .= " -bsymbols";
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4578
					}
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4579
					else
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4580
					{
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4581
						$rombuild .= " -symbols";
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4582
					}
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4583
				}
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  4584
				run_rombuilder($rombuild.$compress, $obeyfile, $thisdir."ROMBUILD.LOG");
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4585
			}
633
a4eca1f021ac ROMTools-13.1.0.2
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
  4586
			elsif($opt_xiponly == 0)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4587
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4588
				# efficient_rom_paging.pm can move everything to core rom.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4589
				# If that is the case, don't run rofsbuild at all to avoid errors.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4590
			#	use constant TRUE => 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4591
			#	use constant FALSE => 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4592
				my $run_rofs_build = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4593
				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4594
				open OBYFILE, "$obeyfile.oby";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4595
				for (<OBYFILE>)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4596
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4597
					if (is_oby_statement($_))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4598
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4599
						$run_rofs_build = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4600
						last;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4601
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4602
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4603
				close OBYFILE;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4604
				if ($run_rofs_build)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4605
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4606
					is_existinpath("rofsbuild", romutl::DIE_NOT_FOUND);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4607
					if(!$nosymbols)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4608
					{
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4609
						if($bsymbols)
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4610
						{
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4611
							$rofsbuild .= " -bsymbols";
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4612
						}
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4613
						else
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4614
						{
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4615
						$rofsbuild .= " -symbols";
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 713
diff changeset
  4616
						}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4617
					}			
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  4618
					run_rombuilder($rofsbuild.$compress, $obeyfile, $thisdir."ROFSBUILD.LOG");
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4619
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4620
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4621
			unlink "rombuild.log";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4622
			unlink "maksym.out";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4623
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4624
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4625
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4626
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4627
#-------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4628
# Subroutine: check if current statement is a valid oby statement
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4629
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4630
sub is_oby_statement
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4631
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4632
	my ($li) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4633
	if ($li =~ /\s*data\s*=/) { return 1;}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4634
	if ($li =~ /\s*file\s*=/) { return 1;}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4635
	if ($li =~ /\s*dll\s*=/) { return 1;}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4636
	if ($li =~ /\s*secondary\s*=/) { return 1;}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4637
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4638
	return 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4639
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4640
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4641
#-------------------------------------------------------
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4642
# Subroutine: convert possibly absolute path into relative path
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4643
#
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4644
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4645
sub relative_path
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4646
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4647
    my ($arg) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4648
    return $arg if ($arg !~ /^\//);	# not an absolute path
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4649
    if ($uppath eq "x")
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4650
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4651
		$uppath=cwd;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4652
		$uppath=~s-\\-\/-go;		    # separator from Perl 5.005_02+ is forward slash
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4653
		$uppath=~s-^(.*[^\/])$-$1\/-o;	    # ensure path ends with a backslash
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4654
		$uppath=~s-\/([^\/]+)-\/..-og;	    # convert directories into ..
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4655
		$uppath=~s-^.:\/--o;		    # remove drive letter and leading backslash
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4656
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4657
    $arg=~s-^\/--o;	# remove leading backslash from original path
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4658
    return "$uppath$arg";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4659
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4660
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4661
# Returns the global @obydata reference to support external tool invocation.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4662
sub getOBYDataRef{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4663
	return \@obydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4664
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4665
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4666
#Match the blank or the comment
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4667
sub isobystatement
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4668
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4669
	my ($l) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4670
	if ($l !~ /=/) { 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4671
		return 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4672
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4673
	return 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4674
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4675
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4676
#Match the data statements
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4677
sub isdatastatement {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4678
	my ($l) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4679
	if ($l !~ /data=/) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4680
	{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4681
		return 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4682
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4683
	return 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4684
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4685
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4686
#Match the spidata statements
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4687
sub isspidatastatement {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4688
	my ($l) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4689
	if ($l !~ /spidata=/) { 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4690
		return 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4691
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4692
	return 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4693
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4694
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4695
#Match the executable statements
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4696
sub isexecutablefile {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4697
	my ($l) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4698
	if (($l=~/file=/)||($l=~/dll=/)||($l=~/primary=/)||($l=~/secondary=/)||($l=~/variant=/)||($l=~/device=/)||($l=~/extension=/)){ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4699
		return 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4700
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4701
	return 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4702
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4703
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4704
#Match the directory metadata statements
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4705
sub isdirectorymetadata {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4706
	my ($l) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4707
	if (($l=~/hide=/) || ($l=~/rename=/) || ($l=~/alias=/)){ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4708
		return 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4709
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4710
	return 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4711
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4712
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4713
#Match the bitmap statements
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4714
sub isbitmap {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4715
	my ($l) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4716
	if ($l=~/bitmap=/){ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4717
		return 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4718
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4719
	return 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4720
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4721
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4722
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4723
#Match the aif file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4724
sub isaif {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4725
	my ($l) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4726
	if ($l=~/(.*)\.aif/){ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4727
		return 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4728
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4729
	return 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4730
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4731
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4732
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4733
#Match the resource file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4734
sub isresource {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4735
	my ($l) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4736
	if ($l=~/(.*)\.rsc/){ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4737
		return 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4738
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4739
	return 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4740
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4741
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4742
#Returns the executable extensions
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4743
sub executableextension {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4744
	my ($l) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4745
	if ($l=~/file=(.*)\.exe$/){ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4746
		return "exe";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4747
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4748
	elsif ($l=~/file=(.*)\.dll$/){ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4749
		return "dll";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4750
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4751
	elsif ($l=~/file=(.*)\.ldd$/){ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4752
		return "ldd";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4753
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4754
	elsif ($l=~/file=(.*)\.fsy$/){ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4755
		return "fsy";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4756
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4757
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4758
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4759
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4760
#Returns all 3 UIDS
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4761
sub executabletype {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4762
	my ($l) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4763
	my $uid1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4764
	my $uid2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4765
	my $uid3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4766
	if ($l=~/uid1\s(0x[\d]*)/){ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4767
		$uid1=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4768
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4769
	if ($l=~/uid2\s(0x[\d]*)/){ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4770
		$uid2=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4771
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4772
	if ($l=~/uid3\s(0x[\d]*)/){ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4773
		$uid3=$1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4774
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4775
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4776
	return $uid1." ".$uid2." ".$uid3."\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4777
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4778
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4779
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4780
#Return source file name
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4781
sub getSourceFile {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4782
	my ($line) = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4783
	if ($line=~/(\w*=)(\S*\s+\S*)\s+(\S*)\s+(\S*)?/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4784
		return $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4785
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4786
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4787
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4788
#Return destination file name
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4789
sub getDestFile{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4790
	my ($line) = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4791
	if ($line=~/(\w*=)(\S*\s+\S*)\s+(\S*)\s+(\S*)?/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4792
		return $3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4793
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4794
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4795
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4796
#Return the obycommand attributes
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4797
sub getOBYAttributes{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4798
	my ($line) = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4799
	if ($line=~/(\w*=)(\S*\s+\S*)\s+(\S*)\s+(\S*)?/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4800
		return $4;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4801
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4802
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4803
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4804
#Return the hardware variant delimiter
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4805
sub getHardwareVariant{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4806
	my ($line) = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4807
	if ($line=~/(\w*[0x[\d]*]=)/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4808
		return $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4809
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4810
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4811
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4812
#Return the hardware variant delimiter
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4813
sub getObyCommand{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4814
	my ($line) = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4815
	if ($line=~/^[data=]/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4816
		return "data";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4817
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4818
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4819
	if ($line=~/^[file=]/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4820
		return "file";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4821
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4822
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4823
	if ($line=~/^[dll=]/) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4824
		return "dll";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4825
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4826
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4827
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4828
# Initialize the symbol info within the given DLL.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4829
sub AddDllDataInfo
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4830
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4831
	my ($line) = @_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4832
	# syntax "<DLLname>@<symbolname> <newvalue>"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4833
	if($line =~ /^\s*(\S+)\s*\@\s*(\S+)\s+(\S+)\s*$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4834
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4835
		my $dllName = lc ($1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4836
		my $symbolname = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4837
		my $intVal = $3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4838
		my $newVal = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4839
		if($intVal =~ /^0x([0-9a-fA-F]+)$/){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4840
		$newVal = hex($1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4841
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4842
		elsif($intVal =~ /^(-\d+)$/ or $intVal =~ /^(\d+)$/){		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4843
			$newVal = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4844
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4845
		else{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4846
 			print "ERROR: Invalid patchable value at \"$line\"\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4847
 			$errors++ if($strict);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4848
 			return 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4849
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4850
		$symbolname =~ s/:(\d+)\[(0x)?[0-9a-f]+\]$//i;	# Remove array element specification (:ELEMENT_BIT_SIZE[INDEX]) to get symbol name
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4851
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4852
		my $DllMapRef = \%{$DllDataMap{$dllName}};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4853
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4854
		my %DllSymInfo = ();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4855
		$DllSymInfo{ordinal}	= undef;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4856
		$DllSymInfo{dataAddr}	= undef;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4857
		$DllSymInfo{size}		= undef;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4858
		# We don't store the value here, since patchdata can be used on an array,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4859
		# in which case we'll create another one of these, and lose the value.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4860
		# Instead, the value is retrieved by re-parsing the command line later.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4861
		$DllSymInfo{lineno}		= $sourceline;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4862
		$DllSymInfo{obyfilename}= $sourcefile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4863
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4864
		$DllMapRef->{$symbolname} = \%DllSymInfo;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4865
		return 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4866
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4867
		return 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4868
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4869
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4870
sub process_dlldata
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4871
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4872
	if(!$patchDataStmtFlag){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4873
		return;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4874
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4875
	my $symbolTblEntry;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4876
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4877
	foreach my $dll (keys %DllDataMap){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4878
		my $DllMapRef = $DllDataMap{$dll};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4879
		if(!$DllMapRef->{srcfile}){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4880
		next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4881
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4882
		my $aDllFile = $DllMapRef->{srcfile};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4883
		my $SymbolCount = scalar ( keys %{$DllMapRef}) - 2; #The map has 'srcfile' and 'dstpath' special keys besides the symbols.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4884
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4885
		my $DllSymMapRef;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4886
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4887
		my @BPABIPlats = &get_bpabiplatlist;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4888
		my $matchedSymbols = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4889
		my $globalSyms = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4890
		my @platlist = &get_platlist;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4891
		my $platName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4892
		my $rootPlatName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4893
		my $plat = "armv5";				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4894
		$plat = &get_abiv2mode() ? $plat."_abiv1" : $plat."_abiv2";		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4895
706
5221386d044b external tools cannot specify path.
lorewang
parents: 697
diff changeset
  4896
		foreach my $plattmp(@platlist) 
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4897
		{
706
5221386d044b external tools cannot specify path.
lorewang
parents: 697
diff changeset
  4898
			if(($aDllFile =~ /[\/\\]($plattmp)[\/\\]/i) or ($aDllFile =~ /[\/\\]($plattmp)\.\w+[\/\\]/i ))
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4899
			{
706
5221386d044b external tools cannot specify path.
lorewang
parents: 697
diff changeset
  4900
				$platName = uc $1;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4901
				last;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4902
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4903
		}		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4904
		$rootPlatName =	&get_platcustomizes($platName) ? &get_platroot($platName) : $platName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4905
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4906
		# Map files will be referred for all ARM platforms, 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4907
		# and for BSF platforms which cutomizes ARM platforms.
706
5221386d044b external tools cannot specify path.
lorewang
parents: 697
diff changeset
  4908
		if($rootPlatName =~ /^(armv5|$plat)$/i){
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4909
			my $mapfile = "${aDllFile}.map";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4910
			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4911
			open MAPFILE, "$mapfile" or die "Can't open $mapfile\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4912
			while(<MAPFILE>){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4913
			my $line = $_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4914
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4915
				#Ignore Local symbols.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4916
				if(!$globalSyms){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4917
					if($line =~ /Global Symbols/){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4918
						$globalSyms = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4919
						next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4920
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4921
					else{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4922
						next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4923
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4924
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4925
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4926
				$symbolTblEntry = $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4927
				if($symbolTblEntry =~ /\s*(\S+)(?:\s+\(EXPORTED\))?\s+(\S+)\s+(\S+)\s+(\S+)\s+(.*)/){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4928
					my $symbol		= $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4929
					my $symbolValue = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4930
					my $data		= $3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4931
					my $symbolSz	= $4;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4932
					if(!exists $DllMapRef->{$symbol}){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4933
						next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4934
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4935
					$DllSymMapRef = $DllMapRef->{$symbol};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4936
					if($data =~ /Data/){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4937
					# Valid
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4938
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4939
					else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4940
					#	Invalid to patch a code symbol.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4941
						print( "$DllSymMapRef->{obyfilename}($DllSymMapRef->{lineno}): Warning: $symbol is not a data Symbol.Ignoring patch statement.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4942
						$errors++ if($strict);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4943
						$DllMapRef->{$symbol} = undef;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4944
						next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4945
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4946
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4947
					
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4948
					# Record the address and the size of the symbol.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4949
					$DllSymMapRef->{dataAddr} = $symbolValue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4950
					$DllSymMapRef->{size} = $symbolSz;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4951
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4952
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4953
					$matchedSymbols++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4954
					if( $matchedSymbols >= $SymbolCount){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4955
						last;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4956
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4957
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4958
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4959
			close MAPFILE;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4960
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4961
		# DSO files will be referred for BPABI platforms(excluding ARM platforms),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4962
		# and for BSF platforms which cutomizes BPABI platforms.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4963
		else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4964
			my $abiDir = undef;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4965
			foreach my $bpabi (@BPABIPlats){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4966
				if($rootPlatName =~ /^$bpabi$/i){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4967
					$abiDir = $platName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4968
					last;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4969
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4970
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4971
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4972
			if(!defined $abiDir){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4973
				print("Can't locate the map or proxy dso file for $aDllFile\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4974
				$errors++ if($strict);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4975
				next; #go to the next patch dll data statement
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4976
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4977
			if( $aDllFile =~ /(.*)\.[^.]+$/ ){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4978
				my $proxydsofile = "$1.dso";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4979
				$proxydsofile =~ s-$abiDir\/(.*)\/-armv5\/lib\/-ig;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4980
				open PIPE, "getexports -d $proxydsofile|" or die "Can't open file $proxydsofile\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4981
				while (<PIPE>){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4982
					my $line = $_;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4983
					if($line =~ /\s*(\S+)\s+(\d+)\s+((\S+)\s+(\d+))?/){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4984
						my $symbol = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4985
						my $ordinal = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4986
						my $data = $3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4987
						my $symbolSz = $5;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4988
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4989
						if(!$data){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4990
							next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4991
						}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4992
						if(!exists $DllMapRef->{$symbol}){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4993
							next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4994
						}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4995
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4996
						$DllSymMapRef = $DllMapRef->{$symbol};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4997
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4998
						# Record the ordinal and the size of the symbol.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  4999
						$DllSymMapRef->{ordinal} = $ordinal;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5000
						$DllSymMapRef->{size} = $symbolSz;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5001
						$matchedSymbols++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5002
						if( $matchedSymbols >= $SymbolCount){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5003
						last;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5004
						}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5005
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5006
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5007
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5008
				close PIPE;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5009
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5010
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5011
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5012
	exit(1) if ($errors && $strict ) ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5013
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5014
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5015
# make sure that all the absolute feature variant paths include a
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5016
# drive letter. This is required because cpp will not work with
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5017
# absolute paths starting with slashes.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5018
sub addDrivesToFeatureVariantPaths
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5019
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5020
	return unless $featureVariant{'VALID'};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5021
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5022
	my $current = &get_epocdrive;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5023
	my $drive = $1 if ($current =~ /^(.:)/);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5024
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5025
	# pre-include file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5026
	my $HRH = $featureVariant{'VARIANT_HRH'};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5027
	$featureVariant{'VARIANT_HRH'} = $drive . $HRH if ($HRH =~ /^[\\\/]/);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5028
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5029
	# ROM include path
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5030
	my $dirRef = $featureVariant{'ROM_INCLUDES'};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5031
	return unless $dirRef;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5032
	my $i = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5033
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5034
	foreach my $dir (@$dirRef)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5035
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5036
		$$dirRef[$i] = $drive . $dir if ($dir =~ /^[\\\/]/);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5037
		$i++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5038
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5039
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5040
sub create_smrimage
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5041
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5042
	if($needSmrImage)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5043
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5044
		foreach my $oby (@obeyFileList)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5045
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5046
			is_existinpath("rofsbuild", romutl::ERROR_NOT_FOUND);
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  5047
			my $command = "rofsbuild -slog -smr=$oby.oby -logfile=$thisdir";
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  5048
			$command .= " -k" if($opt_k);      
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5049
			print "* Executing $command\n" if($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5050
			system($command);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5051
			if($? != 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5052
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5053
				print("* ROFSBUILD failed to generate SMR IMAGE\n") if($opt_v);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5054
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5055
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5056
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5057
				push(@smrImageFileList, $oby.".img");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5058
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5059
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5060
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5061
	if(@smrImageFileList)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5062
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5063
		print "\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5064
		print "-------------------------------------------------------\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5065
		print "| List of file(s) generated pertaining to SMR image |\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5066
		print "-------------------------------------------------------\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5067
		my $arraySize = scalar(@smrImageFileList);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5068
		for(my $i=0; $i < $arraySize; $i++)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5069
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5070
			my $element = shift(@smrImageFileList);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5071
			my $size = -s $element;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5072
			print "Size = ".$size." bytes"."\t"."File = ".$element."\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5073
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5074
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5075
	foreach my $errSmr (keys(%smrNameInfo))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5076
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5077
		if($smrNameInfo{$errSmr} > 1)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5078
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5079
			print "\n SMR image: $errSmr.img creating error for duplicated names!\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5080
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5081
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5082
	if($smrNoImageName)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5083
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5084
		print "\n SMR image creating error for empty image name!\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5085
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5086
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5087
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5088
sub getWorkdir
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5089
{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5090
	return $thisdir;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5091
}
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5092
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  5093
sub isIgnoreConfig
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  5094
{
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  5095
	return $ignoreconfig;
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  5096
}
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 633
diff changeset
  5097
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5098
sub find_stdcpp
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5099
{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5100
    return "cpp" if (!$stdcpp);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5101
    return "cpp" if (&is_linux);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5102
    
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5103
    my $delimiter = &env_delimiter;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5104
		$ENV{PATH}="${epocroot}epoc32\/gcc_mingw\/bin$delimiter".$ENV{PATH};
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5105
    my @paths;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5106
 		@paths = split(/$delimiter/, $ENV{PATH});
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5107
    unshift @paths, "\.";
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5108
    
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5109
    foreach my $path (@paths)
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5110
    {
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5111
        next if ($path =~ /^\s*$/);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5112
        chomp $path;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5113
        $path =~ s/\\/\//g;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5114
        $path .= "\/" unless ($path =~ /\/$/);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5115
        $path = $path."cpp.exe";
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5116
        if (-e $path)
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5117
        {
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5118
		        $path = "\"$path\"";
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5119
        		my $command = "$path --version 2>&1";
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5120
						open DATA, "$command |"   or die "Couldn't execute command: $command\n";
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5121
						my $line = <DATA>;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5122
						chomp($line);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5123
						print "$line\n" if($opt_v);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5124
						if ($line =~ /cpp\.exe \(GCC\) .* \(mingw special\)/)
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5125
						{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5126
							print "found stdcpp in $path\n" if($opt_v);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5127
							close DATA;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5128
							return $path;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5129
						}
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5130
						close DATA;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5131
        }
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5132
    }
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5133
    die "Error: Cannot found standard cpp.exe in the PATH.\n";
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5134
} 
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
  5135
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5136
sub checkcase()
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5137
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5138
	if (&is_windows)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5139
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5140
		my @checkcase_obydatatemp = @obydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5141
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5142
		# call the phase without external tools.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5143
		plugin_phase();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5144
		multlinguify_phase();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5145
		#spi_creation_phase(); #spi creation phase will delete some lines, so do not call this phase
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5146
		suppress_phase();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5147
		process_dlldata();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5148
		bitmap_aif_converison_phase();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5149
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5150
		my $checkcase_log = "checkcase.log";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5151
		unlink $checkcase_log;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5152
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5153
		open CHECKCASELOG, ">$checkcase_log" or die("* Can't create $checkcase_log\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5154
		my @checkcase_lines = @obydata;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5155
		my %checkcase_macro;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5156
		my @checkcase_macrodir;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5157
		my $checkcase_line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5158
		print CHECKCASELOG "======================Macro check part:======================\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5159
		foreach $checkcase_line (@checkcase_lines)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5160
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5161
			track_source($checkcase_line);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5162
			$checkcase_line =~ s-\/-\\-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5163
			$checkcase_line =~ s-\\\\-\\-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5164
			if ($checkcase_line =~ /^\s*REM\s*(re)?defined\s*(\w*)\s*as\s*(\S+)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5165
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5166
				my $checkcase_macrocontent = $3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5167
				my $checkcase_macroname = $2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5168
				if ($checkcase_macrocontent =~ /[a-zA-Z]/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5169
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5170
					$checkcase_macro{$checkcase_macroname} = $checkcase_macrocontent;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5171
					checkcase_macro(\@checkcase_macrodir, $checkcase_macroname, $checkcase_macrocontent);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5172
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5173
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5174
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5175
		print CHECKCASELOG "======================Macro check part end======================\n\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5176
		print CHECKCASELOG "======================File check part:======================\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5177
		foreach $checkcase_line (@checkcase_lines)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5178
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5179
			if ($checkcase_line =~ /^\s*REM\s*.*/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5180
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5181
				next;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5182
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5183
			if ($checkcase_line =~ /^\s*#\s*\d+\s*\"(\S+)\"\s*\d*\s*$/) #oby filename
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5184
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5185
				my $checkcase_whichfile = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5186
				checkcase_obyfilename($checkcase_whichfile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5187
				track_source($checkcase_line);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5188
			}elsif ($checkcase_line =~ /^\s*\S+\s*=\s*"([^"]+)"\s+\S*\s*/ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5189
					 || $checkcase_line =~ /^\s*\S+\s*=\s*(\S+)\s+\S*\s*/) #oby content file name
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5190
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5191
				my $checkcase_pcsidefile = $1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5192
				checkcase_pcsidefilename(\@checkcase_macrodir, $checkcase_pcsidefile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5193
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5194
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5195
		print CHECKCASELOG "======================File check part end======================\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5196
		close CHECKCASELOG;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5197
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5198
		@obydata = @checkcase_obydatatemp;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5199
	}else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5200
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5201
		print "WARNING: checkcase option is only valid on windows.\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5202
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5203
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5204
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5205
sub checkcase_macro()
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5206
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5207
	my $macrodir = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5208
	my $name = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5209
	my $content = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5210
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5211
	if ($content =~ /epoc32/i && (-d $content))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5212
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5213
		my $realdir = `directory.bat $content`;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5214
		$realdir =~ s/\s+$//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5215
		$realdir =~ s/^\s*\w://g if ($content !~ /^\w:/);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5216
		$realdir =~ s/\\$//g if ($content !~ /\\$/);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5217
		$realdir .= "\\" if ($content =~ /\\$/ && $realdir !~ /\\$/);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5218
		$sourcefile =~ s/\//\\/g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5219
		$sourcefile =~ s/\\\\/\\/g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5220
		if ($realdir ne $content)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5221
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5222
			print CHECKCASELOG "check case: macro name is $name\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5223
			print CHECKCASELOG "WARNING: macro case is not equal to real.\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5224
			print CHECKCASELOG "file name is $sourcefile\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5225
			print CHECKCASELOG "current is $content\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5226
			print CHECKCASELOG "expect  is $realdir\n\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5227
			checkcase_convert($sourcefile, $content, $realdir);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5228
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5229
		$content =~ s-\\-\\\\-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5230
		push @$macrodir, $content;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5231
	}else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5232
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5233
		if($name eq "PLATFORM_NAME")
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5234
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5235
			$content =~ s-\\-\\\\-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5236
			$content =~ s-\.-\\\.-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5237
			$checkcase_platform = $content;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5238
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5239
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5240
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5241
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5242
sub checkcase_obyfilename()
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5243
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5244
	my $checkfile = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5245
	if (-e $checkfile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5246
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5247
		while ($checkfile=~s-[\\](?!\.{2}\\)[^\\]*\\\.{2}(?=\\)--go){};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5248
		$sourcefile =~ s/\//\\/g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5249
		if ($checkfile eq $sourcefile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5250
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5251
			return;		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5252
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5253
		my($filename, $dir, $suffix) = fileparse($checkfile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5254
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5255
		my $realdir = `directory.bat $dir`;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5256
		$realdir =~ s/\s+$//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5257
		$realdir .= "\\" if ($realdir !~ /\\$/);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5258
		if ($realdir ne $dir)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5259
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5260
			print CHECKCASELOG "check case: oby file name is $checkfile\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5261
			print CHECKCASELOG "WARNING: dir case is not equal to real.\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5262
			my $tempsrcfile = $sourcefile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5263
			$tempsrcfile =~ s/\\\\/\\/g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5264
			print CHECKCASELOG "file name is $tempsrcfile\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5265
			print CHECKCASELOG "current is $dir\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5266
			print CHECKCASELOG "expect  is $realdir\n\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5267
			checkcase_convert($sourcefile, $dir, $realdir);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5268
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5269
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5270
		my $currentdir = cwd;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5271
		chdir "$dir";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5272
		my @realfile = `dir "$filename" 2>&1`;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5273
		my $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5274
		foreach $line (@realfile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5275
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5276
			if ($line =~ /^\s*(\S+)\s+(\d{2}:\d{2})\s+(PM|AM)?\s+([\d\,])+\s+([\S]+)\s*/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5277
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5278
				my $realfilename = $5;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5279
				my $filetemp = lc $filename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5280
				my $realtemp = lc $realfilename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5281
				if ($filetemp eq $realtemp && $realfilename ne $filename)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5282
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5283
					print CHECKCASELOG "check case: oby file name is $checkfile\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5284
					print CHECKCASELOG "WARNING: filename case is not equal to real.\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5285
					my $tempsrcfile = $sourcefile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5286
					$tempsrcfile =~ s/\\\\/\\/g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5287
					print CHECKCASELOG "file name is $tempsrcfile\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5288
					print CHECKCASELOG "current is $filename\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5289
					print CHECKCASELOG "expect  is $realfilename\n\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5290
					checkcase_convert($sourcefile, $filename, $realfilename);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5291
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5292
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5293
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5294
		chdir "$currentdir";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5295
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5296
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5297
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5298
sub checkcase_pcsidefilename()
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5299
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5300
	my $macrodirs = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5301
	my $checkfile = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5302
	$checkfile =~ s/^\"//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5303
	$checkfile =~ s/\"$//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5304
	if (-e $checkfile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5305
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5306
		while ($checkfile=~s-[\\](?!\.{2}\\)[^\\]*\\\.{2}(?=\\)--go){};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5307
		$sourcefile =~ s/\//\\/g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5308
		my($filename, $dir, $suffix) = fileparse($checkfile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5309
		if ($dir eq "\.\\")
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5310
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5311
			$dir = cwd;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5312
			$dir =~ s/\//\\/g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5313
			$dir .= "\\" if ($dir !~ /\\$/);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5314
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5315
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5316
		my $realdir = `directory.bat $dir`;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5317
		$realdir =~ s/\s+$//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5318
		$realdir =~ s/^\s*\w://g if ($dir !~ /^\w:/);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5319
		$realdir .= "\\" if ($realdir !~ /\\$/);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5320
		my $dirtemp = $dir;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5321
		if ($checkcase_test)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5322
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5323
			my $macrodirtemp = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5324
			foreach my $macrodir (@$macrodirs)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5325
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5326
				if ($dirtemp =~ /^$macrodir(.*)$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5327
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5328
					$macrodirtemp = $macrodir if (length($macrodirtemp) < length($macrodir));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5329
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5330
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5331
			if ($macrodirtemp ne "")
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5332
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5333
				$dirtemp =~ s/^$macrodirtemp//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5334
				$realdir =~ s/^$macrodirtemp//ig;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5335
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5336
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5337
		if ($realdir ne $dirtemp)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5338
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5339
			print CHECKCASELOG "check case: pc side file name is $checkfile\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5340
			print CHECKCASELOG "WARNING: dir case is not equal to real.\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5341
			my $tempsrcfile = $sourcefile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5342
			$tempsrcfile =~ s/\\\\/\\/g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5343
			print CHECKCASELOG "file name is $tempsrcfile\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5344
			print CHECKCASELOG "current is $dirtemp\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5345
			print CHECKCASELOG "expect  is $realdir\n\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5346
			checkcase_convert($sourcefile, $dirtemp, $realdir);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5347
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5348
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5349
		my $currentdir = cwd;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5350
		chdir "$dir";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5351
		my @realfile = `dir "$filename" 2>&1`;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5352
		my $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5353
		foreach $line (@realfile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5354
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5355
			if ($line =~ /^\s*(\S+)\s+(\d{2}:\d{2})\s+(PM|AM)?\s+([\d\,])+\s+(.+)\s*/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5356
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5357
				my $realfilename = $5;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5358
				my $filetemp = lc $filename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5359
				my $realtemp = lc $realfilename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5360
				if ($filetemp eq $realtemp && $realfilename ne $filename)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5361
				{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5362
					print CHECKCASELOG "check case: pc side file name is $checkfile\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5363
					print CHECKCASELOG "WARNING: filename case is not equal to real.\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5364
					my $tempsrcfile = $sourcefile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5365
					$tempsrcfile =~ s/\\\\/\\/g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5366
					print CHECKCASELOG "file name is $tempsrcfile\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5367
					print CHECKCASELOG "current is $filename\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5368
					print CHECKCASELOG "expect  is $realfilename\n\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5369
					checkcase_convert($sourcefile, $filename, $realfilename);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5370
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5371
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5372
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5373
		chdir "$currentdir";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5374
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5375
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5376
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5377
sub checkcase_convert()
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5378
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5379
	return if (!$checkcase_test);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5380
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5381
	my $file = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5382
	my $origin = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5383
	my $real = shift;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5384
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5385
	my @realfile = `dir "$file"  2>&1`;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5386
	my $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5387
	foreach $line (@realfile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5388
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5389
		if ($line =~ /^\s*(\S+)\s+(\d{2}:\d{2})\s+(PM|AM)?\s+([\d\,])+\s+([\S]+)\s*/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5390
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5391
			my $realfilename = $5;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5392
			$realfilename =~ s-\.-\\\.-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5393
			$file =~ s-$realfilename$--ig;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5394
			$realfilename =~ s-\\\.-\.-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5395
			$file .= $realfilename;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5396
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5397
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5398
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5399
	my $tempfile = $file.".temp";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5400
	my $usemultimacro = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5401
	my $uses60macro_aifrsc = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5402
	my $uses60macro_exe = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5403
	my $uses60macro_aificon = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5404
	my $uses60macro_resource = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5405
	my $originwithoutext = $origin;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5406
	my $realwithoutext = $real;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5407
	if ($origin =~ /epoc32/i)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5408
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5409
		my $tempepocroot = $ENV{EPOCROOT};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5410
		$tempepocroot =~ s-\\-\\\\-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5411
		$origin =~ s/^$tempepocroot//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5412
		$real =~ s/^$tempepocroot//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5413
	}elsif ($checkcase_platform ne "" && $origin =~ /^_$checkcase_platform\_(.*)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5414
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5415
		$origin =~ s/^_$checkcase_platform\_/_PLATFORM_NAME_/g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5416
		$real =~ s/^_$checkcase_platform\_/_PLATFORM_NAME_/g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5417
	}elsif ($origin =~ /\S+\_reg\.rsc$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5418
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5419
		$originwithoutext =~ s/\_reg\.rsc$//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5420
		$realwithoutext =~ s/\_reg\.rsc$//ig;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5421
		$uses60macro_aifrsc = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5422
	}elsif ($origin =~ /\S+\.rsc$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5423
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5424
		$originwithoutext =~ s/\.rsc$//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5425
		$realwithoutext =~ s/\.rsc$//ig;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5426
		$usemultimacro = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5427
		$uses60macro_resource = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5428
	}elsif ($origin =~ /\S+\.r01$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5429
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5430
		$originwithoutext =~ s/\.r01$//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5431
		$realwithoutext =~ s/\.r01$//ig;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5432
		$usemultimacro = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5433
	}elsif ($origin =~ /\S+\.exe$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5434
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5435
		$originwithoutext =~ s/\.exe$//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5436
		$realwithoutext =~ s/\.exe$//ig;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5437
		$uses60macro_exe = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5438
	}elsif ($origin =~ /\S+\_aif\.mif$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5439
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5440
		$originwithoutext =~ s/\_aif\.mif$//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5441
		$realwithoutext =~ s/\_aif\.mif$//ig;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5442
		$uses60macro_aificon = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5443
	}elsif ($origin =~ /\S+\.mif$/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5444
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5445
		$originwithoutext =~ s/\.mif$//g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5446
		$realwithoutext =~ s/\.mif$//ig;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5447
		$uses60macro_aificon = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5448
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5449
	$origin =~ s-\\-\\\\-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5450
	$origin =~ s-\.-\\\.-g;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5451
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5452
	open (SRC, "<$file");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5453
	open (DST, ">$tempfile");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5454
	my $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5455
	while($line = <SRC>)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5456
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5457
		my $flag = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5458
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5459
		if ($line =~ /$origin/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5460
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5461
			$originwithoutext = $origin;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5462
			$realwithoutext = $real;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5463
			$flag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5464
		}elsif ($usemultimacro)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5465
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5466
			if ($line =~ /^.*=\s*MULTI_LINGUIFY\s*\(.*$originwithoutext/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5467
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5468
				$flag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5469
			}elsif ($line =~ /^\s*S60_APP_RESOURCE\s*\(\s*$originwithoutext\s*\)/ && $uses60macro_resource)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5470
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5471
				$flag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5472
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5473
		}elsif ($uses60macro_exe)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5474
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5475
			if ($line =~ /^\s*S60_APP_EXE\s*\(\s*$originwithoutext\s*\)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5476
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5477
				$flag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5478
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5479
		}elsif ($uses60macro_aificon)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5480
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5481
			if ($line =~ /^\s*S60_APP_AIF_ICONS\s*\(\s*$originwithoutext\s*\)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5482
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5483
				$flag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5484
			}elsif ($line =~ /^\s*SCALABLE_IMAGE\s*\(.*$originwithoutext\s*\)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5485
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5486
				$flag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5487
			}elsif ($line =~ /^\s*S60_APP_BITMAP\s*\(\s*$originwithoutext\s*\)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5488
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5489
				$flag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5490
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5491
		}elsif ($uses60macro_aifrsc)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5492
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5493
			if ($line =~ /^\s*S60_APP_AIF_RSC\s*\(\s*$originwithoutext\s*\)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5494
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5495
				$flag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5496
			}elsif ($line =~ /^\s*S60_UPGRADABLE_APP_REG_RSC\s*\(\s*$originwithoutext\s*\)/)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5497
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5498
				$flag = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5499
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5500
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5501
		if ($flag)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5502
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5503
			print CHECKCASELOG "it has been converted automatically\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5504
			print CHECKCASELOG "original  line is $line";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5505
			$line =~ s-$originwithoutext-$realwithoutext-;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5506
			print CHECKCASELOG "converted line is $line\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5507
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5508
		print DST $line;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5509
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5510
	close SRC;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5511
	close DST;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5512
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5513
  unlink "$file";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5514
  rename ("$file.temp", "$file");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5515
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5516
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  5517
1;