line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Revision History: |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# 26-Nov-2002 Dick Munroe (munroe@csworks.com) |
6
|
|
|
|
|
|
|
# Initial Version Created. |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# 18-May-2003 Dick Munroe (munroe@csworks.com) |
9
|
|
|
|
|
|
|
# Make sure that package variables can't leak. |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# 19-May-2003 Dick Munroe (munroe@csworks.com) |
12
|
|
|
|
|
|
|
# Use Carp. |
13
|
|
|
|
|
|
|
# Isolate kif related classes in a KIF namespace. |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
package KIF::Build::alpha ; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
749
|
use vars qw($VERSION @ISA) ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
66
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = "1.03" ; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
5
|
use strict ; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
4
|
use Carp ; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
60
|
|
25
|
1
|
|
|
1
|
|
5
|
use File::Copy ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
26
|
1
|
|
|
1
|
|
5
|
use FileHandle ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
27
|
1
|
|
|
1
|
|
350
|
use KIF::Build ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
441
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our @ISA = qw(KIF::Build) ; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub new |
32
|
|
|
|
|
|
|
{ |
33
|
0
|
|
|
0
|
0
|
|
my $thePackage = shift ; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my $theObject = $thePackage->SUPER::new(@_) ; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# |
38
|
|
|
|
|
|
|
# Figure out what bootloader is in use by this system and |
39
|
|
|
|
|
|
|
# allocate an object to be used when (or if) the boot loader |
40
|
|
|
|
|
|
|
# configuration files are modified. |
41
|
|
|
|
|
|
|
# |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
my @theBootloaderConfigurationFiles = (["/etc/aboot.conf", "/boot/etc/aboot.conf"], "/etc/milo.conf") ; |
44
|
0
|
|
|
|
|
|
my $theBootloaderIndex ; |
45
|
|
|
|
|
|
|
my $theIndex ; |
46
|
0
|
|
|
|
|
|
my $theNumberOfBootloaders ; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
for ($theIndex = 0; $theIndex < scalar(@theBootloaderConfigurationFiles); $theIndex++) |
49
|
|
|
|
|
|
|
{ |
50
|
0
|
0
|
|
|
|
|
if (ref($theBootloaderConfigurationFiles[$theIndex]) eq "ARRAY") |
|
|
0
|
|
|
|
|
|
51
|
|
|
|
|
|
|
{ |
52
|
0
|
|
|
|
|
|
foreach (@{$_}) |
|
0
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
{ |
54
|
0
|
0
|
|
|
|
|
if (-e $_) |
55
|
|
|
|
|
|
|
{ |
56
|
0
|
|
|
|
|
|
$theNumberOfBootloaders++ ; |
57
|
0
|
|
|
|
|
|
$theBootloaderIndex = $theIndex ; |
58
|
0
|
|
|
|
|
|
last ; |
59
|
|
|
|
|
|
|
} ; |
60
|
|
|
|
|
|
|
} ; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
elsif (-e $_) |
63
|
|
|
|
|
|
|
{ |
64
|
0
|
|
|
|
|
|
$theNumberOfBootloaders++ ; |
65
|
0
|
|
|
|
|
|
$theBootloaderIndex = $theIndex ; |
66
|
|
|
|
|
|
|
} ; |
67
|
|
|
|
|
|
|
} ; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# |
70
|
|
|
|
|
|
|
# It is possible to use BOTH MILO and aboot on the same system |
71
|
|
|
|
|
|
|
# Check to see if MILO was used to boot this system and choose |
72
|
|
|
|
|
|
|
# MILO if necessary. |
73
|
|
|
|
|
|
|
# |
74
|
|
|
|
|
|
|
# FIXME this is actually NOT known to work. Can someone with |
75
|
|
|
|
|
|
|
# a MILO boot configuration check to see if this is actually |
76
|
|
|
|
|
|
|
# working? |
77
|
|
|
|
|
|
|
# |
78
|
|
|
|
|
|
|
|
79
|
0
|
0
|
|
|
|
|
if ($theNumberOfBootloaders > 1) |
80
|
|
|
|
|
|
|
{ |
81
|
0
|
0
|
|
|
|
|
my $theFileHandle = new FileHandle "< /proc/cmdline" or croak "Can't open /proc/cmdline" ; |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
$theBootloaderIndex = 0 ; |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
while ($_ = $theFileHandle->getline) |
86
|
|
|
|
|
|
|
{ |
87
|
0
|
0
|
|
|
|
|
if (m/BOOT_IMAGE/) |
88
|
|
|
|
|
|
|
{ |
89
|
0
|
|
|
|
|
|
$theBootloaderIndex = 1 ; |
90
|
0
|
|
|
|
|
|
last ; |
91
|
|
|
|
|
|
|
} ; |
92
|
|
|
|
|
|
|
} ; |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
undef $theFileHandle ; |
95
|
|
|
|
|
|
|
} ; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# |
98
|
|
|
|
|
|
|
# Now allocate an object used to manipulate that particular file. |
99
|
|
|
|
|
|
|
# |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
my $theBootloader ; |
102
|
|
|
|
|
|
|
|
103
|
0
|
0
|
|
|
|
|
$theBootloader = new Bootloader::aboot if ($theBootloaderIndex == 0) ; |
104
|
0
|
0
|
|
|
|
|
$theBootloader = new Bootloader::MILO if ($theBootloaderIndex == 1) ; |
105
|
|
|
|
|
|
|
|
106
|
0
|
0
|
|
|
|
|
croak "No bootloader object allocated" if (!defined($theBootloader)) ; |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
$theObject->bootloader($theBootloader) ; |
109
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
return $theObject ; |
111
|
|
|
|
|
|
|
} ; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub doMovefiles |
114
|
|
|
|
|
|
|
{ |
115
|
0
|
|
|
0
|
0
|
|
my $theObject = shift ; |
116
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
$theObject->SUPER::doMovefiles() ; |
118
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
my $theBuildDirectory = $theObject->buildDirectory() ; |
120
|
0
|
|
|
|
|
|
my $theReleaseTag = $theObject->releaseTag() ; |
121
|
|
|
|
|
|
|
|
122
|
0
|
0
|
|
|
|
|
if (-e "$theBuildDirectory/vmlinux") |
123
|
|
|
|
|
|
|
{ |
124
|
0
|
|
|
|
|
|
$theObject->run("gzip -c $theBuildDirectory/vmlinux > /boot/vmlinuz-$theReleaseTag") ; |
125
|
|
|
|
|
|
|
} ; |
126
|
|
|
|
|
|
|
} ; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub validate |
129
|
|
|
|
|
|
|
{ |
130
|
0
|
|
|
0
|
0
|
|
my $theObject = shift ; |
131
|
|
|
|
|
|
|
|
132
|
0
|
0
|
|
|
|
|
croak '/boot/vmlinuz must exist.' if (!-e '/boot/vmlinuz') ; |
133
|
|
|
|
|
|
|
|
134
|
0
|
0
|
|
|
|
|
croak '/boot/vmlinuz must be a link.' if (!-l '/boot/vmlinuz') ; |
135
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
$theObject->SUPER::validate() ; |
137
|
|
|
|
|
|
|
} ; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
1; |