author | Mike Kinghan <mikek@symbian.org> |
Sat, 17 Jul 2010 15:09:24 +0100 | |
changeset 26 | d10c1f04b2be |
child 27 | 3a31ca4b29c4 |
permissions | -rw-r--r-- |
26
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1 |
#!/usr/bin/perl |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
2 |
# |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
3 |
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
4 |
# All rights reserved. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
5 |
# This component and the accompanying materials are made available |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
6 |
# under the terms of the License "Eclipse Public License v1.0" |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
7 |
# which accompanies this distribution, and is available |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
8 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
9 |
# |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
10 |
# Initial Contributors: |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
11 |
# Nokia Corporation - initial contribution. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
12 |
# |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
13 |
# Contributors: |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
14 |
# Mike Kinghan, mikek@symbian.org, for Symbian Foundation |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
15 |
# |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
16 |
# Description: |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
17 |
# |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
18 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
19 |
# romnibus.pl - Build a rom like rom_sbs.pl but without Windows dependencies. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
20 |
# |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
21 |
# Pre-processes the .oby/iby files then invokes rombuild.exe |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
22 |
# (or other specified builder) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
23 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
24 |
# First, read our config file |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
25 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
26 |
use strict; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
27 |
use Getopt::Long; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
28 |
use Cwd; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
29 |
use Cwd 'abs_path'; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
30 |
use File::Spec; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
31 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
32 |
my $on_windows; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
33 |
my $epocroot_vol; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
34 |
my $epocroot_dir; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
35 |
my $epocroot_file; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
36 |
my %dir_listings = (); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
37 |
my %opts=(); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
38 |
my $param_count = scalar(@ARGV); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
39 |
my (@assps, @builds, %variants, @templates, %flags, %insts, %zip, %builder); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
40 |
my $main; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
41 |
my $kmain; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
42 |
my $toroot; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
43 |
my $e32path; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
44 |
my $rombuildpath; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
45 |
my $euserdir; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
46 |
my $elocldir; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
47 |
my $kbdir; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
48 |
my $romname; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
49 |
my $single; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
50 |
my $smain; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
51 |
my $pagedCode; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
52 |
my $debug; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
53 |
my $quiet; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
54 |
my $drive; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
55 |
my $toolpath; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
56 |
my $epoc32path; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
57 |
my $epocroot; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
58 |
my $drive = ""; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
59 |
my $base_path; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
60 |
my $line; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
61 |
sub Variant_GetMacroHRHFile; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
62 |
sub is_RVCT_build($); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
63 |
sub parse_cfg; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
64 |
sub ASSPS; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
65 |
sub BUILDS; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
66 |
sub TEMPLATES; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
67 |
sub usage; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
68 |
sub rectify($$$); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
69 |
sub match_abbrev($$); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
70 |
sub check_opts; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
71 |
sub lookup_file_info($$); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
72 |
sub lookupSymbolInfo($$); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
73 |
sub parse_patch_data($$); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
74 |
sub gen_file; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
75 |
sub nix_fixes { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
76 |
# Fix case-sensitivity offenders for unix/linux environment. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
77 |
my $e32plat_pm = File::Spec->catfile($toolpath,"e32plat.pm"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
78 |
my $armutl_pm = File::Spec->catfile($toolpath,"armutl.pm"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
79 |
my $bpabiutl_pm = File::Spec->catfile($toolpath,"bpabiutl.pm"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
80 |
my $e32variant_pm = File::Spec->catfile($toolpath,"e32variant.pm"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
81 |
my $E32Plat_pm = File::Spec->catfile($toolpath,"E32Plat.pm"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
82 |
my $Armutl_pm = File::Spec->catfile($toolpath,"Armutl.pm"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
83 |
my $BPABIutl_pm = File::Spec->catfile($toolpath,"BPABIutl.pm"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
84 |
my $E32Variant_pm = File::Spec->catfile($toolpath,"E32Variant.pm"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
85 |
# Create symlinks for case-sensitively misnamed modules we need. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
86 |
unless ( -f $E32Plat_pm or -l $E32Plat_pm) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
87 |
symlink($e32plat_pm,$E32Plat_pm); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
88 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
89 |
unless ( -f $Armutl_pm or -l $Armutl_pm) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
90 |
symlink($armutl_pm,$Armutl_pm); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
91 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
92 |
unless ( -f $BPABIutl_pm or -l $BPABIutl_pm) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
93 |
symlink($bpabiutl_pm,$BPABIutl_pm); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
94 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
95 |
unless ( -f $E32Variant_pm or -l $E32Variant_pm) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
96 |
symlink($e32variant_pm,$E32Variant_pm); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
97 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
98 |
# Make uppercase symlinks to all .bsf files in /epoc32/tools |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
99 |
my @bsf_files = glob(File::Spec->catfile($toolpath,"*.bsf")); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
100 |
foreach my $bsf_file (@bsf_files) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
101 |
my ($vol,$dirs,$file) = File::Spec->splitpath($bsf_file); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
102 |
$file =~ /^(\S+)\.bsf/; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
103 |
my $uc_stem = uc($1); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
104 |
my $uc_bsf_file = File::Spec->catpath($vol,$dirs,($uc_stem .".bsf")); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
105 |
unless ( -f $uc_bsf_file or -l $uc_bsf_file ) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
106 |
symlink($bsf_file,$uc_bsf_file) or die "Can't symlink $bsf_file -> $uc_bsf_file. $!"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
107 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
108 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
109 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
110 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
111 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
112 |
BEGIN { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
113 |
$on_windows = $^O =~ /^MSWin/ ? 1 : 0; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
114 |
$epocroot = $ENV{EPOCROOT}; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
115 |
die "ERROR: Must set the EPOCROOT environment variable.\n" if (!defined($epocroot)); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
116 |
print "Environmental epocroot - >$epocroot<\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
117 |
$epocroot = abs_path($epocroot); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
118 |
die "ERROR: EPOCROOT must specify an existing directory.\n" if (!-d $epocroot); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
119 |
($epocroot_vol,$epocroot_dir,$epocroot_file) = File::Spec->splitpath($epocroot); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
120 |
$epocroot = File::Spec->catfile(($epocroot_vol,$epocroot_dir,$epocroot_file),undef); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
121 |
print "EPOCROOT=$ENV{EPOCROOT} resolved as \"$epocroot\"\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
122 |
$epoc32path = "${epocroot}epoc32"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
123 |
$toolpath = File::Spec->catfile($epoc32path,"tools"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
124 |
push @INC, $toolpath; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
125 |
nix_fixes(), unless ($on_windows); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
126 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
127 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
128 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
129 |
my $result = GetOptions (\%opts, "assp=s", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
130 |
"inst=s", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
131 |
"type=s", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
132 |
"variant=s", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
133 |
"build=s", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
134 |
"conf=s", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
135 |
"name=s", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
136 |
"modules=s", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
137 |
"xabi=s", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
138 |
"clean", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
139 |
"quiet", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
140 |
"help", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
141 |
"debug", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
142 |
"zip", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
143 |
"symbol", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
144 |
"noheader", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
145 |
"kerneltrace=s", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
146 |
"rombuilder=s", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
147 |
"define=s@", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
148 |
"rofsbuilder=s", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
149 |
"compress", |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
150 |
); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
151 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
152 |
$debug = $opts{debug}; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
153 |
$quiet = $opts{quiet} unless $debug; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
154 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
155 |
if ($on_windows) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
156 |
#The cpp needed a drive apparently |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
157 |
$drive = $epocroot_vol; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
158 |
$epoc32path = File::Spec->catpath($epocroot_vol,$epoc32path,undef); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
159 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
160 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
161 |
my $cwd = Cwd::cwd(); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
162 |
my ($vol,$dirs,$file) = File::Spec->splitpath($cwd); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
163 |
my @path_parts = File::Spec->splitdir($dirs); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
164 |
while(@path_parts[-1] ne "sf") { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
165 |
pop(@path_parts); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
166 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
167 |
$e32path = File::Spec->catdir((@path_parts,"os")); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
168 |
$base_path = $e32path; # ?? |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
169 |
$rombuildpath = File::Spec->catfile($e32path,"kernelhwsrv","kernel","eka","rombuild"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
170 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
171 |
use E32Plat; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
172 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
173 |
Plat_Init($toolpath . ($on_windows ? '\\' : '/')); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
174 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
175 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
176 |
if ($debug) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
177 |
print "epocroot = $epocroot\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
178 |
print "epoc32path = $epoc32path\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
179 |
print "drive = $drive\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
180 |
print "toolpath = $toolpath\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
181 |
print "toroot = $toroot\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
182 |
print "e32path = $e32path\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
183 |
print "rombuildpath = $rombuildpath\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
184 |
print "base_path = $base_path\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
185 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
186 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
187 |
my $cppflags="-P -undef -Wno-endif-labels -traditional -lang-c++ -nostdinc -iwithprefixbefore $rombuildpath -I $rombuildpath -I $drive$epoc32path "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
188 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
189 |
# Include variant hrh file defines when processing oby and ibys with cpp |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
190 |
# (Code copied from \\EPOC\master\cedar\generic\tools\romkit\tools\buildrom.pm - |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
191 |
# it used relative path to the working dir but we are using absolute path seems neater) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
192 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
193 |
my $variantMacroHRHFile = Variant_GetMacroHRHFile(); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
194 |
if($variantMacroHRHFile){ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
195 |
my ($ignore1,$dir,$file) = File::Spec->splitpath($variantMacroHRHFile); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
196 |
$cppflags .= " -I " . File::Spec->catpath($epocroot_vol,$dir,undef) . " -include " . File::Spec->catpath($epocroot_vol,$dir,$file); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
197 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
198 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
199 |
if($param_count == 0 || $opts{'help'} || !$result) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
200 |
usage(); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
201 |
exit 0; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
202 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
203 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
204 |
# Now check that the options we have make sense |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
205 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
206 |
checkopts(); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
207 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
208 |
if (!$quiet) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
209 |
print "Starting directory: ", Cwd::cwd(), "\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
210 |
print <<EOF; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
211 |
OPTIONS: |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
212 |
\tTYPE: $opts{'type'} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
213 |
\tVARIANT: $opts{'variant'} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
214 |
\tINSTRUCTION SET: $opts{'inst'} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
215 |
\tBUILD: $opts{'build'} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
216 |
\tMODULES: $opts{'modules'} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
217 |
EOF |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
218 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
219 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
220 |
#Pick out the type file |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
221 |
my $skel = "$opts{'type'}.oby"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
222 |
unless (-e $skel) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
223 |
$skel= File::Spec->catfile($rombuildpath,"$opts{'type'}.oby"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
224 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
225 |
unless (-e $skel) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
226 |
die "Can't find type file for type $opts{'type'}, $!"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
227 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
228 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
229 |
print "Using type file $skel\n" if !$quiet; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
230 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
231 |
# If clean is specified, zap all the image and .oby files |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
232 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
233 |
if($opts{'clean'}) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
234 |
unlink glob("*.img"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
235 |
unlink "rom.oby"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
236 |
unlink "rombuild.log"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
237 |
unlink glob("*.rofs"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
238 |
unlink "rofsbuild.log"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
239 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
240 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
241 |
# Now pre-pre-process this file to point to the right places for .ibys |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
242 |
# Unfortunately cpp won't do macro replacement in #include strings, so |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
243 |
# we have to do it by hand |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
244 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
245 |
my $k = $opts{kerneltrace}; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
246 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
247 |
if ($opts{assp}=~/^m(\S+)/i) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
248 |
$kbdir="kb$1"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
249 |
$kbdir="kbarm" if (lc $1 eq 'eig'); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
250 |
} else { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
251 |
$kbdir="kb$opts{assp}"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
252 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
253 |
$single=1 if ($opts{assp}=~/^s(\S+)/i); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
254 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
255 |
if ($single) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
256 |
# Hackery to cope with old compiler |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
257 |
if ($main eq 'MARM') { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
258 |
$smain='SARM'; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
259 |
} else { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
260 |
$smain="S$main"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
261 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
262 |
} else { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
263 |
$smain=$main; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
264 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
265 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
266 |
open(X, "$skel") || die "Can't open type file $skel, $!"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
267 |
open(OUT, "> rom1.tmp") || die "Can't open output file, $!"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
268 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
269 |
# First output the ROM name |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
270 |
print OUT "\nromname=$romname\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
271 |
while(<X>) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
272 |
unless ($on_windows) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
273 |
if (m/#include/) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
274 |
s|\\|\/|g; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
275 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
276 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
277 |
s/\#\#ASSP\#\#/$opts{'assp'}/; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
278 |
s/\#\#VARIANT\#\#/$opts{'variant'}/; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
279 |
s/\#\#BUILD\#\#/$opts{'build'}/; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
280 |
s/\#\#MAIN\#\#/$main/; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
281 |
s/\#\#KMAIN\#\#/$kmain/; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
282 |
s/\#\#E32PATH\#\#/$e32path/; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
283 |
s/\#\#BASEPATH\#\#/$base_path/; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
284 |
s/\#\#EUSERDIR\#\#/$euserdir/; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
285 |
s/\#\#ELOCLDIR\#\#/$elocldir/; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
286 |
s/\#\#KBDIR\#\#/$kbdir/; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
287 |
print OUT; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
288 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
289 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
290 |
close X; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
291 |
close OUT; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
292 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
293 |
# Use cpp to pull in include chains and replace defines |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
294 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
295 |
my $defines = ""; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
296 |
$defines .= "-D MAIN=$main "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
297 |
$defines .= "-D KMAIN=$kmain "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
298 |
$defines .= "-D EUSERDIR=$euserdir "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
299 |
$defines .= "-D ELOCLDIR=$elocldir "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
300 |
$defines .= "-D E32PATH=$e32path "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
301 |
$defines .= "-D BASEPATH=$base_path "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
302 |
$defines .= "-D EPOCROOT=$epocroot "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
303 |
$defines .= "-D SMAIN=$smain " if $smain; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
304 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
305 |
foreach (@{$opts{'define'}}) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
306 |
my @array=split(/,/,$_); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
307 |
foreach (@array) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
308 |
$defines.="-D ".uc $_." "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
309 |
$pagedCode = 1 if $_ eq 'PAGED_CODE'; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
310 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
311 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
312 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
313 |
if ($opts{'modules'}) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
314 |
my @array=split(/,/,$opts{'modules'}); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
315 |
foreach (@array) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
316 |
$defines.="-D ".uc $_." "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
317 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
318 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
319 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
320 |
foreach (keys %opts) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
321 |
next if ($_ eq 'name'); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
322 |
next if ($_ eq 'modules'); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
323 |
next if ($_ eq 'zip'); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
324 |
next if ($_ eq 'symbol'); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
325 |
next if ($_ eq 'kerneltrace'); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
326 |
next if ($_ eq 'define'); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
327 |
$defines.="-D ".uc $_."=".$opts{$_}." "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
328 |
$defines.="-D ".uc $_."_".$opts{$_}." "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
329 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
330 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
331 |
$defines.="-D SINGLE " if ($single); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
332 |
$defines.="-D RVCT " if (IsRVCTBuild($main)); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
333 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
334 |
print "Using defines $defines\n" if !$quiet; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
335 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
336 |
my $ret=1; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
337 |
my $cppcmd; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
338 |
if($opts{'build'}=~/^u/i and $on_windows) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
339 |
# Unicode build |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
340 |
$cppcmd = File::Spec->catfile($epoc32path,"gcc","bin","cpp") . " $cppflags -D UNICODE $defines rom1.tmp rom2.tmp"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
341 |
} else { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
342 |
$cppcmd = "cpp $cppflags $defines rom1.tmp rom2.tmp"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
343 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
344 |
print "Executing CPP:\n\t$cppcmd\n" if $debug; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
345 |
$ret = system($cppcmd); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
346 |
die "ERROR EXECUTING CPP\n" if $ret; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
347 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
348 |
# Purge remarks and blank lines. Complete source filenames and adapt them to host filesystem. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
349 |
rectify("rom2.tmp", "rom3.tmp", $k); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
350 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
351 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
352 |
# scan tmp file and generate auxiliary files, if required |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
353 |
open TMP, "rom3.tmp" or die("Can't open rom3.tmp\n"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
354 |
while ($line=<TMP>) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
355 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
356 |
if ($line=~/\s*gentestpaged/i) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
357 |
genfile("paged"); } |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
358 |
if ($line=~/\s*gentestnonpaged/i) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
359 |
genfile("nonpaged"); } |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
360 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
361 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
362 |
parsePatchData("rom3.tmp", "rom4.tmp"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
363 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
364 |
# break down the oby file into rom, rofs and extensions oby files |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
365 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
366 |
my $oby_index =0; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
367 |
my $dumpfile="rom.oby"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
368 |
my $rofs=0; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
369 |
my $extension=0; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
370 |
my $corerofsname=""; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
371 |
open DUMPFILE, ">$dumpfile" or die("Can't create $dumpfile\n"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
372 |
open TMP, "rom4.tmp" or die("Can't open rom4.tmp\n"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
373 |
while ($line=<TMP>) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
374 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
375 |
if ($line=~/^\s*rofsname/i) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
376 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
377 |
close DUMPFILE; # close rom.oby or previous rofs#/extension#.oby |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
378 |
$oby_index=1; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
379 |
$corerofsname=$line; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
380 |
$corerofsname =~ s/rofsname\s*=\s*//i; # save core rofs name |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
381 |
chomp($corerofsname); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
382 |
unlink $corerofsname || print "unable to delete $corerofsname"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
383 |
my $dumpfile="rofs".$rofs.".oby"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
384 |
$rofs++; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
385 |
open DUMPFILE, ">$dumpfile" or (close TMP and die("Can't create $dumpfile\n")); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
386 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
387 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
388 |
if ($line=~/^\s*coreimage/i) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
389 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
390 |
close DUMPFILE; # close rofs.oby |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
391 |
if ($oby_index ne 1) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
392 |
close TMP; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
393 |
die "Must specify ROFS image before ROFS extension\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
394 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
395 |
my $name=$line; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
396 |
$name =~ s/coreimage\s*=\s*//i; # read core rofs name |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
397 |
chomp($name); # remove trailing \n |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
398 |
if ($name ne $corerofsname) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
399 |
close TMP; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
400 |
die "This extension does not relate to previous ROFS\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
401 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
402 |
$oby_index=33; # open window |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
403 |
my $dumpfile="extension".$extension.".oby"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
404 |
$extension++; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
405 |
open DUMPFILE, ">$dumpfile" or (close TMP and die("Can't create $dumpfile\n")); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
406 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
407 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
408 |
if ($line=~/^\s*extensionrofs/i) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
409 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
410 |
$oby_index=3 if ($oby_index eq 2); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
411 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
412 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
413 |
if (($oby_index eq 2) && !($line=~/^\s*$/)) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
414 |
close TMP; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
415 |
die "Bad ROFS extension specification\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
416 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
417 |
print DUMPFILE $line; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
418 |
$oby_index=2 if ($oby_index eq 33); # close window |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
419 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
420 |
close DUMPFILE; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
421 |
close TMP; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
422 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
423 |
# 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 |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
424 |
# is automatically put into rofs |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
425 |
rename('rom.oby', 'rom4.tmp') || die; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
426 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
427 |
open(IN, 'rom4.tmp') || die "Can't read rom4.tmp"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
428 |
open(ROM, '>rom.oby') || die "Can't write to rom.oby"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
429 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
430 |
if ($oby_index >= 1 && $pagedCode) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
431 |
open(ROFS, '>>rofs0.oby') || die "Can't append to rofs0.oby"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
432 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
433 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
434 |
while ($line=<IN>) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
435 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
436 |
if(($oby_index >= 1) && ($pagedCode) && ($line=~/^\s*data\s*=/) && !($line=~/\.*paging_unmovable\s*/)) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
437 |
print ROFS $line; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
438 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
439 |
else { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
440 |
$line=~s/paging_unmovable//; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
441 |
print ROM $line; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
442 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
443 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
444 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
445 |
close IN; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
446 |
close ROM; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
447 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
448 |
if ($oby_index >= 1 && $pagedCode) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
449 |
close ROFS; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
450 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
451 |
unlink 'rom4.tmp'; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
452 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
453 |
my $flags; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
454 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
455 |
foreach (@{$flags{$opts{'assp'}}}) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
456 |
$flags.=" -$_"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
457 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
458 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
459 |
if($opts{'noheader'}) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
460 |
$flags.=" -no-header"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
461 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
462 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
463 |
if($opts{'compress'}) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
464 |
$flags.=" -compress"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
465 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
466 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
467 |
my $builder = $opts{'rombuilder'}; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
468 |
if ($on_windows) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
469 |
$builder = File::Spec->catfile($toolpath,"rombuild.exe") unless ($builder); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
470 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
471 |
else { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
472 |
$builder = File::Spec->catfile($toolpath,"rombuild") unless ($builder); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
473 |
unless ( -x $builder ) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
474 |
chmod 0755,$builder; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
475 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
476 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
477 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
478 |
print "$builder $flags -type-safe-link -S rom.oby 2>&1\n\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
479 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
480 |
open(Y, "$builder $flags -type-safe-link -S rom.oby 2>&1 | ") || |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
481 |
die "Can't start $builder command, $!"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
482 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
483 |
my $nerrors=0; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
484 |
my $nwarnings=0; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
485 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
486 |
while(<Y>) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
487 |
my $error=(/^error:/i); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
488 |
my $warning=(/^warning:/i); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
489 |
print if ($error or $warning or !$quiet); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
490 |
$nerrors++ if ($error); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
491 |
$nwarnings++ if ($warning); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
492 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
493 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
494 |
print "\nGenerated .oby file is rom.oby\n" if !$quiet; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
495 |
print "\nGenerated image file is $romname\n" if (!$nerrors); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
496 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
497 |
my$rerrors; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
498 |
my $rofsbuilder; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
499 |
if ($rofs) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
500 |
$rofsbuilder = $opts{'rofsbuilder'}; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
501 |
$rofsbuilder = "rofsbuild" unless ($rofsbuilder); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
502 |
for(my $i=0;$i<$rofs;++$i) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
503 |
print "Executing $rofsbuilder on main rofs\n" if !$quiet; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
504 |
my $image="rofs".$i.".oby"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
505 |
system("$rofsbuilder $image"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
506 |
if ($? != 0) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
507 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
508 |
print "$rofsbuilder $image returned $?\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
509 |
$rerrors++; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
510 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
511 |
rename "rofsbuild.log", "rofs$i.log" |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
512 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
513 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
514 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
515 |
if ($rofs and $extension) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
516 |
for(my $i=0;$i<$extension;++$i) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
517 |
print "Executing $rofsbuilder on extension rofs\n" if !$quiet; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
518 |
my $image="extension".$i.".oby"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
519 |
system("$rofsbuilder $image"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
520 |
if ($? != 0) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
521 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
522 |
print "$rofsbuilder $image returned $?\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
523 |
$rerrors++; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
524 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
525 |
rename "rofsbuild.log", "extension$i.log" |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
526 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
527 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
528 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
529 |
if ($nerrors) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
530 |
print "\n\n Errors found during $builder!!\n\nLeaving tmp files\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
531 |
} elsif ($nwarnings) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
532 |
print "\n\n Warnings during $builder!!\n\nLeaving tmp files\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
533 |
} elsif ($rerrors) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
534 |
print "\n\n Errors during $rofsbuilder!!\n\nLeaving tmp files\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
535 |
} else { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
536 |
unlink glob("*.tmp") if !$debug; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
537 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
538 |
if ($opts{zip} or $zip{$opts{assp}}) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
539 |
my $zipname=$romname; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
540 |
$zipname =~ s/\.(\w+)$/\.zip/i; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
541 |
unlink $zipname; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
542 |
system("zip $zipname $romname"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
543 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
544 |
if ($opts{symbol}) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
545 |
my $logname=$romname; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
546 |
$logname =~ s/\.(\w+)$/\.log/i; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
547 |
my $obyname=$romname; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
548 |
$obyname =~ s/\.(\w+)$/\.oby/i; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
549 |
unlink $logname; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
550 |
unlink $obyname; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
551 |
system("rename rombuild.log $logname"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
552 |
system("rename rom.oby $obyname"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
553 |
system("maksym $logname"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
554 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
555 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
556 |
#IMK if ($nerrors || $nwarnings || $rerrors) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
557 |
#IMK exit 4; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
558 |
#IMK} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
559 |
if ($nerrors || $rerrors) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
560 |
exit 4; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
561 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
562 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
563 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
564 |
exit 0; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
565 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
566 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
567 |
################################ Subroutines ################################## |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
568 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
569 |
sub usage { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
570 |
print <<EOT; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
571 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
572 |
rom <options> |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
573 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
574 |
Generate a rom image for the specified target, along with a rom.oby file |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
575 |
that can be fed to (a) rombuild to regenerate the image. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
576 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
577 |
The following options are required: |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
578 |
--variant=<variant> e.g. --variant=assabet |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
579 |
--inst=<instruction set> e.g. --inst=arm4 |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
580 |
--build=<build> e.g. --build=udeb |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
581 |
--type=<type of rom> |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
582 |
tshell for a text shell rom |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
583 |
e32tests for a rom with e32tests |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
584 |
f32tests for rom with f32tests |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
585 |
alltests for all the tests |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
586 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
587 |
The following are optional: |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
588 |
--name=<image name> Give image file specified name |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
589 |
--noheader Pass -no-header option on to rombuild |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
590 |
--help This help message. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
591 |
--clean Remove existing generated files first |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
592 |
--quiet Be less verbose |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
593 |
--modules=<comma separated list> List of additional modules for this ROM |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
594 |
--define=<comma separated list> List of CPP macros to define |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
595 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
596 |
Options may be specified as a short abbreviation |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
597 |
e.g. -b udeb instead of --build udeb |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
598 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
599 |
EOT |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
600 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
601 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
602 |
sub rectify($$$) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
603 |
my ($in, $out, $k) = @_; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
604 |
my $lastblank; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
605 |
my $lineno = 0; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
606 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
607 |
open(OUTPUT_FILE, "> $out") or die "Cannot open $out for output"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
608 |
open(INPUT_FILE, "< $in") or die "Cannot open for $in input"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
609 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
610 |
while ($line=<INPUT_FILE>) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
611 |
++$lineno; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
612 |
if ($line =~ /^\/\// ) {} # Ignore c++ commented lines. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
613 |
elsif ($line =~ /^\s*REM\s+/i) {} # Ignore REM commented lines. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
614 |
elsif ($line =~ /^\s*$/) { # Compress blank lines down to one |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
615 |
if($lastblank) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
616 |
# Do nothing |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
617 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
618 |
else { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
619 |
# This is the first blank line |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
620 |
$lastblank=1; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
621 |
print OUTPUT_FILE $line; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
622 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
623 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
624 |
else { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
625 |
# Not blank |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
626 |
$lastblank = 0; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
627 |
$line =~ s|##||g; # Delete "token-pasting" ops |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
628 |
$line =~ s|//.*$||g; # Delete trailing c++ comments |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
629 |
# prefix the epocroot dir to occurrences of 'epoc32' in all "KEYWORD=..." lines. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
630 |
$line =~ s/(=\s*)[\\\/]epoc32/\1${epocroot}epoc32/i; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
631 |
if (!defined($1)) { # Not a keyword line. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
632 |
if ($k and $line=~/^\s*kerneltrace/i) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
633 |
$line = "kerneltrace $k\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
634 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
635 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
636 |
elsif ($line =~ /^(\s*\S+\s*=\s*)(\S+)(\s*\S*)/) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
637 |
if ($on_windows) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
638 |
$line =~ s|\/|\\|g; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
639 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
640 |
else { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
641 |
my $keyword_part = $1; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
642 |
my $src = $2; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
643 |
my $dest = $3; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
644 |
$src =~ s|\\|\/|g; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
645 |
if ($dest) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
646 |
my ($vol,$dir,$leaf) = File::Spec->splitpath($src); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
647 |
my $lc_leaf = lc($leaf); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
648 |
my $lc_dir = lc($dir); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
649 |
$lc_dir =~ s/\/$//; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
650 |
my $fulldir = $lc_dir; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
651 |
$fulldir =~ s|//|/|g; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
652 |
unless ( -d $fulldir ) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
653 |
chomp $line; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
654 |
# Lower-cased source directory doesn't exist. Give up. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
655 |
die "Guessed source directory \"$fulldir\" does not exist for line $lineno: \"$line\"\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
656 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
657 |
if (($leaf eq $lc_leaf) or (-f "$fulldir\/$leaf")) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
658 |
# Using source directory lowercase and source filename as input. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
659 |
$line = "${keyword_part}${lc_dir}\/${leaf}${dest}\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
660 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
661 |
elsif ( -f "$fulldir\/$lc_leaf") { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
662 |
# Using source directory source filename both lowercase. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
663 |
$line = "${keyword_part}${lc_dir}\/${lc_leaf}${dest}\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
664 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
665 |
else { # Harder. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
666 |
my @dirlist; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
667 |
my $found = 0; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
668 |
if (!defined($dir_listings{$fulldir})) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
669 |
# Haven't got a cached dir listing for the source directory. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
670 |
# Make one now. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
671 |
@dirlist = glob("$fulldir.*"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
672 |
$dir_listings{$fulldir} = \@dirlist; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
673 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
674 |
@dirlist = @{dir_listings{$fulldir}}; # Get listing of source directory from cache. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
675 |
foreach my $file (@dirlist) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
676 |
# See if any file in the source directory case-insensitively matches the input source file. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
677 |
if ( (-f "$fulldir\/$file") and (lc($file) eq $lc_leaf)) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
678 |
$line = "${keyword_part}${lc_dir}\/${file}${dest}\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
679 |
$found = 1; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
680 |
last; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
681 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
682 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
683 |
unless ($found) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
684 |
die "Cannot find any file case-insensitively matching \"$fulldir\/$leaf\" at line $lineno: \"$line\"\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
685 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
686 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
687 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
688 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
689 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
690 |
print OUTPUT_FILE $line; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
691 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
692 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
693 |
close(INPUT_FILE); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
694 |
close(OUTPUT_FILE); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
695 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
696 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
697 |
sub IsRVCTBuild($) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
698 |
my ($build)=@_; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
699 |
return 1 if ($build =~ /^ARMV/i); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
700 |
my @customizations = Plat_Customizations('ARMV5'); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
701 |
return 1 if (grep /$build/, @customizations); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
702 |
return 0; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
703 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
704 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
705 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
706 |
sub IsSmp($) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
707 |
my %SmpKernelDirs=( |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
708 |
'x86smp' => 1, |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
709 |
'x86gmp' => 1, |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
710 |
'arm4smp' => 1, |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
711 |
'armv4smp' => 1, |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
712 |
'armv5smp' => 1 |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
713 |
); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
714 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
715 |
my ($kdir) = @_; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
716 |
return $SmpKernelDirs{lc $kdir}; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
717 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
718 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
719 |
sub checkopts { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
720 |
unless($opts{variant}) { die "No Variant specified"; } |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
721 |
$opts{'build'}="UDEB" unless($opts{'build'}); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
722 |
$opts{'type'}="TSHELL" unless($opts{'type'}); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
723 |
$opts{'inst'}="ARM4" unless($opts{'inst'}); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
724 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
725 |
my $additional; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
726 |
if ($opts{'modules'}) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
727 |
$additional="_".$opts{modules}; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
728 |
$additional=~ s/,/_/ig; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
729 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
730 |
my $build=lc $opts{build}; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
731 |
my $inst=uc $opts{'inst'}; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
732 |
if ($inst eq "MARM") { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
733 |
# Hackery to cope with old compiler |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
734 |
$main="MARM"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
735 |
$euserdir="MARM"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
736 |
$elocldir="MARM"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
737 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
738 |
else { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
739 |
$main=$inst; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
740 |
if ($main eq "THUMB") { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
741 |
$euserdir="ARMI"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
742 |
} else { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
743 |
$euserdir=$main; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
744 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
745 |
if ($main eq "ARMI" or $main eq "THUMB") { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
746 |
$elocldir="ARM4"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
747 |
} else { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
748 |
$elocldir=$main; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
749 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
750 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
751 |
$kmain = $opts{'xabi'}; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
752 |
$kmain = $main unless ($kmain); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
753 |
if (IsSmp($kmain)) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
754 |
$euserdir = $kmain; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
755 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
756 |
if ($opts{name}) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
757 |
$romname=$opts{name}; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
758 |
} else { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
759 |
$romname=uc($opts{variant}.$additional.$main); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
760 |
if ($build=~/^\w*DEB$/i) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
761 |
$romname.='D'; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
762 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
763 |
$romname.='.IMG'; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
764 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
765 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
766 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
767 |
sub lookupFileInfo($$) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
768 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
769 |
my ($infile, $fullname) = @_; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
770 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
771 |
my ($name, $ext) = $fullname =~ /^(.+)\.(\w+)$/ ? ($1, $2) : ($fullname, undef); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
772 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
773 |
open TMP, $infile or die("Can't open $infile\n"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
774 |
while(<TMP>) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
775 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
776 |
$_ = lc; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
777 |
if(/^\s*(\S+)\s*=\s*(\S+)\s+(\S+)/i) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
778 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
779 |
my ($src, $dest) = ($2, $3); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
780 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
781 |
my $destFullname = $dest =~ /^.*\\(.+)$/ ? $1 : $dest; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
782 |
my ($destName, $destExt) = $destFullname =~ /^(.+?)\.(\w+)$/ ? ($1, $2) : ($destFullname, undef); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
783 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
784 |
if ($destName eq $name && (!$ext || $ext eq $destExt)) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
785 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
786 |
close TMP; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
787 |
return ($src, $dest); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
788 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
789 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
790 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
791 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
792 |
die "patchdata: Can't find file $fullname\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
793 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
794 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
795 |
sub lookupSymbolInfo($$) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
796 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
797 |
my ($file, $name) = @_; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
798 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
799 |
open TMP, $file or die "Can't read $file\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
800 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
801 |
# ignore local symbols. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
802 |
while (<TMP>) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
803 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
804 |
last if /Global Symbols|Linker script and memory map/; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
805 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
806 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
807 |
my @return_values = (); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
808 |
my $line; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
809 |
while ($line = <TMP>) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
810 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
811 |
next if (index($line, $name) < 0); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
812 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
813 |
# RVCT 2.2 |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
814 |
# |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
815 |
# KHeapMinCellSize 0x0004e38c Data 4 mem.o(.constdata) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
816 |
# |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
817 |
if ($line =~ /^\s*(\S+)\s+(\S+)\s+data\s+(\S+)/i) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
818 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
819 |
my ($symbol, $addr, $size) = ($1, $2, $3); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
820 |
if ($symbol eq $name) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
821 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
822 |
@return_values = ($addr, $size); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
823 |
last; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
824 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
825 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
826 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
827 |
# This is a quick fix for RVCT 3.1, which uses the text "(EXPORTED)" |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
828 |
# in the map file. Here is an example: |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
829 |
# |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
830 |
# KHeapMinCellSize (EXPORTED) 0x0003d81c Data 4 mem.o(.constdata) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
831 |
# |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
832 |
elsif ($line =~ /^\s*(\S+)\s+\(exported\)\s+(\S+)\s+data\s+(\S+)/i) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
833 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
834 |
my ($symbol, $addr, $size) = ($1, $2, $3); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
835 |
if ($symbol eq $name) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
836 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
837 |
@return_values = ($addr, $size); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
838 |
last; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
839 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
840 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
841 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
842 |
# GCC 4.x map files |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
843 |
# 0x00114c68 KHeapMinCellSize |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
844 |
# 0x00114c6c KHeapShrinkHysRatio |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
845 |
# .rodata 0x00115130 0x968 M:/epoc32/build/kernel/c_99481fddbd6c6f58/_omap3530_ekern_exe/armv5/udeb/heap_hybrid.o |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
846 |
# |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
847 |
elsif ($line =~ /^.+\s+(0x\S+)\s+(\S+)/i) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
848 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
849 |
my ($addr, $symbol) = ($1, $2); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
850 |
if ($symbol eq $name) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
851 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
852 |
my $next_line = <TMP>; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
853 |
if ($next_line =~ /^.+\s+(0x\S+)\s+(\S+)/i) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
854 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
855 |
my $addr2 = $1; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
856 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
857 |
@return_values = ($addr, hex($addr2) - hex($addr)); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
858 |
last; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
859 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
860 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
861 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
862 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
863 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
864 |
close TMP; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
865 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
866 |
die "patchdata: Can't find symbol $name\n" if (scalar @return_values == 0); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
867 |
return @return_values; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
868 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
869 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
870 |
sub parsePatchData($$) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
871 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
872 |
my ($infile, $outfile) = @_; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
873 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
874 |
open IN, $infile or die("Can't read $infile\n"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
875 |
open OUT, ">$outfile" or die("Can't write $outfile\n"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
876 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
877 |
my $line; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
878 |
while($line = <IN>) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
879 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
880 |
if ($line =~ /^\s*patchdata\s+(.+?)\s*$/i) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
881 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
882 |
if ($1 !~ /(\S+)\s*@\s*(\S+)\s+(\S+)\s*$/) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
883 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
884 |
die "Bad patchdata command: $line\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
885 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
886 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
887 |
my ($file, $symbol, $value) = (lc $1, $2, $3); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
888 |
my ($srcFile, $destFile) = lookupFileInfo($infile, $file); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
889 |
my ($index, $elementSize) = (undef, undef); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
890 |
if ($symbol =~ s/:(\d+)\[(\d+)\]$//) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
891 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
892 |
($index, $elementSize) = ($2, $1); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
893 |
$index = hex($index) if $index =~ /^0x/i; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
894 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
895 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
896 |
if ($srcFile =~ /\\armv5(smp)?\\/i) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
897 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
898 |
my ($symbolAddr, $symbolSize) = lookupSymbolInfo("$srcFile.map", $symbol); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
899 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
900 |
my $max; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
901 |
if (defined($index)) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
902 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
903 |
my $bytes; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
904 |
$bytes = 1, $max = 0xff if $elementSize == 8; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
905 |
$bytes = 2, $max = 0xffff if $elementSize == 16; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
906 |
$bytes = 4, $max = 0xffffffff if $elementSize == 32; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
907 |
die("patchdata: invalid element size $elementSize: $line\n") unless defined($bytes); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
908 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
909 |
if ($bytes > 1 && (($symbolSize & ($bytes-1)) != 0)) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
910 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
911 |
die("patchdata: unexpected symbol size $symbolSize for array $symbol ($elementSize-bit elements)\n"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
912 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
913 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
914 |
if ($index >= int($symbolSize / $bytes)) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
915 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
916 |
die("patchdata: index $index out of bounds for $symbol of $symbolSize bytes ($elementSize-bit elements)\n"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
917 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
918 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
919 |
$symbolAddr = hex($symbolAddr) if $symbolAddr =~ /^0x/i; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
920 |
$symbolAddr += $index * $bytes; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
921 |
$symbolAddr = sprintf("0x%x", $symbolAddr); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
922 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
923 |
$symbolSize = $bytes; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
924 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
925 |
elsif ($symbolSize == 1) { $max = 0xff; } |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
926 |
elsif ($symbolSize == 2) { $max = 0xffff; } |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
927 |
elsif ($symbolSize == 4) { $max = 0xffffffff; } |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
928 |
else { die "patchdata: Unexpected symbol size $symbolSize for $symbol\n"; } |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
929 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
930 |
$value = hex($value) if $value =~ /^0x/i; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
931 |
if ($value > $max) |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
932 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
933 |
print("Warning: Value overflow of $symbol\n"); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
934 |
$value &= $max; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
935 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
936 |
$value = sprintf("0x%08x", $value); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
937 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
938 |
$line = "patchdata $destFile addr $symbolAddr $symbolSize $value\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
939 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
940 |
else |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
941 |
{ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
942 |
$line = ""; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
943 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
944 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
945 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
946 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
947 |
print OUT $line; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
948 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
949 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
950 |
close IN; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
951 |
close OUT; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
952 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
953 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
954 |
sub genfile { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
955 |
my $count=0; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
956 |
if($_[0] eq 'paged') { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
957 |
my $file='gentestpaged.txt'; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
958 |
unlink $file; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
959 |
open(OUTFILE, ">$file") or die "Can't open output file, $!"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
960 |
for(my $i=0;$i<50000;++$i) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
961 |
if(($i >5) && ($i % 40 ==0)) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
962 |
print OUTFILE "\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
963 |
$count++; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
964 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
965 |
if(($i+$count) % 5 ==0) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
966 |
print OUTFILE "SATOR "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
967 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
968 |
if(($i+$count) % 5 ==1) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
969 |
print OUTFILE "AREPO "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
970 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
971 |
if(($i+$count) % 5 ==2) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
972 |
print OUTFILE "TENET "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
973 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
974 |
if(($i+$count) % 5 ==3) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
975 |
print OUTFILE "OPERA "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
976 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
977 |
if(($i+$count) % 5 ==4) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
978 |
print OUTFILE "ROTAS "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
979 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
980 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
981 |
} else { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
982 |
my $file='gentestnonpaged.txt'; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
983 |
unlink $file; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
984 |
open(OUTFILE, ">$file") or die "Can't open output file, $!"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
985 |
for(my $i=0;$i<20000;++$i) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
986 |
if(($i >5) && ($i % 40 ==0)) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
987 |
print OUTFILE "\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
988 |
$count++; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
989 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
990 |
if(($i+$count) % 4 ==0) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
991 |
print OUTFILE "STEP "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
992 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
993 |
if(($i+$count) % 4 ==1) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
994 |
print OUTFILE "TIME "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
995 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
996 |
if(($i+$count) % 4 ==2) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
997 |
print OUTFILE "EMIT "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
998 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
999 |
if(($i+$count) % 4 ==3) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1000 |
print OUTFILE "PETS "; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1001 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1002 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1003 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1004 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1005 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1006 |
sub Variant_GetMacroHRHFile { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1007 |
my $cfgFile = File::Spec->catfile($toolpath,"variant","variant.cfg"); # default location |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1008 |
# save the volume, if any. |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1009 |
my ($cfg_vol,$ignore1,$ignore2) = File::Spec->splitpath($cfgFile); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1010 |
my $file; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1011 |
if(-e $cfgFile){ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1012 |
open(FILE, $cfgFile) || die "\nCould not open for reading: " . $cfgFile ."\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1013 |
while (<FILE>) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1014 |
# strip comments |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1015 |
s/^([^#]*)#.*$/$1/o; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1016 |
# skip blank lines |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1017 |
if (/^\s*$/o) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1018 |
next; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1019 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1020 |
# get the hrh file |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1021 |
if($_ =~ /\.hrh/xi){ |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1022 |
$file = $_; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1023 |
last; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1024 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1025 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1026 |
close FILE; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1027 |
die "\nERROR: No variant file specified in $cfgFile!\n" unless $file; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1028 |
$file =~ s/\s+//g; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1029 |
$file =~ s|\\|\/|g, unless($on_windows); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1030 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1031 |
if (File::Spec->file_name_is_absolute($file)) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1032 |
unless ( -f $file) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1033 |
$file = substr $file,1; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1034 |
$file = File::Spec->catfile($epocroot,$file); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1035 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1036 |
my ($vol,$dir,$leaf) = File::Spec->splitpath($file); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1037 |
die "\nERROR: Variant file specified in $cfgFile is not on the same volume as EPOCROOT\n", if (lc($vol) ne lc($cfg_vol)); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1038 |
#$file = File::Spec->catfile($dir,$file); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1039 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1040 |
else { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1041 |
$file = File::Spec->catfile($epoc32path,$file); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1042 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1043 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1044 |
unless(-e $file) { |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1045 |
die "\nERROR: $cfgFile specifies $file which doesn't exist!\n"; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1046 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1047 |
|
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1048 |
$file =~ s/\//\\/g, if ($on_windows); |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1049 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1050 |
return $file; |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1051 |
} |
d10c1f04b2be
Linux support for ROM building under Raptor
Mike Kinghan <mikek@symbian.org>
parents:
diff
changeset
|
1052 |