sbsv1/abld/e32util/omapsig.pl
author Richard Taylor <richard.i.taylor@nokia.com>
Wed, 14 Jul 2010 14:50:01 +0100
changeset 616 24e4ef208cca
parent 606 30b30f9da0b7
permissions -rw-r--r--
sbs version 2.14.2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 599
diff changeset
     1
#!/usr/bin/perl
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     2
# e32toolp\e32util\omapsig.pl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     3
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     4
# Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     5
# All rights reserved.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     6
# This component and the accompanying materials are made available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     7
# under the terms of "Eclipse Public License v1.0"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     8
# which accompanies this distribution, and is available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     9
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    10
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    11
# Initial Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    12
# Nokia Corporation - initial contribution.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    13
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    14
# Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
# Description: 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
# Prepend OMAP boot signature to miniboot binaries
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
# Syntax:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
#	perl omapsig.pl <load address in hex> <input miniboot> <output minboot with sig>
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
use warnings;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
use IO::Handle;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
use File::Copy;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 599
diff changeset
    28
# Version
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 599
diff changeset
    29
my $MajorVersion = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 599
diff changeset
    30
my $MinorVersion = 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 599
diff changeset
    31
my $PatchVersion = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 599
diff changeset
    32
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
if (scalar(@ARGV)!=3) {
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 599
diff changeset
    34
	die "OMAPSIG signature tool V$MajorVersion.$MinorVersion.$PatchVersion\nperl omapsig.pl <load address in hex> <input miniboot> <output minboot with sig>\n";
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
my ($load_address, $infile, $outfile) = @ARGV;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
$load_address = pack('L', hex($load_address));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
my $filesize_in_bytes = -s $infile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
print "miniboot input ", $filesize_in_bytes, " bytes\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
$filesize_in_bytes = pack('L', $filesize_in_bytes);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
open my $in, "< $infile" or die "Can't open $infile for input: $!";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
binmode($in);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
open my $out, "> $outfile" or die "Can't open $outfile for output: $!";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
binmode($out);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
$out->autoflush(1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
print $out $filesize_in_bytes;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
print $out $load_address;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
copy($in, $out) or die "Couldn't copy from $infile to $outfile: $!";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
close $in;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
close $out;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
print "signed miniboot output ", -s $outfile, " bytes\n";
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 599
diff changeset
    62
exit;