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