blob: d373fedbe3dc3cb4aa3d5911a3b732231d4613e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
#!/usr/bin/perl
################################################################################
# change log:
# n/a andrewg 09/07/06 Created
# eggler 2009/04/06 added option file parm
# thallet 2012/08/09 Modified to use with OCC
################################################################################
################################################################################
#
# The purpose of this script is to take as input a occ binary file and convert
# it to a lid which can then be checked into cmvc.
#
################################################################################
use strict;
use warnings;
# ---- MODULES ---- #
use Getopt::Long;
use File::Path;
use File::Basename;
# ---- CONSTANTS ---- #
# ---- GLOBALS ---- #
my $g_debug = 0;
################################################################################
#
# Main program
#
################################################################################
exit(main());
################################################################################
#
# Main
#
################################################################################
sub main
{
my $l_help = '';
my $l_input_bin;
my $l_lid_name;
my $l_update_bin;
my $optionsfile;
if (!GetOptions('h|help' => \$l_help,
'd|debug' => \$g_debug,
'i|input_binary=s'=> \$l_input_bin,
'l|lid_name=s' => \$l_lid_name,
'o|optionsfile=s' => \$optionsfile))
{
return -1;
}
#-- Handle the usage statement immediately.
if ($l_help)
{
usageInfo();
return 0;
}
if((!defined($l_input_bin)) || (!defined($l_lid_name)))
{
print "Must provide both --input_binary and --lid_name!\n";
return -1;
}
if(! -e $l_input_bin)
{
print "Input binary file, $l_input_bin, does not exist!\n";
return -1;
}
# We should now have some file called update_bin_* - lets rename it
system ("cp $l_input_bin occ_update.bin");
# Make sure that the extucode dir exists
if( !(-d $ENV{'sb'}."/extucode") )
{
print "Directory ".$ENV{'sb'}."/extucode not found....Creating\n";
system("mkdir " .$ENV{'sb'}."/extucode");
}
# Now lets run the build scripts
system ("apyfipshdr -r ". $ENV{'bb'} . "/src/lidhdr/$l_lid_name.lidhdr -l ./occ_update.bin -o " . $ENV{'sb'} . "/extucode/$l_lid_name.fips");
system("apyruhhdr -r " . $ENV{'bb'} . "/src/lidhdr/$l_lid_name.lidhdr -l " . $ENV{'sb'} . "/extucode/$l_lid_name.fips");
return(0);
}
################################################################################
#
# usageInfo
#
################################################################################
sub usageInfo
{
print<<EOF;
Usage:
tpmdgenlid.pl -i <absolute bin file> -l <lid name>
OPERATIONS:
-h, -H, --help : Print this summary of options and exit.
-d, --debug : Displays additional output
-i --input_binary : Input binary file
-l --lid_name : Lid name to output to w/o lid suffix (i.e. -l 81e00430)
EOF
}
|