sbsv1/abld/e32util/omapsig.pl
changeset 599 fa7a3cc6effd
child 606 30b30f9da0b7
equal deleted inserted replaced
596:9f25be3da657 599:fa7a3cc6effd
       
     1 # e32toolp\e32util\omapsig.pl
       
     2 #
       
     3 # Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     4 # All rights reserved.
       
     5 # This component and the accompanying materials are made available
       
     6 # under the terms of "Eclipse Public License v1.0"
       
     7 # which accompanies this distribution, and is available
       
     8 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9 #
       
    10 # Initial Contributors:
       
    11 # Nokia Corporation - initial contribution.
       
    12 #
       
    13 # Contributors:
       
    14 #
       
    15 # Description: 
       
    16 #
       
    17 # Prepend OMAP boot signature to miniboot binaries
       
    18 #
       
    19 # Syntax:
       
    20 #	perl omapsig.pl <load address in hex> <input miniboot> <output minboot with sig>
       
    21 #
       
    22 
       
    23 use warnings;
       
    24 use IO::Handle;
       
    25 use File::Copy;
       
    26 
       
    27 if (scalar(@ARGV)!=3) {
       
    28 	die "perl omapsig.pl <load address in hex> <input miniboot> <output minboot with sig>\n";
       
    29 }
       
    30 
       
    31 my ($load_address, $infile, $outfile) = @ARGV;
       
    32 
       
    33 $load_address = pack('L', hex($load_address));
       
    34 
       
    35 my $filesize_in_bytes = -s $infile;
       
    36 
       
    37 print "miniboot input ", $filesize_in_bytes, " bytes\n";
       
    38 
       
    39 $filesize_in_bytes = pack('L', $filesize_in_bytes);
       
    40 
       
    41 open my $in, "< $infile" or die "Can't open $infile for input: $!";
       
    42 binmode($in);
       
    43 open my $out, "> $outfile" or die "Can't open $outfile for output: $!";
       
    44 binmode($out);
       
    45 $out->autoflush(1);
       
    46 
       
    47 print $out $filesize_in_bytes;
       
    48 print $out $load_address;
       
    49 
       
    50 copy($in, $out) or die "Couldn't copy from $infile to $outfile: $!";
       
    51 
       
    52 close $in;
       
    53 close $out;
       
    54 
       
    55 print "signed miniboot output ", -s $outfile, " bytes\n";
       
    56 exit;