equal
deleted
inserted
replaced
|
1 # e32toolp\e32util\omapsig.pl |
|
2 # |
|
3 # Copyright (c) 2008 Symbian Ltd. All rights reserved. |
|
4 # |
|
5 # Prepend OMAP boot signature to miniboot binaries |
|
6 # |
|
7 # Syntax: |
|
8 # perl omapsig.pl <load address in hex> <input miniboot> <output minboot with sig> |
|
9 # |
|
10 |
|
11 use warnings; |
|
12 use strict; |
|
13 use IO::Handle; |
|
14 use File::Copy; |
|
15 |
|
16 if (scalar(@ARGV)!=3) { |
|
17 die "perl omapsig.pl <load address in hex> <input miniboot> <output minboot with sig>\n"; |
|
18 } |
|
19 |
|
20 my ($load_address, $infile, $outfile) = @ARGV; |
|
21 |
|
22 $load_address = pack('L', hex($load_address)); |
|
23 |
|
24 my $filesize_in_bytes = -s $infile; |
|
25 |
|
26 print "miniboot input ", $filesize_in_bytes, " bytes\n"; |
|
27 |
|
28 $filesize_in_bytes = pack('L', $filesize_in_bytes); |
|
29 |
|
30 open my $in, "< $infile" or die "Can't open $infile for input: $!"; |
|
31 binmode($in); |
|
32 open my $out, "> $outfile" or die "Can't open $outfile for output: $!"; |
|
33 binmode($out); |
|
34 $out->autoflush(1); |
|
35 |
|
36 print $out $filesize_in_bytes; |
|
37 print $out $load_address; |
|
38 |
|
39 copy($in, $out) or die "Couldn't copy from $infile to $outfile: $!"; |
|
40 |
|
41 close $in; |
|
42 close $out; |
|
43 |
|
44 print "signed miniboot output ", -s $outfile, " bytes\n"; |
|
45 exit; |