author | Arnaud Lenoir |
Thu, 18 Mar 2010 15:26:01 +0000 | |
branch | RCL_3 |
changeset 79 | 5e2688cee105 |
parent 8 | 8d0f562530b6 |
child 84 | b379919d420f |
permissions | -rw-r--r-- |
5
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
1 |
#!perl |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
2 |
# |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
3 |
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
4 |
# All rights reserved. |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
5 |
# This component and the accompanying materials are made available |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
6 |
# under the terms of the License "Eclipse Public License v1.0" |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
7 |
# which accompanies this distribution, and is available |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
8 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
9 |
# |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
10 |
# Initial Contributors: |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
11 |
# Nokia Corporation - initial contribution. |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
12 |
# |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
13 |
# Contributors: |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
14 |
# |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
15 |
# Description: |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
16 |
# |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
17 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
18 |
# rom.pl - Build a rom |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
19 |
# |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
20 |
# Pre-processes the .oby/iby files then invokes rombuild.exe |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
21 |
# (or other specified builder) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
22 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
23 |
# First, read our config file |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
24 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
25 |
use strict; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
26 |
use Getopt::Long; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
27 |
use Cwd; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
28 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
29 |
#Getopt::Long::Configure("ignore_case"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
30 |
my %opts=(); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
31 |
my $param_count = scalar(@ARGV); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
32 |
my $result = GetOptions (\%opts, "assp=s", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
33 |
"inst=s", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
34 |
"type=s", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
35 |
"variant=s", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
36 |
"build=s", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
37 |
"conf=s", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
38 |
"name=s", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
39 |
"modules=s", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
40 |
"xabi=s", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
41 |
"clean", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
42 |
"quiet", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
43 |
"help", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
44 |
"_debug", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
45 |
"zip", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
46 |
"symbol", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
47 |
"noheader", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
48 |
"kerneltrace=s", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
49 |
"rombuilder=s", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
50 |
"define=s@", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
51 |
"rofsbuilder=s", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
52 |
"compress", |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
53 |
); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
54 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
55 |
my (@assps, @builds, %variants, @templates, %flags, %insts, %zip, %builder); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
56 |
my $main; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
57 |
my $kmain; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
58 |
my $toroot; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
59 |
my $e32path; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
60 |
my $rombuildpath; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
61 |
my $euserdir; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
62 |
my $elocldir; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
63 |
my $kbdir; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
64 |
my $romname; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
65 |
my $single; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
66 |
my $smain; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
67 |
my $pagedCode; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
68 |
my $debug = $opts{_debug}; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
69 |
my $quiet; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
70 |
$quiet = $opts{quiet} unless $debug; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
71 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
72 |
my $drive; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
73 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
74 |
# discover where this script is running from to set the $toroot and $e32path variables |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
75 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
76 |
my $toolpath; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
77 |
my $Epoc32Path; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
78 |
my $EpocRoot; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
79 |
my $drive; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
80 |
my $BasePath; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
81 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
82 |
BEGIN { |
7
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
83 |
|
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
84 |
$EpocRoot = $ENV{EPOCROOT}; |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
85 |
die "ERROR: Must set the EPOCROOT environment variable.\n" if (!defined($EpocRoot)); |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
86 |
print "Environmental epocroot - >$EpocRoot<\n"; |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
87 |
$EpocRoot =~ s-/-\\-go; # for those working with UNIX shells |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
88 |
if ($EpocRoot =~ /^([a-z]:)(.*)$/i) |
5
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
89 |
{ |
7
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
90 |
# Raptor style: Drive letter and trailing \\ removed |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
91 |
$drive = $1; |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
92 |
$EpocRoot = "$2\\"; |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
93 |
$ENV{EPOCROOT} = $EpocRoot; |
5
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
94 |
} |
7
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
95 |
die "ERROR: EPOCROOT must be an absolute path, " . |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
96 |
"not containing a drive letter.\n" if ($EpocRoot !~ /^\\/); |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
97 |
die "ERROR: EPOCROOT must not be a UNC path.\n" if ($EpocRoot =~ /^\\\\/); |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
98 |
die "ERROR: EPOCROOT must end with a backslash.\n" if ($EpocRoot !~ /\\$/); |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
99 |
die "ERROR: EPOCROOT must specify an existing directory.\n" if (!-d $EpocRoot); |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
100 |
|
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
101 |
# The cpp needed a drive apparently |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
102 |
my $cwd = Cwd::cwd(); |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
103 |
$cwd =~ /^(.)/; |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
104 |
$drive = "$1:" unless $drive; |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
105 |
print "epocroot = >$EpocRoot<\n"; |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
106 |
print "drive = >$drive<\n"; |
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
107 |
|
5
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
108 |
my $fp0 = $0; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
109 |
$cwd =~ s/\//\\/g; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
110 |
$fp0 =~ s/\//\\/g; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
111 |
unless ($fp0 =~ /^([A-Za-z]:)?\\/) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
112 |
if ($cwd =~ /\\$/) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
113 |
$fp0 = "$cwd$fp0"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
114 |
} else { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
115 |
$fp0 = "$cwd\\$fp0"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
116 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
117 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
118 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
119 |
my @path = split(/\\/, $cwd); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
120 |
shift(@path); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
121 |
$toroot = ('..\\') x @path; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
122 |
$e32path = $fp0; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
123 |
$e32path =~ s/\\kernelhwsrv\\kernel\\eka\\rombuild\\rom\.pl$//i; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
124 |
$e32path =~ s/^[A-Za-z]://; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
125 |
$rombuildpath = $toroot."sf\\os\\kernelhwsrv\\kernel\\eka\\rombuild"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
126 |
$Epoc32Path = $toroot; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
127 |
$Epoc32Path =~ s/\\$//; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
128 |
$Epoc32Path .= $EpocRoot . "epoc32"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
129 |
$toolpath = "$Epoc32Path\\tools\\"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
130 |
push @INC, $toolpath; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
131 |
$BasePath = $toroot . $e32path; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
132 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
133 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
134 |
use E32Plat; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
135 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
136 |
Plat_Init($toolpath); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
137 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
138 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
139 |
if ($debug) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
140 |
print "EpocRoot = $EpocRoot\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
141 |
print "Epoc32Path = $Epoc32Path\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
142 |
print "drive = $drive\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
143 |
print "toolpath = $toolpath\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
144 |
print "toroot = $toroot\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
145 |
print "e32path = $e32path\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
146 |
print "rombuildpath = $rombuildpath\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
147 |
print "BasePath = $BasePath\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
148 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
149 |
|
8
8d0f562530b6
Adjusted cpp flags so that cpp will be able to find includes such as <rom/syborg/header.iby>
Simon Howkins <simonh@symbian.org>
parents:
7
diff
changeset
|
150 |
my $cppflags="-P -undef -traditional -lang-c++ -nostdinc -iwithprefixbefore $rombuildpath -I $rombuildpath -I $drive$Epoc32Path "; |
5
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
151 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
152 |
# Include variant hrh file defines when processing oby and ibys with cpp |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
153 |
# (Code copied from \\EPOC\master\cedar\generic\tools\romkit\tools\buildrom.pm - |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
154 |
# it used relative path to the working dir but we are using absolute path seems neater) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
155 |
use E32Variant; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
156 |
use Pathutl; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
157 |
my $variantMacroHRHFile = Variant_GetMacroHRHFile(); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
158 |
if($variantMacroHRHFile){ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
159 |
# Using absolute paths so must include drive letter otherwise cpp will fail |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
160 |
# Also adding the directory containing the HRH file to main includes paths in |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
161 |
# case it includes files |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
162 |
my $variantFilePath = Path_Split('Path',$variantMacroHRHFile); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
163 |
$cppflags .= " -I $drive$variantFilePath -include $drive$variantMacroHRHFile"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
164 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
165 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
166 |
if($param_count == 0 || $opts{'help'} || !$result) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
167 |
usage(); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
168 |
exit 0; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
169 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
170 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
171 |
# Now check that the options we have make sense |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
172 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
173 |
checkopts(); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
174 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
175 |
if (!$quiet) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
176 |
print "Starting directory: ", Cwd::cwd(), "\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
177 |
print <<EOF; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
178 |
OPTIONS: |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
179 |
\tTYPE: $opts{'type'} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
180 |
\tVARIANT: $opts{'variant'} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
181 |
\tINSTRUCTION SET: $opts{'inst'} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
182 |
\tBUILD: $opts{'build'} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
183 |
\tMODULES: $opts{'modules'} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
184 |
EOF |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
185 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
186 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
187 |
#Pick out the type file |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
188 |
my $skel; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
189 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
190 |
if (-e "$opts{'type'}.oby") { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
191 |
$skel="$opts{'type'}.oby"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
192 |
} elsif (-e "$rombuildpath\\$opts{'type'}.oby") { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
193 |
$skel="$rombuildpath\\$opts{'type'}.oby"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
194 |
} else { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
195 |
die "Can't find type file for type $opts{'type'}, $!"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
196 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
197 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
198 |
print "Using type file $skel\n" if !$quiet; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
199 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
200 |
# If clean is specified, zap all the image and .oby files |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
201 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
202 |
if($opts{'clean'}) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
203 |
unlink glob("*.img"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
204 |
unlink "rom.oby"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
205 |
unlink "rombuild.log"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
206 |
unlink glob("*.rofs"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
207 |
unlink "rofsbuild.log"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
208 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
209 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
210 |
# Now pre-pre-process this file to point to the right places for .ibys |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
211 |
# Unfortunately cpp won't do macro replacement in #include strings, so |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
212 |
# we have to do it by hand |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
213 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
214 |
my $k = $opts{kerneltrace}; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
215 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
216 |
if ($opts{assp}=~/^m(\S+)/i) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
217 |
$kbdir="kb$1"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
218 |
$kbdir="kbarm" if (lc $1 eq 'eig'); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
219 |
} else { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
220 |
$kbdir="kb$opts{assp}"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
221 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
222 |
$single=1 if ($opts{assp}=~/^s(\S+)/i); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
223 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
224 |
if ($single) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
225 |
# Hackery to cope with old compiler |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
226 |
if ($main eq 'MARM') { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
227 |
$smain='SARM'; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
228 |
} else { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
229 |
$smain="S$main"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
230 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
231 |
} else { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
232 |
$smain=$main; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
233 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
234 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
235 |
open(X, "$skel") || die "Can't open type file $skel, $!"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
236 |
open(OUT, "> rom1.tmp") || die "Can't open output file, $!"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
237 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
238 |
# First output the ROM name |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
239 |
print OUT "\nromname=$romname\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
240 |
while(<X>) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
241 |
s/\#\#ASSP\#\#/$opts{'assp'}/; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
242 |
s/\#\#VARIANT\#\#/$opts{'variant'}/; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
243 |
s/\#\#BUILD\#\#/$opts{'build'}/; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
244 |
s/\#\#MAIN\#\#/$main/; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
245 |
s/\#\#KMAIN\#\#/$kmain/; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
246 |
s/\#\#E32PATH\#\#/$e32path/; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
247 |
s/\#\#BASEPATH\#\#/$BasePath/; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
248 |
s/\#\#EUSERDIR\#\#/$euserdir/; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
249 |
s/\#\#ELOCLDIR\#\#/$elocldir/; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
250 |
s/\#\#KBDIR\#\#/$kbdir/; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
251 |
print OUT; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
252 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
253 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
254 |
close X; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
255 |
close OUT; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
256 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
257 |
# Use cpp to pull in include chains and replace defines |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
258 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
259 |
my $defines = ""; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
260 |
$defines .= "-D MAIN=$main "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
261 |
$defines .= "-D KMAIN=$kmain "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
262 |
$defines .= "-D EUSERDIR=$euserdir "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
263 |
$defines .= "-D ELOCLDIR=$elocldir "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
264 |
$defines .= "-D E32PATH=$e32path "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
265 |
$defines .= "-D BASEPATH=$BasePath "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
266 |
$defines .= "-D EPOCROOT=$EpocRoot "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
267 |
$defines .= "-D SMAIN=$smain " if $smain; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
268 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
269 |
foreach (@{$opts{'define'}}) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
270 |
my @array=split(/,/,$_); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
271 |
foreach (@array) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
272 |
$defines.="-D ".uc $_." "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
273 |
$pagedCode = 1 if $_ eq 'PAGED_CODE'; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
274 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
275 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
276 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
277 |
if ($opts{'modules'}) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
278 |
my @array=split(/,/,$opts{'modules'}); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
279 |
foreach (@array) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
280 |
$defines.="-D ".uc $_." "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
281 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
282 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
283 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
284 |
foreach (keys %opts) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
285 |
next if ($_ eq 'name'); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
286 |
next if ($_ eq 'modules'); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
287 |
next if ($_ eq 'zip'); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
288 |
next if ($_ eq 'symbol'); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
289 |
next if ($_ eq 'kerneltrace'); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
290 |
next if ($_ eq 'define'); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
291 |
$defines.="-D ".uc $_."=".$opts{$_}." "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
292 |
$defines.="-D ".uc $_."_".$opts{$_}." "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
293 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
294 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
295 |
$defines.="-D SINGLE " if ($single); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
296 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
297 |
sub IsRVCTBuild($) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
298 |
my ($build)=@_; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
299 |
return 1 if ($build =~ /^ARMV/i); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
300 |
my @customizations = Plat_Customizations('ARMV5'); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
301 |
return 1 if (grep /$build/, @customizations); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
302 |
return 0; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
303 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
304 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
305 |
$defines.="-D RVCT " if (IsRVCTBuild($main)); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
306 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
307 |
print "Using defines $defines\n" if !$quiet; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
308 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
309 |
my $ret=1; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
310 |
my $cppcmd; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
311 |
if($opts{'build'}=~/^u/i) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
312 |
# Unicode build |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
313 |
$cppcmd = "$Epoc32Path/gcc/bin/cpp $cppflags -D UNICODE $defines rom1.tmp rom2.tmp"; |
7
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
314 |
} else { |
79
5e2688cee105
Modify the line 315 of rom_sbs.pl to access cpp.exe when not building for Unicode.
Arnaud Lenoir
parents:
8
diff
changeset
|
315 |
$cppcmd = "$Epoc32Path/gcc/bin/cpp $cppflags $defines rom1.tmp rom2.tmp"; |
5
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
316 |
} |
7
0a6fb11f0655
Adjusted EPOCROOT handling so that in the context of Raptor invocation,
Simon Howkins <simonh@symbian.org>
parents:
5
diff
changeset
|
317 |
print "Executing CPP:\n\t$cppcmd\n" if $debug; |
5
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
318 |
$ret = system($cppcmd); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
319 |
die "ERROR EXECUTING CPP\n" if $ret; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
320 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
321 |
# Zap any ## marks REMS or blank lines |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
322 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
323 |
cleanup("rom2.tmp", "rom3.tmp", $k); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
324 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
325 |
# scan tmp file and generate auxiliary files, if required |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
326 |
open TMP, "rom3.tmp" or die("Can't open rom3.tmp\n"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
327 |
my $line; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
328 |
while ($line=<TMP>) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
329 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
330 |
if ($line=~/\s*gentestpaged/i) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
331 |
genfile("paged"); } |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
332 |
if ($line=~/\s*gentestnonpaged/i) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
333 |
genfile("nonpaged"); } |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
334 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
335 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
336 |
parsePatchData("rom3.tmp", "rom4.tmp"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
337 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
338 |
# break down the oby file into rom, rofs and extensions oby files |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
339 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
340 |
my $oby_index =0; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
341 |
my $dumpfile="rom.oby"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
342 |
my $rofs=0; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
343 |
my $extension=0; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
344 |
my $corerofsname=""; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
345 |
open DUMPFILE, ">$dumpfile" or die("Can't create $dumpfile\n"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
346 |
my $line; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
347 |
open TMP, "rom4.tmp" or die("Can't open rom4.tmp\n"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
348 |
while ($line=<TMP>) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
349 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
350 |
if ($line=~/^\s*rofsname/i) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
351 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
352 |
close DUMPFILE; # close rom.oby or previous rofs#/extension#.oby |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
353 |
$oby_index=1; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
354 |
$corerofsname=$line; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
355 |
$corerofsname =~ s/rofsname\s*=\s*//i; # save core rofs name |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
356 |
$corerofsname =~ s/\s*$//g; # remove trailing \n |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
357 |
unlink $corerofsname || print "unable to delete $corerofsname"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
358 |
my $dumpfile="rofs".$rofs.".oby"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
359 |
$rofs++; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
360 |
open DUMPFILE, ">$dumpfile" or (close TMP and die("Can't create $dumpfile\n")); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
361 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
362 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
363 |
if ($line=~/^\s*coreimage/i) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
364 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
365 |
close DUMPFILE; # close rofs.oby |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
366 |
if ($oby_index ne 1) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
367 |
close TMP; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
368 |
die "Must specify ROFS image before ROFS extension\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
369 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
370 |
my $name=$line; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
371 |
$name =~ s/coreimage\s*=\s*//i; # read core rofs name |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
372 |
$name =~ s/\s*$//g; # remove trailing \n |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
373 |
if ($name ne $corerofsname) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
374 |
close TMP; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
375 |
die "This extension does not relate to previous ROFS\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
376 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
377 |
$oby_index=33; # open window |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
378 |
my $dumpfile="extension".$extension.".oby"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
379 |
$extension++; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
380 |
open DUMPFILE, ">$dumpfile" or (close TMP and die("Can't create $dumpfile\n")); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
381 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
382 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
383 |
if ($line=~/^\s*extensionrofs/i) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
384 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
385 |
$oby_index=3 if ($oby_index eq 2); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
386 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
387 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
388 |
if (($oby_index eq 2) && !($line=~/^\s*$/)) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
389 |
close TMP; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
390 |
die "Bad ROFS extension specification\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
391 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
392 |
print DUMPFILE $line; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
393 |
$oby_index=2 if ($oby_index eq 33); # close window |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
394 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
395 |
close DUMPFILE; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
396 |
close TMP; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
397 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
398 |
# For paged roms that use rofs, move all data= lines in rom which are not 'paging_unmovable' to rofs, so that paged ram-loaded code |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
399 |
# is automatically put into rofs |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
400 |
rename('rom.oby', 'rom4.tmp') || die; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
401 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
402 |
open(IN, 'rom4.tmp') || die "Can't read rom4.tmp"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
403 |
open(ROM, '>rom.oby') || die "Can't write to rom.oby"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
404 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
405 |
if ($oby_index >= 1 && $pagedCode) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
406 |
open(ROFS, '>>rofs0.oby') || die "Can't append to rofs0.oby"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
407 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
408 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
409 |
while ($line=<IN>) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
410 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
411 |
if(($oby_index >= 1) && ($pagedCode) && ($line=~/^\s*data\s*=/) && !($line=~/\.*paging_unmovable\s*/)) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
412 |
print ROFS $line; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
413 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
414 |
else { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
415 |
$line=~s/paging_unmovable//; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
416 |
print ROM $line; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
417 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
418 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
419 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
420 |
close IN; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
421 |
close ROM; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
422 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
423 |
if ($oby_index >= 1 && $pagedCode) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
424 |
close ROFS; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
425 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
426 |
unlink 'rom4.tmp'; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
427 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
428 |
my $flags; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
429 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
430 |
foreach (@{$flags{$opts{'assp'}}}) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
431 |
$flags.=" -$_"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
432 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
433 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
434 |
if($opts{'noheader'}) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
435 |
$flags.=" -no-header"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
436 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
437 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
438 |
if($opts{'compress'}) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
439 |
$flags.=" -compress"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
440 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
441 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
442 |
my $builder = $opts{'rombuilder'}; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
443 |
$builder = "rombuild" unless ($builder); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
444 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
445 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
446 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
447 |
print "$builder $flags -type-safe-link -S rom.oby 2>&1\n\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
448 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
449 |
open(Y, "$builder $flags -type-safe-link -S rom.oby 2>&1 |") || |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
450 |
die "Can't start $builder command, $!"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
451 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
452 |
my $nerrors=0; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
453 |
my $nwarnings=0; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
454 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
455 |
while(<Y>) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
456 |
my $error=(/^error:/i); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
457 |
my $warning=(/^warning:/i); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
458 |
print if ($error or $warning or !$quiet); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
459 |
$nerrors++ if ($error); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
460 |
$nwarnings++ if ($warning); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
461 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
462 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
463 |
print "\nGenerated .oby file is rom.oby\n" if !$quiet; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
464 |
print "\nGenerated image file is $romname\n" if (!$nerrors); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
465 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
466 |
my$rerrors; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
467 |
my $rofsbuilder; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
468 |
if ($rofs) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
469 |
$rofsbuilder = $opts{'rofsbuilder'}; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
470 |
$rofsbuilder = "rofsbuild" unless ($rofsbuilder); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
471 |
for(my $i=0;$i<$rofs;++$i) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
472 |
print "Executing $rofsbuilder on main rofs\n" if !$quiet; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
473 |
my $image="rofs".$i.".oby"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
474 |
system("$rofsbuilder $image"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
475 |
if ($? != 0) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
476 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
477 |
print "$rofsbuilder $image returned $?\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
478 |
$rerrors++; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
479 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
480 |
rename "rofsbuild.log", "rofs$i.log" |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
481 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
482 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
483 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
484 |
if ($rofs and $extension) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
485 |
for(my $i=0;$i<$extension;++$i) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
486 |
print "Executing $rofsbuilder on extension rofs\n" if !$quiet; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
487 |
my $image="extension".$i.".oby"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
488 |
system("$rofsbuilder $image"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
489 |
if ($? != 0) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
490 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
491 |
print "$rofsbuilder $image returned $?\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
492 |
$rerrors++; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
493 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
494 |
rename "rofsbuild.log", "extension$i.log" |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
495 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
496 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
497 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
498 |
if ($nerrors) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
499 |
print "\n\n Errors found during $builder!!\n\nLeaving tmp files\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
500 |
} elsif ($nwarnings) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
501 |
print "\n\n Warnings during $builder!!\n\nLeaving tmp files\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
502 |
} elsif ($rerrors) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
503 |
print "\n\n Errors during $rofsbuilder!!\n\nLeaving tmp files\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
504 |
} else { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
505 |
unlink glob("*.tmp") if !$debug; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
506 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
507 |
if ($opts{zip} or $zip{$opts{assp}}) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
508 |
my $zipname=$romname; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
509 |
$zipname =~ s/\.(\w+)$/\.zip/i; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
510 |
unlink $zipname; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
511 |
system("zip $zipname $romname"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
512 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
513 |
if ($opts{symbol}) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
514 |
my $logname=$romname; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
515 |
$logname =~ s/\.(\w+)$/\.log/i; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
516 |
my $obyname=$romname; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
517 |
$obyname =~ s/\.(\w+)$/\.oby/i; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
518 |
unlink $logname; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
519 |
unlink $obyname; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
520 |
system("rename rombuild.log $logname"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
521 |
system("rename rom.oby $obyname"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
522 |
system("maksym $logname"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
523 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
524 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
525 |
if ($nerrors || $nwarnings || $rerrors) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
526 |
exit 4; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
527 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
528 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
529 |
exit 0; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
530 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
531 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
532 |
################################ Subroutines ################################## |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
533 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
534 |
sub usage { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
535 |
print <<EOT; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
536 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
537 |
rom <options> |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
538 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
539 |
Generate a rom image for the specified target, along with a rom.oby file |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
540 |
that can be fed to (a) rombuild to regenerate the image. |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
541 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
542 |
The following options are required: |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
543 |
--variant=<variant> e.g. --variant=assabet |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
544 |
--inst=<instruction set> e.g. --inst=arm4 |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
545 |
--build=<build> e.g. --build=udeb |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
546 |
--type=<type of rom> |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
547 |
tshell for a text shell rom |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
548 |
e32tests for a rom with e32tests |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
549 |
f32tests for rom with f32tests |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
550 |
alltests for all the tests |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
551 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
552 |
The following are optional: |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
553 |
--name=<image name> Give image file specified name |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
554 |
--noheader Pass -no-header option on to rombuild |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
555 |
--help This help message. |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
556 |
--clean Remove existing generated files first |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
557 |
--quiet Be less verbose |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
558 |
--modules=<comma separated list> List of additional modules for this ROM |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
559 |
--define=<comma separated list> List of CPP macros to define |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
560 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
561 |
Options may be specified as a short abbreviation |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
562 |
e.g. -b udeb instead of --build udeb |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
563 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
564 |
EOT |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
565 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
566 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
567 |
sub cleanup($$$) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
568 |
my ($in, $out, $k) = @_; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
569 |
my ($line, $lastblank); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
570 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
571 |
open(OUTPUT_FILE, "> $out") or die "Cannot open $out for output"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
572 |
open(INPUT_FILE, "< $in") or die "Cannot open for $in input"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
573 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
574 |
while ($line=<INPUT_FILE>) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
575 |
$line=~s/##//g; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
576 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
577 |
# file=\epoc32\... ==> file=%EPOCROOT%\epoc32\... |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
578 |
$line =~ s/(=\s*)\\epoc32/\1${EpocRoot}Epoc32/i; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
579 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
580 |
# Now compress blank lines down to one |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
581 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
582 |
if($line=~/^\s*$/) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
583 |
if($lastblank) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
584 |
# Do nothing |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
585 |
} else { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
586 |
# This is the first blank line |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
587 |
$lastblank=1; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
588 |
print OUTPUT_FILE $line; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
589 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
590 |
} else { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
591 |
# Not blank |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
592 |
$lastblank=0; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
593 |
if ($k and $line=~/^\s*kerneltrace/i) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
594 |
$line = "kerneltrace $k\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
595 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
596 |
print OUTPUT_FILE $line if !($line=~/^\s*REM\s+/i); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
597 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
598 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
599 |
close(INPUT_FILE); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
600 |
close(OUTPUT_FILE); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
601 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
602 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
603 |
sub IsSmp($) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
604 |
my %SmpKernelDirs=( |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
605 |
'x86smp' => 1, |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
606 |
'x86gmp' => 1, |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
607 |
'arm4smp' => 1, |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
608 |
'armv4smp' => 1, |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
609 |
'armv5smp' => 1 |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
610 |
); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
611 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
612 |
my ($kdir) = @_; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
613 |
return $SmpKernelDirs{lc $kdir}; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
614 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
615 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
616 |
sub checkopts { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
617 |
unless($opts{variant}) { die "No Variant specified"; } |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
618 |
$opts{'build'}="UDEB" unless($opts{'build'}); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
619 |
$opts{'type'}="TSHELL" unless($opts{'type'}); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
620 |
$opts{'inst'}="ARM4" unless($opts{'inst'}); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
621 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
622 |
my $additional; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
623 |
if ($opts{'modules'}) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
624 |
$additional="_".$opts{modules}; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
625 |
$additional=~ s/,/_/ig; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
626 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
627 |
my $build=lc $opts{build}; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
628 |
my $inst=uc $opts{'inst'}; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
629 |
if ($inst eq "MARM") { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
630 |
# Hackery to cope with old compiler |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
631 |
$main="MARM"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
632 |
$euserdir="MARM"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
633 |
$elocldir="MARM"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
634 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
635 |
else { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
636 |
$main=$inst; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
637 |
if ($main eq "THUMB") { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
638 |
$euserdir="ARMI"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
639 |
} else { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
640 |
$euserdir=$main; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
641 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
642 |
if ($main eq "ARMI" or $main eq "THUMB") { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
643 |
$elocldir="ARM4"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
644 |
} else { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
645 |
$elocldir=$main; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
646 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
647 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
648 |
$kmain = $opts{'xabi'}; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
649 |
$kmain = $main unless ($kmain); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
650 |
if (IsSmp($kmain)) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
651 |
$euserdir = $kmain; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
652 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
653 |
if ($opts{name}) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
654 |
$romname=$opts{name}; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
655 |
} else { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
656 |
$romname=uc($opts{variant}.$additional.$main); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
657 |
if ($build=~/^\w*DEB$/i) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
658 |
$romname.='D'; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
659 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
660 |
$romname.='.IMG'; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
661 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
662 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
663 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
664 |
sub lookupFileInfo($$) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
665 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
666 |
my ($infile, $fullname) = @_; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
667 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
668 |
my ($name, $ext) = $fullname =~ /^(.+)\.(\w+)$/ ? ($1, $2) : ($fullname, undef); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
669 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
670 |
open TMP, $infile or die("Can't open $infile\n"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
671 |
while(<TMP>) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
672 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
673 |
$_ = lc; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
674 |
if(/^\s*(\S+)\s*=\s*(\S+)\s+(\S+)/i) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
675 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
676 |
my ($src, $dest) = ($2, $3); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
677 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
678 |
my $destFullname = $dest =~ /^.*\\(.+)$/ ? $1 : $dest; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
679 |
my ($destName, $destExt) = $destFullname =~ /^(.+?)\.(\w+)$/ ? ($1, $2) : ($destFullname, undef); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
680 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
681 |
if ($destName eq $name && (!$ext || $ext eq $destExt)) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
682 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
683 |
close TMP; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
684 |
return ($src, $dest); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
685 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
686 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
687 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
688 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
689 |
die "patchdata: Can't find file $fullname\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
690 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
691 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
692 |
sub lookupSymbolInfo($$) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
693 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
694 |
my ($file, $name) = @_; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
695 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
696 |
open TMP, $file or die "Can't read $file\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
697 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
698 |
# ignore local symbols. |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
699 |
while (<TMP> !~ /Global Symbols/) { } |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
700 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
701 |
while (<TMP>) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
702 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
703 |
if (/^\s*(\S+)\s+(\S+)\s+data\s+(\S+)/i) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
704 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
705 |
my ($symbol, $addr, $size) = ($1, $2, $3); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
706 |
if ($symbol eq $name) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
707 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
708 |
close TMP; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
709 |
return ($addr, $size); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
710 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
711 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
712 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
713 |
# This is a quick fix for RVCT 3.1, which uses the text "(EXPORTED)" |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
714 |
# in the map file. Here is an example: |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
715 |
# |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
716 |
# KHeapMinCellSize (EXPORTED) 0x0003d81c Data 4 mem.o(.constdata) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
717 |
# |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
718 |
elsif (/^\s*(\S+)\s+\(exported\)\s+(\S+)\s+data\s+(\S+)/i) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
719 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
720 |
my ($symbol, $addr, $size) = ($1, $2, $3); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
721 |
if ($symbol eq $name) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
722 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
723 |
close TMP; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
724 |
return ($addr, $size); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
725 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
726 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
727 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
728 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
729 |
die "patchdata: Can't find symbol $name\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
730 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
731 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
732 |
sub parsePatchData($$) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
733 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
734 |
my ($infile, $outfile) = @_; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
735 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
736 |
open IN, $infile or die("Can't read $infile\n"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
737 |
open OUT, ">$outfile" or die("Can't write $outfile\n"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
738 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
739 |
my $line; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
740 |
while($line = <IN>) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
741 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
742 |
if ($line =~ /^\s*patchdata\s+(.+?)\s*$/i) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
743 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
744 |
if ($1 !~ /(\S+)\s*@\s*(\S+)\s+(\S+)\s*$/) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
745 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
746 |
die "Bad patchdata command: $line\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
747 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
748 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
749 |
my ($file, $symbol, $value) = (lc $1, $2, $3); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
750 |
my ($srcFile, $destFile) = lookupFileInfo($infile, $file); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
751 |
my ($index, $elementSize) = (undef, undef); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
752 |
if ($symbol =~ s/:(\d+)\[(\d+)\]$//) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
753 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
754 |
($index, $elementSize) = ($2, $1); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
755 |
$index = hex($index) if $index =~ /^0x/i; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
756 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
757 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
758 |
if ($srcFile =~ /\\armv5(smp)?\\/i) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
759 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
760 |
my ($symbolAddr, $symbolSize) = lookupSymbolInfo("$srcFile.map", $symbol); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
761 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
762 |
my $max; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
763 |
if (defined($index)) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
764 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
765 |
my $bytes; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
766 |
$bytes = 1, $max = 0xff if $elementSize == 8; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
767 |
$bytes = 2, $max = 0xffff if $elementSize == 16; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
768 |
$bytes = 4, $max = 0xffffffff if $elementSize == 32; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
769 |
die("patchdata: invalid element size $elementSize: $line\n") unless defined($bytes); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
770 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
771 |
if ($bytes > 1 && (($symbolSize & ($bytes-1)) != 0)) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
772 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
773 |
die("patchdata: unexpected symbol size $symbolSize for array $symbol ($elementSize-bit elements)\n"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
774 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
775 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
776 |
if ($index >= int($symbolSize / $bytes)) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
777 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
778 |
die("patchdata: index $index out of bounds for $symbol of $symbolSize bytes ($elementSize-bit elements)\n"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
779 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
780 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
781 |
$symbolAddr = hex($symbolAddr) if $symbolAddr =~ /^0x/i; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
782 |
$symbolAddr += $index * $bytes; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
783 |
$symbolAddr = sprintf("0x%x", $symbolAddr); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
784 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
785 |
$symbolSize = $bytes; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
786 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
787 |
elsif ($symbolSize == 1) { $max = 0xff; } |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
788 |
elsif ($symbolSize == 2) { $max = 0xffff; } |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
789 |
elsif ($symbolSize == 4) { $max = 0xffffffff; } |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
790 |
else { die "patchdata: Unexpected symbol size $symbolSize for $symbol\n"; } |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
791 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
792 |
$value = hex($value) if $value =~ /^0x/i; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
793 |
if ($value > $max) |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
794 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
795 |
print("Warning: Value overflow of $symbol\n"); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
796 |
$value &= $max; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
797 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
798 |
$value = sprintf("0x%08x", $value); |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
799 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
800 |
$line = "patchdata $destFile addr $symbolAddr $symbolSize $value\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
801 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
802 |
else |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
803 |
{ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
804 |
$line = ""; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
805 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
806 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
807 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
808 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
809 |
print OUT $line; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
810 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
811 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
812 |
close IN; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
813 |
close OUT; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
814 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
815 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
816 |
sub genfile { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
817 |
my $count=0; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
818 |
if($_[0] eq 'paged') { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
819 |
my $file='gentestpaged.txt'; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
820 |
unlink $file; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
821 |
open(OUTFILE, ">$file") or die "Can't open output file, $!"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
822 |
for(my $i=0;$i<50000;++$i) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
823 |
if(($i >5) && ($i % 40 ==0)) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
824 |
print OUTFILE "\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
825 |
$count++; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
826 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
827 |
if(($i+$count) % 5 ==0) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
828 |
print OUTFILE "SATOR "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
829 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
830 |
if(($i+$count) % 5 ==1) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
831 |
print OUTFILE "AREPO "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
832 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
833 |
if(($i+$count) % 5 ==2) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
834 |
print OUTFILE "TENET "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
835 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
836 |
if(($i+$count) % 5 ==3) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
837 |
print OUTFILE "OPERA "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
838 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
839 |
if(($i+$count) % 5 ==4) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
840 |
print OUTFILE "ROTAS "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
841 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
842 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
843 |
} else { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
844 |
my $file='gentestnonpaged.txt'; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
845 |
unlink $file; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
846 |
open(OUTFILE, ">$file") or die "Can't open output file, $!"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
847 |
for(my $i=0;$i<20000;++$i) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
848 |
if(($i >5) && ($i % 40 ==0)) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
849 |
print OUTFILE "\n"; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
850 |
$count++; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
851 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
852 |
if(($i+$count) % 4 ==0) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
853 |
print OUTFILE "STEP "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
854 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
855 |
if(($i+$count) % 4 ==1) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
856 |
print OUTFILE "TIME "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
857 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
858 |
if(($i+$count) % 4 ==2) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
859 |
print OUTFILE "EMIT "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
860 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
861 |
if(($i+$count) % 4 ==3) { |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
862 |
print OUTFILE "PETS "; |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
863 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
864 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
865 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
866 |
} |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
867 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
868 |
__END__ |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
869 |
|
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
870 |
# Tell emacs that this is a perl script even 'though it has a .bat extension |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
871 |
# Local Variables: |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
872 |
# mode:perl |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
873 |
# tab-width:4 |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
874 |
# End: |
4ab060f25417
Create and register FLM for building ROMs with rom_sbs.pl through SBSv2.
Arnaud Lenoir <arnaudl@symbian.org>
parents:
diff
changeset
|
875 |