author | lorewang |
Mon, 22 Nov 2010 13:38:53 +0800 | |
changeset 701 | 170c8b305768 |
parent 697 | 818fe0ed324b |
child 706 | 5221386d044b |
child 712 | df89378e9223 |
permissions | -rw-r--r-- |
606 | 1 |
# |
2 |
# Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
# All rights reserved. |
|
4 |
# This component and the accompanying materials are made available |
|
5 |
# under the terms of the License "Eclipse Public License v1.0" |
|
6 |
# which accompanies this distribution, and is available |
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
# |
|
9 |
# Initial Contributors: |
|
10 |
# Nokia Corporation - initial contribution. |
|
11 |
# |
|
12 |
# Contributors: |
|
13 |
# |
|
14 |
# Description: |
|
15 |
# This package is to build rom image |
|
16 |
# |
|
17 |
||
18 |
package buildrom; |
|
19 |
||
20 |
require Exporter; |
|
21 |
@ISA=qw(Exporter); |
|
22 |
@EXPORT=qw( |
|
23 |
image_content_processing_phase |
|
24 |
process_cmdline_arguments |
|
25 |
preprocessing_phase |
|
26 |
substitution_phase |
|
27 |
reorganize_phase |
|
28 |
plugin_phase |
|
29 |
multlinguify_phase |
|
30 |
spi_creation_phase |
|
31 |
suppress_phase |
|
32 |
bitmap_aif_converison_phase |
|
33 |
cleaning_phase |
|
34 |
create_dumpfile |
|
35 |
create_dirlisting |
|
36 |
suppress_image_generation |
|
37 |
invoke_rombuild |
|
38 |
getOBYDataRef |
|
39 |
isobystatement |
|
40 |
isdatastatement |
|
41 |
isspidatastatement |
|
42 |
isexecutablefile |
|
43 |
isdirectorymetadata |
|
44 |
isbitmap |
|
45 |
isaif |
|
46 |
isresource |
|
47 |
hardwarevariant |
|
48 |
executableextension |
|
49 |
executabletype |
|
50 |
getSourceFile |
|
51 |
getDestFile |
|
52 |
getOBYAttributes |
|
53 |
getHardwareVariant |
|
54 |
getObyCommand |
|
55 |
process_dlldata |
|
56 |
featurefile_creation_phase |
|
57 |
processData |
|
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 | 60 |
isIgnoreConfig |
606 | 61 |
); |
62 |
||
63 |
my $useinterpretsis = 1; |
|
64 |
if ($^O !~ /^MSWin32$/i){ |
|
65 |
$useinterpretsis = 0; |
|
66 |
} |
|
67 |
my $enforceFeatureManager = 0; # Flag to make Feature Manager mandatory if SYMBIAN_FEATURE_MANAGER macro is defined. |
|
68 |
||
69 |
my $BuildromMajorVersion = 3 ; |
|
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
70 |
my $BuildromMinorVersion = 32; |
633 | 71 |
my $BuildromPatchVersion = 0; |
606 | 72 |
|
73 |
||
74 |
sub print_usage |
|
75 |
{ |
|
76 |
||
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 | 81 |
if ($enforceFeatureManager) |
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 | 90 |
} |
91 |
||
92 |
#........1.........2.........3.........4.........5.........6.........7..... |
|
93 |
print <<USAGE_EOF; |
|
94 |
||
95 |
BUILDROM - ROM configuration tool V$BuildromMajorVersion.$BuildromMinorVersion.$BuildromPatchVersion |
|
96 |
||
97 |
Usage: |
|
98 |
buildrom [options] obyfile [obyfile2 ...] |
|
99 |
||
100 |
Build a ROM according to the specification defined by concatenating the |
|
101 |
specified obyfiles. |
|
102 |
||
103 |
The initial specification is modified by C++ preprocessor directives, |
|
104 |
and subsequently adjusted by statements in the ROM specification language. |
|
105 |
The final specification is in the subset of the specification language |
|
106 |
which is understood directly by ROMBUILD. |
|
107 |
||
108 |
Each obyfile parameter specifies a file via a search path: if the |
|
109 |
filename is not matched then buildrom will look in \/epoc32\/rom\/include. |
|
110 |
||
111 |
Buildrom invokes ROMBUILD to generate the ROM image, and produces a |
|
112 |
number of related files such as the ROM symbol file. The name of the |
|
113 |
image file is specified directly by the -o option, or determined by |
|
114 |
scanning the final specification for the "romname" keyword. If there is |
|
115 |
more than one "romname" statement, the last one takes precedence. |
|
116 |
||
117 |
The available options are |
|
118 |
||
119 |
-Dxxx -- C++ preprocessor arguments |
|
120 |
-oimagename -- ROM image name, overriding any ROMNAME statement |
|
121 |
-s -- strict option, any missing files will stop buildrom |
|
122 |
-p -- preserves the intermediate files pertaining to data drive, Z drive and BMCONV |
|
123 |
-spi -- enable producing SPI files |
|
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 | 127 |
$featuresOptionUsage |
128 |
-etool -- external tool specification (xx is tool's perl module) |
|
129 |
-compress -- compression type of ROM image: |
|
130 |
-compress compress whole ROM image. |
|
131 |
-compress=paged compress paged section in the ROM image only. |
|
132 |
-compress=unpaged compress unpaged section in the ROM image only. |
|
133 |
-ccomprmethod -- compression method: none|inflate|bytepair |
|
134 |
-geninc -- generate INC file |
|
135 |
-gendep -- generate dependence graph for rom image |
|
136 |
-nosymbols -- disable creation of symbol file |
|
137 |
-noimage -- disable creation of ROM/ROFS/DataDrive Image |
|
138 |
-j<digit> -- do the main job with <digit> threads |
|
139 |
-cache -- allow the ROFSBUILD to reuse/generate cached executable files |
|
140 |
-nocache -- force the ROFSBUILD not to reuse/generate cached executable files |
|
141 |
-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
|
142 |
-oby-charset=<charset> -- used character set in which OBY was written |
606 | 143 |
-loglevel<level> -- Level of information logging where loglevel is 0,1,2 |
144 |
0 default level of information |
|
145 |
1 host/ROM filenames, file size and the hidden attribute along with level0 log |
|
146 |
2 E32 file header attributes along with level1 log |
|
147 |
-z=xxx or -zdrivepath=xxx -- specify a location to create Z drive directory. |
|
148 |
-d=xxx or -datadrivepath=xxx -- specify a location to create data drive directory. |
|
149 |
-k or -keepgoing -- enable keepgoing,continue to create the data drive image even |
|
150 |
if the non-sis, sis or zdrive image file(s) are missing or corrupt; create rom/rofs |
|
151 |
image even some oby files missing and/or duplicated definitions in oby files . |
|
152 |
-r or -retainfolder -- enable retainfolder,would retain pre-existence of z & data drive folder. |
|
153 |
-zdriveimage=xxx -- specify Z drive image (ROM, CORE, ROFS or Ext-ROFS image). |
|
154 |
-pfile=xxx -- specify a parameter file for interpretsis to take additional parameters. |
|
155 |
-argforinterpretsis=xxx -- specify command line argument(s) for interpretsis which will override the |
|
156 |
parameter file contents. |
|
157 |
-l=xxx or -logimagecontents=xxx -- extract all stub-sis and SWI certificate store file(s) only |
|
158 |
and log all the file(s) that are part of the Z drive image on to a log file. |
|
159 |
-I<directory> -- Use <directory> for the referenced IBY/OBY files |
|
160 |
-argfile=xxx -- specify argument-file name containing list of command-line arguments to buildrom |
|
161 |
-lowmem -- use memory-mapped file for image build to reduce physical memory consumption |
|
162 |
-checkcase -- check character case of path/name in oby/iby files, |
|
163 |
the result will be checkcase.log, this option is only valid on windows. |
|
609 | 164 |
-workdir=xxx -- specify a directory to contain generated files. |
165 |
-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
|
166 |
-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
|
167 |
-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
|
168 |
-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
|
169 |
-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
|
170 |
don't preprocess the input oby files. |
647 | 171 |
-inputoby=<finalOBYfile> -- Ignore BUILDROM config phase, invoke Rombuild/Rofsbuild using <finalOBYfile>. |
172 |
<finalOBYfile> must contain one and ONLY one of romsize/rofssize/dataimagename/imagename keywords, |
|
173 |
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
|
174 |
|
606 | 175 |
Popular -D defines to use include |
176 |
||
177 |
-D_DEBUG -- select debug versions of some files |
|
178 |
-D_FULL_DEBUG -- select debug versions of all files |
|
179 |
-D_ARM4 -- specify the target platform |
|
180 |
||
181 |
-D_EABI=xxxx -- specify target for all files (e.g. armv5) |
|
182 |
-D_KABI=xxxx -- specify the target platform for the Kernel (e.g. armv5) |
|
183 |
||
184 |
Other defines may be useful for particular OBY files. |
|
185 |
||
186 |
USAGE_EOF |
|
187 |
} |
|
188 |
||
189 |
use strict; |
|
190 |
use romutl; |
|
191 |
use romosvariant; |
|
192 |
||
193 |
my $PerlEPOCPath = &get_epocroot()."epoc32\/tools\/"; # fully qualified pathname of the directory containing EPOC Perl modules |
|
194 |
||
195 |
sub ExportDirs ($); |
|
196 |
||
197 |
my $xmlrequired = 0; # assume xml required is false. Used to determine if xml |
|
198 |
# modules should be loaded. |
|
199 |
||
200 |
use flexmodload; # To load modules dynamically |
|
201 |
||
202 |
# Work out the relative path to the epoc32 directory |
|
203 |
use spitool qw(&createSpi); |
|
204 |
use Cwd; |
|
205 |
use externaltools; #To invoke External Tools |
|
206 |
use File::Basename; |
|
207 |
||
208 |
my @tempfiles; |
|
209 |
my $preserve = 0; #flag to indicate if temporary files should be preserved |
|
210 |
my $uppath="x"; # will be initialised when first needed |
|
211 |
||
212 |
my $epocroot = &get_epocroot; |
|
213 |
||
214 |
my @obyfiles; |
|
215 |
my $cppargs = "-nostdinc -undef"; |
|
216 |
my $opt_v = 0; |
|
217 |
my $opt_o = ""; |
|
218 |
my $strict = 0; |
|
219 |
my $warnSelection = 0; # default is not warn about selecting files from |
|
220 |
# different directories when the file is missing from |
|
221 |
# the specified directory |
|
222 |
||
223 |
my $createspi = 0; # don't create SPI files by default |
|
224 |
my $spiset=0; |
|
225 |
my $spiplacement = 0; # enable the placement of spi file |
|
226 |
my %spipositionflag = (); # map of Image index at which the keyword SPI_POSITION is used. |
|
227 |
||
228 |
use constant NONE => 0; |
|
229 |
use constant INFLATE => 1; |
|
230 |
use constant BYTEPAIR => 2; |
|
231 |
my $opt_compression; # Default compression method parameter undefined |
|
232 |
||
233 |
use constant UNCOMPRESSED => 0; # Indicates the ROM image will not be compressed. |
|
234 |
use constant ALLSECTIONS => 1; # Indicates both paged section and unpaged section will be compressed. |
|
235 |
use constant PAGEDSECTION => 2; # Indicates only paged section will be compressed. |
|
236 |
use constant UNPAGEDSECTION => 3; # Indicates only unpaged section will be compressed. |
|
237 |
my $opt_compression_type = UNCOMPRESSED; # Leave the ROM image uncompressed by default. |
|
238 |
||
239 |
#Variables to store cache command line options |
|
240 |
my $opt_cache = 0; |
|
241 |
my $opt_nocache = 0; |
|
242 |
my $opt_cleancache = 0; |
|
243 |
||
244 |
my $thisdir=cwd; |
|
245 |
$thisdir=~s-\\-\/-go; # separator from Perl 5.005_02+ is forward slash |
|
246 |
$thisdir.= "\/" unless $thisdir =~ /\/$/; |
|
247 |
$thisdir =~ s-\/-\\-g if (&is_windows); |
|
248 |
||
249 |
my $rominclude = $epocroot."epoc32\/rom\/include\/"; |
|
250 |
$rominclude = &get_epocdrive().$rominclude unless $rominclude =~ /^.:/; |
|
251 |
$rominclude =~s-\\-\/-g; |
|
252 |
||
253 |
my %plugintypes; #hash of plugin types and their SPI files' destinations in ROM |
|
254 |
$plugintypes{"ECOM"} = "\/private\/10009d8f\/"; #ECOM SPI files' destination in ROM image |
|
255 |
||
256 |
my @obydata; |
|
257 |
my @newobydata; |
|
258 |
my %substitutionData; |
|
259 |
my @substitutionOrder; |
|
260 |
my %languageCodes; |
|
261 |
my $defaultLanguageCode; |
|
262 |
my %multiLinguifyAlias; # to by-pass the 'mustbesysbin' option for multilinguify 'alias'es. |
|
263 |
my $abiDowngrade = ""; |
|
264 |
my @binarySelectionOrder; |
|
265 |
my $fromDIR; |
|
266 |
my %rombuildOptions = ("-type-safe-link" => 1 ); |
|
267 |
my $enforceSysBin = 0; |
|
268 |
||
269 |
my $line; |
|
270 |
my $errors = 0; |
|
271 |
my @romimage; |
|
272 |
my $rombasename; |
|
273 |
||
274 |
my $sourcefile; |
|
275 |
my $sourceline; |
|
276 |
#my $line; |
|
277 |
my %romfiles; |
|
278 |
||
279 |
# To handle BINARY_SELECTION_ORDER macro. |
|
280 |
my $firstDIR; |
|
281 |
my $binarySelectionOrderFlag = 0; |
|
282 |
||
283 |
my %DllDataMap = (); #Map to keep track of DLL Data patch statements. |
|
284 |
my $patchDataStmtFlag = 0; |
|
285 |
||
286 |
my $featuremanager = 0; #Flag to enable support for feature manager database XML file and to generate |
|
287 |
# features data file. |
|
288 |
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
|
289 |
my $noFeatureConf = 0 ; |
606 | 290 |
my $preBuiltFeaturesDataFile = ''; # To store the name of pre-built features.dat file provided with "-nofm" option. |
291 |
||
292 |
#Image Content XML file that supports specific feature to be added |
|
293 |
my $image_content = undef; |
|
294 |
#Feature list XML file that acts as database containing all features details |
|
295 |
my $featureXml = undef; |
|
296 |
my $geninc = ""; |
|
297 |
my $gendep = ""; |
|
298 |
my $nosymbols = ""; |
|
299 |
my $noimage = ""; |
|
300 |
my $customizedPlat = undef; |
|
301 |
my $opt_jobs= ""; |
|
302 |
||
303 |
#Summary of files(both executables and data files) currently includes |
|
304 |
# host and ROM file names, |
|
305 |
# size of the file in ROM |
|
306 |
# whether the file is hidden |
|
307 |
# This option is added so that the above additional information is emitted by rombuild/rofsbuild tools |
|
308 |
# only when supplied with this option so that the existing tools don't get affected. |
|
309 |
my $logLevel=""; |
|
310 |
||
311 |
# This option is used to pass -lowmem argument to rombuild/rofsbuild tools |
|
312 |
my $lowMem=""; |
|
313 |
||
314 |
# Feature Variation modules and data |
|
315 |
my %featureVariant; |
|
316 |
||
317 |
# global variables specific to data drive image generation. |
|
318 |
use File::Path; # Module to provide functions to remove or create directories in a convenient way. |
|
319 |
use File::Copy; # Module to provide functions to copy file(s) from source to destination. |
|
320 |
use File::Find; |
|
321 |
use datadriveimage; # module which provides all necessary functions to create data drive image. |
|
322 |
my $ZDirloc = ""; # location of Z drive directory. |
|
323 |
my $DataDriveDirloc = ""; # location of data drive directory. |
|
324 |
my @sisfilelist; # an array to hold sis file(s). |
|
325 |
my @zDriveImageList; # an array to hold z drive image name. |
|
326 |
my @datadiveobydata; # an array to hold data drive oby data. |
|
327 |
my @datadriveimage; # array which holds data drive image attribute. |
|
328 |
my $rootdir = ""; # which holds root directory information. |
|
329 |
my @datadrivedata; # array to maintain list of lines taken from processed data drive oby file. |
|
330 |
my @nonsisFilelist; # array to maintain list of nonsis file(s). |
|
331 |
my @sisobydata; # array to maintain all list of files(s) got by installing sis files. |
|
332 |
my @renameList; # array to maintain list of file(s) that has to be renamed. |
|
333 |
my @aliaslist; # array to maintain list of file(s) that has to be made alias. |
|
334 |
my @hideList; # array to maintain list of file(s) that has to be made hidden. |
|
335 |
my $sisfilepresent = 0; # enable if sis file(s) are present. |
|
336 |
my $stubsisfilepresent = 0; # enable if stub-sis file(s) are present. |
|
337 |
my $opt_k = 0; # enable if keepgoing option is specified by the user. |
|
338 |
my $opt_r = 0; # enable if retain pre-existence of folder is specified by the user. |
|
339 |
my $dataImageCount = 0; # no of data drive image that has to generated. |
|
340 |
my @zdriveImageName; # list of Z drive image name(s) specified using zdriveimagename in oby/iby file. |
|
341 |
my $opt_zimage = 0; # enable if z drive image is found. |
|
342 |
my $zDrivePresent = 0; # flag to check whether Z drive needs to be created. |
|
343 |
my @dataDriveFileList; # list of processed data drive related files. |
|
344 |
my $paraFile = undef; # parameter file for interpretsis. |
|
345 |
my @romImages; # list of generated z drive image(s)(rom/rofs). |
|
346 |
my $imageEntryLogFile = undef; # a log file to log all the z drive image contents. |
|
347 |
my $opt_logFile = 0; # enable if z drive entries has to be logged on to a log file. |
|
348 |
my %dataIndexHash = (); # a hash which holds key-value pair between datadrive index and datadrive image count. |
|
349 |
my $interpretsisOpt = undef; # enable if command line arguments are specified by the user to INTERPRETSIS. |
|
350 |
my @interpretsisOptList; # an array which holds all the list of option(s) that needs to passed to INTERPRETSIS. |
|
351 |
my @Global_BPABIPlats; |
|
352 |
my @Global_PlatList; |
|
353 |
my @smrImageFileList; |
|
354 |
my $needSmrImage = 0; |
|
355 |
my %smrPartitions; |
|
356 |
my %smrNameInfo; |
|
357 |
my @obeyFileList; |
|
358 |
my $smrNoImageName = 0; |
|
359 |
my $onlysmrimage = 1; |
|
360 |
my $checkcase = 0; |
|
361 |
my $checkcase_platform = ""; |
|
362 |
my $checkcase_test = 0; |
|
363 |
my $opt_workdir = 0; |
|
609 | 364 |
my $prependepocroot = 0; |
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
365 |
my $stdcpp = 0; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
366 |
my $obycharset; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
367 |
my $cppoption = 0; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
368 |
my $preprocessor = "cpp"; |
633 | 369 |
my $opt_xiponly = 0; |
647 | 370 |
my $ignoreconfig = 0; |
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
371 |
my $nopreprocess = 0; |
647 | 372 |
my $romcount = 0; |
606 | 373 |
|
374 |
sub match_obyfile |
|
375 |
{ |
|
376 |
my ($obyfile) = @_; |
|
377 |
if (-f $obyfile) |
|
378 |
{ |
|
379 |
push @obyfiles, $obyfile; |
|
380 |
return 1; |
|
381 |
} |
|
382 |
||
383 |
# search for the oby file in the list of include directories |
|
384 |
my @otherDirs = ($rominclude); |
|
385 |
||
386 |
if ($featureVariant{'VALID'}) |
|
387 |
{ |
|
388 |
my $dirRef = $featureVariant{'ROM_INCLUDES'}; |
|
389 |
||
390 |
@otherDirs = @$dirRef if ($dirRef); |
|
391 |
} |
|
392 |
foreach my $dir (@otherDirs) |
|
393 |
{ |
|
394 |
print "$dir/$obyfile\n" if ($opt_v); |
|
395 |
if (-f "$dir/$obyfile") |
|
396 |
{ |
|
397 |
push @obyfiles, "$dir/$obyfile"; |
|
398 |
return 1; |
|
399 |
} |
|
400 |
} |
|
401 |
return 0; |
|
402 |
} |
|
403 |
||
404 |
||
405 |
# This function invokes ROFSBUILD tool with appropriate parameters to generate data drive image. |
|
406 |
# It also deletes zdrive and datadrive folder after all the image has been processed and generated |
|
407 |
# if and only if preserve(-p) option is disabled. |
|
408 |
sub create_datadriveImage |
|
409 |
{ |
|
410 |
for (my $dataidx=0; $dataidx < $dataImageCount; $dataidx++) |
|
411 |
{ |
|
412 |
my $driveIndex = $dataIndexHash{$dataidx}; |
|
413 |
||
414 |
if(defined($driveIndex)) |
|
415 |
{ |
|
416 |
my $obeyfile=$datadriveimage[$driveIndex]{obeyfile}; |
|
417 |
my $compress=$datadriveimage[$driveIndex]{compress}; |
|
418 |
my $uncompress=$datadriveimage[$driveIndex]{uncompress}; |
|
419 |
||
420 |
if ($obeyfile) |
|
421 |
{ |
|
422 |
if(!defined $opt_compression) |
|
423 |
{ |
|
424 |
if ($compress ne 0) |
|
425 |
{ |
|
426 |
$compress=" -compress"; |
|
427 |
} |
|
428 |
elsif($uncompress ne 0) |
|
429 |
{ |
|
430 |
$compress=" -uncompress"; |
|
431 |
} |
|
432 |
elsif($compress eq 0) |
|
433 |
{ |
|
434 |
$compress=" "; |
|
435 |
} |
|
436 |
} |
|
437 |
else |
|
438 |
{ |
|
439 |
$compress = $opt_compression; |
|
440 |
$compress =~m/\s-(compression)(method)\s(none|inflate|bytepair)/; |
|
441 |
print "* ".$1." ".$2.": ".$3; |
|
442 |
} |
|
647 | 443 |
my $command = "rofsbuild -slog".$compress." -datadrive=$obeyfile.oby -logfile=$thisdir"; |
444 |
$command .= " -k" if($opt_k); |
|
606 | 445 |
print "* Executing $command\n" if ($opt_v); |
446 |
system($command); |
|
447 |
if ($? != 0) |
|
448 |
{ |
|
449 |
&datadriveimage::reportError("* ROFSBUILD failed to generate data drive image",$opt_k); |
|
450 |
} |
|
451 |
else |
|
452 |
{ |
|
453 |
push(@dataDriveFileList,$obeyfile.".img"); |
|
454 |
} |
|
455 |
} |
|
456 |
} |
|
457 |
} |
|
458 |
# after processing all the data drive image(s) delete zdrive and datadrive directory |
|
459 |
# if and only if preserve(-p) option is disabled. |
|
460 |
if($dataImageCount) |
|
461 |
{ |
|
462 |
# delete Z drive directory if and only if preserve(-p) option is disabled. |
|
463 |
my $retVal = &deleteDirectory($ZDirloc,$opt_v)if(!($preserve)); |
|
464 |
if($retVal) |
|
465 |
{ |
|
466 |
&datadriveimage::reportError("* Warning could not delete $ZDirloc",$opt_k); |
|
467 |
} |
|
468 |
# delete data drive directory if and only if preserve(-p) option is disabled. |
|
469 |
$retVal = &deleteDirectory($DataDriveDirloc,$opt_v)if(!($preserve)); |
|
470 |
if($retVal) |
|
471 |
{ |
|
472 |
&datadriveimage::reportError("* Warning could not delete $DataDriveDirloc",$opt_k); |
|
473 |
} |
|
474 |
# reset image count to zero. |
|
475 |
$dataImageCount = 0; |
|
476 |
# reset z drive present to zero. |
|
477 |
$zDrivePresent = 0; |
|
478 |
} |
|
479 |
} |
|
480 |
||
481 |
sub tidy_exit |
|
482 |
{ |
|
483 |
#------------------------------------------------------- |
|
484 |
# Tidy and exit |
|
485 |
||
486 |
if (!$preserve) |
|
487 |
{ |
|
488 |
foreach my $tempfiles (@tempfiles) |
|
489 |
{ |
|
490 |
print "remove $tempfiles\n" if ($opt_v); |
|
491 |
unlink "$tempfiles"; |
|
492 |
} |
|
493 |
} |
|
494 |
if($rombasename) |
|
495 |
{ |
|
496 |
system("dir $rombasename.*"); |
|
497 |
} |
|
498 |
if(@dataDriveFileList) |
|
499 |
{ |
|
500 |
print "\n"; |
|
501 |
print " ----------------------------------------------------------\n"; |
|
502 |
print "| List of file(s) generated pertaining to data drive image |\n"; |
|
503 |
print " ----------------------------------------------------------\n"; |
|
504 |
my $arraySize = scalar(@dataDriveFileList); |
|
505 |
for( my $i=0; $i < $arraySize; $i++ ) |
|
506 |
{ |
|
507 |
# remove the first element from an array and return it |
|
508 |
my $element = shift(@dataDriveFileList); |
|
509 |
# get the size of the file. |
|
510 |
my $size = -s $element; |
|
511 |
print "Size = ".$size." bytes"."\t"."File = ".$element."\n"; |
|
512 |
} |
|
513 |
} |
|
514 |
exit(0); |
|
515 |
} |
|
516 |
||
517 |
# This is the main function which is responsible for processing data drive image. |
|
518 |
# This function internally calls other functions to create datadrive folder,zdrive folder |
|
519 |
# and external tools such as INTERPRETSIS, READIMAGE and finally ROFSBUILD to generate |
|
520 |
# appropriate data drive image. |
|
521 |
sub processData |
|
522 |
{ |
|
523 |
if($dataImageCount) |
|
524 |
{ |
|
647 | 525 |
if(!$ignoreconfig) |
606 | 526 |
{ |
647 | 527 |
# set the default path for Z drive and Data drive directory, |
528 |
# if and only if, path is not specified by the user. |
|
529 |
$ZDirloc = $thisdir."zdrive" unless ($ZDirloc); |
|
530 |
$DataDriveDirloc = $thisdir."datadrive" unless ($DataDriveDirloc); |
|
531 |
#delete any existing Z drive directory. |
|
532 |
my $retVal = &datadriveimage::deleteDirectory($ZDirloc,$opt_v)if(!$opt_r); |
|
533 |
if($retVal) |
|
534 |
{ |
|
535 |
exit(1) if(!$opt_k); |
|
536 |
} |
|
537 |
# delete pre-existence of data drive folder, if and only if -r option is not enabled. |
|
538 |
$retVal = &datadriveimage::deleteDirectory($DataDriveDirloc,$opt_v) if(!$opt_r); |
|
539 |
if($retVal) |
|
606 | 540 |
{ |
647 | 541 |
exit(1) if(!$opt_k); |
542 |
} |
|
543 |
if($opt_logFile) |
|
544 |
{ |
|
545 |
# clean any pre-existance of log file. |
|
546 |
unlink($ZDirloc."\/".$imageEntryLogFile); |
|
547 |
} |
|
548 |
||
549 |
for (my $datadriveidx=0; $datadriveidx < $dataImageCount; $datadriveidx++) |
|
550 |
{ |
|
551 |
my $driveIndex = $dataIndexHash{$datadriveidx}; |
|
552 |
# get the data drive name. |
|
553 |
if( defined( $driveIndex ) ) |
|
606 | 554 |
{ |
647 | 555 |
my $datadrivename=$datadriveimage[$driveIndex]{obeyfile}; |
556 |
# get the size of the data drive. |
|
557 |
my $size = $datadriveimage[$driveIndex]{size}; |
|
558 |
if( $datadrivename ) |
|
606 | 559 |
{ |
647 | 560 |
# set data drive oby file. |
561 |
my $datadriveobyfile = $datadrivename.".oby"; |
|
562 |
# final location of prototype data drive. |
|
563 |
my $proDataDriveDirloc; |
|
564 |
# Location of stub-sis file(s) inside Z Drive folder. |
|
565 |
my $zDriveSisFileLoc; |
|
566 |
# check if more than one data drive image needs to be generated. |
|
567 |
if ($datadrivename =~ /.*[\\\/]([^\\\/]+)$/) |
|
606 | 568 |
{ |
647 | 569 |
$datadrivename = $1; |
570 |
} |
|
571 |
if( $dataImageCount > 1 ) |
|
572 |
{ |
|
573 |
# if yes, then set the location of prototype data drive folder as |
|
574 |
# DataDriveDirloc + datadrivename |
|
575 |
$proDataDriveDirloc = $DataDriveDirloc."\/".$datadrivename; |
|
606 | 576 |
} |
577 |
else |
|
578 |
{ |
|
647 | 579 |
# else, then set the location of prototype data drive folder as DataDriveDirloc |
580 |
$proDataDriveDirloc = $DataDriveDirloc; |
|
581 |
} |
|
582 |
||
583 |
# create prototype data drive folder. |
|
584 |
print "creating data drive folder\n" if ($opt_v); |
|
585 |
&datadriveimage::createDirectory($proDataDriveDirloc); |
|
586 |
||
587 |
# check for sis file keyword in ROM description file. |
|
588 |
# if found,then locate for stub-sisfile. |
|
589 |
# create Z drive( if and only if stub-sis files are present in ROM description file ) |
|
590 |
# and dump all the non-sis files on to the Z drive folder. |
|
591 |
if(&datadriveimage::checkForSisFile($datadriveobyfile,\@sisfilelist,\$sisfilepresent)) |
|
592 |
{ |
|
593 |
my $zDriveImagePresent = 0; # flag to check whether z drive image is Present; |
|
594 |
if(&datadriveimage::checkForZDriveImageKeyword($datadriveobyfile,\@zDriveImageList,\$zDriveImagePresent) ) |
|
606 | 595 |
{ |
647 | 596 |
# find out size of the array |
597 |
my $arraysize = scalar(@zDriveImageList); |
|
598 |
for( my $i=0; $i < $arraysize; $i++ ) |
|
606 | 599 |
{ |
647 | 600 |
$zDriveSisFileLoc = $ZDirloc."\/".$datadrivename; |
601 |
&datadriveimage::invokeReadImage(pop(@zDriveImageList),$zDriveSisFileLoc,$opt_v,$imageEntryLogFile,$opt_k); |
|
602 |
} |
|
603 |
} |
|
604 |
else |
|
605 |
{ |
|
606 |
$zDriveSisFileLoc = $ZDirloc; |
|
607 |
# locate and copy stub-sis file(s),for the first time. |
|
608 |
if( !$zDrivePresent ) |
|
609 |
{ |
|
610 |
# check for image file. |
|
611 |
if( $opt_zimage ) |
|
606 | 612 |
{ |
647 | 613 |
# image(s)supplied to BUILDROM(like rom,rofs,extrofs or core) using "-zdriveimage" option, |
614 |
# are maintained in a seperate array and the element from the array is fetched one by one and is |
|
615 |
# fed to READIMAGE as an input. |
|
616 |
foreach my $element (@zdriveImageName) |
|
617 |
{ |
|
618 |
# invoke READIMAGE to extract all /swi stub sis file(s) from the given image. |
|
619 |
$zDrivePresent = &datadriveimage::invokeReadImage($element,$zDriveSisFileLoc,$opt_v,$imageEntryLogFile,$opt_k); |
|
620 |
} |
|
606 | 621 |
} |
647 | 622 |
else |
606 | 623 |
{ |
647 | 624 |
# if zdrive image(s) such as (rom,core,rofs or extrofs) are generated ealier to the data drive image processing |
625 |
# then these images are maintained in an array and the element from the array is fetched one by one and is |
|
626 |
# fed to READIMAGE as an input. |
|
627 |
foreach my $element (@romImages) |
|
628 |
{ |
|
629 |
# invoke READIMAGE to extract all /swi stub sis file(s) from the given image. |
|
630 |
$zDrivePresent = &datadriveimage::invokeReadImage($element,$zDriveSisFileLoc,$opt_v,$imageEntryLogFile,$opt_k); |
|
631 |
} |
|
606 | 632 |
} |
633 |
} |
|
634 |
} |
|
647 | 635 |
# invoke INTERPRETSIS tool with z drive folder location. |
636 |
if ($useinterpretsis) |
|
637 |
{ |
|
638 |
&datadriveimage::invokeInterpretsis( \@sisfilelist,$proDataDriveDirloc,$opt_v,$zDriveSisFileLoc,$paraFile,$opt_k,\@interpretsisOptList,$thisdir)if($sisfilepresent); |
|
639 |
}else |
|
640 |
{ |
|
641 |
print "Warning: interpretsis is not ready on linux.\n"; |
|
642 |
} |
|
606 | 643 |
} |
647 | 644 |
|
645 |
# create an oby file by traversing through upated prototype data drive directory. |
|
646 |
&datadriveimage::dumpDatadriveObydata( $proDataDriveDirloc,$datadriveobyfile,$size,\@nonsisFilelist, |
|
647 |
\@renameList,\@aliaslist,\@hideList,\@sisobydata,\@datadrivedata,$opt_k,$opt_v ); |
|
648 |
#reset sisfilepresent flag to zero; |
|
649 |
$sisfilepresent =0; |
|
606 | 650 |
} |
651 |
} |
|
652 |
} |
|
653 |
} |
|
654 |
create_datadriveImage(); |
|
655 |
} |
|
656 |
tidy_exit; |
|
657 |
} |
|
658 |
#Parse and process image content xml file |
|
659 |
#Gets the oby files listed in the xml file |
|
660 |
# Pushes all the oby files found to an array |
|
661 |
||
662 |
sub image_content_processing_phase |
|
663 |
{ |
|
664 |
if(!defined ($image_content)) |
|
665 |
{ |
|
666 |
return; |
|
667 |
} |
|
668 |
&ImageContentHandler::ParseImageContentXML($image_content); |
|
669 |
&ImageContentHandler::ProcessImageContent; |
|
670 |
||
671 |
if(defined ($image_content) ) |
|
672 |
{ |
|
673 |
# Collect the oby files if any in the Image content file |
|
674 |
my $files = &ImageContentHandler::GetObyFiles; |
|
675 |
foreach my $obeyfile (@$files) |
|
676 |
{ |
|
677 |
next if match_obyfile($obeyfile); |
|
678 |
next if (match_obyfile("$obeyfile.oby")); |
|
679 |
} |
|
680 |
} |
|
681 |
} |
|
682 |
||
683 |
# Subroutine to process parameter-file |
|
684 |
sub parameterFileProcessor |
|
685 |
{ |
|
686 |
my $paramFile = shift(@_); |
|
687 |
my @paramFileParamaters = (); |
|
688 |
||
689 |
my $fileOpenFlag = 1; |
|
690 |
open FILE,"<", $paramFile or $fileOpenFlag = 0; |
|
691 |
||
692 |
if(!$fileOpenFlag) |
|
693 |
{ |
|
694 |
print "Error: Could not open parameter-file \"$paramFile\" for reading.\n"; |
|
695 |
return; |
|
696 |
} |
|
697 |
||
698 |
# Parse parameter-file and collect all the parameters in an array |
|
699 |
while(my $line = <FILE>) |
|
700 |
{ |
|
701 |
# Read the line till character ';'(used for providing comments in the file) or EOL |
|
702 |
$line = $1 if ($line =~ /(.*);/); |
|
703 |
||
704 |
# Split the parameters specified in a line based on white-spaces |
|
705 |
my @paramaters = split(/(\s)/,$line); |
|
706 |
||
707 |
my $flag = 0; |
|
708 |
my $argWithQuotes=''; |
|
709 |
||
710 |
foreach my $value (@paramaters) |
|
711 |
{ |
|
712 |
# If the parameter doesn't conatian double quotes then push it |
|
713 |
# to the list of parameters. |
|
714 |
if(($value !~ /\"/) && (!$argWithQuotes)) |
|
715 |
{ |
|
716 |
if ($value !~ /^\s*$/) |
|
717 |
{ |
|
718 |
push @paramFileParamaters,$value; |
|
719 |
} |
|
720 |
} |
|
721 |
# If the parameter is in the form -fm="faturedb.xml" then remove |
|
722 |
# double quotes and push it to the list of parameters. |
|
723 |
elsif(($value =~ /\".*\"/)) |
|
724 |
{ |
|
725 |
$value =~ s/\"//g; |
|
726 |
push @paramFileParamaters,$value; |
|
727 |
} |
|
728 |
# If the parameter is in the form -fm="fature db.xml" then read |
|
729 |
# the parameter starting from opening quote till the closing quote. |
|
730 |
elsif( ($value =~ /\"/) && $argWithQuotes) |
|
731 |
{ |
|
732 |
$argWithQuotes .= $value; |
|
733 |
$argWithQuotes =~ s/\"//g; |
|
734 |
push @paramFileParamaters,$argWithQuotes; |
|
735 |
$argWithQuotes=''; |
|
736 |
} |
|
737 |
else |
|
738 |
{ |
|
739 |
$argWithQuotes .= $value; |
|
740 |
} |
|
741 |
} |
|
742 |
} |
|
743 |
||
744 |
close FILE; |
|
745 |
||
746 |
if (!@paramFileParamaters) |
|
747 |
{ |
|
748 |
print "Warning: No parameters specified in paramer-file \"$paramFile\".\n"; |
|
749 |
return; |
|
750 |
} |
|
751 |
||
752 |
my $paramFileFlag = 1; |
|
753 |
||
754 |
# Invoke subroutine "process_cmdline_arguments" to process the parameters read from |
|
755 |
# the parameter file. |
|
756 |
&process_cmdline_arguments($paramFileFlag, @paramFileParamaters); |
|
757 |
||
758 |
} |
|
759 |
||
760 |
# Processes the command line arguments passed to buildrom tool |
|
761 |
||
762 |
sub process_cmdline_arguments |
|
763 |
{ |
|
764 |
my %tmpBldRomOpts; |
|
765 |
||
766 |
my ($paramFileFlag, @argList); |
|
767 |
||
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
768 |
if (defined @_ && scalar(@_) > 0) { |
606 | 769 |
($paramFileFlag, @argList) = @_; |
770 |
} |
|
771 |
else |
|
772 |
{ |
|
773 |
@argList = @ARGV; |
|
774 |
} |
|
775 |
||
776 |
if (!defined $paramFileFlag) |
|
777 |
{ |
|
778 |
# Enforce Feature Manager if macro SYMBIAN_FEATURE_MANAGER is defined in the HRH file. |
|
779 |
my @hrhMacros = &get_variantmacrolist; |
|
780 |
if (grep /^SYMBIAN_FEATURE_MANAGER\s*$/, @hrhMacros) |
|
781 |
{ |
|
782 |
$enforceFeatureManager = 1; |
|
783 |
} |
|
784 |
||
785 |
# Process the parameters of parameter-file if passed. |
|
786 |
foreach my $arg (@argList) |
|
787 |
{ |
|
788 |
if ($arg =~ /^-argfile=(.*)/) |
|
789 |
{ |
|
790 |
¶meterFileProcessor($1); |
|
791 |
} |
|
792 |
} |
|
793 |
} |
|
794 |
# 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
|
795 |
my @newArgList = (); |
606 | 796 |
foreach my $arg (@argList) { |
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
797 |
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
|
798 |
$opt_k = 1; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
799 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
800 |
elsif($arg =~ /^-nopreprocess$/i ) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
801 |
$nopreprocess = 1 ; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
802 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
803 |
elsif ($arg =~ /^-workdir=(.*)/) |
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
804 |
{ |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
805 |
my $workdir = $1; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
806 |
if (!-d $workdir) |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
807 |
{ |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
808 |
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
|
809 |
} |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
810 |
my $currentdir = cwd; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
811 |
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
|
812 |
$thisdir=cwd; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
813 |
$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
|
814 |
$thisdir.= "\/" unless $thisdir =~ /\/$/; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
815 |
if(&is_windows) |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
816 |
{ |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
817 |
$thisdir =~ s-\/-\\-g; |
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 |
$opt_workdir = 1; |
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
820 |
chdir "$currentdir"; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
821 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
822 |
else { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
823 |
push @newArgList, $arg ; |
606 | 824 |
} |
825 |
} |
|
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
826 |
foreach my $arg (@newArgList) |
606 | 827 |
{ |
828 |
if ($arg =~ /^-argfile=(.*)/) |
|
829 |
{ |
|
830 |
¶meterFileProcessor($1) if (defined $paramFileFlag); |
|
831 |
next; |
|
832 |
} |
|
833 |
if ($arg =~ /^-[DI]/) |
|
834 |
{ |
|
835 |
$cppargs .= " $arg"; |
|
836 |
#Set 'udeb' for debug option |
|
837 |
if($arg =~ /^-D_FULL_DEBUG/) |
|
838 |
{ |
|
839 |
$tmpBldRomOpts{"BUILD_DIR"} = "udeb"; |
|
840 |
} |
|
841 |
#Set specific platform supplied from the command option |
|
842 |
elsif($arg =~ /^-D_PLAT=(.*)/) |
|
843 |
{ |
|
844 |
$tmpBldRomOpts{"ABI_DIR"} = $1; |
|
845 |
} |
|
846 |
# Check for a Feature Variant |
|
847 |
elsif ($arg =~ /^-DFEATUREVARIANT=(.*)/) |
|
848 |
{ |
|
849 |
my $varname = $1; |
|
850 |
||
851 |
if ($varname =~ /^\.(.*)$/) |
|
852 |
{ |
|
853 |
# for testing, locate the VAR file in the current directory |
|
854 |
%featureVariant = get_variant($1, "."); |
|
855 |
} |
|
856 |
else |
|
857 |
{ |
|
858 |
%featureVariant = get_variant($varname); |
|
859 |
} |
|
860 |
if (!$featureVariant{'VALID'}) |
|
861 |
{ |
|
862 |
print "FEATUREVARIANT $varname is not VALID\n"; |
|
863 |
$errors++; |
|
864 |
} |
|
865 |
if ($featureVariant{'VIRTUAL'}) |
|
866 |
{ |
|
867 |
print "FEATUREVARIANT $varname is VIRTUAL\n"; |
|
868 |
$errors++; |
|
869 |
} |
|
870 |
addDrivesToFeatureVariantPaths(); |
|
871 |
} |
|
872 |
next; |
|
873 |
} |
|
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
874 |
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
|
875 |
{ |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
876 |
$obycharset = $1; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
877 |
next; |
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 |
if (($arg =~ /^-o(.*)/i) && ($arg !~ /^-oby-charset/i)) |
606 | 880 |
{ |
881 |
$opt_o = $1; |
|
882 |
next; |
|
883 |
} |
|
884 |
if ($arg =~ /^-j(\d+)$/i) |
|
885 |
{ |
|
886 |
$opt_jobs = "-j".$1; |
|
887 |
next; |
|
888 |
} |
|
889 |
if ($arg =~ /^-v$/) |
|
890 |
{ |
|
891 |
$opt_v =1; |
|
892 |
next; |
|
893 |
} |
|
894 |
if ($arg =~ /^-s$/) |
|
895 |
{ |
|
896 |
$strict = 1; |
|
897 |
next; |
|
898 |
} |
|
899 |
if ($arg =~ /^-w$/) |
|
900 |
{ |
|
901 |
$warnSelection = 1; |
|
902 |
next; |
|
903 |
} |
|
904 |
if ($arg =~ /^-p$/) |
|
905 |
{ |
|
906 |
$preserve = 1; |
|
907 |
next; |
|
908 |
} |
|
909 |
if ($arg =~ /^-nospi$/) |
|
910 |
{ |
|
911 |
$createspi=0; |
|
912 |
$spiset=1; |
|
913 |
next; |
|
914 |
} |
|
915 |
if ($arg =~ /^-spi$/) |
|
916 |
{ |
|
917 |
$createspi=1; |
|
918 |
$spiset=1; |
|
919 |
next; |
|
920 |
} |
|
921 |
#Process External Tool |
|
922 |
if ($arg =~/^-e(.*)/)#Match to get the tool perl module files |
|
923 |
{ |
|
924 |
&externaltools::loadTools($1); |
|
925 |
next; |
|
926 |
} |
|
927 |
#Process imagecontent file |
|
647 | 928 |
if( $arg =~ /^-i(.*)/ && $arg !~ /^-input(.*)/) |
606 | 929 |
{ |
930 |
# Disabling -i option |
|
931 |
print "Warning: Ignoring invalid Option $arg \n"; |
|
932 |
next; |
|
933 |
} |
|
934 |
#Process feature manager database xml file |
|
935 |
if($arg =~ /^-fm=(.*)/) |
|
936 |
{ |
|
937 |
if (!$enforceFeatureManager) |
|
938 |
{ |
|
939 |
print "Unknown arg: $arg\n"; |
|
940 |
$errors++; |
|
941 |
next; |
|
942 |
} |
|
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
943 |
$noFeatureConf = 0; |
606 | 944 |
$featureXml = $1; |
945 |
$xmlrequired = 1; |
|
946 |
$featuremanager = 1; |
|
947 |
if ($featureXml =~ /^$/) |
|
948 |
{ |
|
949 |
print "Error: No filename specified with \"-fm=\" option.\n"; |
|
950 |
} |
|
951 |
next; |
|
952 |
} |
|
953 |
#Process Cache command line options. |
|
954 |
if($arg =~ /^-cache/) |
|
955 |
{ |
|
956 |
$opt_cache = 1; |
|
957 |
next; |
|
958 |
} |
|
959 |
if($arg =~ /^-nocache/) |
|
960 |
{ |
|
961 |
$opt_nocache = 1; |
|
962 |
next; |
|
963 |
} |
|
964 |
if($arg =~ /^-cleancache/) |
|
965 |
{ |
|
966 |
$opt_cleancache = 1; |
|
967 |
next; |
|
968 |
} |
|
969 |
||
970 |
#Process ROM image compression type if it's specified through command line option. |
|
971 |
if($arg =~ /^-compress(.*)/) |
|
972 |
{ |
|
973 |
if($1 eq '') |
|
974 |
{ |
|
975 |
$opt_compression_type = ALLSECTIONS; |
|
976 |
print "Whole ROM image will be compressed.\n"; |
|
977 |
} |
|
978 |
elsif($1 eq '=paged') |
|
979 |
{ |
|
980 |
$opt_compression_type = PAGEDSECTION; |
|
981 |
print "Paged section of the ROM image will be compressed.\n"; |
|
982 |
} |
|
983 |
elsif($1 eq '=unpaged') |
|
984 |
{ |
|
985 |
$opt_compression_type = UNPAGEDSECTION; |
|
986 |
print "Unpaged section of the ROM image will be compressed.\n"; |
|
987 |
} |
|
988 |
else |
|
989 |
{ |
|
990 |
print "Unknown compression type: $1\n"; |
|
991 |
$errors++; |
|
992 |
} |
|
993 |
next; |
|
994 |
} |
|
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
995 |
if ($arg =~ /^-nofm(=(.*))?$/) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
996 |
if(!$1) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
997 |
$noFeatureConf = 1 ; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
998 |
next ; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
999 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1000 |
|
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1001 |
if (!$enforceFeatureManager) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1002 |
print "Unsupported option: $arg\n"; |
606 | 1003 |
$errors++; |
1004 |
next; |
|
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1005 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1006 |
$noFeatureConf = 0; |
606 | 1007 |
$noFeatureManager = 1; |
1008 |
#DEF125375 If caller is simply giving -nofm without any parameter, a warning message will be given. |
|
1009 |
if(!$2) |
|
1010 |
{ |
|
1011 |
print "Warning: No filename specified with \"-nofm=\" option, feature data file might not be included.\n"; |
|
1012 |
} |
|
1013 |
else |
|
1014 |
{ |
|
1015 |
$preBuiltFeaturesDataFile = $2; |
|
1016 |
} |
|
1017 |
next; |
|
1018 |
} |
|
1019 |
#Process feature registry database xml file |
|
1020 |
if($arg =~ /^-fr=(.*)/ || $arg =~ /^-f(.*)/) |
|
1021 |
{ |
|
1022 |
if ($enforceFeatureManager) |
|
1023 |
{ |
|
1024 |
print "Error: Option \"-f|-fr\" is no longer supported.\n"; |
|
1025 |
$errors++; |
|
1026 |
next; |
|
1027 |
} |
|
1028 |
$featureXml = $1; |
|
1029 |
$xmlrequired = 1; |
|
1030 |
if ($featureXml =~ /^$/) |
|
1031 |
{ |
|
1032 |
print "Error: No filename specified with \"-f|-fr\" option.\n"; |
|
1033 |
} |
|
1034 |
next; |
|
1035 |
} |
|
1036 |
if ($arg =~ /^-spiplacement$/) |
|
1037 |
{ |
|
1038 |
$spiplacement = 1; |
|
1039 |
next; |
|
1040 |
} |
|
1041 |
if ($arg =~ /^-noimage$/) |
|
1042 |
{ |
|
1043 |
$noimage=1; |
|
1044 |
next; |
|
1045 |
} |
|
1046 |
if ($arg =~ /^-nosymbols$/) |
|
1047 |
{ |
|
1048 |
$nosymbols=1; |
|
1049 |
next; |
|
1050 |
} |
|
1051 |
if ($arg =~ /^-geninc$/) |
|
1052 |
{ |
|
1053 |
$geninc=1; |
|
1054 |
next; |
|
1055 |
} |
|
1056 |
if($arg =~ /^-gendep$/) |
|
1057 |
{ |
|
1058 |
$gendep=1; |
|
1059 |
next; |
|
1060 |
} |
|
1061 |
if ($arg =~ /^-checkcase$/) |
|
1062 |
{ |
|
1063 |
$checkcase=1; |
|
1064 |
next; |
|
1065 |
} |
|
1066 |
if ($arg =~ /^-checkcase_test$/) |
|
1067 |
{ |
|
1068 |
$checkcase_test=1; |
|
1069 |
next; |
|
1070 |
} |
|
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1071 |
|
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
1072 |
if ($arg =~ /^-stdcpp$/) |
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1073 |
{ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1074 |
if($nopreprocess) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1075 |
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
|
1076 |
} |
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1077 |
else { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1078 |
if (&is_linux) |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1079 |
{ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1080 |
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
|
1081 |
next; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1082 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1083 |
if ($cppoption) |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1084 |
{ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1085 |
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
|
1086 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1087 |
$stdcpp = 1; |
606 | 1088 |
} |
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
1089 |
next; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
1090 |
} |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
1091 |
if ($arg =~ /^-cpp=(.*)/) |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
1092 |
{ |
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1093 |
if($nopreprocess) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1094 |
print STDERR "Warning: -cpp option is invalid because the -nopreprocess option set.\n"; |
606 | 1095 |
} |
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1096 |
else { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1097 |
if ($stdcpp) |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1098 |
{ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1099 |
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
|
1100 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1101 |
if ($cppoption) |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1102 |
{ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1103 |
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
|
1104 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1105 |
$cppoption = 1; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1106 |
$preprocessor = $1; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1107 |
$preprocessor =~ s-\\-\/-g; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1108 |
$preprocessor =~ s-EPOCROOT##\/?-$epocroot-g; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1109 |
if (-d $preprocessor) |
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 |
$preprocessor .= "\/" unless $preprocessor =~ /\/$/; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1112 |
$preprocessor .= "cpp"; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1113 |
} |
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
1114 |
} |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
1115 |
next; |
606 | 1116 |
} |
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
1117 |
|
609 | 1118 |
if ($arg =~ /^-prependepocroot$/) |
1119 |
{ |
|
1120 |
$prependepocroot = 1; |
|
1121 |
next; |
|
1122 |
} |
|
1123 |
if($arg =~/^-c(.*)/) |
|
606 | 1124 |
{ |
1125 |
if($1 eq 'none' ) |
|
1126 |
{ |
|
1127 |
$opt_compression = " -compressionmethod none"; |
|
1128 |
} |
|
1129 |
elsif($1 eq 'inflate' ) |
|
1130 |
{ |
|
1131 |
$opt_compression = " -compressionmethod inflate"; |
|
1132 |
} |
|
1133 |
elsif($1 eq 'bytepair' ) |
|
1134 |
{ |
|
1135 |
$opt_compression = " -compressionmethod bytepair"; |
|
1136 |
} |
|
1137 |
else |
|
1138 |
{ |
|
1139 |
print "Unknown compression method: $1\n"; |
|
1140 |
$errors++; |
|
1141 |
} |
|
1142 |
next; |
|
1143 |
} |
|
647 | 1144 |
if ($arg =~ /^-inputoby=(.*)/) |
1145 |
{ |
|
1146 |
$ignoreconfig =1; |
|
1147 |
my $ignoreoby = $1; |
|
1148 |
$ignoreoby .= ".oby" unless $ignoreoby =~ /\.oby$/i; |
|
1149 |
die "$ignoreoby file does not exist!!\n" if (!-e $ignoreoby); |
|
1150 |
open IGNORE, "$ignoreoby" or die("* Can't open $ignoreoby\n"); |
|
1151 |
my @lines = <IGNORE>; |
|
1152 |
close IGNORE; |
|
1153 |
my $keywordcount = 0; |
|
1154 |
my $romimgcount = 0; |
|
1155 |
my $rofsimgcount = 0; |
|
1156 |
my $fatcount = 0; |
|
1157 |
my $smrcount = 0; |
|
1158 |
foreach my $line (@lines) |
|
1159 |
{ |
|
1160 |
if ($line =~ /^\s*romsize\s*=/) |
|
1161 |
{ |
|
1162 |
next if ($romimgcount); |
|
1163 |
$romimgcount = 1; |
|
1164 |
$keywordcount ++; |
|
1165 |
$ignoreoby =~ s/\.oby$//i; |
|
1166 |
$romimage[$romcount] = {xip=>1, obeyfile=>$ignoreoby, compress=>0, extension=>0, composite=>"none",uncompress=>0 }; |
|
1167 |
$romcount ++; |
|
1168 |
}elsif ($line =~ /^\s*rofssize\s*=/) |
|
1169 |
{ |
|
1170 |
next if ($rofsimgcount); |
|
1171 |
$rofsimgcount = 1; |
|
1172 |
$keywordcount ++; |
|
1173 |
$ignoreoby =~ s/\.oby$//i; |
|
1174 |
$romimage[$romcount] = {xip=>0, obeyfile=>$ignoreoby, compress=>0, extension=>0, composite=>"none",uncompress=>0 }; |
|
1175 |
$romcount ++; |
|
1176 |
}elsif ($line =~ /^\s*dataimagename\s*=/) |
|
1177 |
{ |
|
1178 |
next if ($fatcount); |
|
1179 |
$fatcount = 1; |
|
1180 |
$keywordcount ++; |
|
1181 |
$ignoreoby =~ s/\.oby$//i; |
|
1182 |
$datadriveimage[$dataImageCount] = {obeyfile=>$ignoreoby, compress=>0, uncompress=>0}; |
|
1183 |
$dataImageCount ++; |
|
1184 |
$dataIndexHash{0} = 0; |
|
1185 |
}elsif ($line =~ /^\s*imagename\s*=/) |
|
1186 |
{ |
|
1187 |
next if ($smrcount); |
|
1188 |
$smrcount = 1; |
|
1189 |
$keywordcount ++; |
|
1190 |
$ignoreoby =~ s/\.oby$//i; |
|
1191 |
$needSmrImage = 1; |
|
1192 |
push @obeyFileList, $ignoreoby; |
|
1193 |
} |
|
1194 |
} |
|
1195 |
die "$ignoreoby file does not contain keywords romsize/rofssize/dataimagename/imagename, cannot identify the oby type!\n" if ($keywordcount == 0); |
|
1196 |
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); |
|
1197 |
next; |
|
1198 |
} |
|
606 | 1199 |
if( $arg =~ /^-loglevel\d+$/) |
1200 |
{ |
|
1201 |
$logLevel= $arg; |
|
1202 |
next; |
|
1203 |
} |
|
1204 |
# get Z directory location if specified by the user. |
|
1205 |
# if yes, then extract directory location from the given array element. |
|
1206 |
if( $arg =~ /^-z=(.*)/ || $arg =~ /^-zdrivepath=(.*)/i ) |
|
1207 |
{ |
|
1208 |
# check for white space in the specified folder path |
|
1209 |
# if "yes" then warn the user saying folder will be created under default location. |
|
1210 |
# else set the path specified by the user. |
|
1211 |
if(&datadriveimage::checkForWhiteSpace($1,"zdrive")) |
|
1212 |
{ |
|
1213 |
next; |
|
1214 |
} |
|
1215 |
else |
|
1216 |
{ |
|
1217 |
$ZDirloc = $1; |
|
1218 |
$ZDirloc =~ s-\\-\/-g; |
|
1219 |
if( $ZDirloc !~ m/\/(\Z)/) |
|
1220 |
{ |
|
1221 |
$ZDirloc .= "\/"; |
|
1222 |
} |
|
1223 |
if( $ZDirloc !~ m/:/) |
|
1224 |
{ |
|
1225 |
print "drive letter not specified\n"; |
|
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
1226 |
$ZDirloc = $thisdir.$ZDirloc; |
606 | 1227 |
} |
1228 |
print "Z Drive directory location = $ZDirloc\n"; |
|
1229 |
#set the location of Z Drive directory. |
|
1230 |
$ZDirloc .= "zdrive"; |
|
1231 |
} |
|
1232 |
next; |
|
1233 |
} |
|
1234 |
# get data directory location if specified by the user. |
|
1235 |
# if yes, then extract directory location from the given array element. |
|
1236 |
if( $arg =~ /^-d=(.*)/ || $arg =~ /^-datadrivepath=(.*)/i ) |
|
1237 |
{ |
|
1238 |
# check for white space in the specified folder path |
|
1239 |
# if "yes" then warn the user saying folder will be created under default location. |
|
1240 |
# else set the path specified by the user. |
|
1241 |
if(&datadriveimage::checkForWhiteSpace($1,"datadrive")) |
|
1242 |
{ |
|
1243 |
next; |
|
1244 |
} |
|
1245 |
else |
|
1246 |
{ |
|
1247 |
$DataDriveDirloc = $1; |
|
1248 |
$DataDriveDirloc =~ s-\\-\/-g; |
|
1249 |
if( $DataDriveDirloc !~ m/\/(\Z)/) |
|
1250 |
{ |
|
1251 |
$DataDriveDirloc .= "\/"; |
|
1252 |
} |
|
1253 |
if( $DataDriveDirloc !~ m/:/) |
|
1254 |
{ |
|
1255 |
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
|
1256 |
$DataDriveDirloc = $thisdir.$DataDriveDirloc; |
606 | 1257 |
} |
1258 |
print "Data Drive directory location = $DataDriveDirloc\n"; |
|
1259 |
#set the location of Data Drive directory. |
|
1260 |
$DataDriveDirloc .= "datadrive"; |
|
1261 |
} |
|
1262 |
next; |
|
1263 |
} |
|
1264 |
# get Z dive image if specified by the user. |
|
1265 |
if( $arg =~ /^-zdriveimage=(.*)/i ) |
|
1266 |
{ |
|
1267 |
my $imageName = $1; |
|
1268 |
if( $imageName =~ m/\,/) |
|
1269 |
{ |
|
1270 |
@zdriveImageName = split(/\,/,$imageName); |
|
1271 |
} |
|
1272 |
else |
|
1273 |
{ |
|
1274 |
push(@zdriveImageName,$imageName); |
|
1275 |
} |
|
1276 |
$opt_zimage = 1; |
|
1277 |
next; |
|
1278 |
} |
|
1279 |
# get command line arguments which needs to be passed to INTERPRETSIS, if specified by the user. |
|
1280 |
if( $arg =~ /^-argforinterpretsis=(.*)/i ) |
|
1281 |
{ |
|
1282 |
my $interpretsisOpt = $1; |
|
1283 |
if( $interpretsisOpt =~ m/\,/) |
|
1284 |
{ |
|
1285 |
@interpretsisOptList = split(/\,/,$interpretsisOpt); |
|
1286 |
} |
|
1287 |
else |
|
1288 |
{ |
|
1289 |
push(@interpretsisOptList,$interpretsisOpt); |
|
1290 |
} |
|
1291 |
next; |
|
1292 |
} |
|
1293 |
if ( $arg =~ /^-r$/i || $arg =~ /^-retainfolder$/i ) |
|
1294 |
{ |
|
1295 |
$opt_r = 1; |
|
1296 |
next; |
|
1297 |
} |
|
1298 |
if ( $arg =~ /^-pfile=(.*)/i ) |
|
1299 |
{ |
|
1300 |
$paraFile = $1; |
|
1301 |
next; |
|
1302 |
} |
|
1303 |
if ( $arg =~ /^-l=(.*)/i || $arg =~ /^-logimageentry=(.*)/i ) |
|
1304 |
{ |
|
1305 |
if( $1 =~/[\/\\]/ || $1 =~ m/:/) |
|
1306 |
{ |
|
1307 |
print "* Warning: Invalid log file extension try filename.txt\n"; |
|
1308 |
next; |
|
1309 |
} |
|
1310 |
else |
|
1311 |
{ |
|
1312 |
$opt_logFile = 1; |
|
1313 |
$imageEntryLogFile = $1; |
|
1314 |
} |
|
1315 |
next; |
|
1316 |
} |
|
1317 |
if ( $arg =~ /^-lowmem/i ) |
|
1318 |
{ |
|
1319 |
$lowMem = $arg; |
|
1320 |
next; |
|
1321 |
} |
|
633 | 1322 |
if( $arg =~ /^-xiponly$/i) |
1323 |
{ |
|
1324 |
$opt_xiponly = 1; |
|
1325 |
next; |
|
1326 |
} |
|
606 | 1327 |
if ($arg =~ /^-/) |
1328 |
{ |
|
1329 |
print "Unknown arg: $arg\n"; |
|
1330 |
$errors++; |
|
1331 |
next; |
|
1332 |
} |
|
1333 |
# It's an OBY file |
|
1334 |
next if (match_obyfile($arg)); |
|
1335 |
next if (match_obyfile("$arg.oby")); |
|
1336 |
||
1337 |
print "Cannot find oby file: $arg\n"; |
|
1338 |
$errors++ if(!$opt_k); |
|
1339 |
} |
|
1340 |
||
1341 |
if (defined $paramFileFlag) |
|
1342 |
{ |
|
1343 |
return; |
|
1344 |
} |
|
1345 |
||
647 | 1346 |
$preserve = 1 if ($ignoreconfig); |
1347 |
if (@obyfiles<1 && !$ignoreconfig) |
|
606 | 1348 |
{ |
1349 |
print "Missing obyfile argument\n"; |
|
1350 |
$errors++ if(!$opt_k); |
|
1351 |
} |
|
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
1352 |
if(defined($obycharset)) |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
1353 |
{ |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
1354 |
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
|
1355 |
{ |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
1356 |
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
|
1357 |
} |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
1358 |
} |
606 | 1359 |
|
1360 |
if ($errors) |
|
1361 |
{ |
|
1362 |
print_usage(); |
|
1363 |
exit 1; |
|
1364 |
} |
|
1365 |
||
1366 |
if ($noFeatureManager && $featuremanager) |
|
1367 |
{ |
|
1368 |
print "Warning: Ignoring \"-nofm\" option, as both \"-nofm\" and \"-fm\" options are provided.\n"; |
|
1369 |
$noFeatureManager = 0; |
|
1370 |
} |
|
1371 |
||
1372 |
# Adding variant specific macros by including a HRH file |
|
1373 |
# (only required if no Feature Variant is used) |
|
1374 |
if (!$featureVariant{'VALID'}) |
|
1375 |
{ |
|
1376 |
my $variantMacroHRHFile = get_variantmacroHRHfile(); |
|
1377 |
if($variantMacroHRHFile){ |
|
1378 |
my $variantFilePath = split_path('Path',$variantMacroHRHFile); |
|
1379 |
$cppargs .= " -I " . &append_driveandquote($variantFilePath) . " -include " . &append_driveandquote($variantMacroHRHFile); |
|
1380 |
print "in cmd process $cppargs\n" if ($opt_v); |
|
1381 |
} |
|
1382 |
} |
|
1383 |
# load the required modules if xml is required |
|
1384 |
if ($xmlrequired == 1) |
|
1385 |
{ |
|
1386 |
if (defined ($featureXml)) |
|
1387 |
{ |
|
1388 |
load_featuresutil(); |
|
1389 |
} |
|
1390 |
||
1391 |
if ($image_content) |
|
1392 |
{ |
|
1393 |
&FlexLoad_ModuleL("ImageContentHandler"); |
|
1394 |
# some variables for ImageContentHandler may have been setup |
|
1395 |
my ($key, $value); |
|
1396 |
&ImageContentHandler::SetBldRomOpts; # Defaults to armv5 platform |
|
1397 |
while (($key,$value) = each %tmpBldRomOpts) |
|
1398 |
{ |
|
1399 |
&ImageContentHandler::SetBldRomOpts($key, $value); |
|
1400 |
} |
|
1401 |
} |
|
1402 |
||
1403 |
} |
|
1404 |
} |
|
1405 |
||
1406 |
#---------------------------------------------------------------------------------- |
|
1407 |
# Preprocessing phase |
|
1408 |
# |
|
1409 |
# Concatentate the specified .oby files and pass them through cpp |
|
1410 |
# to get the raw ROM specification in tmp1.oby |
|
1411 |
||
1412 |
sub preprocessing_phase |
|
1413 |
{ |
|
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1414 |
if($nopreprocess == 0) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1415 |
my $temp1OBYFile = $thisdir."tmp1.oby"; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1416 |
unlink "$temp1OBYFile"; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1417 |
|
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1418 |
# 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
|
1419 |
if (defined ($featureXml)) |
606 | 1420 |
{ |
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1421 |
$cppargs .= " -DROM_FEATURE_MANAGEMENT "; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1422 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1423 |
|
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1424 |
# 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
|
1425 |
if ($featureVariant{'VALID'}) |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1426 |
{ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1427 |
$cppargs .= " -I."; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1428 |
my $incRef = $featureVariant{'ROM_INCLUDES'}; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1429 |
if ($incRef) |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1430 |
{ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1431 |
foreach (@$incRef) |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1432 |
{ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1433 |
$cppargs .= " -I \"$_\""; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1434 |
} |
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 |
my $HRH = $featureVariant{'VARIANT_HRH'}; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1437 |
if ($HRH) |
606 | 1438 |
{ |
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1439 |
$cppargs .= " -include \"$HRH\""; |
606 | 1440 |
} |
1441 |
} |
|
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1442 |
else |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1443 |
{ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1444 |
# 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
|
1445 |
$cppargs .= " -I. -I \"$rominclude\""; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1446 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1447 |
|
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1448 |
if ($stdcpp) |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1449 |
{ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1450 |
$preprocessor = find_stdcpp(); |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1451 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1452 |
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
|
1453 |
|
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1454 |
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
|
1455 |
$errors = 0; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1456 |
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
|
1457 |
foreach my $arg (@obyfiles) |
606 | 1458 |
{ |
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1459 |
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
|
1460 |
|
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1461 |
if(open(OBY, $arg)) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1462 |
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
|
1463 |
while ($line=<OBY>) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1464 |
print CPP $line; |
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 |
close OBY; |
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 |
else { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1469 |
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
|
1470 |
if(!$opt_k){ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1471 |
close CPP; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1472 |
exit(1); |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1473 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1474 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1475 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1476 |
close CPP; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1477 |
my $cpp_status = $?; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1478 |
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
|
1479 |
|
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1480 |
if( defined ($image_content)) |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1481 |
{ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1482 |
#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
|
1483 |
&ReadPreprocessedFile($temp1OBYFile); |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1484 |
|
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1485 |
# 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
|
1486 |
&ImageContentHandler::UpdateObyBinaryStaticDep(); |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1487 |
|
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1488 |
#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
|
1489 |
&ImageContentHandler::GenObyFile($temp1OBYFile); |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1490 |
} |
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 |
if($obycharset =~ /utf-?8/i) |
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 |
my $utf8file = $thisdir."tmp1utf8.oby"; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1495 |
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
|
1496 |
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
|
1497 |
while(<INFILE>) |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1498 |
{ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1499 |
print CHARSETTRAN $_; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1500 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1501 |
close CHARSETTRAN; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1502 |
close INFILE; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1503 |
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
|
1504 |
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
|
1505 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1506 |
@obydata = (); |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1507 |
# load tmp1.oby here |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1508 |
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
|
1509 |
while(<TMP1>) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1510 |
push @obydata,$_; |
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 |
close TMP1 ; |
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
1513 |
} |
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1514 |
else { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1515 |
foreach my $arg (@obyfiles) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1516 |
if(open(OBY, $arg)) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1517 |
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
|
1518 |
while (<OBY>) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1519 |
push @obydata,$_; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1520 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1521 |
close OBY; |
606 | 1522 |
} |
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1523 |
else { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1524 |
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
|
1525 |
if(!$opt_k){ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1526 |
exit(1); |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1527 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1528 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1529 |
} |
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
1530 |
} |
606 | 1531 |
} |
1532 |
||
1533 |
sub ReadPreprocessedFile |
|
1534 |
{ |
|
1535 |
# Read the OBY file that was generated by the pre-processor. This OBY is a conglomeration of all the OBYs |
|
1536 |
# passed directly to buildrom and/or the ones passed through Image Content XML. |
|
1537 |
# It marks the binaries coming from OBY. This is required to be able to point out the binaries that are |
|
1538 |
# mentioned neither in the OBY nor in the CDF. Such binaries are arrived at through static dependencies |
|
1539 |
# and need to be included in ROM. |
|
1540 |
||
1541 |
my $temp1OBYFile = shift; |
|
1542 |
my $tmpline; |
|
1543 |
my $srcFileName; |
|
1544 |
my $srcFilePath; |
|
1545 |
my $dstFileName; |
|
1546 |
my $dstFilePath; |
|
1547 |
open (OBYFH, "$temp1OBYFile") or die("* Can't open $temp1OBYFile\n"); |
|
1548 |
while($tmpline =<OBYFH>) { |
|
1549 |
if ($tmpline=~/(\S+)\s*=\s*(\S+)\s+(\S+)/) {#Get the first parameter (source File path) from oby line |
|
1550 |
$srcFilePath = $2; |
|
1551 |
$dstFilePath = $3; |
|
1552 |
||
1553 |
if ($srcFilePath=~/.*[\/\\](\S+)/) { |
|
1554 |
$srcFileName = $1; |
|
1555 |
} |
|
1556 |
if ($dstFilePath=~/.*[\/\\](\S+)/) { |
|
1557 |
$dstFileName = $1; |
|
1558 |
} |
|
1559 |
my $binaryInfoRef = &cdfparser::GetBinaryInfo($dstFileName); |
|
1560 |
||
1561 |
if(defined($binaryInfoRef)) |
|
1562 |
{ |
|
1563 |
#Found in CDF file |
|
1564 |
if($binaryInfoRef->{IsFoundInCDF}) |
|
1565 |
{ |
|
1566 |
print "Warning: File $srcFileName mentioned in OBY as well as CDF file\n"; |
|
1567 |
} |
|
1568 |
} |
|
1569 |
else |
|
1570 |
{ |
|
1571 |
#Found in OBY file |
|
1572 |
&ImageContentHandler::AddBinaryFromOby($dstFileName, $srcFilePath); |
|
1573 |
} |
|
1574 |
} |
|
1575 |
} |
|
1576 |
close OBYFH; |
|
1577 |
} |
|
1578 |
||
1579 |
||
1580 |
#---------------------------------------------------------------------------------- |
|
1581 |
# Substitution phase |
|
1582 |
# |
|
1583 |
# Handle the "define XXX YYY" lines, perform the substitutions. |
|
1584 |
# Print out any ECHO lines or ERROR lines. |
|
1585 |
# |
|
1586 |
||
1587 |
# Predefined substitutions: |
|
1588 |
# TODAY means todays' date |
|
1589 |
# RIGHT_NOW means the exact time |
|
1590 |
# EPOCROOT taken from the environment |
|
1591 |
||
1592 |
sub substitution_phase |
|
1593 |
{ |
|
1594 |
{ |
|
1595 |
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); |
|
1596 |
$substitutionData{"TODAY"} = sprintf("%02d/%02d/%04d", $mday, $mon+1, $year+1900); |
|
1597 |
$substitutionData{"RIGHT_NOW"} = sprintf("%02d/%02d/%04d %02d:%02d:%02d", $mday, $mon+1, $year+1900, $hour, $min, $sec); |
|
1598 |
$substitutionData{"EPOCROOT"} = $epocroot; |
|
1599 |
@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
|
1600 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1601 |
|
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1602 |
foreach $line(@obydata) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1603 |
if(($line =~ /^\s*romsize\s*=/i) || ( $line=~ /^\s*rom_image/i) || ($line =~ /^\s*data_image/i)) { |
606 | 1604 |
$onlysmrimage = 0; |
1605 |
last; |
|
1606 |
} |
|
1607 |
} |
|
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1608 |
if($noFeatureConf == 0) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1609 |
if ($enforceFeatureManager && (!$featuremanager) && (!$noFeatureManager) ) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1610 |
my $defaultFeatureDbFlag = 0; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1611 |
foreach $line(@obydata) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1612 |
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
|
1613 |
{ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1614 |
# 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
|
1615 |
|
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1616 |
$featureXml = "$epocroot$1"; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1617 |
$featureXml =~ s-\\-\/-g; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1618 |
$featuremanager = 1; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1619 |
$defaultFeatureDbFlag = 1; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1620 |
load_featuresutil(); |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1621 |
last; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1622 |
} |
606 | 1623 |
} |
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1624 |
|
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1625 |
|
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1626 |
if(!$defaultFeatureDbFlag && !$onlysmrimage) |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1627 |
{ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1628 |
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
|
1629 |
exit(1); |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1630 |
} |
606 | 1631 |
} |
1632 |
} |
|
697
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 |
# Setup default rom configuration |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1635 |
$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
|
1636 |
|
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1637 |
my @savedObyData = @obydata; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1638 |
@obydata = (); |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1639 |
foreach $line(@savedObyData) { |
606 | 1640 |
track_source($line); |
1641 |
$line =~ s-\\-\/-g; |
|
1642 |
||
609 | 1643 |
if ($prependepocroot) |
606 | 1644 |
{ |
609 | 1645 |
my $tempstring = $epocroot."epoc32\/"; |
1646 |
if(($line !~ /^\s*\#/) && ($line =~ /\/epoc32\//i) |
|
1647 |
&& ($line !~ /EPOCROOT##\/?epoc32\//i) && ($line !~ /$tempstring/i)) |
|
1648 |
{ |
|
1649 |
print "add EPOCROOT for line: $line\n" if ($opt_v); |
|
1650 |
$line =~ s-\/epoc32-EPOCROOT##epoc32-ig; |
|
1651 |
} |
|
606 | 1652 |
} |
1653 |
# |
|
1654 |
# Recognise keywords in lines that we process before substitution |
|
1655 |
# |
|
1656 |
# # lineno "file" flagno |
|
1657 |
# DEFINE name replacement-with-0-spaces |
|
1658 |
# |
|
1659 |
if($line=~/^\s*$/) |
|
1660 |
{ |
|
1661 |
next; |
|
1662 |
} |
|
1663 |
if ($line=~/^# (\d+) "(.*)" (\d+)/) |
|
1664 |
{ |
|
1665 |
push @obydata, $line; |
|
1666 |
next; |
|
1667 |
} |
|
1668 |
||
1669 |
if ($line=~/^\s*defaultfeaturedb\s*=?\s*(\S+)/i) |
|
1670 |
{ |
|
1671 |
push @obydata, "REM $line"; |
|
1672 |
next; |
|
1673 |
} |
|
1674 |
#process the External tool invocation using IBY file |
|
1675 |
if ($line=~/externaltool=(.*),?/i) |
|
1676 |
{ |
|
1677 |
&externaltools::loadTools($1); |
|
1678 |
next; |
|
1679 |
} |
|
1680 |
||
1681 |
#Process the patch statement |
|
1682 |
if($line =~ /^\s*patchdata\s*(.*)/i) |
|
1683 |
{ |
|
1684 |
$patchDataStmtFlag = 1; |
|
1685 |
my $new_line = $1; |
|
1686 |
# syntax "<DLLnamewithpath> addr <variableaddress> <variablesize> <newvalue>" |
|
1687 |
# If the line matches with above syntax, just add the line into oby file. |
|
1688 |
if($new_line !~ /^\s*(\S+)\s+addr\s+(\S+)\s+(\S+)\s+(\S+)\s*$/i) |
|
1689 |
{ |
|
1690 |
if(AddDllDataInfo($new_line)) |
|
1691 |
{ |
|
1692 |
$line = "REM $line"; |
|
1693 |
} |
|
1694 |
} |
|
1695 |
} |
|
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1696 |
if($noFeatureConf == 0) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1697 |
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
|
1698 |
# 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
|
1699 |
if(defined ($featureXml)) |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1700 |
{ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1701 |
push @obydata, "$line"; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1702 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1703 |
else |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1704 |
{ |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1705 |
push @obydata, "REM handled $line"; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1706 |
} |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
1707 |
next; |
606 | 1708 |
} |
1709 |
} |
|
1710 |
||
1711 |
if ($line=~/^\s*DEFINE\s+(\w+)\s+(\S+)/i) |
|
1712 |
{ |
|
1713 |
my $key=$1; |
|
1714 |
my $value=$2; |
|
1715 |
foreach my $wordToSubstitute (@substitutionOrder) |
|
1716 |
{ |
|
1717 |
my $whatToSubstituteItWith=$substitutionData{$wordToSubstitute}; |
|
1718 |
$value=~s/$wordToSubstitute/$whatToSubstituteItWith/g; |
|
1719 |
} |
|
1720 |
$value=~s/##//g; |
|
1721 |
if (defined $substitutionData{$key}) |
|
1722 |
{ |
|
1723 |
# If the key is redefined, apply it at the new position rather |
|
1724 |
# than the old one. |
|
1725 |
push @obydata, "REM redefined $key as $value\n";# Leave a record of the definition |
|
1726 |
@substitutionOrder = grep !/^$key$/, @substitutionOrder; |
|
1727 |
} |
|
1728 |
else |
|
1729 |
{ |
|
1730 |
push @obydata, "REM defined $key as $value\n"; # Leave a record of the definition |
|
1731 |
} |
|
1732 |
$substitutionData{$key}=$value; |
|
1733 |
||
1734 |
foreach my $wordToSubstitute (@substitutionOrder) |
|
1735 |
{ |
|
1736 |
if ($key =~ /$wordToSubstitute/) |
|
1737 |
{ |
|
1738 |
print_source_error("Warning: $key is masked by earlier definition of $wordToSubstitute"); |
|
1739 |
} |
|
1740 |
} |
|
1741 |
||
1742 |
push @substitutionOrder, $key; |
|
1743 |
next; |
|
1744 |
} |
|
1745 |
# |
|
1746 |
# Do the substitutions in strict order of definition, |
|
1747 |
# then eliminate any old-fashioned ## things which may be left |
|
1748 |
# |
|
1749 |
foreach my $wordToSubstitute (@substitutionOrder) |
|
1750 |
{ |
|
1751 |
my $whatToSubstituteItWith=$substitutionData{$wordToSubstitute}; |
|
1752 |
$line=~s/$wordToSubstitute/$whatToSubstituteItWith/g; |
|
1753 |
} |
|
1754 |
$line=~s/##//g; |
|
1755 |
# |
|
1756 |
# Recognise keywords in lines that we process after substitution |
|
1757 |
# |
|
1758 |
# ECHO anything at all |
|
1759 |
# WARNING anything at all |
|
1760 |
# ERROR anything at all |
|
1761 |
# LANGUAGE_CODE nnn |
|
1762 |
# DEFAULT_LANGUAGE nnn |
|
1763 |
# ABI_DOWNGRADE from to |
|
1764 |
# ROMBUILD_OPTION command-line-option |
|
1765 |
# ROM_IMAGE |
|
1766 |
# PlatSecEnforceSysBin on|off |
|
1767 |
# ENABLE_SPI/DISABLE_SPI |
|
1768 |
# |
|
1769 |
if ($line=~/^\s*ECHO\s+(.*?)\s*$/i) |
|
1770 |
{ |
|
1771 |
print "$1\n"; |
|
1772 |
push @obydata, "REM handled $line"; |
|
1773 |
next; |
|
1774 |
} |
|
1775 |
if ($line=~/^\s*(ERROR|WARNING)\s+(.*?)\s*$/i) |
|
1776 |
{ |
|
1777 |
print_source_error("$1 $2"); |
|
1778 |
$errors++ if ($1 =~ /ERROR/i); |
|
1779 |
push @obydata, "REM handled $line"; |
|
1780 |
next; |
|
1781 |
} |
|
1782 |
if ($line=~/^\s*(PlatSecEnforceSysBin)\s+(\S+)\s*$/i) |
|
1783 |
{ |
|
1784 |
$enforceSysBin = ($2 =~ /ON/i); |
|
1785 |
push @obydata, $line; |
|
1786 |
next; |
|
1787 |
} |
|
1788 |
if ($line=~/^\s*LANGUAGE_CODE\s+(\S+)\s*/i) |
|
1789 |
{ |
|
1790 |
my $code = $1; |
|
1791 |
if ($code !~ /^\d\d+$/) |
|
1792 |
{ |
|
1793 |
print_source_error("bad language code $code"); |
|
1794 |
$errors++; |
|
1795 |
} |
|
1796 |
else |
|
1797 |
{ |
|
1798 |
$languageCodes{$code} = 1; |
|
1799 |
} |
|
1800 |
push @obydata, "REM handled $line"; |
|
1801 |
next; |
|
1802 |
} |
|
1803 |
if ($line=~/^\s*DEFAULT_LANGUAGE\s+(\S+)\s*/i) |
|
1804 |
{ |
|
1805 |
my $code = $1; |
|
1806 |
if ($code !~ /^\d\d+$/) |
|
1807 |
{ |
|
1808 |
print_source_error("bad default language code $code"); |
|
1809 |
$errors++; |
|
1810 |
} |
|
1811 |
else |
|
1812 |
{ |
|
1813 |
$defaultLanguageCode = $code; |
|
1814 |
} |
|
1815 |
push @obydata, "REM handled $line"; |
|
1816 |
next; |
|
1817 |
} |
|
1818 |
||
1819 |
if ($line=~/^\s*ABI_DOWNGRADE\s*/i) |
|
1820 |
{ |
|
1821 |
if ($line =~ /\s(.+)\s*->\s*(.+)\s*$/) |
|
1822 |
{ |
|
1823 |
$abiDowngrade = "$1 $2"; |
|
1824 |
} |
|
1825 |
else |
|
1826 |
{ |
|
1827 |
print_source_error("bad ABI downgrade : $line"); |
|
1828 |
$errors++; |
|
1829 |
} |
|
1830 |
push @obydata, "REM handled $line"; |
|
1831 |
next; |
|
1832 |
} |
|
1833 |
if ($line=~/^\s*BINARY_SELECTION_ORDER\s*/i) |
|
1834 |
{ |
|
1835 |
if ($line =~ /\s([^,]+)\s*,\s*(.+)\s*$/) |
|
1836 |
{ |
|
1837 |
$binarySelectionOrderFlag = 1; |
|
1838 |
$firstDIR = $1; |
|
1839 |
# remove whitespaces |
|
1840 |
$firstDIR = trim($firstDIR); |
|
1841 |
@binarySelectionOrder = split(',', $2); |
|
1842 |
@binarySelectionOrder = trim(@binarySelectionOrder); |
|
1843 |
||
1844 |
} |
|
1845 |
else |
|
1846 |
{ |
|
1847 |
print_source_error("bad order specified: $line"); |
|
1848 |
$errors++; |
|
1849 |
} |
|
1850 |
push @obydata, "REM handled $line"; |
|
1851 |
next; |
|
1852 |
} |
|
1853 |
||
1854 |
if ($line=~/^\s*ROMBUILD_OPTION\s+(\S+)\s*/i) |
|
1855 |
{ |
|
1856 |
$rombuildOptions{$1} = 1; |
|
1857 |
push @obydata, "REM handled $line"; |
|
1858 |
next; |
|
1859 |
} |
|
1860 |
||
1861 |
if ($line=~/^\s*enable_spi\s*$/i) |
|
1862 |
{ |
|
1863 |
if(!($spiset)) { |
|
1864 |
$createspi=1; |
|
1865 |
} |
|
1866 |
push @obydata, "REM handled $line"; |
|
1867 |
next; |
|
1868 |
} |
|
1869 |
||
1870 |
if ($line=~/^\s*disable_spi\s*/i) |
|
1871 |
{ |
|
1872 |
if(!($spiset)) { |
|
1873 |
$createspi=0; |
|
1874 |
} |
|
1875 |
push @obydata, "REM handled $line"; |
|
1876 |
next; |
|
1877 |
} |
|
1878 |
||
1879 |
if ($line=~/^\s*DATA_IMAGE\s+/i) |
|
1880 |
{ |
|
1881 |
if ($line =~ /\s+(\d+)\s+(\S+)\s+/i) |
|
1882 |
{ |
|
1883 |
my $datadriveidx = $1; |
|
1884 |
my $datadriveimagename = $2; |
|
1885 |
# have a count on number of data drive images that needs to be created |
|
1886 |
print "data drive partion name = $datadriveimagename\n " if($opt_v); |
|
1887 |
my $dataimagesize = 0; |
|
1888 |
if ($line =~ /\s+size=(\S+)\s*/i) |
|
1889 |
{ |
|
1890 |
$dataimagesize=$1; |
|
1891 |
} |
|
1892 |
my $fstype = ""; |
|
1893 |
my $compress=0; |
|
1894 |
my $uncompress=0; |
|
1895 |
if ($line =~ /\s+compress\s*/i) |
|
1896 |
{ |
|
1897 |
$compress=1; |
|
1898 |
} |
|
1899 |
elsif($line =~ /\s+uncompress\s*/i) |
|
1900 |
{ |
|
1901 |
$uncompress=1; |
|
1902 |
} |
|
1903 |
if ($line =~ /\s+fat16\s*/i) |
|
1904 |
{ |
|
1905 |
$fstype = "fat16"; |
|
1906 |
} |
|
1907 |
if ($line =~ /\s+fat32\s*/i) |
|
1908 |
{ |
|
1909 |
$fstype = "fat32"; |
|
1910 |
} |
|
1911 |
||
1912 |
$datadriveimage[$datadriveidx] = {name=>$datadriveimagename, size=>$dataimagesize, compress=>$compress, uncompress=>$uncompress, fstype=>$fstype}; |
|
1913 |
print "DATA_IMAGE[$datadriveidx] $datadriveimage[$datadriveidx]{name} size=$datadriveimage[$datadriveidx]{size} compress=$compress uncompress=$uncompress fstype=$fstype\n" if ($opt_v); |
|
1914 |
} |
|
1915 |
else |
|
1916 |
{ |
|
1917 |
print_source_error("bad DATA_IMAGE specification : $line"); |
|
1918 |
$errors++; |
|
1919 |
} |
|
1920 |
push @obydata, "REM handled $line"; |
|
1921 |
next; |
|
1922 |
} |
|
1923 |
if ($line=~/^\s*ROM_IMAGE\s+/i) |
|
1924 |
{ |
|
1925 |
if ($line =~ /\s+(\d+)\s+(\S+)\s+/i) |
|
1926 |
{ |
|
1927 |
my $romidx=$1; |
|
1928 |
my $rompartitionname=$2; |
|
1929 |
my $rompartitionsize=0; |
|
1930 |
if ($line =~ /\s+size=(\S+)\s*/i) |
|
1931 |
{ $rompartitionsize=$1; } |
|
1932 |
my $xip=1; |
|
1933 |
my $compress=0; |
|
1934 |
my $uncompress=0; |
|
1935 |
my $extend=0; |
|
1936 |
my $composite="none"; |
|
1937 |
if ($line =~ /\s+non-xip\s*/i) |
|
1938 |
{ $xip=0; } |
|
1939 |
if ($line =~ /\s+compress\s*/i) |
|
1940 |
{ $compress=1; } |
|
1941 |
elsif($line =~ /\s+uncompress\s*/i) |
|
1942 |
{ $uncompress=1;} # This option is passed to rofsbuild. For rombuild, not saying --compress means to uncompress |
|
1943 |
if ($line =~ /\s+extension\s*/i) |
|
1944 |
{ $extend=1; } |
|
1945 |
if ($line =~ /\s+composite_primary\s*/i) # added to support new composite_primary keyword in obey files |
|
1946 |
{ if (!($extend)) |
|
1947 |
{ $composite="composite_primary"; } |
|
1948 |
else |
|
1949 |
{ print "Error: composite_primary keyword must be used with a core image\n"; } |
|
1950 |
} |
|
1951 |
if ($line =~ /\s+composite_secondary\s*/i) # added to support new composite_secondary keyword in obey files |
|
1952 |
{ if (!($extend)) |
|
1953 |
{ $composite="composite_secondary"; } |
|
1954 |
else |
|
1955 |
{ print "Error: composite_secondary keyword must be used with core image\n"; } |
|
1956 |
} |
|
1957 |
||
1958 |
# Compress and Uncompress are 2 different options and |
|
1959 |
# not mentioning one of them doesn't necessarily mean the other. |
|
1960 |
||
1961 |
$romimage[$romidx] = {name=>$rompartitionname, size=>$rompartitionsize, xip=>$xip, compress=>$compress, extension=>$extend, composite=>$composite, uncompress=>$uncompress}; |
|
1962 |
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); |
|
1963 |
check_romimage($romidx, $line); |
|
1964 |
} |
|
1965 |
else |
|
1966 |
{ |
|
1967 |
print_source_error("bad ROM_IMAGE specification : $line"); |
|
1968 |
$errors++; |
|
1969 |
} |
|
1970 |
push @obydata, "REM handled $line"; |
|
1971 |
next; |
|
1972 |
} |
|
1973 |
||
1974 |
push @obydata, $line; |
|
1975 |
} |
|
1976 |
||
1977 |
close TMP1; |
|
1978 |
exit(1) if ($errors); |
|
1979 |
dump_obydata("tmp2.oby", "result of substitution phase") if ($opt_v); |
|
1980 |
} |
|
1981 |
||
1982 |
sub check_romimage |
|
1983 |
{ |
|
1984 |
my ($idx, $line) = @_; |
|
1985 |
if ($idx gt 7) |
|
1986 |
{ |
|
1987 |
print_source_error("too many roms : $line"); |
|
1988 |
$errors++; |
|
1989 |
} |
|
1990 |
if ($romimage[$idx]{xip} eq 0) |
|
1991 |
{ |
|
1992 |
if ($romimage[$idx]{size} eq 0) |
|
1993 |
{ |
|
1994 |
print_source_error("must specify a size for non-xip ROM : $line"); |
|
1995 |
$errors++; |
|
1996 |
} |
|
1997 |
} |
|
1998 |
if ($romimage[$idx]{extension} ne 0) |
|
1999 |
{ |
|
2000 |
if ($romimage[$idx-1]{extension} ne 0) |
|
2001 |
{ |
|
2002 |
print_source_error("cannot extend ROM image multiple times : $line"); |
|
2003 |
$errors++; |
|
2004 |
} |
|
2005 |
} |
|
2006 |
} |
|
2007 |
||
2008 |
sub dump_obydata |
|
2009 |
{ |
|
2010 |
my ($dumpfile, $comment) = @_; |
|
2011 |
$dumpfile = $thisdir.$dumpfile; |
|
2012 |
unlink($dumpfile); |
|
2013 |
open DUMPFILE, ">$dumpfile" or die("* Can't create $dumpfile\n"); |
|
2014 |
print "* Writing $dumpfile - $comment\n"; |
|
2015 |
my $line; |
|
2016 |
foreach $line (@obydata) |
|
2017 |
{ |
|
2018 |
print DUMPFILE $line; |
|
2019 |
} |
|
2020 |
close DUMPFILE; |
|
2021 |
} |
|
2022 |
||
2023 |
sub track_source |
|
2024 |
{ |
|
2025 |
my ($line) = @_; |
|
2026 |
if ($line=~/^# (\d+) "(.*)"/) |
|
2027 |
{ |
|
2028 |
$sourceline=$1-1; |
|
2029 |
$sourcefile=$2; |
|
2030 |
$sourcefile=~ s/\\\\/\\/g; |
|
2031 |
$sourcefile=~ s/\\/\//g; |
|
2032 |
return; |
|
2033 |
} |
|
2034 |
$sourceline++; |
|
2035 |
} |
|
2036 |
||
2037 |
sub print_source_error |
|
2038 |
{ |
|
2039 |
my ($message) = @_; |
|
2040 |
print "$sourcefile($sourceline): $message\n"; |
|
2041 |
} |
|
2042 |
||
2043 |
sub reassert_sourceline |
|
2044 |
{ |
|
2045 |
my ($offset) = @_; |
|
2046 |
return sprintf "# %d \"$sourcefile\" \n", $sourceline+1+$offset; |
|
2047 |
} |
|
2048 |
||
2049 |
||
2050 |
#---------------------------------------------------------------------------------- |
|
2051 |
# Reorganisation phase |
|
2052 |
# |
|
2053 |
# Group lines beginning with "rom_image[<id>]" and deposit them in the appropriate |
|
2054 |
# order. Truncate the description at the "stop" line, if there is one. |
|
2055 |
||
2056 |
sub reorganize_phase |
|
2057 |
{ |
|
2058 |
||
2059 |
undef @newobydata; |
|
2060 |
my @section2; |
|
2061 |
my @part3; |
|
2062 |
my @part4; |
|
2063 |
my @part5; |
|
2064 |
my @part6; |
|
2065 |
my @part7; |
|
2066 |
my @part8; |
|
2067 |
my @partitions = ( \@newobydata, \@section2, \@part3, \@part4, \@part5, \@part6, \@part7, \@part8 ); |
|
2068 |
my @currentpartition; # partition stack |
|
2069 |
||
2070 |
my @processedImageIdx; # list of proccesed data drive image index. |
|
2071 |
my $dataDriveStartRegion = 0; |
|
2072 |
my $dataDriveEndRegion = 0; |
|
2073 |
my $dataDriveIdx; |
|
2074 |
my @datapartition; |
|
2075 |
my @linesArray; |
|
2076 |
my $curlyBraceShouldFollow; |
|
2077 |
||
2078 |
my $collect_section2=1; |
|
2079 |
my $smrImageStartRegion = 0; |
|
2080 |
my $smrImageEndRegion = 0; |
|
2081 |
my $smrImageIndex = 0; |
|
2082 |
||
2083 |
foreach $line (@obydata) |
|
2084 |
{ |
|
2085 |
track_source($line); |
|
2086 |
if ($line=~/^\s*stop/i) |
|
2087 |
{ |
|
2088 |
last; |
|
2089 |
} |
|
2090 |
if ($line =~ /^\s*ROM_IMAGE\[(\S+)\]\s+\{(.*)$/i) |
|
2091 |
{ |
|
2092 |
# ROM_IMAGE[n] { |
|
2093 |
my $idx=$1; |
|
2094 |
my $partition=$partitions[$idx]; |
|
2095 |
push @currentpartition, $partition; |
|
2096 |
$line="REM handled $line"; |
|
2097 |
} |
|
2098 |
elsif( ($line =~ /^\s*DATA_IMAGE\[(\S+)\]\s*$/i) || ($line =~ /^\s*DATA_IMAGE\[(\S+)\]\s*\{\s*$/i)) |
|
2099 |
{ |
|
2100 |
# DATA_IMAGE[n] or DATA_IMAGE[n] { is specified. |
|
2101 |
# get the index. |
|
2102 |
$dataDriveIdx=$1; |
|
2103 |
if($line !~ /\s*\{\s*/i) |
|
2104 |
{ |
|
2105 |
$curlyBraceShouldFollow = 1; |
|
2106 |
} |
|
2107 |
# make a check if dataDriveIdx exists in the processedImageIdx array. |
|
2108 |
# if no, then push the dataDriveIdx on the processedImageIdx array. |
|
2109 |
# if yes,then dont execute the loop. |
|
2110 |
if(&datadriveimage::checkInArray(\@processedImageIdx,$dataDriveIdx)) |
|
2111 |
{ |
|
2112 |
# push the index on to the array. |
|
2113 |
push(@processedImageIdx,$dataDriveIdx); |
|
2114 |
# increment the image count. |
|
2115 |
++$dataImageCount; |
|
2116 |
} |
|
2117 |
||
2118 |
$dataIndexHash{($dataImageCount-1)} = $dataDriveIdx; |
|
2119 |
# set start of the image section. |
|
2120 |
$dataDriveStartRegion = 1; |
|
2121 |
# set end of image section to zero. |
|
2122 |
$dataDriveEndRegion = 0; |
|
2123 |
push (@linesArray,"\n"); |
|
2124 |
$line="REM handled $line"; |
|
2125 |
} |
|
2126 |
elsif( $line =~ /^\s*SMR_IMAGE\s*\{\s*$/i) |
|
2127 |
{ |
|
2128 |
$smrImageStartRegion = 1; |
|
2129 |
$smrImageEndRegion = 0; |
|
2130 |
$needSmrImage = 1; |
|
2131 |
push (@linesArray, "\n"); |
|
2132 |
$line="REM handled $line"; |
|
2133 |
} |
|
2134 |
elsif((defined $curlyBraceShouldFollow) && ($line !~ /^\s*$/i)) |
|
2135 |
{ |
|
2136 |
undef $curlyBraceShouldFollow; |
|
2137 |
if($line !~ /^\s*\{\s*/i) |
|
2138 |
{ |
|
2139 |
print "Error: Symbol '{' not followed after the keyword DATA_IMAGE\[".$dataDriveIdx."\]\n"; |
|
2140 |
$errors++; |
|
2141 |
} |
|
2142 |
next; |
|
2143 |
} |
|
2144 |
# data drive specific keywords. |
|
2145 |
elsif( $line =~/^\s*dataimagename\s*\=\s*(\S+)/i ) |
|
2146 |
{ |
|
2147 |
# set the name for the image, if image name is specified using driveimagename keyword. |
|
2148 |
$datadriveimage[$dataDriveIdx]{name} = $1 if($dataDriveStartRegion && !$dataDriveEndRegion); |
|
2149 |
print"datadriveimagename = $datadriveimage[$dataDriveIdx]{name}\n" if($dataDriveStartRegion && !$dataDriveEndRegion && $opt_v); |
|
2150 |
# skip the line. |
|
2151 |
next; |
|
2152 |
} |
|
2153 |
elsif( $line =~/^\s*dataimagesize\s*\=\s*(\S+)/i ) |
|
2154 |
{ |
|
2155 |
# set the size for the image, if image size is specified using driveimagesize keyword. |
|
2156 |
$datadriveimage[$dataDriveIdx]{size} = $1 if($dataDriveStartRegion && !$dataDriveEndRegion); |
|
2157 |
print"datadriveimagesize = $datadriveimage[$dataDriveIdx]{size}\n" if($dataDriveStartRegion && !$dataDriveEndRegion && $opt_v); |
|
2158 |
# skip the line. |
|
2159 |
next; |
|
2160 |
} |
|
2161 |
elsif( $line =~/^\s*dataimagefilesystem\s*\=\s*(\S+)/i ) |
|
2162 |
{ |
|
2163 |
# set the file system type for the image, if image file system is specified using dataimagefilesystem keyword. |
|
2164 |
$datadriveimage[$dataDriveIdx]{fstype} = $1 if($dataDriveStartRegion && !$dataDriveEndRegion); |
|
2165 |
print"datadriveimagefstype = $datadriveimage[$dataDriveIdx]{fstype}\n" if($dataDriveStartRegion && !$dataDriveEndRegion && $opt_v); |
|
2166 |
# skip the line. |
|
2167 |
next; |
|
2168 |
} |
|
2169 |
elsif( $line =~/^\s*compress/i ) |
|
2170 |
{ |
|
2171 |
# Compresses the resulting data drive image using the Deflate, Huffman+LZ77 algorithm. |
|
2172 |
if($dataDriveStartRegion && !$dataDriveEndRegion) |
|
2173 |
{ |
|
2174 |
$datadriveimage[$dataDriveIdx]{compress} = 1; |
|
2175 |
$datadriveimage[$dataDriveIdx]{uncompress} = 0; |
|
2176 |
print"datadriveimage[$dataDriveIdx] compress = $datadriveimage[$dataDriveIdx]{compress}\n" if($opt_v); |
|
2177 |
} |
|
2178 |
} |
|
2179 |
elsif( $line =~/^\s*uncompress/i ) |
|
2180 |
{ |
|
2181 |
# Uncompresses the resulting data drive image. |
|
2182 |
if($dataDriveStartRegion && !$dataDriveEndRegion) |
|
2183 |
{ |
|
2184 |
$datadriveimage[$dataDriveIdx]{uncompress} = 1; |
|
2185 |
$datadriveimage[$dataDriveIdx]{compress} = 0; |
|
2186 |
print"datadriveimage[$dataDriveIdx] uncompress = $datadriveimage[$dataDriveIdx]{uncompress}\n" if($opt_v); |
|
2187 |
} |
|
2188 |
} |
|
2189 |
elsif ($line =~ /^\s*ROM_IMAGE\[(\S+)\](.*)$/i) |
|
2190 |
{ |
|
2191 |
# ROM_IMAGE[n] file=... |
|
2192 |
my $origline=$line; |
|
2193 |
$line="$2\n"; # remove the ROM_IMAGE[.] keyword |
|
2194 |
my $idx=$1; |
|
2195 |
my $partition=$partitions[$idx]; |
|
2196 |
push @$partition, reassert_sourceline(-1); |
|
2197 |
push @$partition, $line; |
|
2198 |
$line="REM handled $origline"; |
|
2199 |
} |
|
2200 |
elsif ($line =~ /^\s*DATA_IMAGE\[(\S+)\](.*)$/i) |
|
2201 |
{ |
|
2202 |
# DATA_IMAGE[n] file=... |
|
2203 |
my $origline=$line; |
|
2204 |
# remove the DATA_IMAGE[.] keyword |
|
2205 |
$line="$2\n"; |
|
2206 |
# get the index value |
|
2207 |
my $idx=$1; |
|
2208 |
# iterate through the hash to get corresponding |
|
2209 |
# key from the value(i.e idx) |
|
2210 |
while (my($key, $value) = each(%dataIndexHash)) |
|
2211 |
{ |
|
2212 |
if ($value eq $idx ) |
|
2213 |
{ |
|
2214 |
$idx = $key; |
|
2215 |
} |
|
2216 |
} |
|
2217 |
push @{$datapartition[$idx]}, reassert_sourceline(-1); |
|
2218 |
push @{$datapartition[$idx]}, $line; |
|
2219 |
$line="REM handled $origline"; |
|
2220 |
} |
|
2221 |
elsif ($line =~ /^\s*\}.*$/i) |
|
2222 |
{ |
|
2223 |
if($dataDriveStartRegion) |
|
2224 |
{ |
|
2225 |
# since "}" brace is encountered |
|
2226 |
# reset the start of DATA_IMAGE to zero. |
|
2227 |
$dataDriveStartRegion = 0; |
|
2228 |
# mark the the end of the DATA_IMAGE. |
|
2229 |
$dataDriveEndRegion = 1; |
|
2230 |
if(!$datadriveimage[$dataDriveIdx]{name}) |
|
2231 |
{ |
|
2232 |
# image name is not defined, define a default name. |
|
2233 |
$datadriveimage[$dataDriveIdx]{name} = "dataImage".$dataDriveIdx; |
|
2234 |
} |
|
2235 |
if(!$datadriveimage[$dataDriveIdx]{fstype}) |
|
2236 |
{ |
|
2237 |
# image name is not defined, define a default name. |
|
2238 |
$datadriveimage[$dataDriveIdx]{fstype} = "fat16"; |
|
2239 |
} |
|
2240 |
foreach my $file (@linesArray) |
|
2241 |
{ |
|
2242 |
push @{$datapartition[($dataImageCount-1)]},$file; |
|
2243 |
} |
|
2244 |
## if end of the DATA_IMAGE is true, |
|
2245 |
## make room for next DATA_IMAGE if any. |
|
2246 |
undef(@linesArray); |
|
2247 |
#un define $dataDriveIdx; |
|
2248 |
undef($dataDriveIdx); |
|
2249 |
} |
|
2250 |
elsif($smrImageStartRegion) |
|
2251 |
{ |
|
2252 |
$smrImageStartRegion = 0; |
|
2253 |
$smrImageEndRegion = 1; |
|
2254 |
foreach my $file (@linesArray) |
|
2255 |
{ |
|
2256 |
push @{$smrPartitions{$smrImageIndex}}, $file; |
|
2257 |
} |
|
2258 |
undef(@linesArray); |
|
2259 |
$smrImageIndex++; |
|
2260 |
} |
|
2261 |
elsif (scalar @currentpartition > 0) |
|
2262 |
{ |
|
2263 |
pop @currentpartition; |
|
2264 |
} |
|
2265 |
else |
|
2266 |
{ |
|
2267 |
print "WARNING: closing '}' found with no matching 'ROM_IMAGE[<n>]/DATA_IMAGE[<n>] {'\n"; |
|
2268 |
} |
|
2269 |
$line="REM handled $line"; |
|
2270 |
} |
|
2271 |
elsif ($line=~/^\s*section2(.*)$/i) |
|
2272 |
{ |
|
2273 |
my $origline=$line; |
|
2274 |
$line="$1\n"; # remove the section2 keyword |
|
2275 |
if ($collect_section2) |
|
2276 |
{ |
|
2277 |
push @section2, reassert_sourceline(-1); |
|
2278 |
push @section2, $line; |
|
2279 |
$line="REM handled $origline"; |
|
2280 |
} |
|
2281 |
} |
|
2282 |
elsif ($line=~/^\s*section/i) |
|
2283 |
{ |
|
2284 |
push @newobydata, $line; # insert the section statement |
|
2285 |
if (@section2 != 0) |
|
2286 |
{ |
|
2287 |
push @newobydata, "REM accumulated section2 lines\n"; |
|
2288 |
} |
|
2289 |
foreach $line (@section2) |
|
2290 |
{ |
|
2291 |
push @newobydata, $line; # insert accumulated section2 lines |
|
2292 |
} |
|
2293 |
$collect_section2=0; |
|
2294 |
$line = reassert_sourceline(); |
|
2295 |
} |
|
2296 |
||
2297 |
elsif ($line=~/^\s*extensionrom/i) |
|
2298 |
{ |
|
2299 |
# end of ROM description, so deposit accumulated lines |
|
2300 |
if (@section2 != 0) |
|
2301 |
{ |
|
2302 |
push @newobydata, "REM accumulated section2 lines\n"; |
|
2303 |
} |
|
2304 |
foreach $line (@section2) |
|
2305 |
{ |
|
2306 |
push @newobydata, $line; # insert accumulated section2 lines |
|
2307 |
} |
|
2308 |
$collect_section2=0; |
|
2309 |
push @newobydata, reassert_sourceline(); |
|
2310 |
} |
|
2311 |
||
2312 |
elsif ( scalar(@linesArray) ) |
|
2313 |
{ |
|
2314 |
if($dataDriveStartRegion && !$dataDriveEndRegion) |
|
2315 |
{ |
|
2316 |
my $modifiedLine = $line; |
|
2317 |
push @linesArray, $modifiedLine; |
|
2318 |
$line = "REM handled $line"; |
|
2319 |
} |
|
2320 |
elsif($smrImageStartRegion && !$smrImageEndRegion) |
|
2321 |
{ |
|
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
2322 |
if($line =~ /^(\s*IMAGENAME\s*=\s*)(\S+)/i) |
606 | 2323 |
{ |
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
2324 |
my $front = $1; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
2325 |
my $smrimagename = $2; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
2326 |
if ($smrimagename !~ /^.:/ && $smrimagename !~ /^[\\\/]/) |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
2327 |
{ |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
2328 |
$smrimagename = $thisdir.$smrimagename; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
2329 |
} |
606 | 2330 |
$smrimagename =~s/(\.img)//i; |
2331 |
if(exists($smrNameInfo{$smrimagename})) |
|
2332 |
{ |
|
2333 |
$smrNameInfo{$smrimagename}++; |
|
2334 |
} |
|
2335 |
else |
|
2336 |
{ |
|
2337 |
$smrNameInfo{$smrimagename} = 1; |
|
2338 |
} |
|
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
2339 |
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
|
2340 |
}else |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
2341 |
{ |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
2342 |
push @linesArray, $line; |
606 | 2343 |
} |
2344 |
$line = "REM handled $line"; |
|
2345 |
} |
|
2346 |
} |
|
2347 |
elsif (scalar @currentpartition) |
|
2348 |
{ |
|
2349 |
my $modifiedLine = $line; |
|
2350 |
if ($line =~ /^\s*SPI_POSITION/i) |
|
2351 |
{ |
|
2352 |
if(!($createspi && $spiplacement)) |
|
2353 |
{ |
|
2354 |
# comment the line if the spi placement flag is not enabled or if the spi creation is not enabled. |
|
2355 |
$modifiedLine = "REM SPI creation/placement flag not enabled. Ignoring SPI_POSITION\n"; |
|
2356 |
print ("Warning: SPI creation/placement flag not enabled. Ignoring SPI_POSITION\n" ) if ($opt_v); |
|
2357 |
} |
|
2358 |
} |
|
2359 |
# a partition is specified |
|
2360 |
# push this line into the currently selected partition |
|
2361 |
my $partition=$currentpartition[-1]; |
|
2362 |
push @$partition, $modifiedLine; |
|
2363 |
$line="REM handled $line"; |
|
2364 |
} |
|
2365 |
elsif ($line =~ /^\s*SPI_POSITION/i) |
|
2366 |
{ |
|
2367 |
if(!($createspi && $spiplacement)) |
|
2368 |
{ |
|
2369 |
# comment the line if the spi placement flag is not enabled or if the spi creation is not enabled. |
|
2370 |
$line = "REM SPI creation/placement flag not enabled. Ignoring SPI_POSITION\n"; |
|
2371 |
print ("Warning: SPI creation/placement flag not enabled. Ignoring SPI_POSITION\n" ) if ($opt_v); |
|
2372 |
} |
|
2373 |
} |
|
2374 |
push @newobydata, $line; |
|
2375 |
} |
|
2376 |
||
2377 |
# output the grouped data |
|
2378 |
my $partitionidx=2; |
|
2379 |
if ($collect_section2) |
|
2380 |
{ $partitionidx=1; } # output old "section2" if not done already |
|
2381 |
for (; $partitionidx<8; $partitionidx++) |
|
2382 |
{ |
|
2383 |
my $partition=$partitions[$partitionidx]; |
|
2384 |
if (@$partition != 0) |
|
2385 |
{ |
|
2386 |
push @newobydata, "REM ROM_IMAGE[$partitionidx]\n"; |
|
2387 |
foreach $line (@$partition) |
|
2388 |
{ |
|
2389 |
push @newobydata, $line; # insert accumulated section2 lines |
|
2390 |
} |
|
2391 |
} |
|
2392 |
} |
|
2393 |
||
2394 |
for ( my $datapartitionidx=0; $datapartitionidx < $dataImageCount; $datapartitionidx++ ) |
|
2395 |
{ |
|
2396 |
if( defined( @{ $datapartition[$datapartitionidx] } ) ) |
|
2397 |
{ |
|
2398 |
push @newobydata, "REM DATA_IMAGE[$dataIndexHash{$datapartitionidx}]\n" ; |
|
2399 |
foreach my $file (@{$datapartition[$datapartitionidx]}) |
|
2400 |
{ |
|
2401 |
push @newobydata, $file; |
|
2402 |
} |
|
2403 |
} |
|
2404 |
} |
|
2405 |
||
2406 |
||
2407 |
foreach my $imageIndex (keys(%smrPartitions)) |
|
2408 |
{ |
|
2409 |
my $imagename; |
|
2410 |
my @obeyfile; |
|
2411 |
||
2412 |
foreach (@{$smrPartitions{$imageIndex}}) |
|
2413 |
{ |
|
2414 |
if(/^\s*imagename\s*=\s*(\S+)/i) |
|
2415 |
{ |
|
2416 |
$imagename = $1; |
|
2417 |
} |
|
2418 |
push @obeyfile, $_; |
|
2419 |
} |
|
2420 |
if($smrNameInfo{$imagename} == 1) |
|
2421 |
{ |
|
2422 |
push @obeyFileList, $imagename; |
|
2423 |
push @newobydata, "REM SMR_IMAGE \n"; |
|
2424 |
push @newobydata, @obeyfile; |
|
2425 |
} |
|
2426 |
if(! defined($imagename)) |
|
2427 |
{ |
|
2428 |
$smrNoImageName = 1; |
|
2429 |
} |
|
2430 |
undef $imagename; |
|
2431 |
undef @obeyfile; |
|
2432 |
} |
|
2433 |
||
2434 |
@obydata = @newobydata; |
|
2435 |
exit(1) if ($errors); |
|
2436 |
dump_obydata("tmp3.oby", "result of reorganisation phase") if ($opt_v); |
|
2437 |
} |
|
2438 |
||
2439 |
||
2440 |
#---------------------------------------------------------------------------------- |
|
2441 |
# Plugin phase |
|
2442 |
# |
|
2443 |
# Process any plugin annotation lines |
|
2444 |
# Note: This expands resource lines to include MULTI_LINGUIFY so must be done before |
|
2445 |
# the Multilinguify phase |
|
2446 |
||
2447 |
# hash of SPI file target directories is located near the start of this file, before sub match_obyfile |
|
2448 |
||
2449 |
sub plugin_phase |
|
2450 |
{ |
|
2451 |
undef @newobydata; |
|
2452 |
foreach $line (@obydata) |
|
2453 |
{ |
|
2454 |
track_source($line); |
|
2455 |
if ($line =~ /^\s*REM/i) |
|
2456 |
{ |
|
2457 |
# ignore REM statements, to avoid processing "REM ECOM_PLUGIN(xxx,yyy)" |
|
2458 |
} |
|
2459 |
elsif(plugin_match($line)) { |
|
2460 |
$line = reassert_sourceline(); |
|
2461 |
} |
|
2462 |
push @newobydata, $line; |
|
2463 |
} |
|
2464 |
||
2465 |
@obydata = @newobydata; |
|
2466 |
dump_obydata("tmp4.oby", "result of Plugin stage") if ($opt_v); |
|
2467 |
} |
|
2468 |
||
2469 |
sub plugin_match () |
|
2470 |
{ |
|
2471 |
my ($line) = @_; |
|
2472 |
foreach my $plugintype (keys(%plugintypes)) { |
|
2473 |
if ($line =~ m/^.*__$plugintype\_PLUGIN\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/i) |
|
2474 |
# __<plugin-type>_PLUGIN(emulator directory, file rom dir, dataz_, resource rom dir, filename, resource filename) |
|
2475 |
{ |
|
2476 |
my $emulatorDir=$1; |
|
2477 |
my $fileRomDir=$2; |
|
2478 |
my $dataz_= $3; |
|
2479 |
my $resourceDir=$4; |
|
2480 |
my $pluginFileName=$5; |
|
2481 |
my $pluginResourceName=$6; |
|
2482 |
my $spidatahide = 0; |
|
2483 |
my $paged_data = ""; |
|
2484 |
||
2485 |
if ($line =~ m/paged\s*$/i) |
|
2486 |
{ |
|
2487 |
$line =~ m/\s+(\S+)\s*$/; |
|
2488 |
$paged_data = $1; |
|
2489 |
} |
|
2490 |
||
2491 |
if ($line =~ m/^\s*(_hide)/i ) |
|
2492 |
{ |
|
2493 |
$spidatahide = 1; |
|
2494 |
} |
|
2495 |
||
2496 |
# for resource files strip the .rsc or .dll from the end (will be .dll where we use |
|
2497 |
# SYMBIAN_SECURE_ECOM and are building resources to the same name as ecom plugin dlls) |
|
2498 |
||
2499 |
if ($pluginResourceName =~ m/^(.+)\./) |
|
2500 |
{ |
|
2501 |
$pluginResourceName = $1; |
|
2502 |
} |
|
2503 |
else |
|
2504 |
{ |
|
2505 |
print_source_error("Invalid Resource name: $pluginResourceName in " . $plugintype . "_PLUGIN :$line"); |
|
2506 |
#treat as error if strict option selected; |
|
2507 |
$errors++ if ($strict); |
|
2508 |
} |
|
2509 |
||
2510 |
if ($spidatahide) |
|
2511 |
{ |
|
2512 |
push @newobydata, "hide=$fileRomDir\/$pluginFileName\n"; |
|
2513 |
} |
|
2514 |
else |
|
2515 |
{ |
|
2516 |
push @newobydata, "file=$emulatorDir\/$pluginFileName $fileRomDir\/$pluginFileName $paged_data\n"; |
|
2517 |
} |
|
2518 |
||
2519 |
if($createspi) { |
|
2520 |
if ($spidatahide) |
|
2521 |
{ |
|
2522 |
push @newobydata, "spidatahide=MULTI_LINGUIFY(RSC $dataz_\/$resourceDir\/$pluginResourceName $resourceDir\/$pluginResourceName) " . lc($plugintype) . "\.spi " . $plugintypes{$plugintype} . "\n"; |
|
2523 |
} |
|
2524 |
else |
|
2525 |
{ |
|
2526 |
push @newobydata, "spidata=MULTI_LINGUIFY(RSC $dataz_\/$resourceDir\/$pluginResourceName $resourceDir\/$pluginResourceName) " . lc($plugintype) . "\.spi " . $plugintypes{$plugintype} . "\n"; |
|
2527 |
} |
|
2528 |
} else { |
|
2529 |
if ($spidatahide) |
|
2530 |
{ |
|
2531 |
push @newobydata, "hide=MULTI_LINGUIFY(RSC $dataz_\/$resourceDir\/$pluginResourceName $resourceDir\/$pluginResourceName)\n"; |
|
2532 |
} |
|
2533 |
else |
|
2534 |
{ |
|
2535 |
push @newobydata, "data=MULTI_LINGUIFY(RSC $dataz_\/$resourceDir\/$pluginResourceName $resourceDir\/$pluginResourceName)\n"; |
|
2536 |
} |
|
2537 |
} |
|
2538 |
return 1; #successful match |
|
2539 |
} |
|
2540 |
} |
|
2541 |
} |
|
2542 |
||
2543 |
||
2544 |
#---------------------------------------------------------------------------------- |
|
2545 |
# Multilinguify phase |
|
2546 |
# |
|
2547 |
# Process the MULTILINGUIFY() lines |
|
2548 |
||
2549 |
sub multlinguify_phase |
|
2550 |
{ |
|
2551 |
if ((scalar keys %languageCodes) == 0) |
|
2552 |
{ |
|
2553 |
print "* No language codes specified, defaulting to 01\n"; |
|
2554 |
$defaultLanguageCode = "01"; |
|
2555 |
} |
|
2556 |
$languageCodes{$defaultLanguageCode} = 1; |
|
2557 |
||
2558 |
undef @newobydata; |
|
2559 |
foreach $line (@obydata) |
|
2560 |
{ |
|
2561 |
track_source($line); |
|
2562 |
if ($line =~ /^\s*REM/i) |
|
2563 |
{ |
|
2564 |
# ignore REM statements, to avoid processing "REM data=xxx yyy" |
|
2565 |
} |
|
2566 |
elsif ($line=~/^(.*?)\bMULTI_LINGUIFY\s*\(\s*(\S+)\s+(\S+)\s+(\S+)\s*\)(.*)$/i) |
|
2567 |
{ |
|
2568 |
my $initialStuff=$1; |
|
2569 |
$initialStuff = lc ($initialStuff);# if ($enableLowercaseTransfer); |
|
2570 |
my $defaultFileNameExtension=$2; |
|
2571 |
$defaultFileNameExtension = lc ($defaultFileNameExtension);# if ($enableLowercaseTransfer); |
|
2572 |
my $sourceFileNameWithoutExtension=$3; |
|
2573 |
$sourceFileNameWithoutExtension = ($sourceFileNameWithoutExtension);# if ($enableLowercaseTransfer); |
|
2574 |
my $targetFileNameWithoutExtension=$4; |
|
2575 |
my $finalStuff=$5; |
|
2576 |
my $spidataflag = 0; |
|
2577 |
my $spidatahide = 0; |
|
2578 |
my $datahide = 0; |
|
2579 |
||
2580 |
if ($initialStuff=~/\w$/) |
|
2581 |
{ |
|
2582 |
$initialStuff.=" "; |
|
2583 |
} |
|
2584 |
if ($finalStuff=~/^\w/) |
|
2585 |
{ |
|
2586 |
$finalStuff=" ".$finalStuff; |
|
2587 |
} |
|
2588 |
if ($initialStuff =~ /^\s*spidata/i) |
|
2589 |
{ |
|
2590 |
$spidataflag = 1; |
|
2591 |
} |
|
2592 |
if ($initialStuff =~ /^\s*spidatahide/i) |
|
2593 |
{ |
|
2594 |
$spidataflag = 1; |
|
2595 |
$spidatahide = 1; |
|
2596 |
} |
|
2597 |
if ($initialStuff =~ /^\s*hide/i) |
|
2598 |
{ |
|
2599 |
$datahide = 1; |
|
2600 |
} |
|
2601 |
||
2602 |
||
2603 |
# ecom.spi should contain the .RSC files |
|
2604 |
if ($spidataflag) |
|
2605 |
{ |
|
2606 |
my $sourceFileNameExtension = $defaultFileNameExtension; |
|
2607 |
my $targetFileNameExtension = $defaultFileNameExtension; |
|
2608 |
if (-e ("$sourceFileNameWithoutExtension.$sourceFileNameExtension")) |
|
2609 |
{ |
|
2610 |
if ($spidatahide) |
|
2611 |
{ |
|
2612 |
push @newobydata, "$initialStuff$sourceFileNameWithoutExtension.$sourceFileNameExtension$finalStuff\n"; |
|
2613 |
} |
|
2614 |
else |
|
2615 |
{ |
|
2616 |
push @newobydata, "$initialStuff$sourceFileNameWithoutExtension.$sourceFileNameExtension $targetFileNameWithoutExtension.$targetFileNameExtension$finalStuff\n"; |
|
2617 |
} |
|
2618 |
} |
|
2619 |
} |
|
2620 |
my $useDefaultFileNameExtension=1; |
|
2621 |
foreach my $languageCode (keys %languageCodes) { |
|
2622 |
my $sourceFileNameExtension=$defaultFileNameExtension; |
|
2623 |
$sourceFileNameExtension=~s/^(.*).{2}$/$1$languageCode/; |
|
2624 |
if (! -e ("$sourceFileNameWithoutExtension.$sourceFileNameExtension")) |
|
2625 |
{ |
|
2626 |
if (!$spidataflag) |
|
2627 |
{ |
|
2628 |
next if (!$useDefaultFileNameExtension); |
|
2629 |
next if (defined $defaultLanguageCode and !($languageCode eq $defaultLanguageCode)); |
|
2630 |
$useDefaultFileNameExtension=0; |
|
2631 |
if (!$datahide) |
|
2632 |
{ |
|
2633 |
print "Converting >$sourceFileNameWithoutExtension.$sourceFileNameExtension< to $defaultFileNameExtension\n"; |
|
2634 |
$sourceFileNameExtension=$defaultFileNameExtension; |
|
2635 |
} |
|
2636 |
} |
|
2637 |
else |
|
2638 |
{ |
|
2639 |
next; |
|
2640 |
} |
|
2641 |
} |
|
2642 |
||
2643 |
my $targetFileNameExtension; |
|
2644 |
# ecom.sNN should contain the corresponding language code .RNN files |
|
2645 |
if(!$spidataflag and (defined $defaultLanguageCode and ($languageCode eq $defaultLanguageCode))) |
|
2646 |
{ |
|
2647 |
$targetFileNameExtension = $defaultFileNameExtension; |
|
2648 |
} |
|
2649 |
else |
|
2650 |
{ |
|
2651 |
$targetFileNameExtension = $sourceFileNameExtension; |
|
2652 |
} |
|
2653 |
my $modifiedfinalStuff = $finalStuff; |
|
2654 |
$modifiedfinalStuff =~ s/\.spi/\.s$languageCode/i; |
|
2655 |
||
2656 |
if ($spidatahide) |
|
2657 |
{ |
|
2658 |
push @newobydata, "$initialStuff$sourceFileNameWithoutExtension.$sourceFileNameExtension$modifiedfinalStuff\n"; |
|
2659 |
} |
|
2660 |
elsif ($datahide) |
|
2661 |
{ |
|
2662 |
push @newobydata, "$initialStuff$targetFileNameWithoutExtension.$targetFileNameExtension$modifiedfinalStuff\n"; |
|
2663 |
if(!($sourceFileNameExtension eq $targetFileNameExtension)) |
|
2664 |
{ |
|
2665 |
push @newobydata, "$initialStuff$targetFileNameWithoutExtension.$sourceFileNameExtension$modifiedfinalStuff\n"; |
|
2666 |
} |
|
2667 |
} |
|
2668 |
else |
|
2669 |
{ |
|
2670 |
push @newobydata, "$initialStuff$sourceFileNameWithoutExtension.$sourceFileNameExtension $targetFileNameWithoutExtension.$sourceFileNameExtension$modifiedfinalStuff\n"; |
|
2671 |
if(!($sourceFileNameExtension eq $targetFileNameExtension)) |
|
2672 |
{ |
|
2673 |
push @newobydata, "alias $targetFileNameWithoutExtension.$sourceFileNameExtension $targetFileNameWithoutExtension.$targetFileNameExtension $modifiedfinalStuff\n"; |
|
2674 |
$targetFileNameWithoutExtension =~ s-\\-\/-g; |
|
2675 |
$multiLinguifyAlias{"$targetFileNameWithoutExtension.$sourceFileNameExtension"} = 1; |
|
2676 |
} |
|
2677 |
} |
|
2678 |
} |
|
2679 |
$line = reassert_sourceline(); |
|
2680 |
} |
|
2681 |
push @newobydata, $line; |
|
2682 |
} |
|
2683 |
||
2684 |
@obydata = @newobydata; |
|
2685 |
dump_obydata("tmp5.oby", "result of choosing language-specific files") if ($opt_v); |
|
2686 |
undef @newobydata; |
|
2687 |
||
2688 |
} |
|
2689 |
||
2690 |
my @featurefilearray; #2d array storing names and locations of feature files in each rom image |
|
2691 |
my @featureslist; #array of hashes, stores all the features which are to go into the feature files |
|
2692 |
my $featurefilecount=0; #counts number of feature files in each rom image |
|
2693 |
my $featurescount=0; #counts number of features |
|
2694 |
my $dir; # Stores the ROM image location of features.dat/featreg.cfg files |
|
2695 |
my $featurefilename; # Stores the name of feature file to be generated(i.e. "features.dat" or "featreg.cfg") |
|
2696 |
my @spiarray; #2d array storing names and locations of spi files in each rom image |
|
2697 |
my @datafiles; #array of hashes, stores all the data files which are to go into the spi files |
|
2698 |
my @hidedatafiles; #array of hashes, stores all the data files which are to be hidden in the spi files |
|
2699 |
my $spicount=0; #counts number of spi files in each rom image |
|
2700 |
my $filescount=0; #counts number of data files |
|
2701 |
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
|
2702 |
my $romimagecount=0; #number of rom image currently working with |
606 | 2703 |
|
2704 |
sub locateexisting |
|
2705 |
{ # 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
|
2706 |
my ($index, $spifile, $base) =@_; |
606 | 2707 |
my $i=0; |
2708 |
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
|
2709 |
if($spiarray[$base][$i]{spi} eq $spiarray[$index][$spifile]{spi}) { |
606 | 2710 |
my $spiname; |
2711 |
my $spiextension; |
|
2712 |
if($spiarray[$base][$i]{spifile} =~ /(.*)\.(.*)$/) { |
|
2713 |
$spiname=$1; |
|
2714 |
$spiextension=$2; |
|
2715 |
} |
|
2716 |
if(-e "$spiname-$base-$i\.$spiextension") { |
|
2717 |
return "$spiname-$base-$i\.$spiextension"; |
|
2718 |
} |
|
2719 |
} |
|
2720 |
$i++; |
|
2721 |
} |
|
2722 |
return ""; |
|
2723 |
} |
|
2724 |
||
2725 |
sub create |
|
2726 |
{ #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
|
2727 |
my ($index, $spifile, $base) =@_; #$index = current rom image number, $spifile = current spifile number, $base=number of rom image basing on |
606 | 2728 |
my $existingspi = ""; |
2729 |
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
|
2730 |
$existingspi = locateexisting($index, $spifile, $base); |
606 | 2731 |
if($existingspi ne "") { |
2732 |
$existingspi = "-i$existingspi"; |
|
2733 |
||
2734 |
} |
|
2735 |
} |
|
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
2736 |
if($spiarray[$index][$spifile]{spifile} =~ /(.+)\.(.*)$/) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
2737 |
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 | 2738 |
my @dataforspi; # array to store names of data files to include in spi file |
2739 |
my @hidedatainspi; # array to store names of data files that are to be hidden in spi file |
|
2740 |
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
|
2741 |
if($datafiles[$k]{rom}==$index && $datafiles[$k]{spifile} == $spifile) { |
606 | 2742 |
push @dataforspi, $datafiles[$k]{data}; #push name of data file onto array if correct romimage and spi type |
2743 |
} |
|
2744 |
} |
|
2745 |
||
2746 |
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
|
2747 |
if($hidedatafiles[$j]{rom}==$index && $hidedatafiles[$j]{spifile} == $spifile) |
606 | 2748 |
{ |
2749 |
push @hidedatainspi, $hidedatafiles[$j]{data}; #push name of data file to be hidden onto array if correct romimage and spi type |
|
2750 |
} |
|
2751 |
} |
|
2752 |
my @spiargs; #arguments passed to createSpi |
|
2753 |
push @spiargs, ("-t$targetspi", "-d$thisdir", "-hide@hidedatainspi"); |
|
2754 |
if($existingspi ne "") { push @spiargs, $existingspi; } |
|
2755 |
&spitool::createSpi(@spiargs, @dataforspi); # external call to |
|
2756 |
} |
|
2757 |
} |
|
2758 |
||
2759 |
#---------------------------------------------------------------------------------- |
|
2760 |
# SPI file creation phase |
|
2761 |
# |
|
2762 |
# If SPI files for resource (.rsc) are required then creates SPI files for each ROM image |
|
2763 |
# |
|
2764 |
sub spi_creation_phase |
|
2765 |
{ |
|
2766 |
my $composite_secondary=-1; |
|
2767 |
if($createspi) { |
|
2768 |
my $secondary=0; |
|
2769 |
for (my $i=1; $i<8; $i++) |
|
2770 |
{ |
|
2771 |
if($romimage[$i]{composite} eq "composite_secondary") |
|
2772 |
{ $secondary++; } |
|
2773 |
} |
|
2774 |
if(!$secondary) |
|
2775 |
{ $romimage[0]{composite} = "composite_secondary"; } |
|
2776 |
if($secondary>1) |
|
2777 |
{ print "Warning, more than one composite_primary specified, using image with lowest ROM_IMAGE number\n"; } |
|
2778 |
||
2779 |
foreach $line (@obydata) |
|
2780 |
{ |
|
2781 |
if ($line=~/^\s*REM \s*ROM_IMAGE\[(\d)\]/) # specify which romimage following lines are part of |
|
2782 |
{ |
|
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
2783 |
$romimagecount=$1; |
606 | 2784 |
$spicount=0; |
2785 |
} elsif ($line =~ /^\s*REM/i) |
|
2786 |
{ |
|
2787 |
# ignore any other REM statements |
|
2788 |
} elsif ($line=~/^\s*spidata\s*=\s*(\S+)\s+(\S+)\s+(\S+)\s(\S+)\s*$/) { |
|
2789 |
#spidata=\epoc32\data\Z\Resource\Plugins\Obexclasscontroller.RSC Resource\Plugins\Obexclasscontroller.RSC ecom.spi \private\10003a3f\ |
|
2790 |
my $targetspi=$4.$3; |
|
2791 |
my $flag=1; |
|
2792 |
my $i; |
|
2793 |
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
|
2794 |
if($spiarray[$romimagecount][$i]{spi} eq $targetspi) { |
606 | 2795 |
$flag=0; |
2796 |
} |
|
2797 |
} |
|
2798 |
||
2799 |
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
|
2800 |
$spiarray[$romimagecount][$spicount++]={spifile=>$3, spidir=>$4, spi=>$4.$3}; |
606 | 2801 |
$i=$spicount; |
2802 |
} |
|
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
2803 |
$datafiles[$filescount++]= {data=>$1, rom=>$romimagecount, spifile=>$i-1}; |
606 | 2804 |
} elsif ($spiplacement && $line =~/^\s*SPI_POSITION/i){ |
2805 |
# mark the image index at which the SPI_POSITION keyword has occured in order to avoid writing duplicate |
|
2806 |
# 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
|
2807 |
$spipositionflag{$romimagecount} = 1; |
606 | 2808 |
} elsif ($line=~/^\s*spidatahide\s*=\s*(\S+)\s+(\S+)\s(\S+)\s*$/) { |
2809 |
#spidatahide=\epoc32\data\Z\Resource\Plugins\Obexclasscontroller.RSC ecom.spi \private\10003a3f\ |
|
2810 |
my $targetspi=$3.$2; |
|
2811 |
my $flag=1; |
|
2812 |
my $i; |
|
2813 |
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
|
2814 |
if($spiarray[$romimagecount][$i]{spi} eq $targetspi) { |
606 | 2815 |
$flag=0; |
2816 |
} |
|
2817 |
} |
|
2818 |
||
2819 |
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
|
2820 |
$spiarray[$romimagecount][$spicount++]={spifile=>$2, spidir=>$3, spi=>$3.$2}; |
606 | 2821 |
$i=$spicount; |
2822 |
} |
|
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
2823 |
$hidedatafiles[$hidefilescount++]= {data=>$1, rom=>$romimagecount, spifile=>$i-1}; |
606 | 2824 |
} |
2825 |
||
2826 |
} |
|
2827 |
||
2828 |
for(my $i=0;$i<8 && $composite_secondary<0;$i++) { # loop to set $composite_secondary value |
|
2829 |
if($romimage[$i]{composite} eq "composite_secondary") { |
|
2830 |
$composite_secondary=$i; |
|
2831 |
} |
|
2832 |
} |
|
2833 |
||
2834 |
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 |
|
2835 |
if($romimage[$i]{composite} eq "composite_primary") { |
|
2836 |
my $j=0; |
|
2837 |
while(defined $spiarray[$composite_secondary][$j]) { |
|
2838 |
my $flag=1; |
|
2839 |
my $k=0; |
|
2840 |
while(defined $spiarray[$i][$k] && $flag) { |
|
2841 |
if($spiarray[$composite_secondary][$j]{spi} eq $spiarray[$i][$k]{spi}) { |
|
2842 |
$flag=0; |
|
2843 |
} |
|
2844 |
$k++; |
|
2845 |
} |
|
2846 |
if($flag) { |
|
2847 |
$spiarray[$i][$k]{spifile}=$spiarray[$composite_secondary][$j]{spifile}; |
|
2848 |
$spiarray[$i][$k]{spidir}=$spiarray[$composite_secondary][$j]{spidir}; |
|
2849 |
$spiarray[$i][$k]{spi}=$spiarray[$composite_secondary][$j]{spi}; |
|
2850 |
} |
|
2851 |
$j++; |
|
2852 |
} |
|
2853 |
} |
|
2854 |
} |
|
2855 |
||
2856 |
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 |
|
2857 |
if($romimage[$i]{extension}) { |
|
2858 |
my $j=0; |
|
2859 |
while(defined $spiarray[$i-1][$j]) { |
|
2860 |
my $flag=1; |
|
2861 |
my $k=0; |
|
2862 |
while(defined $spiarray[$i][$k] && $flag) { |
|
2863 |
if($spiarray[$i-1][$j]{spi} eq $spiarray[$i][$k]{spi}) { |
|
2864 |
$flag=0; |
|
2865 |
} |
|
2866 |
$k++; |
|
2867 |
} |
|
2868 |
if($flag) { |
|
2869 |
$spiarray[$i][$k]{spifile}=$spiarray[$i-1][$j]{spifile}; |
|
2870 |
$spiarray[$i][$k]{spidir}=$spiarray[$i-1][$j]{spidir}; |
|
2871 |
$spiarray[$i][$k]{spi}=$spiarray[$i-1][$j]{spi}; |
|
2872 |
} |
|
2873 |
$j++; |
|
2874 |
} |
|
2875 |
} |
|
2876 |
} |
|
2877 |
||
2878 |
for(my $i=0;$i<scalar @spiarray;$i++) { #create SPI files for ROMs which are neither composite_primary nor extensions |
|
2879 |
if(!($romimage[$i]{extension}) && $romimage[$i]{composite} ne "composite_primary") { |
|
2880 |
my $j=0; |
|
2881 |
while(defined $spiarray[$i][$j]) { |
|
2882 |
create($i,$j++); |
|
2883 |
} |
|
2884 |
} |
|
2885 |
} |
|
2886 |
||
2887 |
for(my $i=0;$i<8;$i++) { #create SPI files for ROMs marked as composite_primary |
|
2888 |
if($romimage[$i]{composite} eq "composite_primary") { |
|
2889 |
my $j=0; |
|
2890 |
while(defined $spiarray[$i][$j]) { |
|
2891 |
create($i,$j++,$composite_secondary); |
|
2892 |
} |
|
2893 |
} |
|
2894 |
} |
|
2895 |
for(my $i=0;$i<8;$i++) { #create SPI files for ROMs marked as extension |
|
2896 |
if($romimage[$i]{extension}) { |
|
2897 |
my $j=0; |
|
2898 |
while(defined $spiarray[$i][$j]) { |
|
2899 |
create($i,$j++,$i-1); |
|
2900 |
} |
|
2901 |
} |
|
2902 |
} |
|
2903 |
||
2904 |
undef @newobydata; |
|
2905 |
my $flag=1; |
|
2906 |
my $imageIdx=0; |
|
2907 |
foreach $line (@obydata) { #add SPI files to ROM image, adds lines to obey file to specify existing locations of SPI files and target locations. |
|
2908 |
||
2909 |
if($spiplacement){ |
|
2910 |
$flag = 0; # Reset the flag since the spi file must be added to the final OBY only on finding SPI_POSITION |
|
2911 |
# keyword when the spiplacement flag is set. If the spiplacement flag is set but SPI_POSITION |
|
2912 |
# is not found in the oby files, then no spi entry is emitted. |
|
2913 |
if($line =~ /^\s*SPI_POSITION/i){ |
|
2914 |
next if (!$spipositionflag{$imageIdx});#This spi has already been entered into OBY. |
|
2915 |
my $spiIdx=0; |
|
2916 |
while(defined $spiarray[$imageIdx][$spiIdx]) { |
|
2917 |
if($spiarray[$imageIdx][$spiIdx]{spifile} =~ /(.+)\.(.*)$/) { |
|
2918 |
my $targetspi="$1-$imageIdx-$spiIdx\.$2"; |
|
2919 |
push @newobydata, "data=" . "$thisdir" . $targetspi . " \"" . $spiarray[$imageIdx][$spiIdx]{spi} . "\"\n"; |
|
2920 |
} |
|
2921 |
$spiIdx++; |
|
2922 |
} |
|
2923 |
if($spiIdx == 0){ |
|
2924 |
# If there is no plugin in this image, the SPI_POSITION statement is ignore. |
|
2925 |
print ("Warning: statement SPI_POSTION ignored as no plugin was found at ROM_IMAGE[${imageIdx}]\n"); |
|
2926 |
} |
|
2927 |
$spipositionflag{$imageIdx} = 0; |
|
2928 |
} |
|
2929 |
elsif( $line =~ /REM ROM_IMAGE\[(\d)\]/i){ |
|
2930 |
$imageIdx = $1; |
|
2931 |
push @newobydata, $line; |
|
2932 |
} |
|
2933 |
elsif($line =~ /^\s*spidata/i) { |
|
2934 |
} else { |
|
2935 |
push @newobydata, $line; |
|
2936 |
} |
|
2937 |
} |
|
2938 |
elsif($line =~/REM ROM_IMAGE\[(\d)\]/) { |
|
2939 |
my $romimage=$1; |
|
2940 |
if($flag) { #put in SPI files for ROM_IMAGE[0] |
|
2941 |
$flag=0; |
|
2942 |
my $k=0; |
|
2943 |
while(defined $spiarray[0][$k]) { |
|
2944 |
if($spiarray[0][$k]{spifile} =~ /(.+)\.(.*)$/) { |
|
2945 |
my $targetspi="$1-0-$k\.$2"; |
|
2946 |
push @newobydata, "data=" . "$thisdir" . $targetspi . " \"" . $spiarray[0][$k]{spidir} . $targetspi . "\"\n"; |
|
2947 |
} |
|
2948 |
$k++; |
|
2949 |
} |
|
2950 |
} |
|
2951 |
my $j=0; |
|
2952 |
push @newobydata, "\n" . $line . "\n"; |
|
2953 |
while(defined $spiarray[$romimage][$j]) { #put in SPI files for current ROM_IMAGE |
|
2954 |
if($spiarray[$romimage][$j]{spifile} =~ /(.+)\.(.*)$/) { |
|
2955 |
my $targetspi="$1-$romimage-$j\.$2"; |
|
2956 |
push @newobydata, "data=" . "$thisdir" . $targetspi . " \"" . $spiarray[$romimage][$j]{spidir} . $targetspi . "\"\n"; |
|
2957 |
} |
|
2958 |
$j++; |
|
2959 |
} |
|
2960 |
} elsif($line =~ /^\s*extensionrom/i) { |
|
2961 |
if($flag) { #put in SPI files |
|
2962 |
my $k=0; |
|
2963 |
while(defined $spiarray[0][$k]) { |
|
2964 |
if($spiarray[0][$k]{spifile} =~ /(.+)\.(.*)$/) { |
|
2965 |
my $targetspi="$1-0-$k\.$2"; |
|
2966 |
push @newobydata, "data=" . "$thisdir" . $targetspi . " \"" . $spiarray[0][$k]{spidir} . $targetspi . "\"\n"; |
|
2967 |
} |
|
2968 |
$k++; |
|
2969 |
} |
|
2970 |
$flag = 0; |
|
2971 |
} |
|
2972 |
push @newobydata, $line; |
|
2973 |
} elsif($line =~ /^\s*spidata/i) {; |
|
2974 |
} else { |
|
2975 |
push @newobydata, $line; |
|
2976 |
} |
|
2977 |
} |
|
2978 |
if($flag) { #put in SPI files for ROM_IMAGE[0] if it is the only ROM_IMAGE |
|
2979 |
my $k=0; |
|
2980 |
while(defined $spiarray[0][$k]) { |
|
2981 |
if($spiarray[0][$k]{spifile} =~ /(.+)\.(.*)$/) { |
|
2982 |
my $targetspi="$1-0-$k\.$2"; |
|
2983 |
push @newobydata, "data=" . "$thisdir" . $targetspi . " \"" . $spiarray[0][$k]{spidir} . $targetspi . "\"\n"; |
|
2984 |
} |
|
2985 |
$k++; |
|
2986 |
} |
|
2987 |
} |
|
2988 |
@obydata=@newobydata; |
|
2989 |
} |
|
2990 |
dump_obydata("tmp6.oby", "result of SPI stage") if ($opt_v); |
|
2991 |
} |
|
2992 |
||
2993 |
sub load_featuresutil |
|
2994 |
{ |
|
2995 |
&FlexLoad_ModuleL("featuresutil"); |
|
2996 |
||
2997 |
# Parse the feature database XML file |
|
2998 |
if(!&featuresutil::parseXMLDatabase($featureXml, $featuremanager, $strict)) |
|
2999 |
{ |
|
3000 |
$featureXml = undef; |
|
3001 |
exit(1) if($strict); |
|
3002 |
} |
|
3003 |
} |
|
3004 |
||
3005 |
#---------------------------------------------------------------------------------- |
|
3006 |
# Feature registry configuration file/Features data file generation phase |
|
3007 |
# |
|
3008 |
# If feature registry configuration files/features data files are required then creates these files for |
|
3009 |
# each ROM/ROFS image |
|
3010 |
# |
|
3011 |
sub featurefile_creation_phase |
|
3012 |
{ |
|
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
3013 |
if($onlysmrimage){ |
606 | 3014 |
return; |
3015 |
} |
|
697
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
3016 |
if($noFeatureConf) { |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
3017 |
checkcase() if ($checkcase); |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
3018 |
return ; |
818fe0ed324b
Moving feature configuration out of the buildrom scope.
Ross Qin <ross.qin@nokia.com>
parents:
654
diff
changeset
|
3019 |
} |
606 | 3020 |
# Set the name and Rom Image location of feature file. |
3021 |
if ($enforceFeatureManager) |
|
3022 |
{ |
|
3023 |
# features data file location |
|
3024 |
$dir = "private\/10205054\/"; |
|
3025 |
$featurefilename = "features.dat"; |
|
3026 |
} |
|
3027 |
else |
|
3028 |
{ |
|
3029 |
# feature registry configuration file location |
|
3030 |
$dir = "private\/102744CA\/"; |
|
3031 |
$featurefilename = "featreg.cfg"; |
|
3032 |
} |
|
3033 |
if (defined ($featureXml)) |
|
3034 |
{ |
|
3035 |
my $featurefilecount=0; |
|
3036 |
my $romimage=0; |
|
3037 |
||
3038 |
foreach $line (@obydata) |
|
3039 |
{ |
|
3040 |
# specify which romimage following lines are part of |
|
3041 |
if ($line=~/^\s*REM \s*ROM_IMAGE\[(\d)\]/) |
|
3042 |
{ |
|
3043 |
$romimage=$1; |
|
3044 |
$featurefilecount=0; |
|
3045 |
} |
|
3046 |
elsif ($line =~ /^\s*REM/i) |
|
3047 |
{ |
|
3048 |
# ignore any other REM statements |
|
3049 |
} |
|
3050 |
elsif($line =~ /^\s*(FEATURE)\s*(\S*)\s*(.*)/i |
|
3051 |
|| $line =~ /^\s*(EXCLUDE_FEATURE)\s*(\S*)\s*(.*)/i) |
|
3052 |
{ |
|
3053 |
# FEATURE <feature_name> [ SF <status falgs> ] [ UD <user data> ] |
|
3054 |
my $feature = $1; |
|
3055 |
my $featurevalue = $2; |
|
3056 |
my $featureargs = $3; |
|
3057 |
my $reservedbit = 0; |
|
3058 |
my %featureflags=(); |
|
3059 |
||
3060 |
# Options 'SF' and 'UD' will be supported only for "-fm" option |
|
3061 |
if ($featuremanager) |
|
3062 |
{ |
|
3063 |
# [ SF <status falgs> ] [ UD <user data> ] |
|
3064 |
$featureargs =~ /(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*/ ; |
|
3065 |
||
3066 |
# Store the values of 'SF' and 'UD', or any invalid option, if provided |
|
3067 |
if ($1) |
|
3068 |
{ |
|
3069 |
$featureflags{uc($1)} = $2; |
|
3070 |
} |
|
3071 |
if ($3) |
|
3072 |
{ |
|
3073 |
$featureflags{uc($3)} = $4; |
|
3074 |
} |
|
3075 |
||
3076 |
# Generate a warning if the option provided with Feature/Exclude_Feature keyword is |
|
3077 |
# not 'SF' or 'UD'. |
|
3078 |
foreach my $Key (keys %featureflags) |
|
3079 |
{ |
|
3080 |
if ($Key !~ /^(SF|UD)$/) |
|
3081 |
{ |
|
3082 |
print "Warning: Invalid argument \"$Key\" specified for feature $featurevalue\n"; |
|
3083 |
delete $featureflags{$Key}; |
|
3084 |
next; |
|
3085 |
} |
|
3086 |
} |
|
3087 |
} |
|
3088 |
# In verbose mode, generate warning if "SF|UD" arguments or invalid arguments are specified |
|
3089 |
# for "-f|fr" option. |
|
3090 |
elsif ($featureargs && $opt_v) |
|
3091 |
{ |
|
3092 |
print "Invalid argument(s) \"$featureargs\" provided for feature \"$featurevalue\"\n"; |
|
3093 |
foreach my $Key (keys %featureflags) |
|
3094 |
{ |
|
3095 |
delete $featureflags{$Key}; |
|
3096 |
} |
|
3097 |
} |
|
3098 |
||
3099 |
# The feature file name is of the format featreg.cfg[x-y] or features.dat[x-y] |
|
3100 |
# where x is the romimage id, y is always 0, reserved for future use. |
|
3101 |
my $targetfeaturefile; |
|
3102 |
if (($romimage == 0) && ($reservedbit == 0)) |
|
3103 |
{ |
|
3104 |
||
3105 |
# Core image will not have the mangled name |
|
3106 |
$targetfeaturefile = $featurefilename; |
|
3107 |
} |
|
3108 |
else |
|
3109 |
{ |
|
3110 |
$targetfeaturefile = $featurefilename . "\[". $romimage . "\-$reservedbit\]"; |
|
3111 |
} |
|
3112 |
my $flag=1; |
|
3113 |
my $featureflag; |
|
3114 |
if ($feature =~ /^FEATURE$/i) |
|
3115 |
{ |
|
3116 |
$featureflag = 1; |
|
3117 |
} |
|
3118 |
else |
|
3119 |
{ |
|
3120 |
$featureflag = 0; |
|
3121 |
} |
|
3122 |
||
3123 |
my $i; |
|
3124 |
# loop to see if name of feature file already added to this romimage in array |
|
3125 |
for($i=0;$i<$featurefilecount && $flag;$i++) |
|
3126 |
{ |
|
3127 |
if($featurefilearray[$romimage][$i]{cfgfile} eq $targetfeaturefile) |
|
3128 |
{ |
|
3129 |
$flag=0; |
|
3130 |
} |
|
3131 |
} |
|
3132 |
||
3133 |
if($flag) { # adds feature file if not yet listed for this romimage in array |
|
3134 |
$featurefilearray[$romimage][$featurefilecount++]={cfgfile=>$targetfeaturefile, cfgdir=>$dir}; |
|
3135 |
$i=$featurefilecount; |
|
3136 |
} |
|
3137 |
||
3138 |
$featureslist[$featurescount]= {feature=>$featurevalue, include=>$featureflag, rom=>$romimage, cfgfile=>$i-1}; |
|
3139 |
||
3140 |
# Store the value of 'SF' in 'featureslist' array |
|
3141 |
if (defined $featureflags{SF}) |
|
3142 |
{ |
|
3143 |
$featureslist[$featurescount]->{SF} = $featureflags{SF}; |
|
3144 |
} |
|
3145 |
# Store the value of 'UD' in 'featureslist' array |
|
3146 |
if (defined $featureflags{UD}) |
|
3147 |
{ |
|
3148 |
$featureslist[$featurescount]->{UD} = $featureflags{UD}; |
|
3149 |
} |
|
3150 |
$featurescount++; |
|
3151 |
} |
|
3152 |
} |
|
3153 |
||
3154 |
# Create Feature File |
|
3155 |
for(my $i=0;$i<scalar @featurefilearray;$i++) |
|
3156 |
{ |
|
3157 |
my $j=0; |
|
3158 |
while(defined $featurefilearray[$i][$j]) |
|
3159 |
{ |
|
3160 |
my $targetfeaturefile = $thisdir.$featurefilearray[$i][$j]{cfgfile}; |
|
3161 |
if (!(&featuresutil::createFeatureFile($i,$j,$targetfeaturefile,\@featureslist,$featuremanager))) |
|
3162 |
{ |
|
3163 |
$featurefilearray[$i][$j]{cfgfile}= undef; |
|
3164 |
exit(1) if($strict); |
|
3165 |
} |
|
3166 |
$j++; |
|
3167 |
} |
|
3168 |
} |
|
3169 |
||
3170 |
undef @newobydata; |
|
3171 |
my $flag=1; |
|
3172 |
my $imageIdx=0; |
|
3173 |
||
3174 |
# Add feature files to ROM image, adds lines to obey file to specify existing locations |
|
3175 |
# of feature files and target locations. |
|
3176 |
foreach $line (@obydata) |
|
3177 |
{ |
|
3178 |
if($line =~/REM ROM_IMAGE\[(\d)\]/i) |
|
3179 |
{ |
|
3180 |
my $romimage=$1; |
|
3181 |
if($flag) |
|
3182 |
{ |
|
3183 |
# Put in feature files for ROM_IMAGE[0] |
|
3184 |
$flag=0; |
|
3185 |
my $k=0; |
|
3186 |
while(defined $featurefilearray[0][$k]) |
|
3187 |
{ |
|
3188 |
my $targetfeaturefile=$featurefilearray[0][$k]{cfgfile}; |
|
3189 |
if (defined $targetfeaturefile) |
|
3190 |
{ |
|
3191 |
push @newobydata, "data=" . "$thisdir" . $targetfeaturefile . " \"" . $featurefilearray[0][$k]{cfgdir} . $targetfeaturefile . "\"\n"; |
|
3192 |
} |
|
3193 |
$k++; |
|
3194 |
} |
|
3195 |
} |
|
3196 |
push @newobydata, "\n" . $line . "\n"; |
|
3197 |
||
3198 |
my $j=0; |
|
3199 |
while(defined $featurefilearray[$romimage][$j]) |
|
3200 |
{ |
|
3201 |
# Put in feature files for current ROM_IMAGE |
|
3202 |
my $targetfeaturefile=$featurefilearray[$romimage][$j]{cfgfile}; |
|
3203 |
||
3204 |
# Rom images will not have mangled name for feature files |
|
3205 |
my $destinationfeaturefile = $featurefilename; |
|
3206 |
||
3207 |
# Rofsbuild will set attribute 'exattrib=U' in the entry record when this field is used. |
|
3208 |
# File Server when asked for a directory listing would notice the attribute and will return the |
|
3209 |
# list with mangled names. Hence, mangled name for feature files should not be put in ROM_IMAGE. |
|
3210 |
my $exattribute = "exattrib=U"; |
|
3211 |
||
3212 |
if (defined $targetfeaturefile) |
|
3213 |
{ |
|
3214 |
push @newobydata, "data=" . "$thisdir" . $targetfeaturefile . " \"" . $featurefilearray[$romimage][$j]{cfgdir} . $destinationfeaturefile . "\"\t\t" . $exattribute . "\n"; |
|
3215 |
} |
|
3216 |
$j++; |
|
3217 |
} |
|
3218 |
} |
|
3219 |
elsif($line !~ /^\s*(FEATURE)\s*/i && $line !~ /^\s*(EXCLUDE_FEATURE)\s*/i) |
|
3220 |
{ |
|
3221 |
# Put in all other lines except the FEATURE and EXCLUDE_FEATURE keywords |
|
3222 |
push @newobydata, $line; |
|
3223 |
} |
|
3224 |
} |
|
3225 |
||
3226 |
if($flag) |
|
3227 |
{ |
|
3228 |
# Put in feature files for ROM_IMAGE[0] if it is the only ROM_IMAGE |
|
3229 |
my $k=0; |
|
3230 |
while(defined $featurefilearray[0][$k]) |
|
3231 |
{ |
|
3232 |
my $targetfeaturefile = $featurefilearray[0][$k]{cfgfile}; |
|
3233 |
if (defined $targetfeaturefile) |
|
3234 |
{ |
|
3235 |
push @newobydata, "data=" . "$thisdir" . $targetfeaturefile . " \"" . $featurefilearray[0][$k]{cfgdir} . $targetfeaturefile . "\"\n"; |
|
3236 |
} |
|
3237 |
$k++; |
|
3238 |
} |
|
3239 |
} |
|
3240 |
@obydata=@newobydata; |
|
3241 |
} |
|
3242 |
elsif ($enforceFeatureManager && $noFeatureManager && $preBuiltFeaturesDataFile) |
|
3243 |
{ |
|
3244 |
print "Valid: $preBuiltFeaturesDataFile\n"; |
|
3245 |
if (-e $preBuiltFeaturesDataFile) |
|
3246 |
{ |
|
3247 |
my @newobydata = (); |
|
3248 |
my $flag = 1; |
|
3249 |
foreach my $line (@obydata) |
|
3250 |
{ |
|
3251 |
# Put in the pre-built features data file in ROM_IMAGE[0] |
|
3252 |
if($line =~/REM ROM_IMAGE\[1\]/i) |
|
3253 |
{ |
|
3254 |
push @newobydata, "data=$preBuiltFeaturesDataFile" . " \"" . $dir . $featurefilename . "\"\n"; |
|
3255 |
$flag =0; |
|
3256 |
} |
|
3257 |
push @newobydata, $line; |
|
3258 |
} |
|
3259 |
if($flag) |
|
3260 |
{ |
|
3261 |
# Put in the pre-built features data file in ROM_IMAGE[0] if it is the only ROM_IMAGE |
|
3262 |
push @newobydata, "data=$preBuiltFeaturesDataFile" . " \"" . $dir . $featurefilename . "\"\n"; |
|
3263 |
} |
|
3264 |
@obydata = @newobydata; |
|
3265 |
} |
|
3266 |
else |
|
3267 |
{ |
|
3268 |
print "Error: File \"$preBuiltFeaturesDataFile\" doesn't exist.\n"; |
|
3269 |
exit(1); |
|
3270 |
} |
|
3271 |
} |
|
3272 |
elsif ($enforceFeatureManager) |
|
3273 |
{ |
|
3274 |
print "Error: no feature data file or pre-built feature data file is provided!"; |
|
3275 |
exit(1); |
|
3276 |
} |
|
3277 |
||
3278 |
checkcase() if ($checkcase); |
|
3279 |
} |
|
3280 |
my ($fromABI,$toABI) = split / /,$abiDowngrade; |
|
3281 |
||
3282 |
#---------------------------------------------------------------------------------- |
|
3283 |
# Problem suppression phase |
|
3284 |
# |
|
3285 |
# Downgrade files which don't exist for the ABI (if a downgrade path is specified) |
|
3286 |
# Comment out missing files or report errors if strict option enabled |
|
3287 |
# |
|
3288 |
# Detect any references to Feature Variant binaries and substitute in the |
|
3289 |
# correct source binary name using the VMAP file mechanism. |
|
3290 |
||
3291 |
sub suppress_phase |
|
3292 |
{ |
|
3293 |
undef @newobydata; |
|
3294 |
||
3295 |
init_plat($PerlEPOCPath); |
|
3296 |
||
3297 |
# use the "default" feature variant by default. |
|
3298 |
my $varname = $featureVariant{'VALID'} ? $featureVariant{'NAME'} : "default"; |
|
3299 |
||
3300 |
foreach $line (@obydata) |
|
3301 |
{ |
|
3302 |
track_source($line); |
|
633 | 3303 |
if (($opt_xiponly == 1) && ($line =~ /^\s*REM\s*ROM_IMAGE\[\s*[^0]\s*\]/i)) |
3304 |
{ |
|
3305 |
print "Skip all the content for ROFS image\n" if($opt_v); |
|
3306 |
last; |
|
3307 |
} |
|
3308 |
elsif ($line =~ /^\s*REM/i || $line =~ /^\s*TIME\s*=\s*/i) |
|
606 | 3309 |
{ |
3310 |
# ignore REM statements, to avoid processing "REM data=xxx yyy" |
|
3311 |
} |
|
3312 |
# |
|
3313 |
# thing=some\file |
|
3314 |
# |
|
3315 |
elsif ($line =~ /(\S+)\s*=\s*"?(\S+[\/\\]\S+)"?/) |
|
3316 |
{ |
|
3317 |
my $what = $1; |
|
3318 |
my $filename = $2; |
|
3319 |
if ($line =~ /(\S+)\s*=\s*"([^"]+)"/) |
|
3320 |
{ |
|
3321 |
$filename = $2; |
|
3322 |
} |
|
3323 |
my $normedFilename = &get_versionedname($filename); |
|
3324 |
||
3325 |
# find all the alternative file locations |
|
3326 |
my @alternatives = fallback($normedFilename); |
|
3327 |
# test the original location first |
|
3328 |
unshift(@alternatives, $normedFilename); |
|
3329 |
||
3330 |
# choose the first file location that actually exists |
|
3331 |
my $fileExists = 0; |
|
3332 |
foreach my $altFile (@alternatives) |
|
3333 |
{ |
|
3334 |
my $tmpPath; |
|
3335 |
my $tmpFile; |
|
3336 |
if($altFile =~ /"?(.*[\/\\]arm\w+_?\w+)[\/\\]([^"]+)/i) |
|
3337 |
{ |
|
3338 |
$tmpPath = $1; |
|
3339 |
$tmpFile = $2; |
|
3340 |
} |
|
3341 |
$tmpPath .= "\.$varname"; |
|
3342 |
||
3343 |
if (-e $tmpPath ."\/$tmpFile"){ |
|
3344 |
# SBSv2 variant binary exists |
|
3345 |
$fileExists = $tmpPath . "\/$tmpFile"; |
|
3346 |
} |
|
3347 |
else { |
|
3348 |
# SBSv1 variant binary or invariant binary |
|
3349 |
$fileExists = get_BVbinname($altFile, $varname); |
|
3350 |
} |
|
3351 |
last if $fileExists; |
|
3352 |
} |
|
3353 |
||
3354 |
# edit the OBY line to use the actual file name which we found. |
|
3355 |
# (maybe) warn if an alternative to the original was selected. |
|
3356 |
if ($fileExists) |
|
3357 |
{ |
|
3358 |
my $from = $filename; |
|
3359 |
$from =~ s/\\/\\\\/g; |
|
3360 |
$from =~ s/\//\\\//g; # need to escape backslashes |
|
3361 |
$from =~ s/(\[|\])/\\$1/g; # need to escape square brackets for file names like "featreg.cfg[x-y]",etc. |
|
647 | 3362 |
$from =~ s/(\{|\})/\\$1/g; # need to escape brace for file names like "mydll{00010001}.dll",etc. |
606 | 3363 |
my $into = $fileExists; |
3364 |
||
3365 |
$line =~ s/$from/$into/i; |
|
3366 |
||
3367 |
if ($warnSelection && ($fileExists ne $normedFilename)) |
|
3368 |
{ |
|
3369 |
print "replaced $filename with $fileExists\n"; |
|
3370 |
} |
|
3371 |
} |
|
3372 |
else |
|
3373 |
{ |
|
3374 |
# No suitable alternative was found, so comment out the line unless |
|
3375 |
# it is a manatory ROMBUILD keyword, in which case it is better |
|
3376 |
# to let ROMBUILD report the missing file rather than report the |
|
3377 |
# missing keyword. |
|
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
3378 |
if ($what !~ /^bootbinary|variant|primary|secondary|hide|dir|imagename/i) |
606 | 3379 |
{ |
3380 |
$line = "REM MISSING " . $line; |
|
3381 |
print_source_error("Missing file: '$filename' in statement '$what='"); |
|
3382 |
print "\ttried @alternatives\n" if ($opt_v && @alternatives > 1); |
|
3383 |
# treat as an error if the strict option is selected. |
|
3384 |
$errors++ if ($strict); |
|
3385 |
} |
|
3386 |
} |
|
3387 |
||
3388 |
# Once the binary is located in the appropriate ABI directory (e.g.,following the binary |
|
3389 |
# selection order), check if the binary has been used in a patch dll statement. This is |
|
3390 |
# required to find out the source file. In ABIv1, the source file is required to find the |
|
3391 |
# .map file, while, in ABIv2, the destination file gives the dso file name. |
|
3392 |
if($line =~ /(\S+)\s*=\s*(\S+)\s+(\S+)\s*(.*)?/) |
|
3393 |
{ |
|
3394 |
my $aSrcfile = $2; |
|
3395 |
my $dstFile = $3; |
|
3396 |
my $dstPath = ""; |
|
3397 |
||
3398 |
if($aSrcfile =~ /"?([^"]+)/){ |
|
3399 |
$aSrcfile = $1; |
|
3400 |
} |
|
3401 |
||
3402 |
$aSrcfile = &get_versionedname($aSrcfile); |
|
3403 |
if($dstFile =~ /"?(.*)[\/\\]([^"]+)/) |
|
3404 |
{ |
|
3405 |
$dstPath = $1; |
|
3406 |
$dstFile = $2; |
|
3407 |
} |
|
3408 |
my $dllMapKey = lc ($dstFile); |
|
3409 |
if(exists $DllDataMap{$dllMapKey}) { |
|
3410 |
my $dllSymInfo = \%{$DllDataMap{$dllMapKey}}; |
|
3411 |
$dllSymInfo->{srcfile} = $aSrcfile; |
|
3412 |
$dllSymInfo->{dstpath} = $dstPath; |
|
3413 |
} |
|
3414 |
} |
|
3415 |
||
3416 |
} |
|
3417 |
push @newobydata, $line; |
|
3418 |
} |
|
3419 |
||
3420 |
@obydata = @newobydata; |
|
3421 |
dump_obydata("tmp7.oby", "result of problem-suppression phase") if ($opt_v); |
|
3422 |
die "ERROR: $errors missing file(s) detected\n" if ($strict && $errors ); |
|
3423 |
} |
|
3424 |
||
3425 |
# Remove leading and trailing whitespaces from a list of strings or a single string |
|
3426 |
sub trim |
|
3427 |
{ |
|
3428 |
my @out = @_; |
|
3429 |
for (@out) { |
|
3430 |
s/^\s+//; |
|
3431 |
s/\s+$//; |
|
3432 |
} |
|
3433 |
return wantarray ? @out : $out[0]; |
|
3434 |
} |
|
3435 |
||
3436 |
# Generate a list of alternative locations for the given filename |
|
3437 |
sub fallback |
|
3438 |
{ |
|
3439 |
my $file = shift; |
|
3440 |
my @alternatives = CheckCustomization($file); |
|
3441 |
||
3442 |
# If BINARY_SELECTION_ORDER macro is specified in the oby file |
|
3443 |
if ($binarySelectionOrderFlag) |
|
3444 |
{ |
|
3445 |
# Search in the specified binary order |
|
3446 |
if(scalar(@Global_PlatList) == 0) |
|
3447 |
{ |
|
3448 |
@Global_PlatList = get_platlist(); |
|
3449 |
} |
|
3450 |
my $b; |
|
3451 |
my $e; |
|
3452 |
foreach my $plat (@Global_PlatList) |
|
3453 |
{ |
|
3454 |
if ($file =~ /^(.*)[\/\\]$plat[\/\\](.*)$/i) |
|
3455 |
{ |
|
3456 |
$b = $1; |
|
3457 |
$e = $2; |
|
3458 |
last; |
|
3459 |
} |
|
3460 |
} |
|
3461 |
push(@alternatives, "$b\/$firstDIR\/$e"); |
|
3462 |
||
3463 |
foreach my $toDIR (@binarySelectionOrder) |
|
3464 |
{ |
|
3465 |
push(@alternatives, "$b\/$toDIR\/$e"); |
|
3466 |
} |
|
3467 |
} |
|
3468 |
||
3469 |
# If the file is not found in the specified ABIV2 platform, then select from armv5 directory. |
|
3470 |
# This is necessary as some of the runtime DLLs will be present only in armv5 directory. |
|
3471 |
# Add the BPABI Platforms to be added |
|
3472 |
if(scalar(@Global_BPABIPlats) == 0) |
|
3473 |
{ |
|
3474 |
@Global_BPABIPlats = &get_bpabiplatlist; |
|
3475 |
} |
|
3476 |
||
3477 |
foreach my $BpabiPlat (@Global_BPABIPlats) |
|
3478 |
{ |
|
3479 |
if ($fromABI eq "" && $file =~ /^(.*)[\/\\]$BpabiPlat[\/\\](.*)$/i) |
|
3480 |
{ |
|
3481 |
push(@alternatives, "$1\/armv5\/$2"); |
|
3482 |
} |
|
3483 |
} |
|
3484 |
||
3485 |
if ($customizedPlat && $fromABI eq "" && $file =~ /^(.*)[\/\\]$customizedPlat[\/\\](.*)$/i) |
|
3486 |
{ |
|
3487 |
my $b = $1; |
|
3488 |
my $e = $2; |
|
3489 |
# if platform customization |
|
3490 |
my $rootPlat = get_platroot($customizedPlat); |
|
3491 |
||
3492 |
#Check in ARMV7 folder for binaries in case GCCEV7 is used [DEF128457 ] |
|
3493 |
if($customizedPlat == "GCCEV7") |
|
3494 |
{ |
|
3495 |
push(@alternatives,"$b\/armv7\/$e"); |
|
3496 |
} |
|
3497 |
||
3498 |
if( grep /$rootPlat/, @Global_BPABIPlats) |
|
3499 |
{ |
|
3500 |
push(@alternatives, "$b\/armv5\/$e"); |
|
3501 |
} |
|
3502 |
} |
|
3503 |
||
3504 |
if ($fromABI eq "" && $file =~ /^(.*)[\/\\]armv5_abiv1[\/\\](.*)$/i) |
|
3505 |
{ |
|
3506 |
push(@alternatives, "$1\/armv5\/$2"); |
|
3507 |
} |
|
3508 |
||
3509 |
if ($fromABI ne "" && $file =~ /^(.*)[\/\\]$fromABI[\/\\](.*)$/) |
|
3510 |
{ |
|
3511 |
push(@alternatives, "$1\/$toABI\/$2"); |
|
3512 |
} |
|
3513 |
||
3514 |
return @alternatives; |
|
3515 |
} |
|
3516 |
||
3517 |
# Generate a list of alternative locations for the given filename which |
|
3518 |
# result from the possible platform customizations. |
|
3519 |
sub CheckCustomization |
|
3520 |
{ |
|
3521 |
my $file = shift; |
|
3522 |
my @alternatives; |
|
3523 |
$customizedPlat = undef; # global (used in feedback) |
|
3524 |
||
3525 |
if(scalar(@Global_PlatList) == 0) |
|
3526 |
{ |
|
3527 |
@Global_PlatList = get_platlist(); |
|
3528 |
} |
|
3529 |
foreach my $plat (@Global_PlatList) |
|
3530 |
{ |
|
3531 |
if ($file =~ /^(.*)[\/\\]$plat[\/\\](.*)$/i) |
|
3532 |
{ |
|
3533 |
my $b = $1; |
|
3534 |
my $e = $2; |
|
3535 |
my $root = get_platcustomizes($plat); |
|
3536 |
if ($root) |
|
3537 |
{ |
|
3538 |
# Preserve the plat that is customized |
|
3539 |
$customizedPlat = $plat; |
|
3540 |
||
3541 |
# If a BSF platform customizes another BSF platform (i.e. a |
|
3542 |
# BSF hierarchy exists), look for the file starting from the |
|
3543 |
# child BSF platform and working back to the root BSF platform |
|
3544 |
while ($root) |
|
3545 |
{ |
|
3546 |
push(@alternatives, "$b\/$root\/$e"); |
|
3547 |
||
3548 |
# Temporary special case for armv5_abiv1 and armv5_abiv2 |
|
3549 |
if ($root =~ /^armv5_abiv[12]$/i) |
|
3550 |
{ |
|
3551 |
push(@alternatives, "$b\/armv5\/$e"); |
|
3552 |
} |
|
3553 |
||
3554 |
$root = get_platcustomizes($root); |
|
3555 |
} |
|
3556 |
} |
|
3557 |
return @alternatives; |
|
3558 |
} |
|
3559 |
} |
|
3560 |
return @alternatives; |
|
3561 |
} |
|
3562 |
||
3563 |
#---------------------------------------------------------------------------------- |
|
3564 |
# Bitmap and aif conversion phase |
|
3565 |
# |
|
3566 |
# Convert any "bitmap=" or "compressed-bitmap=" files into ROM format bitmaps |
|
3567 |
# Convert any "auto-bitmap=" to handle bitmap appropriately for xip and non-xip images |
|
3568 |
# Convert "aif=" files appropriately for xip and non-xip images |
|
3569 |
sub bitmap_aif_converison_phase |
|
3570 |
{ |
|
3571 |
my $is_xip=1; |
|
3572 |
undef @newobydata; |
|
3573 |
foreach $line (@obydata) |
|
3574 |
{ |
|
3575 |
track_source($line); |
|
3576 |
# keep track of the XIP-ness of this rom partition |
|
3577 |
if ($line =~ /^\s*REM ROM_IMAGE\[(\d+)\]\s+(.*)$/i) |
|
3578 |
{ $is_xip=$romimage[$1]{xip}; } |
|
3579 |
# |
|
3580 |
# aif=source dest |
|
3581 |
# include aif file - use XIP version for XIP roms if it exists, otherwise use the file specified |
|
3582 |
# |
|
3583 |
if ($line =~ /^\s*aif=/i) |
|
3584 |
{ |
|
3585 |
my $xip="_xip"; |
|
3586 |
my @aif= split(/\s+/,$line); |
|
3587 |
my $path=Path_Split('Path',"$aif[0]"); |
|
3588 |
my $base=Path_Split('Base',"$aif[0]"); |
|
3589 |
$path =~ s/^....//; |
|
3590 |
my $ext=Path_Split('Ext',"$aif[0]"); |
|
3591 |
if ($is_xip && (-e "$path$base$xip$ext")) |
|
3592 |
{ $line="data=$path$base$xip$ext\t\t$aif[1]\n"; } |
|
3593 |
else |
|
3594 |
{ $line="data=$path$base$ext\t\t$aif[1]\n"; } |
|
3595 |
} |
|
3596 |
# |
|
3597 |
# auto-bitmap= |
|
3598 |
# |
|
3599 |
# if currently in XIP image, then use a compressed-bitmap |
|
3600 |
# otherwise use a RAM format bitmap |
|
3601 |
# |
|
3602 |
if ($line =~ /^\s*auto-bitmap=/i) |
|
3603 |
{ |
|
3604 |
if ($is_xip) |
|
3605 |
{ $line =~ s/auto-bitmap=/compressed-bitmap=/i } |
|
3606 |
else |
|
3607 |
{ $line =~ s/auto-bitmap=/data=/i } |
|
3608 |
} |
|
3609 |
# |
|
3610 |
# uncompressed-bitmap |
|
3611 |
# |
|
3612 |
# this is currently just a synonym for 'bitmap' |
|
3613 |
$line =~ s/uncompressed-bitmap=/bitmap=/i; |
|
3614 |
||
3615 |
# |
|
3616 |
# bitmap=source dest |
|
3617 |
# |
|
3618 |
if ($line =~ /^\s*bitmap=\s*"?(\S+)"?\s+"?(\S+)"?/i) |
|
3619 |
{ |
|
3620 |
my $mbm = $1; |
|
3621 |
my $dest = $2; |
|
3622 |
my $rom_mbm = "$1_rom"; |
|
3623 |
if ($is_xip eq 0) |
|
3624 |
{ |
|
3625 |
# non-XIP rom - just include the mbm file |
|
3626 |
$line = "data=\"$mbm\"\t\"$dest\"\n"; |
|
3627 |
} |
|
3628 |
else |
|
3629 |
{ |
|
3630 |
if (! -e $rom_mbm || -M $rom_mbm >= -M $mbm) |
|
3631 |
{ |
|
3632 |
is_existinpath("bmconv", romutl::DIE_NOT_FOUND); |
|
3633 |
||
3634 |
my $rom_mbm_tmp = $rom_mbm; |
|
3635 |
my $mbm_tmp = $mbm; |
|
3636 |
if ($^O =~ /^MSWIN32$/i){ |
|
3637 |
$mbm_tmp =~ s-\/-\\-g; |
|
3638 |
$rom_mbm_tmp =~ s-\/-\\-g; |
|
3639 |
} |
|
3640 |
||
3641 |
system "bmconv -q -r $rom_mbm_tmp -m$mbm_tmp"; |
|
3642 |
my $bmconv_status = $?; |
|
3643 |
die "* bmconv failed\n" if ($bmconv_status != 0 || !-f $rom_mbm); |
|
3644 |
} |
|
3645 |
$line = "data=\"$rom_mbm\"\t\"$dest\"\n"; |
|
3646 |
push @tempfiles, $rom_mbm; |
|
3647 |
} |
|
3648 |
} |
|
3649 |
# |
|
3650 |
# compressed-bitmap= |
|
3651 |
# |
|
3652 |
# if file is a compressed ROM image file |
|
3653 |
elsif ($line =~ /^\s*compressed-bitmap=\s*"?(\S+)"?\s+"?(\S+)"?/i) |
|
3654 |
{ |
|
3655 |
my $mbm = $1; |
|
3656 |
my $dest = $2; |
|
3657 |
my $cmprssd_rom_mbm = "$1_rom"; |
|
3658 |
if ($is_xip eq 0) |
|
3659 |
{ |
|
3660 |
# non-XIP rom - just include the mbm file |
|
3661 |
$line = "data=\"$mbm\"\t\"$dest\"\n"; |
|
3662 |
} |
|
3663 |
else |
|
3664 |
{ |
|
3665 |
if (! -e $cmprssd_rom_mbm || -M $cmprssd_rom_mbm >= -M $mbm) |
|
3666 |
{ |
|
3667 |
is_existinpath("bmconv", romutl::DIE_NOT_FOUND); |
|
3668 |
||
3669 |
my $cmprssd_rom_mbm_tmp = $cmprssd_rom_mbm; |
|
3670 |
my $mbm_tmp = $mbm; |
|
3671 |
if ($^O =~ /^MSWIN32$/i){ |
|
3672 |
$mbm_tmp =~ s-\/-\\-g; |
|
3673 |
$cmprssd_rom_mbm_tmp =~ s-\/-\\-g; |
|
3674 |
} |
|
3675 |
||
3676 |
system "bmconv -q -s $cmprssd_rom_mbm_tmp -m$mbm_tmp"; |
|
3677 |
my $bmconv_status = $?; |
|
3678 |
die "* bmconv failed\n" if ($bmconv_status != 0 || !-f $cmprssd_rom_mbm); |
|
3679 |
} |
|
3680 |
$line = "data=\"$cmprssd_rom_mbm\"\t\"$dest\"\n"; |
|
3681 |
push @tempfiles, $cmprssd_rom_mbm; |
|
3682 |
} |
|
3683 |
} |
|
3684 |
push @newobydata, $line; |
|
3685 |
} |
|
3686 |
@obydata = @newobydata; |
|
3687 |
dump_obydata("tmp8.oby", "result of bitmap conversion phase") if ($opt_v); |
|
3688 |
} |
|
3689 |
||
3690 |
||
3691 |
sub reformat_line($) |
|
3692 |
{ |
|
3693 |
my ($line) = @_; |
|
3694 |
my $type = ""; |
|
3695 |
my $variant = ""; |
|
3696 |
my $pcfile = ""; |
|
3697 |
my $romfile = ""; |
|
3698 |
my $tail = ""; |
|
3699 |
||
3700 |
# time=21/07/1999 12:00:00 |
|
3701 |
# primary[0x09080004] =\epoc32\release\misa\udeb\ekern.exe |
|
3702 |
# data=\epoc32\wins\C\System\Alarms\churchbell.snd "System\Alarms\Church bell" |
|
3703 |
# file[0x07060001]=\epoc32\release\MAWD\urel\cAkyb1.dll System\Libs\EKeyb.dll |
|
3704 |
# file=\epoc32\release\marm\urel\eikcore.dll System\Libs\Eikcore.dll |
|
3705 |
# alias \System\Bin\DRTRVCT2_2.dll \System\Bin\DRTRVCT2_1.dll |
|
3706 |
# |
|
3707 |
$line =~ s-\\-\/-g; |
|
3708 |
if ($line =~ /^\s*TIME\s*=\s*/i) |
|
3709 |
{ |
|
3710 |
return $line; |
|
3711 |
} |
|
654 | 3712 |
elsif($line =~ /^\s*(volume|volumeid)\s*=.*/i) |
606 | 3713 |
{ |
3714 |
return $line; |
|
3715 |
} |
|
3716 |
elsif($line =~ /^\s*kerneltrace\s*=.*/i) |
|
3717 |
{ |
|
3718 |
return $line; |
|
3719 |
} |
|
647 | 3720 |
elsif($line =~ /^\s*(dir|dircopy)\s*=.*/i) |
606 | 3721 |
{ |
3722 |
return $line; |
|
3723 |
} |
|
3724 |
elsif($line =~ /^\s*bootbinary\s*=(.*)/i) |
|
3725 |
{ |
|
3726 |
} |
|
3727 |
if ($line =~ /^\s*(\S+)\s*=\s*(\S+)\s+"\/?(.*)"(.*)$/) |
|
3728 |
{ |
|
3729 |
$type = $1; |
|
3730 |
$variant = ""; |
|
3731 |
$pcfile = $2; |
|
3732 |
$romfile = $3; |
|
3733 |
$tail = $4; |
|
3734 |
} |
|
3735 |
elsif ($line =~ /^\s*(\S+)(\[\S+\])\s*=\s*(\S+)\s+\/?(\S+)(.*)$/) |
|
3736 |
{ |
|
3737 |
$type = $1; |
|
3738 |
$variant = $2; |
|
3739 |
$pcfile = $3; |
|
3740 |
$romfile = $4; |
|
3741 |
$tail = $5; |
|
3742 |
} |
|
3743 |
elsif ($line =~ /(\S+)\s*=\s*"([^"]+)"\s+"\/?(.*)"(.*)$/ |
|
3744 |
|| $line =~ /(\S+)\s*=\s*"([^"]+)"\s+\/?(\S+)(.*)$/) |
|
3745 |
{ |
|
3746 |
if ($line !~ /^REM MISSING/i) |
|
3747 |
{ |
|
3748 |
$type = $1; |
|
3749 |
$variant = ""; |
|
3750 |
$pcfile = "\"$2\""; |
|
3751 |
$romfile = $3; |
|
3752 |
$tail = $4; |
|
3753 |
} |
|
3754 |
else{ |
|
3755 |
return $line; |
|
3756 |
} |
|
3757 |
} |
|
3758 |
elsif ($line =~ /^\s*(\S+)\s*=\s*(\S+)\s+\/?(\S+)(.*)$/) |
|
3759 |
{ |
|
3760 |
$type = $1; |
|
3761 |
$variant = ""; |
|
3762 |
$pcfile = $2; |
|
3763 |
$romfile = $3; |
|
3764 |
$tail = $4; |
|
3765 |
} |
|
3766 |
elsif($line =~ /^\s*(patchdata)\s*(\S+)\s*\@\s*(\S+)\s+(\S+)/i) |
|
3767 |
{ |
|
3768 |
# Reformat the patchdata statement |
|
3769 |
my $romfilename = $2; |
|
3770 |
my $patchdlldatamap_key = lc ($romfilename); |
|
3771 |
my $symbolname = $3; |
|
3772 |
my $value = $4; |
|
3773 |
my ($index, $elementSize); # For when the symbol is an array, and we're patching one element |
|
3774 |
my $scalarSize; |
|
3775 |
||
3776 |
if(!defined $DllDataMap{$patchdlldatamap_key}->{dstpath}){ |
|
3777 |
print_source_error(" File $romfilename has not been included into ROM image"); |
|
3778 |
$errors++ if($strict); |
|
3779 |
$line = "REM $line\n"; |
|
3780 |
return $line; |
|
3781 |
} |
|
3782 |
||
3783 |
if ($enforceSysBin) |
|
3784 |
{ |
|
3785 |
if ($DllDataMap{$patchdlldatamap_key}->{dstpath} !~ /^sys\\bin/i |
|
3786 |
&& $DllDataMap{$patchdlldatamap_key}->{dstpath} !~ /^sys\/bin/i) |
|
3787 |
{ |
|
3788 |
$DllDataMap{$patchdlldatamap_key}->{dstpath} = "sys\/bin"; |
|
3789 |
} |
|
3790 |
} |
|
3791 |
||
3792 |
my $dllfile = $DllDataMap{$patchdlldatamap_key}->{dstpath} . "\/". $romfilename; |
|
3793 |
||
3794 |
$line = "$1 "; |
|
3795 |
$line .= "$dllfile "; |
|
3796 |
||
3797 |
# Convert value into decimal (used to be done in AddDllDataInfo, but that limited us to |
|
3798 |
# one value per symbol, and we now support patching arrays, e.g. the Hal's InitialValue[], |
|
3799 |
# so we can't do it that way any more.) |
|
3800 |
if ($value =~ /^0x([0-9a-f]+)$/i) { |
|
3801 |
$value = hex($1); |
|
3802 |
} |
|
3803 |
elsif ($value =~ /^(-?\d+)$/) { |
|
3804 |
$value = $1; |
|
3805 |
} |
|
3806 |
else { |
|
3807 |
print_source_error("Attempt to set $symbolname to illegal value $value"); |
|
3808 |
$errors++ if($strict); |
|
3809 |
$line = "REM $line\n"; |
|
3810 |
return $line; |
|
3811 |
} |
|
3812 |
||
3813 |
if ($symbolname =~ s/:(\d+)\[((0x)?[0-9a-f]+)\]$//i) { |
|
3814 |
($index, $elementSize) = ($2, $1); |
|
3815 |
$index = hex($index) if $index =~ /^0x/i; |
|
3816 |
} |
|
3817 |
||
3818 |
my $DllSymInfoRef = $DllDataMap{$patchdlldatamap_key}->{$symbolname}; |
|
3819 |
||
3820 |
if (!defined($DllSymInfoRef->{size})) { |
|
3821 |
print_source_error("Size for symbol $symbolname not found"); |
|
3822 |
$errors++ if($strict); |
|
3823 |
$line = "REM $line\n"; |
|
3824 |
return $line; |
|
3825 |
} |
|
3826 |
||
3827 |
if (defined($elementSize)) { |
|
3828 |
$scalarSize = $elementSize / 8; |
|
3829 |
if ($scalarSize != 1 && $scalarSize != 2 && $scalarSize != 4) { |
|
3830 |
print_source_error("Invalid bit size $elementSize for array $symbolname in $romfilename"); |
|
3831 |
$errors++ if($strict); |
|
3832 |
$line = "REM $line\n"; |
|
3833 |
return $line; |
|
3834 |
} |
|
3835 |
if (($index + 1) * $scalarSize > $DllSymInfoRef->{size}) { |
|
3836 |
print_source_error("Invalid index $index into array $symbolname in $romfilename"); |
|
3837 |
$errors++ if($strict); |
|
3838 |
$line = "REM $line\n"; |
|
3839 |
return $line; |
|
3840 |
} |
|
3841 |
} else { |
|
3842 |
$scalarSize = $DllSymInfoRef->{size}; |
|
3843 |
} |
|
3844 |
||
3845 |
my $max_value = 0xffffffff; |
|
3846 |
||
3847 |
if ($scalarSize == 1) { |
|
3848 |
$max_value = 0xff; |
|
3849 |
} |
|
3850 |
elsif ($scalarSize == 2) { |
|
3851 |
$max_value = 0xffff; |
|
3852 |
} |
|
3853 |
||
3854 |
if ($value > $max_value) { |
|
3855 |
$value &= $max_value; |
|
3856 |
print "$DllSymInfoRef->{obyfilename}($DllSymInfoRef->{lineno}): Warning:Value overflow of $symbolname\n"; |
|
3857 |
$errors++ if($strict); |
|
3858 |
} |
|
3859 |
||
3860 |
if(defined $DllSymInfoRef->{ordinal}) { |
|
3861 |
if (defined($elementSize)) { |
|
3862 |
my $ord = $DllSymInfoRef->{ordinal}; |
|
3863 |
my $offset = $index * $scalarSize; |
|
3864 |
$line .= "ordinal $ord+$offset "; |
|
3865 |
} else { |
|
3866 |
$line .= "ordinal "; |
|
3867 |
$line .= $DllSymInfoRef->{ordinal} . " "; |
|
3868 |
} |
|
3869 |
} |
|
3870 |
elsif(defined $DllSymInfoRef->{dataAddr}) { |
|
3871 |
if (defined($elementSize)) { |
|
3872 |
my $addr = $DllSymInfoRef->{dataAddr}; |
|
3873 |
$addr = hex($addr) if $addr =~ /^0x/i; |
|
3874 |
$addr = sprintf("0x%08x", $addr + $index * $scalarSize); |
|
3875 |
$line .= "addr $addr "; |
|
3876 |
} else { |
|
3877 |
$line .= "addr "; |
|
3878 |
$line .= $DllSymInfoRef->{dataAddr} . " "; |
|
3879 |
} |
|
3880 |
} |
|
3881 |
else |
|
3882 |
{ |
|
3883 |
print_source_error("Ordinal or Address for exported symbol $symbolname in $romfilename couldn't be located"); |
|
3884 |
$errors++ if($strict); |
|
3885 |
$line = "REM $line\n"; |
|
3886 |
return $line; |
|
3887 |
}; |
|
3888 |
||
3889 |
$line .= "$scalarSize $value\n"; |
|
3890 |
||
3891 |
return $line; |
|
3892 |
} |
|
3893 |
elsif ($line =~ /^\s*(\S+)\s*(\S+)\s+\/?(\S+)(.*)$/) |
|
3894 |
{ |
|
3895 |
$type = $1; |
|
3896 |
$variant = ""; |
|
3897 |
$pcfile = $2; |
|
3898 |
$romfile = $3; |
|
3899 |
$tail = $4; |
|
3900 |
||
3901 |
if ($type !~ /^(alias)$/i) |
|
3902 |
{ |
|
3903 |
# Return now, if it is not an 'alias'. |
|
3904 |
return $line; |
|
3905 |
} |
|
3906 |
else |
|
3907 |
{ |
|
3908 |
# There is no substitution needed for SysBin 'alias'es. |
|
3909 |
if ($romfile =~ /^sys\\bin\\/i |
|
3910 |
||$romfile =~ /^sys\/bin/i) |
|
3911 |
{ |
|
3912 |
return $line; |
|
3913 |
} |
|
3914 |
} |
|
3915 |
} |
|
3916 |
else |
|
3917 |
{ |
|
3918 |
return $line; |
|
3919 |
} |
|
3920 |
# Buildrom should generate warning when destination path provided for a file |
|
3921 |
# is not a standard path(as per platsec) and "PlatSecEnforceSysBin" is turned off. |
|
3922 |
my $warnFlag = 1; |
|
3923 |
my $mustBeSysBin = $enforceSysBin; |
|
3924 |
if ($type =~ /^(data|compress|nocompress)$/i |
|
3925 |
&& $romfile !~ /^system\/(bin|libs|programs)\//i) |
|
3926 |
{ |
|
3927 |
$mustBeSysBin = 0; |
|
3928 |
$warnFlag = 0; |
|
3929 |
} |
|
3930 |
||
3931 |
if ($mustBeSysBin) |
|
3932 |
{ |
|
3933 |
if ($type =~ /^(alias)$/i |
|
3934 |
&& $romfile !~ /^sys\\bin\\/i |
|
3935 |
&& $romfile !~ /^sys\/bin/i) |
|
3936 |
{ |
|
3937 |
# for multilinguify 'alias'es (generally resource files) 'MustBeSysBin' should not be enforced. |
|
3938 |
if(defined($multiLinguifyAlias{$pcfile})) { |
|
3939 |
return $line; |
|
3940 |
} |
|
3941 |
||
3942 |
my $filename = "\/$romfile"; # in case no path is specified |
|
3943 |
$filename = substr $filename, rindex($filename, "\/"); |
|
3944 |
$romfile = "sys\/bin".$filename; |
|
3945 |
||
3946 |
if ($pcfile !~ /^sys\\bin\\/i |
|
3947 |
&& $pcfile !~ /^sys\/bin/i) |
|
3948 |
{ |
|
3949 |
my $pcfilename = "\/$pcfile"; # in case no path is specified |
|
3950 |
$pcfilename = substr $pcfilename, rindex($pcfilename, "\/"); |
|
3951 |
$pcfile = "sys\/bin".$pcfilename; |
|
3952 |
} |
|
3953 |
return "$type$variant $pcfile \t$romfile$tail\n"; |
|
3954 |
} |
|
3955 |
||
3956 |
if ($romfile !~ /^sys\\bin\\/i |
|
3957 |
&& $romfile !~ /^sys\/bin/i) |
|
3958 |
{ |
|
3959 |
my $filename = "\/$romfile"; # in case no path is specified |
|
3960 |
$filename = substr $filename, rindex($filename, "\/"); |
|
3961 |
$romfile = "sys\/bin".$filename; |
|
3962 |
} |
|
3963 |
} |
|
3964 |
else |
|
3965 |
{ |
|
3966 |
if ($warnFlag && $romfile !~ /^sys\\bin\\/i && $romfile !~ /^sys\/bin/i) |
|
3967 |
{ |
|
3968 |
print "Warning: Outside standard path at \"$line\"\n"; |
|
3969 |
} |
|
3970 |
if ($type =~ /^(alias)$/i) |
|
3971 |
{ |
|
3972 |
# Return the line as it is for non-MustBeSysBin 'alias'es. |
|
3973 |
return $line; |
|
3974 |
} |
|
3975 |
} |
|
3976 |
$romfiles{$romfile} = $variant.$pcfile; |
|
3977 |
return "$type$variant=$pcfile \t\"$romfile\"$tail\n"; |
|
3978 |
} |
|
3979 |
||
3980 |
my @hidearray; |
|
3981 |
||
3982 |
sub mark |
|
3983 |
{ # function to mark files in ROMs as hidden |
|
3984 |
my ($base,$ext) = @_; |
|
3985 |
my $i=0; |
|
3986 |
my @coreimagerange = (-1,-1); #coreimagerange stores the places within @hidearray where the $base files start and end |
|
3987 |
my @extensionimagerange = (-1,-1); #extensionimagerange stores the places within @hidearray where the $ext files start and end |
|
3988 |
for(my $i=0;$i<scalar @hidearray;$i++) { #loop sets values in @coreimagerange and in @extensionimagerange |
|
3989 |
if($hidearray[$i]{rom}==$base) { |
|
3990 |
if($coreimagerange[0]<0) { |
|
3991 |
$coreimagerange[0]=$i; |
|
3992 |
$coreimagerange[1]=$i; |
|
3993 |
} else { |
|
3994 |
$coreimagerange[1]=$i; |
|
3995 |
} |
|
3996 |
} elsif($hidearray[$i]{rom}==$ext) { |
|
3997 |
if($extensionimagerange[0]<0) { |
|
3998 |
$extensionimagerange[0]=$i; |
|
3999 |
$extensionimagerange[1]=$i; |
|
4000 |
} else { |
|
4001 |
$extensionimagerange[1]=$i; |
|
4002 |
} |
|
4003 |
} |
|
4004 |
} |
|
4005 |
||
4006 |
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 |
|
4007 |
for(my $j=$coreimagerange[0];$j<=$coreimagerange[1];$j++) { |
|
4008 |
if($hidearray[$i]{dest} eq $hidearray[$j]{dest}) { |
|
4009 |
$hidearray[$i]{hide}=1; |
|
4010 |
} |
|
4011 |
} |
|
4012 |
} |
|
4013 |
} |
|
4014 |
||
4015 |
||
4016 |
#---------------------------------------------------------------------------------- |
|
4017 |
# Cleaning phase |
|
4018 |
# |
|
4019 |
# Remove "REM defined", "REM handled" |
|
4020 |
# Remove the "# lineno" information |
|
4021 |
# Collapse multiple blank lines |
|
4022 |
# Apply the PlatSecEnforceSysBin setting |
|
4023 |
# Produce ROM directory listing |
|
4024 |
# Identify the ROM image name |
|
4025 |
sub cleaning_phase |
|
4026 |
{ |
|
4027 |
my $romname; |
|
4028 |
my $skippingBlanks=0; |
|
4029 |
undef @newobydata; |
|
4030 |
||
4031 |
if($opt_v) |
|
4032 |
{ |
|
4033 |
my $logWin = $thisdir."logwin.oby"; |
|
4034 |
my $logLinux = $thisdir."loglinux.oby"; |
|
4035 |
unlink($logWin); |
|
4036 |
unlink($logLinux); |
|
4037 |
open LOGWIN, ">$logWin" or die("* Can't create $logWin\n"); |
|
4038 |
open LOGLINUX, ">$logLinux" or die("* Can't create $logLinux\n"); |
|
4039 |
} |
|
4040 |
||
4041 |
foreach $line (@obydata) |
|
4042 |
{ |
|
4043 |
track_source($line); |
|
4044 |
if ($line=~/^REM (defined|handled)/) |
|
4045 |
{ |
|
4046 |
next; |
|
4047 |
} |
|
4048 |
if ($line=~/^# (\d+) "(.*)"/) |
|
4049 |
{ |
|
4050 |
next; |
|
4051 |
} |
|
4052 |
# |
|
4053 |
# Blank line compression |
|
4054 |
# |
|
4055 |
if ($line=~/^\s*$/) |
|
4056 |
{ |
|
4057 |
if ($skippingBlanks==1) |
|
4058 |
{ |
|
4059 |
next; |
|
4060 |
} |
|
4061 |
$skippingBlanks=1; |
|
4062 |
} |
|
4063 |
else |
|
4064 |
{ |
|
4065 |
$skippingBlanks=0; |
|
4066 |
} |
|
4067 |
# |
|
4068 |
# Track ROMNAME, allowing overrides |
|
4069 |
# |
|
4070 |
if ($line=~/romname\s*[=\s]\s*"?(\S+)\.(\S+)"?\s*/i) |
|
4071 |
{ |
|
4072 |
if ($romname ne "" && $opt_o eq "") |
|
4073 |
{ |
|
4074 |
print_source_error("Overrides previous ROM name $romname"); |
|
4075 |
} |
|
4076 |
$rombasename = $1; |
|
4077 |
$romname = "$1.$2"; |
|
4078 |
if ($opt_workdir) |
|
4079 |
{ |
|
4080 |
$rombasename = $thisdir.$rombasename; |
|
4081 |
$romname = $thisdir.$romname; |
|
4082 |
} |
|
4083 |
next; |
|
4084 |
} |
|
4085 |
# |
|
4086 |
# ROM directory listing |
|
4087 |
# |
|
4088 |
my $newline = reformat_line($line); |
|
4089 |
if( ($newline !~ /^\s*TIME\s*=\s*/i) |
|
4090 |
&&($newline !~ /^\s*volume\s*=.*/i) |
|
4091 |
&&($newline !~ /^\s*kerneltrace\s*=.*/i)) |
|
4092 |
{ |
|
4093 |
my $tmpline = $newline; |
|
4094 |
if(&is_windows) |
|
4095 |
{ |
|
4096 |
$newline =~ s-\/-\\-go; |
|
4097 |
if($opt_v) |
|
4098 |
{ |
|
4099 |
print LOGWIN $newline; |
|
4100 |
$tmpline =~ s-\\-\/-go; |
|
4101 |
print LOGLINUX $tmpline; |
|
4102 |
} |
|
4103 |
}else #unix os |
|
4104 |
{ |
|
4105 |
$newline =~ s-\\-\/-go; |
|
4106 |
if($opt_v) |
|
4107 |
{ |
|
4108 |
print LOGLINUX $newline; |
|
4109 |
$tmpline =~ s-\/-\\-go; |
|
4110 |
print LOGWIN $tmpline; |
|
4111 |
} |
|
4112 |
} |
|
4113 |
} |
|
4114 |
||
4115 |
push @newobydata, $newline; |
|
4116 |
} |
|
4117 |
if($opt_v) |
|
4118 |
{ |
|
4119 |
close LOGWIN; |
|
4120 |
close LOGLINUX; |
|
4121 |
} |
|
4122 |
||
4123 |
exit(1) if($errors && $strict); |
|
4124 |
# Handle ROMNAME and possible -o override |
|
4125 |
if ($opt_o ne "") |
|
4126 |
{ |
|
4127 |
if ($opt_workdir && $opt_o !~ /^[\\\/]/ && $opt_o !~ /^.:/) |
|
4128 |
{ |
|
4129 |
$opt_o = $thisdir.$opt_o; |
|
4130 |
} |
|
4131 |
if (&is_windows) |
|
4132 |
{ |
|
4133 |
$opt_o =~ s-\/-\\-g; |
|
4134 |
}else |
|
4135 |
{ |
|
4136 |
$opt_o =~ s-\\-\/-g; |
|
4137 |
} |
|
4138 |
$romname=$opt_o; |
|
4139 |
if ($opt_o=~/(\S+)\.(\S+)/) |
|
4140 |
{ |
|
4141 |
$rombasename=$1; |
|
4142 |
} |
|
4143 |
else |
|
4144 |
{ |
|
4145 |
$rombasename=$romname; |
|
4146 |
} |
|
4147 |
} |
|
4148 |
if(!$onlysmrimage) |
|
4149 |
{ |
|
4150 |
unshift @newobydata, "romname=$romname\n"; # first line of final OBY file |
|
4151 |
} |
|
4152 |
@obydata = @newobydata; |
|
4153 |
||
4154 |
print "* Removing previous image and logs...\n"; |
|
4155 |
unlink glob("$rombasename.*"); |
|
4156 |
||
4157 |
my $obyrecordline; |
|
4158 |
if($createspi) {# section added to mark SPI files in core images as hidden (if appropriate) if extension ROMs are being produced |
|
4159 |
my $imagenum=0; |
|
4160 |
my $count=0; |
|
4161 |
foreach my $line (@obydata) { # fill @hidearray with all file= or data= entries from @obydata, recording which image they are in and their target destination |
|
4162 |
if($line =~/^\s*(file|data)\s*=\s*(\S+)\s+(\S+)\s*$/gi) { |
|
4163 |
$hidearray[$count] = {rom=>$imagenum, type=>$1, dest=>$3}; |
|
4164 |
$hidearray[$count]{dest} =~s/\"//g; |
|
4165 |
$count++; |
|
4166 |
} elsif($line =~/^\s*REM\s+ROM_IMAGE\[(\d)\]\s*$/i ) { |
|
4167 |
$imagenum=$1; |
|
4168 |
} |
|
4169 |
} |
|
4170 |
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 |
|
4171 |
if($romimage[$i]{extension}) { |
|
4172 |
mark($i-1,$i); |
|
4173 |
} |
|
4174 |
} |
|
4175 |
undef @newobydata; |
|
4176 |
||
4177 |
my $hideflag=0; # is set to 1 if there are files which need to be hidden, determines whether to run next section of code |
|
4178 |
for(my $i=0;$i<scalar @hidearray;$i++) { |
|
4179 |
if($hidearray[$i]{hide}==1) { |
|
4180 |
$hideflag=1; |
|
4181 |
} |
|
4182 |
} |
|
4183 |
||
4184 |
my $obeyrom=0; |
|
4185 |
if($hideflag) { #if there exist files which need hiding |
|
4186 |
my $i=0; |
|
4187 |
my $exitflag=0; |
|
4188 |
$obyrecordline=0; |
|
4189 |
for(;$obyrecordline<scalar @obydata && !$exitflag;) { # nested for loops produce new obey file in @newobydata, including hide= lines |
|
4190 |
print "Line = $obyrecordline $i " . scalar @hidearray . "\n"; |
|
4191 |
if($i==scalar @hidearray) { |
|
4192 |
$exitflag=1; |
|
4193 |
} |
|
4194 |
for(;$i<scalar @hidearray;$i++) { |
|
4195 |
if($hidearray[$i]{hide}==1) { |
|
4196 |
my $rom=$hidearray[$i]{rom}; |
|
4197 |
my $destination=$hidearray[$i]{dest}; |
|
4198 |
while($obeyrom<$rom && $obyrecordline<scalar @obydata) { #pushes lines to @newobydata until specified rom is reached |
|
4199 |
push @newobydata, $obydata[$obyrecordline]; |
|
4200 |
if($obydata[$obyrecordline] =~/^\s*REM\s+ROM_IMAGE\[(\d)\]\s*$/i){ |
|
4201 |
$obeyrom=$1; |
|
4202 |
} |
|
4203 |
$obyrecordline++; |
|
4204 |
} |
|
4205 |
my $flag=1; #get to here when $obeyrom==$rom |
|
4206 |
while($flag && $obyrecordline<scalar @obydata) { |
|
4207 |
$destination=~s|\\|/|g; |
|
4208 |
my $obyline=$obydata[$obyrecordline]; |
|
4209 |
$obyline=~s|\\|/|g; |
|
4210 |
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 |
|
4211 |
push @newobydata, "hide=$hidearray[$i]{dest}\n$obydata[$obyrecordline]"; |
|
4212 |
$obyrecordline++; |
|
4213 |
$flag=0; |
|
4214 |
} else { |
|
4215 |
push @newobydata, $obydata[$obyrecordline++]; |
|
4216 |
} |
|
4217 |
} |
|
4218 |
} |
|
4219 |
} |
|
4220 |
} |
|
4221 |
} |
|
4222 |
while($obyrecordline< scalar @obydata) { # add the rest of the lines from @obydata to @newobydata |
|
4223 |
push @newobydata, $obydata[$obyrecordline++]; |
|
4224 |
} |
|
4225 |
@obydata=@newobydata; |
|
4226 |
undef @newobydata; |
|
4227 |
} |
|
4228 |
dump_obydata("tmp9.oby", "result of cleaning phase") if ($opt_v); |
|
4229 |
} |
|
4230 |
||
4231 |
||
4232 |
#---------------------------------------------------------------------------------- |
|
4233 |
# |
|
4234 |
# Divide the oby file into multiple sections - one for each rom image - ready |
|
4235 |
# for the appropriate rom builder. |
|
4236 |
# |
|
4237 |
||
4238 |
sub generate_romheader |
|
4239 |
{ |
|
4240 |
my ($idx) = @_; |
|
4241 |
if ($romimage[$idx]{xip} ne 0) |
|
4242 |
{ |
|
4243 |
my $header = "\n"; |
|
4244 |
if ($romimage[$idx]{extension}) |
|
4245 |
{ |
|
4246 |
$header = "extensionrom=$rombasename.$romimage[$idx]{name}.img\n"; |
|
4247 |
$header .= "romsize=$romimage[$idx]{size}\n\n"; |
|
4248 |
} |
|
4249 |
return $header; |
|
4250 |
} |
|
4251 |
# non-xip |
|
4252 |
my $header; |
|
4253 |
if ($romimage[$idx]{extension}) |
|
4254 |
{ |
|
4255 |
$header = "extensionrofs=$rombasename.$romimage[$idx]{name}.img\n"; |
|
4256 |
$header .= "rofssize=$romimage[$idx]{size}\n\n"; |
|
4257 |
} |
|
4258 |
else |
|
4259 |
{ |
|
4260 |
$header="rofsname=$rombasename.$romimage[$idx]{name}.img\n"; |
|
4261 |
$header .= "rofssize=$romimage[$idx]{size}\n\n"; |
|
4262 |
} |
|
4263 |
return $header; |
|
4264 |
} |
|
4265 |
||
4266 |
#---------------------------------------------------------------------------------- |
|
4267 |
# Dump OBY file. |
|
4268 |
# |
|
4269 |
# Creates final OBY file. |
|
4270 |
# |
|
4271 |
sub create_dumpfile |
|
4272 |
{ |
|
4273 |
my $romimageidx; |
|
4274 |
my $smrimageidx = 0; |
|
4275 |
my $dumpfile="$rombasename"; |
|
4276 |
$romimage[0]{obeyfile}=$dumpfile; |
|
4277 |
$dumpfile .= ".oby"; |
|
4278 |
unlink($dumpfile); |
|
4279 |
if($rombasename && !$onlysmrimage) |
|
4280 |
{ |
|
4281 |
open DUMPFILE, ">$dumpfile" or die("* Can't create $dumpfile\n"); |
|
4282 |
print "* Writing $dumpfile - final OBY file\n"; |
|
4283 |
$romimageidx=0; |
|
4284 |
print DUMPFILE generate_romheader($romimageidx); |
|
4285 |
} |
|
4286 |
foreach $line (@obydata) |
|
4287 |
{ |
|
4288 |
if ($line =~ /^\s*REM ROM_IMAGE\[(\d+)\]\s+(.*)$/i) |
|
4289 |
{ |
|
4290 |
$romimageidx=$1; |
|
4291 |
if ($romimage[$romimageidx]{extension} eq '0') |
|
4292 |
{ # next rom oby file |
|
4293 |
close DUMPFILE; |
|
4294 |
$dumpfile="$rombasename.$romimage[$romimageidx]{name}"; |
|
4295 |
$romimage[$romimageidx]{obeyfile}=$dumpfile; |
|
4296 |
$dumpfile .= ".oby"; |
|
4297 |
open DUMPFILE, ">$dumpfile" or die("* Can't create $dumpfile\n"); |
|
4298 |
print "* Writing $dumpfile - final OBY file\n"; |
|
4299 |
# header |
|
4300 |
print DUMPFILE $line; |
|
4301 |
print DUMPFILE generate_romheader($romimageidx); |
|
4302 |
next; |
|
4303 |
} |
|
4304 |
else |
|
4305 |
{ # extension |
|
4306 |
# header |
|
4307 |
print DUMPFILE $line; |
|
4308 |
print DUMPFILE generate_romheader($romimageidx); |
|
4309 |
next; |
|
4310 |
} |
|
4311 |
} |
|
4312 |
# write data drive oby file. |
|
4313 |
elsif ($line =~ /^\s*REM DATA_IMAGE\[(\d+)\]\s+(.*)$/i) |
|
4314 |
{ |
|
4315 |
my $dataimageidx=$1; |
|
4316 |
close DUMPFILE; |
|
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
4317 |
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
|
4318 |
if ($name !~ /^.:/ && $name !~ /^[\\\/]/) |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
4319 |
{ |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
4320 |
$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
|
4321 |
} |
606 | 4322 |
$dumpfile="$datadriveimage[$dataimageidx]{name}"; |
4323 |
$datadriveimage[$dataimageidx]{obeyfile}=$dumpfile; |
|
4324 |
$dumpfile .= ".oby"; |
|
4325 |
open DUMPFILE, ">$dumpfile" or die("* Can't create $dumpfile\n"); |
|
4326 |
print "* Writing $dumpfile - intermediate OBY file\n"; |
|
4327 |
# header |
|
4328 |
print DUMPFILE $line; |
|
4329 |
print DUMPFILE generate_datadriveheader($dataimageidx,\@datadriveimage); |
|
4330 |
push(@dataDriveFileList,$dumpfile); |
|
4331 |
next; |
|
4332 |
} |
|
4333 |
elsif ($line =~ /^\s*REM SMR_IMAGE\s*$/i) |
|
4334 |
{ |
|
4335 |
close DUMPFILE; |
|
4336 |
$dumpfile = $obeyFileList[$smrimageidx]; |
|
4337 |
$smrimageidx++; |
|
4338 |
$dumpfile .= ".oby"; |
|
4339 |
open DUMPFILE, ">$dumpfile" or die("* Can't create $dumpfile\n"); |
|
4340 |
print "*Writing $dumpfile - intermediate OBY file\n"; |
|
4341 |
print DUMPFILE $line; |
|
4342 |
push(@smrImageFileList, $dumpfile); |
|
4343 |
next; |
|
4344 |
} |
|
4345 |
print DUMPFILE $line; |
|
4346 |
} |
|
4347 |
close DUMPFILE; |
|
4348 |
} |
|
4349 |
||
4350 |
#---------------------------------------------------------------------------------- |
|
4351 |
# |
|
4352 |
# Full ROM directory listing - use case-insensitive sort |
|
4353 |
# |
|
4354 |
sub create_dirlisting |
|
4355 |
{ |
|
4356 |
if($rombasename) |
|
4357 |
{ |
|
4358 |
print "* Writing $rombasename.dir - ROM directory listing\n"; |
|
4359 |
open DIRFILE, ">$rombasename.dir" or die("* Can't create ROM directory listing\n"); |
|
4360 |
||
4361 |
my $file; |
|
4362 |
my $prevdir = ""; |
|
4363 |
foreach $file (sort {uc($a) cmp uc($b)} keys %romfiles) |
|
4364 |
{ |
|
4365 |
my $dir = substr $file,0,rindex($file, "\/"); |
|
4366 |
if (uc $dir ne uc $prevdir) |
|
4367 |
{ |
|
4368 |
$prevdir = $dir; |
|
4369 |
print DIRFILE "\n"; |
|
4370 |
} |
|
4371 |
||
4372 |
my @sources = split /\n/,$romfiles{$file}; |
|
4373 |
printf DIRFILE "%-40s\t%s\n", $file, shift @sources; |
|
4374 |
while (@sources) |
|
4375 |
{ |
|
4376 |
printf DIRFILE "%39s+\t%s\n", "", shift @sources; |
|
4377 |
} |
|
4378 |
} |
|
4379 |
close DIRFILE; |
|
4380 |
} |
|
4381 |
} |
|
4382 |
||
4383 |
#---------------------------------------------------------------------------------- |
|
4384 |
# |
|
4385 |
# Suppress Rom/Rofs/DataDrive Image creation if "-noimage" option is provided. |
|
4386 |
# |
|
4387 |
||
4388 |
sub suppress_image_generation |
|
4389 |
{ |
|
4390 |
if($noimage) |
|
4391 |
{ |
|
4392 |
&tidy_exit; |
|
4393 |
} |
|
4394 |
} |
|
4395 |
||
4396 |
#---------------------------------------------------------------------------------- |
|
4397 |
# Execute rombuild & maksym for each final XIP OBY file |
|
4398 |
# Execute rofsbuild for each non-XIP oby file |
|
4399 |
# |
|
4400 |
||
4401 |
sub run_rombuilder |
|
4402 |
{ |
|
4403 |
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
|
4404 |
$command .= " -logfile=$logfile $obeyfile.oby"; |
606 | 4405 |
#CR1258 test cases are depending on the following output. |
4406 |
print "* Executing $command\n" if ($opt_v); |
|
4407 |
||
4408 |
open DATA, "$command 2>&1 |" or die "Couldn't execute command: $command"; |
|
4409 |
while ( defined( my $line = <DATA> ) ) { |
|
4410 |
chomp($line); |
|
4411 |
print "$line\n"; |
|
4412 |
} |
|
4413 |
close DATA; |
|
4414 |
||
4415 |
if ($? != 0) |
|
4416 |
{ |
|
4417 |
$errors++; |
|
4418 |
$command =~ /^\s*(\S+)\s+-slog/; |
|
4419 |
print "* $1 failed\n"; |
|
4420 |
} |
|
4421 |
else |
|
4422 |
{ |
|
4423 |
push(@romImages,$obeyfile.".img"); |
|
4424 |
} |
|
4425 |
print "\n"; |
|
4426 |
rename "$logfile","$obeyfile.log" or die("* Can't rename $logfile\n"); |
|
4427 |
exit(1) if ($errors); |
|
4428 |
} |
|
4429 |
||
4430 |
#---------------------------------------------------------------------------------- |
|
4431 |
# ROMBUILD AND ROFSBUILD |
|
4432 |
# |
|
4433 |
# Invokes rombuild and rofsbuild. |
|
4434 |
# Creates .log, .symbol files. |
|
4435 |
# |
|
4436 |
sub invoke_rombuild |
|
4437 |
{ |
|
4438 |
#For CR1258, -compress command line option is introduced, and it's being handled as following |
|
4439 |
my $rom_compression_type; |
|
4440 |
if($opt_compression_type eq ALLSECTIONS) |
|
4441 |
{ |
|
4442 |
$rom_compression_type = "-compress"; |
|
4443 |
} |
|
4444 |
elsif($opt_compression_type eq PAGEDSECTION) |
|
4445 |
{ |
|
4446 |
$rom_compression_type = "-compress=paged"; |
|
4447 |
} |
|
4448 |
elsif($opt_compression_type eq UNPAGEDSECTION) |
|
4449 |
{ |
|
4450 |
$rom_compression_type = "-compress=unpaged"; |
|
4451 |
} |
|
4452 |
else |
|
4453 |
{ |
|
4454 |
$rom_compression_type = ""; |
|
4455 |
} |
|
4456 |
||
4457 |
#Compose command line options for Cache. |
|
4458 |
my $cache_options; |
|
4459 |
if($opt_cache == 1) |
|
4460 |
{ |
|
4461 |
$cache_options = "-cache "; |
|
4462 |
} |
|
4463 |
if($opt_nocache == 1) |
|
4464 |
{ |
|
4465 |
$cache_options .= "-nocache "; |
|
4466 |
} |
|
4467 |
if($opt_cleancache == 1) |
|
4468 |
{ |
|
4469 |
$cache_options .= "-cleancache"; |
|
4470 |
} |
|
4471 |
||
4472 |
my $rombuild; |
|
4473 |
if(!$geninc) |
|
4474 |
{ |
|
4475 |
$rombuild = "rombuild -slog $rom_compression_type $logLevel $lowMem $opt_jobs"; |
|
4476 |
} |
|
4477 |
else |
|
4478 |
{ |
|
4479 |
$rombuild = "rombuild -slog $rom_compression_type -geninc $logLevel $lowMem $opt_jobs"; |
|
4480 |
} |
|
4481 |
if($gendep) |
|
4482 |
{ |
|
4483 |
$rombuild .= " -gendep"; |
|
4484 |
} |
|
4485 |
$rombuild .= " -k" if($opt_k); |
|
4486 |
my $rofsbuild = "rofsbuild -slog $logLevel $lowMem $opt_jobs $cache_options"; |
|
4487 |
foreach my $arg (keys %rombuildOptions) |
|
4488 |
{ |
|
4489 |
$rombuild .= " $arg"; |
|
4490 |
} |
|
4491 |
$rofsbuild .= " -k" if($opt_k); |
|
4492 |
for (my $romidx=0; $romidx<8; $romidx++) |
|
4493 |
{ |
|
4494 |
my $obeyfile=$romimage[$romidx]{obeyfile}; |
|
4495 |
my $xip=$romimage[$romidx]{xip}; |
|
4496 |
my $compress=$romimage[$romidx]{compress}; |
|
4497 |
my $uncompress=$romimage[$romidx]{uncompress}; |
|
4498 |
if ($obeyfile) |
|
4499 |
{ |
|
4500 |
if(!defined $opt_compression) |
|
4501 |
{ |
|
4502 |
if ($compress ne 0) |
|
4503 |
{ |
|
4504 |
$compress=" -compress"; |
|
4505 |
} |
|
4506 |
elsif($uncompress ne 0) |
|
4507 |
{ |
|
4508 |
$compress=" -uncompress"; |
|
4509 |
} |
|
4510 |
elsif($compress eq 0) |
|
4511 |
{ |
|
4512 |
$compress=" "; |
|
4513 |
} |
|
4514 |
} |
|
4515 |
else |
|
4516 |
{ |
|
4517 |
$compress = $opt_compression; |
|
4518 |
$compress =~m/\s-(compression)(method)\s(none|inflate|bytepair)/; |
|
4519 |
print "* ".$1." ".$2.": ".$3; |
|
4520 |
} |
|
4521 |
if ($xip) |
|
4522 |
{ |
|
4523 |
is_existinpath("rombuild", romutl::DIE_NOT_FOUND); |
|
4524 |
$rombuild .= " -symbols" unless($nosymbols) ; |
|
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
4525 |
run_rombuilder($rombuild.$compress, $obeyfile, $thisdir."ROMBUILD.LOG"); |
606 | 4526 |
} |
633 | 4527 |
elsif($opt_xiponly == 0) |
606 | 4528 |
{ |
4529 |
# efficient_rom_paging.pm can move everything to core rom. |
|
4530 |
# If that is the case, don't run rofsbuild at all to avoid errors. |
|
4531 |
# use constant TRUE => 1; |
|
4532 |
# use constant FALSE => 0; |
|
4533 |
my $run_rofs_build = 0; |
|
4534 |
||
4535 |
open OBYFILE, "$obeyfile.oby"; |
|
4536 |
for (<OBYFILE>) |
|
4537 |
{ |
|
4538 |
if (is_oby_statement($_)) |
|
4539 |
{ |
|
4540 |
$run_rofs_build = 1; |
|
4541 |
last; |
|
4542 |
} |
|
4543 |
} |
|
4544 |
close OBYFILE; |
|
4545 |
if ($run_rofs_build) |
|
4546 |
{ |
|
4547 |
is_existinpath("rofsbuild", romutl::DIE_NOT_FOUND); |
|
4548 |
if(!$nosymbols) |
|
4549 |
{ |
|
4550 |
$rofsbuild .= " -symbols"; |
|
4551 |
} |
|
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
4552 |
run_rombuilder($rofsbuild.$compress, $obeyfile, $thisdir."ROFSBUILD.LOG"); |
606 | 4553 |
} |
4554 |
} |
|
4555 |
unlink "rombuild.log"; |
|
4556 |
unlink "maksym.out"; |
|
4557 |
} |
|
4558 |
} |
|
4559 |
} |
|
4560 |
||
4561 |
#------------------------------------------------------- |
|
4562 |
# Subroutine: check if current statement is a valid oby statement |
|
4563 |
# |
|
4564 |
sub is_oby_statement |
|
4565 |
{ |
|
4566 |
my ($li) = @_; |
|
4567 |
if ($li =~ /\s*data\s*=/) { return 1;} |
|
4568 |
if ($li =~ /\s*file\s*=/) { return 1;} |
|
4569 |
if ($li =~ /\s*dll\s*=/) { return 1;} |
|
4570 |
if ($li =~ /\s*secondary\s*=/) { return 1;} |
|
4571 |
||
4572 |
return 0; |
|
4573 |
} |
|
4574 |
||
4575 |
#------------------------------------------------------- |
|
4576 |
# Subroutine: convert possibly absolute path into relative path |
|
4577 |
# |
|
4578 |
||
4579 |
sub relative_path |
|
4580 |
{ |
|
4581 |
my ($arg) = @_; |
|
4582 |
return $arg if ($arg !~ /^\//); # not an absolute path |
|
4583 |
if ($uppath eq "x") |
|
4584 |
{ |
|
4585 |
$uppath=cwd; |
|
4586 |
$uppath=~s-\\-\/-go; # separator from Perl 5.005_02+ is forward slash |
|
4587 |
$uppath=~s-^(.*[^\/])$-$1\/-o; # ensure path ends with a backslash |
|
4588 |
$uppath=~s-\/([^\/]+)-\/..-og; # convert directories into .. |
|
4589 |
$uppath=~s-^.:\/--o; # remove drive letter and leading backslash |
|
4590 |
} |
|
4591 |
$arg=~s-^\/--o; # remove leading backslash from original path |
|
4592 |
return "$uppath$arg"; |
|
4593 |
} |
|
4594 |
||
4595 |
# Returns the global @obydata reference to support external tool invocation. |
|
4596 |
sub getOBYDataRef{ |
|
4597 |
return \@obydata; |
|
4598 |
} |
|
4599 |
||
4600 |
#Match the blank or the comment |
|
4601 |
sub isobystatement |
|
4602 |
{ |
|
4603 |
my ($l) = @_; |
|
4604 |
if ($l !~ /=/) { |
|
4605 |
return 0; |
|
4606 |
} |
|
4607 |
return 1; |
|
4608 |
} |
|
4609 |
||
4610 |
#Match the data statements |
|
4611 |
sub isdatastatement { |
|
4612 |
my ($l) = @_; |
|
4613 |
if ($l !~ /data=/) |
|
4614 |
{ |
|
4615 |
return 0; |
|
4616 |
} |
|
4617 |
return 1; |
|
4618 |
} |
|
4619 |
||
4620 |
#Match the spidata statements |
|
4621 |
sub isspidatastatement { |
|
4622 |
my ($l) = @_; |
|
4623 |
if ($l !~ /spidata=/) { |
|
4624 |
return 0; |
|
4625 |
} |
|
4626 |
return 1; |
|
4627 |
} |
|
4628 |
||
4629 |
#Match the executable statements |
|
4630 |
sub isexecutablefile { |
|
4631 |
my ($l) = @_; |
|
4632 |
if (($l=~/file=/)||($l=~/dll=/)||($l=~/primary=/)||($l=~/secondary=/)||($l=~/variant=/)||($l=~/device=/)||($l=~/extension=/)){ |
|
4633 |
return 1; |
|
4634 |
} |
|
4635 |
return 0; |
|
4636 |
} |
|
4637 |
||
4638 |
#Match the directory metadata statements |
|
4639 |
sub isdirectorymetadata { |
|
4640 |
my ($l) = @_; |
|
4641 |
if (($l=~/hide=/) || ($l=~/rename=/) || ($l=~/alias=/)){ |
|
4642 |
return 1; |
|
4643 |
} |
|
4644 |
return 0; |
|
4645 |
} |
|
4646 |
||
4647 |
#Match the bitmap statements |
|
4648 |
sub isbitmap { |
|
4649 |
my ($l) = @_; |
|
4650 |
if ($l=~/bitmap=/){ |
|
4651 |
return 1; |
|
4652 |
} |
|
4653 |
return 0; |
|
4654 |
} |
|
4655 |
||
4656 |
||
4657 |
#Match the aif file |
|
4658 |
sub isaif { |
|
4659 |
my ($l) = @_; |
|
4660 |
if ($l=~/(.*)\.aif/){ |
|
4661 |
return 1; |
|
4662 |
} |
|
4663 |
return 0; |
|
4664 |
} |
|
4665 |
||
4666 |
||
4667 |
#Match the resource file |
|
4668 |
sub isresource { |
|
4669 |
my ($l) = @_; |
|
4670 |
if ($l=~/(.*)\.rsc/){ |
|
4671 |
return 1; |
|
4672 |
} |
|
4673 |
return 0; |
|
4674 |
} |
|
4675 |
||
4676 |
#Returns the executable extensions |
|
4677 |
sub executableextension { |
|
4678 |
my ($l) = @_; |
|
4679 |
if ($l=~/file=(.*)\.exe$/){ |
|
4680 |
return "exe"; |
|
4681 |
} |
|
4682 |
elsif ($l=~/file=(.*)\.dll$/){ |
|
4683 |
return "dll"; |
|
4684 |
} |
|
4685 |
elsif ($l=~/file=(.*)\.ldd$/){ |
|
4686 |
return "ldd"; |
|
4687 |
} |
|
4688 |
elsif ($l=~/file=(.*)\.fsy$/){ |
|
4689 |
return "fsy"; |
|
4690 |
} |
|
4691 |
} |
|
4692 |
||
4693 |
||
4694 |
#Returns all 3 UIDS |
|
4695 |
sub executabletype { |
|
4696 |
my ($l) = @_; |
|
4697 |
my $uid1; |
|
4698 |
my $uid2; |
|
4699 |
my $uid3; |
|
4700 |
if ($l=~/uid1\s(0x[\d]*)/){ |
|
4701 |
$uid1=$1; |
|
4702 |
} |
|
4703 |
if ($l=~/uid2\s(0x[\d]*)/){ |
|
4704 |
$uid2=$1; |
|
4705 |
} |
|
4706 |
if ($l=~/uid3\s(0x[\d]*)/){ |
|
4707 |
$uid3=$1; |
|
4708 |
} |
|
4709 |
||
4710 |
return $uid1." ".$uid2." ".$uid3."\n"; |
|
4711 |
} |
|
4712 |
||
4713 |
||
4714 |
#Return source file name |
|
4715 |
sub getSourceFile { |
|
4716 |
my ($line) = shift; |
|
4717 |
if ($line=~/(\w*=)(\S*\s+\S*)\s+(\S*)\s+(\S*)?/) { |
|
4718 |
return $2; |
|
4719 |
} |
|
4720 |
} |
|
4721 |
||
4722 |
#Return destination file name |
|
4723 |
sub getDestFile{ |
|
4724 |
my ($line) = shift; |
|
4725 |
if ($line=~/(\w*=)(\S*\s+\S*)\s+(\S*)\s+(\S*)?/) { |
|
4726 |
return $3; |
|
4727 |
} |
|
4728 |
} |
|
4729 |
||
4730 |
#Return the obycommand attributes |
|
4731 |
sub getOBYAttributes{ |
|
4732 |
my ($line) = shift; |
|
4733 |
if ($line=~/(\w*=)(\S*\s+\S*)\s+(\S*)\s+(\S*)?/) { |
|
4734 |
return $4; |
|
4735 |
} |
|
4736 |
} |
|
4737 |
||
4738 |
#Return the hardware variant delimiter |
|
4739 |
sub getHardwareVariant{ |
|
4740 |
my ($line) = shift; |
|
4741 |
if ($line=~/(\w*[0x[\d]*]=)/) { |
|
4742 |
return $1; |
|
4743 |
} |
|
4744 |
} |
|
4745 |
||
4746 |
#Return the hardware variant delimiter |
|
4747 |
sub getObyCommand{ |
|
4748 |
my ($line) = shift; |
|
4749 |
if ($line=~/^[data=]/) { |
|
4750 |
return "data"; |
|
4751 |
} |
|
4752 |
||
4753 |
if ($line=~/^[file=]/) { |
|
4754 |
return "file"; |
|
4755 |
} |
|
4756 |
||
4757 |
if ($line=~/^[dll=]/) { |
|
4758 |
return "dll"; |
|
4759 |
} |
|
4760 |
} |
|
4761 |
||
4762 |
# Initialize the symbol info within the given DLL. |
|
4763 |
sub AddDllDataInfo |
|
4764 |
{ |
|
4765 |
my ($line) = @_; |
|
4766 |
# syntax "<DLLname>@<symbolname> <newvalue>" |
|
4767 |
if($line =~ /^\s*(\S+)\s*\@\s*(\S+)\s+(\S+)\s*$/) |
|
4768 |
{ |
|
4769 |
my $dllName = lc ($1); |
|
4770 |
my $symbolname = $2; |
|
4771 |
my $intVal = $3; |
|
4772 |
my $newVal = 0; |
|
4773 |
if($intVal =~ /^0x([0-9a-fA-F]+)$/){ |
|
4774 |
$newVal = hex($1); |
|
4775 |
} |
|
4776 |
elsif($intVal =~ /^(-\d+)$/ or $intVal =~ /^(\d+)$/){ |
|
4777 |
$newVal = $1; |
|
4778 |
} |
|
4779 |
else{ |
|
4780 |
print "ERROR: Invalid patchable value at \"$line\"\n"; |
|
4781 |
$errors++ if($strict); |
|
4782 |
return 1; |
|
4783 |
} |
|
4784 |
$symbolname =~ s/:(\d+)\[(0x)?[0-9a-f]+\]$//i; # Remove array element specification (:ELEMENT_BIT_SIZE[INDEX]) to get symbol name |
|
4785 |
||
4786 |
my $DllMapRef = \%{$DllDataMap{$dllName}}; |
|
4787 |
||
4788 |
my %DllSymInfo = (); |
|
4789 |
$DllSymInfo{ordinal} = undef; |
|
4790 |
$DllSymInfo{dataAddr} = undef; |
|
4791 |
$DllSymInfo{size} = undef; |
|
4792 |
# We don't store the value here, since patchdata can be used on an array, |
|
4793 |
# in which case we'll create another one of these, and lose the value. |
|
4794 |
# Instead, the value is retrieved by re-parsing the command line later. |
|
4795 |
$DllSymInfo{lineno} = $sourceline; |
|
4796 |
$DllSymInfo{obyfilename}= $sourcefile; |
|
4797 |
||
4798 |
$DllMapRef->{$symbolname} = \%DllSymInfo; |
|
4799 |
return 0; |
|
4800 |
} |
|
4801 |
return 1; |
|
4802 |
} |
|
4803 |
||
4804 |
sub process_dlldata |
|
4805 |
{ |
|
4806 |
if(!$patchDataStmtFlag){ |
|
4807 |
return; |
|
4808 |
} |
|
4809 |
my $symbolTblEntry; |
|
4810 |
||
4811 |
foreach my $dll (keys %DllDataMap){ |
|
4812 |
my $DllMapRef = $DllDataMap{$dll}; |
|
4813 |
if(!$DllMapRef->{srcfile}){ |
|
4814 |
next; |
|
4815 |
} |
|
4816 |
my $aDllFile = $DllMapRef->{srcfile}; |
|
4817 |
my $SymbolCount = scalar ( keys %{$DllMapRef}) - 2; #The map has 'srcfile' and 'dstpath' special keys besides the symbols. |
|
4818 |
||
4819 |
my $DllSymMapRef; |
|
4820 |
||
4821 |
my @BPABIPlats = &get_bpabiplatlist; |
|
4822 |
my $matchedSymbols = 0; |
|
4823 |
my $globalSyms = 0; |
|
4824 |
my @platlist = &get_platlist; |
|
4825 |
my $platName; |
|
4826 |
my $rootPlatName; |
|
4827 |
my $plat = "armv5"; |
|
4828 |
$plat = &get_abiv2mode() ? $plat."_abiv1" : $plat."_abiv2"; |
|
4829 |
||
4830 |
foreach my $plat(@platlist) |
|
4831 |
{ |
|
4832 |
if(($aDllFile =~ /[\/\\]($plat)[\/\\]/i) or ($aDllFile =~ /[\/\\]($plat\.\w+)[\/\\]/i )) |
|
4833 |
{ |
|
4834 |
$platName = $1; |
|
4835 |
last; |
|
4836 |
} |
|
4837 |
} |
|
4838 |
$rootPlatName = &get_platcustomizes($platName) ? &get_platroot($platName) : $platName; |
|
4839 |
||
4840 |
# Map files will be referred for all ARM platforms, |
|
4841 |
# and for BSF platforms which cutomizes ARM platforms. |
|
4842 |
if($rootPlatName =~ /^armv5|$plat$/i){ |
|
4843 |
my $mapfile = "${aDllFile}.map"; |
|
4844 |
||
4845 |
open MAPFILE, "$mapfile" or die "Can't open $mapfile\n"; |
|
4846 |
while(<MAPFILE>){ |
|
4847 |
my $line = $_; |
|
4848 |
||
4849 |
#Ignore Local symbols. |
|
4850 |
if(!$globalSyms){ |
|
4851 |
if($line =~ /Global Symbols/){ |
|
4852 |
$globalSyms = 1; |
|
4853 |
next; |
|
4854 |
} |
|
4855 |
else{ |
|
4856 |
next; |
|
4857 |
} |
|
4858 |
} |
|
4859 |
||
4860 |
$symbolTblEntry = $line; |
|
4861 |
if($symbolTblEntry =~ /\s*(\S+)(?:\s+\(EXPORTED\))?\s+(\S+)\s+(\S+)\s+(\S+)\s+(.*)/){ |
|
4862 |
my $symbol = $1; |
|
4863 |
my $symbolValue = $2; |
|
4864 |
my $data = $3; |
|
4865 |
my $symbolSz = $4; |
|
4866 |
if(!exists $DllMapRef->{$symbol}){ |
|
4867 |
next; |
|
4868 |
} |
|
4869 |
$DllSymMapRef = $DllMapRef->{$symbol}; |
|
4870 |
if($data =~ /Data/){ |
|
4871 |
# Valid |
|
4872 |
} |
|
4873 |
else { |
|
4874 |
# Invalid to patch a code symbol. |
|
4875 |
print( "$DllSymMapRef->{obyfilename}($DllSymMapRef->{lineno}): Warning: $symbol is not a data Symbol.Ignoring patch statement.\n"); |
|
4876 |
$errors++ if($strict); |
|
4877 |
$DllMapRef->{$symbol} = undef; |
|
4878 |
next; |
|
4879 |
} |
|
4880 |
||
4881 |
||
4882 |
# Record the address and the size of the symbol. |
|
4883 |
$DllSymMapRef->{dataAddr} = $symbolValue; |
|
4884 |
$DllSymMapRef->{size} = $symbolSz; |
|
4885 |
||
4886 |
||
4887 |
$matchedSymbols++; |
|
4888 |
if( $matchedSymbols >= $SymbolCount){ |
|
4889 |
last; |
|
4890 |
} |
|
4891 |
} |
|
4892 |
} |
|
4893 |
close MAPFILE; |
|
4894 |
} |
|
4895 |
# DSO files will be referred for BPABI platforms(excluding ARM platforms), |
|
4896 |
# and for BSF platforms which cutomizes BPABI platforms. |
|
4897 |
else { |
|
4898 |
my $abiDir = undef; |
|
4899 |
foreach my $bpabi (@BPABIPlats){ |
|
4900 |
if($rootPlatName =~ /^$bpabi$/i){ |
|
4901 |
$abiDir = $platName; |
|
4902 |
last; |
|
4903 |
} |
|
4904 |
} |
|
4905 |
||
4906 |
if(!defined $abiDir){ |
|
4907 |
print("Can't locate the map or proxy dso file for $aDllFile\n"); |
|
4908 |
$errors++ if($strict); |
|
4909 |
next; #go to the next patch dll data statement |
|
4910 |
} |
|
4911 |
if( $aDllFile =~ /(.*)\.[^.]+$/ ){ |
|
4912 |
my $proxydsofile = "$1.dso"; |
|
4913 |
$proxydsofile =~ s-$abiDir\/(.*)\/-armv5\/lib\/-ig; |
|
4914 |
open PIPE, "getexports -d $proxydsofile|" or die "Can't open file $proxydsofile\n"; |
|
4915 |
while (<PIPE>){ |
|
4916 |
my $line = $_; |
|
4917 |
if($line =~ /\s*(\S+)\s+(\d+)\s+((\S+)\s+(\d+))?/){ |
|
4918 |
my $symbol = $1; |
|
4919 |
my $ordinal = $2; |
|
4920 |
my $data = $3; |
|
4921 |
my $symbolSz = $5; |
|
4922 |
||
4923 |
if(!$data){ |
|
4924 |
next; |
|
4925 |
} |
|
4926 |
if(!exists $DllMapRef->{$symbol}){ |
|
4927 |
next; |
|
4928 |
} |
|
4929 |
||
4930 |
$DllSymMapRef = $DllMapRef->{$symbol}; |
|
4931 |
||
4932 |
# Record the ordinal and the size of the symbol. |
|
4933 |
$DllSymMapRef->{ordinal} = $ordinal; |
|
4934 |
$DllSymMapRef->{size} = $symbolSz; |
|
4935 |
$matchedSymbols++; |
|
4936 |
if( $matchedSymbols >= $SymbolCount){ |
|
4937 |
last; |
|
4938 |
} |
|
4939 |
} |
|
4940 |
} |
|
4941 |
||
4942 |
close PIPE; |
|
4943 |
} |
|
4944 |
} |
|
4945 |
} |
|
4946 |
exit(1) if ($errors && $strict ) ; |
|
4947 |
} |
|
4948 |
||
4949 |
# make sure that all the absolute feature variant paths include a |
|
4950 |
# drive letter. This is required because cpp will not work with |
|
4951 |
# absolute paths starting with slashes. |
|
4952 |
sub addDrivesToFeatureVariantPaths |
|
4953 |
{ |
|
4954 |
return unless $featureVariant{'VALID'}; |
|
4955 |
||
4956 |
my $current = &get_epocdrive; |
|
4957 |
my $drive = $1 if ($current =~ /^(.:)/); |
|
4958 |
||
4959 |
# pre-include file |
|
4960 |
my $HRH = $featureVariant{'VARIANT_HRH'}; |
|
4961 |
$featureVariant{'VARIANT_HRH'} = $drive . $HRH if ($HRH =~ /^[\\\/]/); |
|
4962 |
||
4963 |
# ROM include path |
|
4964 |
my $dirRef = $featureVariant{'ROM_INCLUDES'}; |
|
4965 |
return unless $dirRef; |
|
4966 |
my $i = 0; |
|
4967 |
||
4968 |
foreach my $dir (@$dirRef) |
|
4969 |
{ |
|
4970 |
$$dirRef[$i] = $drive . $dir if ($dir =~ /^[\\\/]/); |
|
4971 |
$i++; |
|
4972 |
} |
|
4973 |
} |
|
4974 |
sub create_smrimage |
|
4975 |
{ |
|
4976 |
if($needSmrImage) |
|
4977 |
{ |
|
4978 |
foreach my $oby (@obeyFileList) |
|
4979 |
{ |
|
4980 |
is_existinpath("rofsbuild", romutl::ERROR_NOT_FOUND); |
|
647 | 4981 |
my $command = "rofsbuild -slog -smr=$oby.oby -logfile=$thisdir"; |
4982 |
$command .= " -k" if($opt_k); |
|
606 | 4983 |
print "* Executing $command\n" if($opt_v); |
4984 |
system($command); |
|
4985 |
if($? != 0) |
|
4986 |
{ |
|
4987 |
print("* ROFSBUILD failed to generate SMR IMAGE\n") if($opt_v); |
|
4988 |
} |
|
4989 |
else |
|
4990 |
{ |
|
4991 |
push(@smrImageFileList, $oby.".img"); |
|
4992 |
} |
|
4993 |
} |
|
4994 |
} |
|
4995 |
if(@smrImageFileList) |
|
4996 |
{ |
|
4997 |
print "\n"; |
|
4998 |
print "-------------------------------------------------------\n"; |
|
4999 |
print "| List of file(s) generated pertaining to SMR image |\n"; |
|
5000 |
print "-------------------------------------------------------\n"; |
|
5001 |
my $arraySize = scalar(@smrImageFileList); |
|
5002 |
for(my $i=0; $i < $arraySize; $i++) |
|
5003 |
{ |
|
5004 |
my $element = shift(@smrImageFileList); |
|
5005 |
my $size = -s $element; |
|
5006 |
print "Size = ".$size." bytes"."\t"."File = ".$element."\n"; |
|
5007 |
} |
|
5008 |
} |
|
5009 |
foreach my $errSmr (keys(%smrNameInfo)) |
|
5010 |
{ |
|
5011 |
if($smrNameInfo{$errSmr} > 1) |
|
5012 |
{ |
|
5013 |
print "\n SMR image: $errSmr.img creating error for duplicated names!\n"; |
|
5014 |
} |
|
5015 |
} |
|
5016 |
if($smrNoImageName) |
|
5017 |
{ |
|
5018 |
print "\n SMR image creating error for empty image name!\n"; |
|
5019 |
} |
|
5020 |
} |
|
5021 |
||
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5022 |
sub getWorkdir |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5023 |
{ |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5024 |
return $thisdir; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5025 |
} |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5026 |
|
647 | 5027 |
sub isIgnoreConfig |
5028 |
{ |
|
5029 |
return $ignoreconfig; |
|
5030 |
} |
|
5031 |
||
626
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5032 |
sub find_stdcpp |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5033 |
{ |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5034 |
return "cpp" if (!$stdcpp); |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5035 |
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
|
5036 |
|
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5037 |
my $delimiter = &env_delimiter; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5038 |
$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
|
5039 |
my @paths; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5040 |
@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
|
5041 |
unshift @paths, "\."; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5042 |
|
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5043 |
foreach my $path (@paths) |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5044 |
{ |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5045 |
next if ($path =~ /^\s*$/); |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5046 |
chomp $path; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5047 |
$path =~ s/\\/\//g; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5048 |
$path .= "\/" unless ($path =~ /\/$/); |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5049 |
$path = $path."cpp.exe"; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5050 |
if (-e $path) |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5051 |
{ |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5052 |
$path = "\"$path\""; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5053 |
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
|
5054 |
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
|
5055 |
my $line = <DATA>; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5056 |
chomp($line); |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5057 |
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
|
5058 |
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
|
5059 |
{ |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5060 |
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
|
5061 |
close DATA; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5062 |
return $path; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5063 |
} |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5064 |
close DATA; |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5065 |
} |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5066 |
} |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5067 |
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
|
5068 |
} |
ac03b93ca9c4
ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents:
609
diff
changeset
|
5069 |
|
606 | 5070 |
sub checkcase() |
5071 |
{ |
|
5072 |
if (&is_windows) |
|
5073 |
{ |
|
5074 |
my @checkcase_obydatatemp = @obydata; |
|
5075 |
||
5076 |
# call the phase without external tools. |
|
5077 |
plugin_phase(); |
|
5078 |
multlinguify_phase(); |
|
5079 |
#spi_creation_phase(); #spi creation phase will delete some lines, so do not call this phase |
|
5080 |
suppress_phase(); |
|
5081 |
process_dlldata(); |
|
5082 |
bitmap_aif_converison_phase(); |
|
5083 |
||
5084 |
my $checkcase_log = "checkcase.log"; |
|
5085 |
unlink $checkcase_log; |
|
5086 |
||
5087 |
open CHECKCASELOG, ">$checkcase_log" or die("* Can't create $checkcase_log\n"); |
|
5088 |
my @checkcase_lines = @obydata; |
|
5089 |
my %checkcase_macro; |
|
5090 |
my @checkcase_macrodir; |
|
5091 |
my $checkcase_line; |
|
5092 |
print CHECKCASELOG "======================Macro check part:======================\n"; |
|
5093 |
foreach $checkcase_line (@checkcase_lines) |
|
5094 |
{ |
|
5095 |
track_source($checkcase_line); |
|
5096 |
$checkcase_line =~ s-\/-\\-g; |
|
5097 |
$checkcase_line =~ s-\\\\-\\-g; |
|
5098 |
if ($checkcase_line =~ /^\s*REM\s*(re)?defined\s*(\w*)\s*as\s*(\S+)/) |
|
5099 |
{ |
|
5100 |
my $checkcase_macrocontent = $3; |
|
5101 |
my $checkcase_macroname = $2; |
|
5102 |
if ($checkcase_macrocontent =~ /[a-zA-Z]/) |
|
5103 |
{ |
|
5104 |
$checkcase_macro{$checkcase_macroname} = $checkcase_macrocontent; |
|
5105 |
checkcase_macro(\@checkcase_macrodir, $checkcase_macroname, $checkcase_macrocontent); |
|
5106 |
} |
|
5107 |
} |
|
5108 |
} |
|
5109 |
print CHECKCASELOG "======================Macro check part end======================\n\n"; |
|
5110 |
print CHECKCASELOG "======================File check part:======================\n"; |
|
5111 |
foreach $checkcase_line (@checkcase_lines) |
|
5112 |
{ |
|
5113 |
if ($checkcase_line =~ /^\s*REM\s*.*/) |
|
5114 |
{ |
|
5115 |
next; |
|
5116 |
} |
|
5117 |
if ($checkcase_line =~ /^\s*#\s*\d+\s*\"(\S+)\"\s*\d*\s*$/) #oby filename |
|
5118 |
{ |
|
5119 |
my $checkcase_whichfile = $1; |
|
5120 |
checkcase_obyfilename($checkcase_whichfile); |
|
5121 |
track_source($checkcase_line); |
|
5122 |
}elsif ($checkcase_line =~ /^\s*\S+\s*=\s*"([^"]+)"\s+\S*\s*/ |
|
5123 |
|| $checkcase_line =~ /^\s*\S+\s*=\s*(\S+)\s+\S*\s*/) #oby content file name |
|
5124 |
{ |
|
5125 |
my $checkcase_pcsidefile = $1; |
|
5126 |
checkcase_pcsidefilename(\@checkcase_macrodir, $checkcase_pcsidefile); |
|
5127 |
} |
|
5128 |
} |
|
5129 |
print CHECKCASELOG "======================File check part end======================\n"; |
|
5130 |
close CHECKCASELOG; |
|
5131 |
||
5132 |
@obydata = @checkcase_obydatatemp; |
|
5133 |
}else |
|
5134 |
{ |
|
5135 |
print "WARNING: checkcase option is only valid on windows.\n"; |
|
5136 |
} |
|
5137 |
} |
|
5138 |
||
5139 |
sub checkcase_macro() |
|
5140 |
{ |
|
5141 |
my $macrodir = shift; |
|
5142 |
my $name = shift; |
|
5143 |
my $content = shift; |
|
5144 |
||
5145 |
if ($content =~ /epoc32/i && (-d $content)) |
|
5146 |
{ |
|
5147 |
my $realdir = `directory.bat $content`; |
|
5148 |
$realdir =~ s/\s+$//g; |
|
5149 |
$realdir =~ s/^\s*\w://g if ($content !~ /^\w:/); |
|
5150 |
$realdir =~ s/\\$//g if ($content !~ /\\$/); |
|
5151 |
$realdir .= "\\" if ($content =~ /\\$/ && $realdir !~ /\\$/); |
|
5152 |
$sourcefile =~ s/\//\\/g; |
|
5153 |
$sourcefile =~ s/\\\\/\\/g; |
|
5154 |
if ($realdir ne $content) |
|
5155 |
{ |
|
5156 |
print CHECKCASELOG "check case: macro name is $name\n"; |
|
5157 |
print CHECKCASELOG "WARNING: macro case is not equal to real.\n"; |
|
5158 |
print CHECKCASELOG "file name is $sourcefile\n"; |
|
5159 |
print CHECKCASELOG "current is $content\n"; |
|
5160 |
print CHECKCASELOG "expect is $realdir\n\n"; |
|
5161 |
checkcase_convert($sourcefile, $content, $realdir); |
|
5162 |
} |
|
5163 |
$content =~ s-\\-\\\\-g; |
|
5164 |
push @$macrodir, $content; |
|
5165 |
}else |
|
5166 |
{ |
|
5167 |
if($name eq "PLATFORM_NAME") |
|
5168 |
{ |
|
5169 |
$content =~ s-\\-\\\\-g; |
|
5170 |
$content =~ s-\.-\\\.-g; |
|
5171 |
$checkcase_platform = $content; |
|
5172 |
} |
|
5173 |
} |
|
5174 |
} |
|
5175 |
||
5176 |
sub checkcase_obyfilename() |
|
5177 |
{ |
|
5178 |
my $checkfile = shift; |
|
5179 |
if (-e $checkfile) |
|
5180 |
{ |
|
5181 |
while ($checkfile=~s-[\\](?!\.{2}\\)[^\\]*\\\.{2}(?=\\)--go){}; |
|
5182 |
$sourcefile =~ s/\//\\/g; |
|
5183 |
if ($checkfile eq $sourcefile) |
|
5184 |
{ |
|
5185 |
return; |
|
5186 |
} |
|
5187 |
my($filename, $dir, $suffix) = fileparse($checkfile); |
|
5188 |
||
5189 |
my $realdir = `directory.bat $dir`; |
|
5190 |
$realdir =~ s/\s+$//g; |
|
5191 |
$realdir .= "\\" if ($realdir !~ /\\$/); |
|
5192 |
if ($realdir ne $dir) |
|
5193 |
{ |
|
5194 |
print CHECKCASELOG "check case: oby file name is $checkfile\n"; |
|
5195 |
print CHECKCASELOG "WARNING: dir case is not equal to real.\n"; |
|
5196 |
my $tempsrcfile = $sourcefile; |
|
5197 |
$tempsrcfile =~ s/\\\\/\\/g; |
|
5198 |
print CHECKCASELOG "file name is $tempsrcfile\n"; |
|
5199 |
print CHECKCASELOG "current is $dir\n"; |
|
5200 |
print CHECKCASELOG "expect is $realdir\n\n"; |
|
5201 |
checkcase_convert($sourcefile, $dir, $realdir); |
|
5202 |
} |
|
5203 |
||
5204 |
my $currentdir = cwd; |
|
5205 |
chdir "$dir"; |
|
5206 |
my @realfile = `dir "$filename" 2>&1`; |
|
5207 |
my $line; |
|
5208 |
foreach $line (@realfile) |
|
5209 |
{ |
|
5210 |
if ($line =~ /^\s*(\S+)\s+(\d{2}:\d{2})\s+(PM|AM)?\s+([\d\,])+\s+([\S]+)\s*/) |
|
5211 |
{ |
|
5212 |
my $realfilename = $5; |
|
5213 |
my $filetemp = lc $filename; |
|
5214 |
my $realtemp = lc $realfilename; |
|
5215 |
if ($filetemp eq $realtemp && $realfilename ne $filename) |
|
5216 |
{ |
|
5217 |
print CHECKCASELOG "check case: oby file name is $checkfile\n"; |
|
5218 |
print CHECKCASELOG "WARNING: filename case is not equal to real.\n"; |
|
5219 |
my $tempsrcfile = $sourcefile; |
|
5220 |
$tempsrcfile =~ s/\\\\/\\/g; |
|
5221 |
print CHECKCASELOG "file name is $tempsrcfile\n"; |
|
5222 |
print CHECKCASELOG "current is $filename\n"; |
|
5223 |
print CHECKCASELOG "expect is $realfilename\n\n"; |
|
5224 |
checkcase_convert($sourcefile, $filename, $realfilename); |
|
5225 |
} |
|
5226 |
} |
|
5227 |
} |
|
5228 |
chdir "$currentdir"; |
|
5229 |
} |
|
5230 |
} |
|
5231 |
||
5232 |
sub checkcase_pcsidefilename() |
|
5233 |
{ |
|
5234 |
my $macrodirs = shift; |
|
5235 |
my $checkfile = shift; |
|
5236 |
$checkfile =~ s/^\"//g; |
|
5237 |
$checkfile =~ s/\"$//g; |
|
5238 |
if (-e $checkfile) |
|
5239 |
{ |
|
5240 |
while ($checkfile=~s-[\\](?!\.{2}\\)[^\\]*\\\.{2}(?=\\)--go){}; |
|
5241 |
$sourcefile =~ s/\//\\/g; |
|
5242 |
my($filename, $dir, $suffix) = fileparse($checkfile); |
|
5243 |
if ($dir eq "\.\\") |
|
5244 |
{ |
|
5245 |
$dir = cwd; |
|
5246 |
$dir =~ s/\//\\/g; |
|
5247 |
$dir .= "\\" if ($dir !~ /\\$/); |
|
5248 |
} |
|
5249 |
||
5250 |
my $realdir = `directory.bat $dir`; |
|
5251 |
$realdir =~ s/\s+$//g; |
|
5252 |
$realdir =~ s/^\s*\w://g if ($dir !~ /^\w:/); |
|
5253 |
$realdir .= "\\" if ($realdir !~ /\\$/); |
|
5254 |
my $dirtemp = $dir; |
|
5255 |
if ($checkcase_test) |
|
5256 |
{ |
|
5257 |
my $macrodirtemp = ""; |
|
5258 |
foreach my $macrodir (@$macrodirs) |
|
5259 |
{ |
|
5260 |
if ($dirtemp =~ /^$macrodir(.*)$/) |
|
5261 |
{ |
|
5262 |
$macrodirtemp = $macrodir if (length($macrodirtemp) < length($macrodir)); |
|
5263 |
} |
|
5264 |
} |
|
5265 |
if ($macrodirtemp ne "") |
|
5266 |
{ |
|
5267 |
$dirtemp =~ s/^$macrodirtemp//g; |
|
5268 |
$realdir =~ s/^$macrodirtemp//ig; |
|
5269 |
} |
|
5270 |
} |
|
5271 |
if ($realdir ne $dirtemp) |
|
5272 |
{ |
|
5273 |
print CHECKCASELOG "check case: pc side file name is $checkfile\n"; |
|
5274 |
print CHECKCASELOG "WARNING: dir case is not equal to real.\n"; |
|
5275 |
my $tempsrcfile = $sourcefile; |
|
5276 |
$tempsrcfile =~ s/\\\\/\\/g; |
|
5277 |
print CHECKCASELOG "file name is $tempsrcfile\n"; |
|
5278 |
print CHECKCASELOG "current is $dirtemp\n"; |
|
5279 |
print CHECKCASELOG "expect is $realdir\n\n"; |
|
5280 |
checkcase_convert($sourcefile, $dirtemp, $realdir); |
|
5281 |
} |
|
5282 |
||
5283 |
my $currentdir = cwd; |
|
5284 |
chdir "$dir"; |
|
5285 |
my @realfile = `dir "$filename" 2>&1`; |
|
5286 |
my $line; |
|
5287 |
foreach $line (@realfile) |
|
5288 |
{ |
|
5289 |
if ($line =~ /^\s*(\S+)\s+(\d{2}:\d{2})\s+(PM|AM)?\s+([\d\,])+\s+(.+)\s*/) |
|
5290 |
{ |
|
5291 |
my $realfilename = $5; |
|
5292 |
my $filetemp = lc $filename; |
|
5293 |
my $realtemp = lc $realfilename; |
|
5294 |
if ($filetemp eq $realtemp && $realfilename ne $filename) |
|
5295 |
{ |
|
5296 |
print CHECKCASELOG "check case: pc side file name is $checkfile\n"; |
|
5297 |
print CHECKCASELOG "WARNING: filename case is not equal to real.\n"; |
|
5298 |
my $tempsrcfile = $sourcefile; |
|
5299 |
$tempsrcfile =~ s/\\\\/\\/g; |
|
5300 |
print CHECKCASELOG "file name is $tempsrcfile\n"; |
|
5301 |
print CHECKCASELOG "current is $filename\n"; |
|
5302 |
print CHECKCASELOG "expect is $realfilename\n\n"; |
|
5303 |
checkcase_convert($sourcefile, $filename, $realfilename); |
|
5304 |
} |
|
5305 |
} |
|
5306 |
} |
|
5307 |
chdir "$currentdir"; |
|
5308 |
} |
|
5309 |
} |
|
5310 |
||
5311 |
sub checkcase_convert() |
|
5312 |
{ |
|
5313 |
return if (!$checkcase_test); |
|
5314 |
||
5315 |
my $file = shift; |
|
5316 |
my $origin = shift; |
|
5317 |
my $real = shift; |
|
5318 |
||
5319 |
my @realfile = `dir "$file" 2>&1`; |
|
5320 |
my $line; |
|
5321 |
foreach $line (@realfile) |
|
5322 |
{ |
|
5323 |
if ($line =~ /^\s*(\S+)\s+(\d{2}:\d{2})\s+(PM|AM)?\s+([\d\,])+\s+([\S]+)\s*/) |
|
5324 |
{ |
|
5325 |
my $realfilename = $5; |
|
5326 |
$realfilename =~ s-\.-\\\.-g; |
|
5327 |
$file =~ s-$realfilename$--ig; |
|
5328 |
$realfilename =~ s-\\\.-\.-g; |
|
5329 |
$file .= $realfilename; |
|
5330 |
} |
|
5331 |
} |
|
5332 |
||
5333 |
my $tempfile = $file.".temp"; |
|
5334 |
my $usemultimacro = 0; |
|
5335 |
my $uses60macro_aifrsc = 0; |
|
5336 |
my $uses60macro_exe = 0; |
|
5337 |
my $uses60macro_aificon = 0; |
|
5338 |
my $uses60macro_resource = 0; |
|
5339 |
my $originwithoutext = $origin; |
|
5340 |
my $realwithoutext = $real; |
|
5341 |
if ($origin =~ /epoc32/i) |
|
5342 |
{ |
|
5343 |
my $tempepocroot = $ENV{EPOCROOT}; |
|
5344 |
$tempepocroot =~ s-\\-\\\\-g; |
|
5345 |
$origin =~ s/^$tempepocroot//g; |
|
5346 |
$real =~ s/^$tempepocroot//g; |
|
5347 |
}elsif ($checkcase_platform ne "" && $origin =~ /^_$checkcase_platform\_(.*)/) |
|
5348 |
{ |
|
5349 |
$origin =~ s/^_$checkcase_platform\_/_PLATFORM_NAME_/g; |
|
5350 |
$real =~ s/^_$checkcase_platform\_/_PLATFORM_NAME_/g; |
|
5351 |
}elsif ($origin =~ /\S+\_reg\.rsc$/) |
|
5352 |
{ |
|
5353 |
$originwithoutext =~ s/\_reg\.rsc$//g; |
|
5354 |
$realwithoutext =~ s/\_reg\.rsc$//ig; |
|
5355 |
$uses60macro_aifrsc = 1; |
|
5356 |
}elsif ($origin =~ /\S+\.rsc$/) |
|
5357 |
{ |
|
5358 |
$originwithoutext =~ s/\.rsc$//g; |
|
5359 |
$realwithoutext =~ s/\.rsc$//ig; |
|
5360 |
$usemultimacro = 1; |
|
5361 |
$uses60macro_resource = 1; |
|
5362 |
}elsif ($origin =~ /\S+\.r01$/) |
|
5363 |
{ |
|
5364 |
$originwithoutext =~ s/\.r01$//g; |
|
5365 |
$realwithoutext =~ s/\.r01$//ig; |
|
5366 |
$usemultimacro = 1; |
|
5367 |
}elsif ($origin =~ /\S+\.exe$/) |
|
5368 |
{ |
|
5369 |
$originwithoutext =~ s/\.exe$//g; |
|
5370 |
$realwithoutext =~ s/\.exe$//ig; |
|
5371 |
$uses60macro_exe = 1; |
|
5372 |
}elsif ($origin =~ /\S+\_aif\.mif$/) |
|
5373 |
{ |
|
5374 |
$originwithoutext =~ s/\_aif\.mif$//g; |
|
5375 |
$realwithoutext =~ s/\_aif\.mif$//ig; |
|
5376 |
$uses60macro_aificon = 1; |
|
5377 |
}elsif ($origin =~ /\S+\.mif$/) |
|
5378 |
{ |
|
5379 |
$originwithoutext =~ s/\.mif$//g; |
|
5380 |
$realwithoutext =~ s/\.mif$//ig; |
|
5381 |
$uses60macro_aificon = 1; |
|
5382 |
} |
|
5383 |
$origin =~ s-\\-\\\\-g; |
|
5384 |
$origin =~ s-\.-\\\.-g; |
|
5385 |
||
5386 |
open (SRC, "<$file"); |
|
5387 |
open (DST, ">$tempfile"); |
|
5388 |
my $line; |
|
5389 |
while($line = <SRC>) |
|
5390 |
{ |
|
5391 |
my $flag = 0; |
|
5392 |
||
5393 |
if ($line =~ /$origin/) |
|
5394 |
{ |
|
5395 |
$originwithoutext = $origin; |
|
5396 |
$realwithoutext = $real; |
|
5397 |
$flag = 1; |
|
5398 |
}elsif ($usemultimacro) |
|
5399 |
{ |
|
5400 |
if ($line =~ /^.*=\s*MULTI_LINGUIFY\s*\(.*$originwithoutext/) |
|
5401 |
{ |
|
5402 |
$flag = 1; |
|
5403 |
}elsif ($line =~ /^\s*S60_APP_RESOURCE\s*\(\s*$originwithoutext\s*\)/ && $uses60macro_resource) |
|
5404 |
{ |
|
5405 |
$flag = 1; |
|
5406 |
} |
|
5407 |
}elsif ($uses60macro_exe) |
|
5408 |
{ |
|
5409 |
if ($line =~ /^\s*S60_APP_EXE\s*\(\s*$originwithoutext\s*\)/) |
|
5410 |
{ |
|
5411 |
$flag = 1; |
|
5412 |
} |
|
5413 |
}elsif ($uses60macro_aificon) |
|
5414 |
{ |
|
5415 |
if ($line =~ /^\s*S60_APP_AIF_ICONS\s*\(\s*$originwithoutext\s*\)/) |
|
5416 |
{ |
|
5417 |
$flag = 1; |
|
5418 |
}elsif ($line =~ /^\s*SCALABLE_IMAGE\s*\(.*$originwithoutext\s*\)/) |
|
5419 |
{ |
|
5420 |
$flag = 1; |
|
5421 |
}elsif ($line =~ /^\s*S60_APP_BITMAP\s*\(\s*$originwithoutext\s*\)/) |
|
5422 |
{ |
|
5423 |
$flag = 1; |
|
5424 |
} |
|
5425 |
}elsif ($uses60macro_aifrsc) |
|
5426 |
{ |
|
5427 |
if ($line =~ /^\s*S60_APP_AIF_RSC\s*\(\s*$originwithoutext\s*\)/) |
|
5428 |
{ |
|
5429 |
$flag = 1; |
|
5430 |
}elsif ($line =~ /^\s*S60_UPGRADABLE_APP_REG_RSC\s*\(\s*$originwithoutext\s*\)/) |
|
5431 |
{ |
|
5432 |
$flag = 1; |
|
5433 |
} |
|
5434 |
} |
|
5435 |
if ($flag) |
|
5436 |
{ |
|
5437 |
print CHECKCASELOG "it has been converted automatically\n"; |
|
5438 |
print CHECKCASELOG "original line is $line"; |
|
5439 |
$line =~ s-$originwithoutext-$realwithoutext-; |
|
5440 |
print CHECKCASELOG "converted line is $line\n"; |
|
5441 |
} |
|
5442 |
print DST $line; |
|
5443 |
} |
|
5444 |
close SRC; |
|
5445 |
close DST; |
|
5446 |
||
5447 |
unlink "$file"; |
|
5448 |
rename ("$file.temp", "$file"); |
|
5449 |
} |
|
5450 |
||
5451 |
1; |