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
|
|
|
|
|
|
|
# 27-Nov-2002 Dick Munroe (munroe@csworks.com) |
9
|
|
|
|
|
|
|
# Support LILO as a bootloader. |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# 03-Dec-2002 Dick Munroe (munroe@csworks.com) |
12
|
|
|
|
|
|
|
# Fix search for alternate boot loader configuration files. |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# 18-May-2003 Dick Munroe (munroe@csworks.com) |
15
|
|
|
|
|
|
|
# Make sure package variables can't leak. |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
# 19-May-2003 Dick Munroe (munroe@csworks.com) |
18
|
|
|
|
|
|
|
# Use Carp. |
19
|
|
|
|
|
|
|
# Isolate kif related classes in a KIF namespace. |
20
|
|
|
|
|
|
|
# |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package KIF::Build::ix86 ; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
518
|
use vars qw($VERSION @ISA) ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
59
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $VERSION = "1.02" ; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
1
|
|
5
|
use strict ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
1
|
|
4
|
use Carp ; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
44
|
|
31
|
1
|
|
|
1
|
|
4
|
use File::Copy ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
32
|
1
|
|
|
1
|
|
6
|
use KIF::Build ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
33
|
1
|
|
|
1
|
|
6
|
use KIF::Bootloader::grub ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
34
|
1
|
|
|
1
|
|
4
|
use KIF::Bootloader::lilo ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
562
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
our @ISA = qw(KIF::Build) ; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub new |
39
|
|
|
|
|
|
|
{ |
40
|
0
|
|
|
0
|
0
|
|
my $thePackage = shift ; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my $theObject = $thePackage->SUPER::new(@_) ; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# |
45
|
|
|
|
|
|
|
# Figure out what bootloader is in use by this system and |
46
|
|
|
|
|
|
|
# allocate an object to be used when (or if) the boot loader |
47
|
|
|
|
|
|
|
# configuration files are modified. |
48
|
|
|
|
|
|
|
# |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my @theBootloaderConfigurationFiles = ("/boot/grub/grub.conf", "/etc/lilo.conf") ; |
51
|
0
|
|
|
|
|
|
my $theBootloaderIndex ; |
52
|
|
|
|
|
|
|
my $theIndex ; |
53
|
0
|
|
|
|
|
|
my $theNumberOfBootloaders ; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
for ($theIndex = 0; $theIndex < scalar(@theBootloaderConfigurationFiles); $theIndex++) |
56
|
|
|
|
|
|
|
{ |
57
|
0
|
0
|
|
|
|
|
if (-e $theBootloaderConfigurationFiles[$theIndex]) |
58
|
|
|
|
|
|
|
{ |
59
|
0
|
|
|
|
|
|
$theNumberOfBootloaders++ ; |
60
|
0
|
|
|
|
|
|
$theBootloaderIndex = $theIndex ; |
61
|
|
|
|
|
|
|
} ; |
62
|
|
|
|
|
|
|
} ; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# |
65
|
|
|
|
|
|
|
# It is possible to use BOTH LILO and Grub on the same system |
66
|
|
|
|
|
|
|
# Check to see if LILO was used to boot this system and choose |
67
|
|
|
|
|
|
|
# LILO if necessary. |
68
|
|
|
|
|
|
|
# |
69
|
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
if ($theNumberOfBootloaders > 1) |
71
|
|
|
|
|
|
|
{ |
72
|
0
|
0
|
|
|
|
|
my $theFileHandle = new FileHandle "< /proc/cmdline" or croak "Can't open /proc/cmdline" ; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
$theBootloaderIndex = 0 ; |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
while ($_ = $theFileHandle->getline) |
77
|
|
|
|
|
|
|
{ |
78
|
0
|
0
|
|
|
|
|
if (m/BOOT_IMAGE/) |
79
|
|
|
|
|
|
|
{ |
80
|
0
|
|
|
|
|
|
$theBootloaderIndex = 1 ; |
81
|
0
|
|
|
|
|
|
last ; |
82
|
|
|
|
|
|
|
} ; |
83
|
|
|
|
|
|
|
} ; |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
undef $theFileHandle ; |
86
|
|
|
|
|
|
|
} ; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# |
89
|
|
|
|
|
|
|
# Now allocate an object used to manipulate that particular file. |
90
|
|
|
|
|
|
|
# |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
my $theBootloader ; |
93
|
|
|
|
|
|
|
|
94
|
0
|
0
|
|
|
|
|
$theBootloader = new KIF::Bootloader::grub if ($theBootloaderIndex == 0) ; |
95
|
0
|
0
|
|
|
|
|
$theBootloader = new KIF::Bootloader::lilo if ($theBootloaderIndex == 1) ; |
96
|
|
|
|
|
|
|
|
97
|
0
|
0
|
|
|
|
|
croak "No bootloader object allocated" if (!defined($theBootloader)) ; |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
$theObject->bootloader($theBootloader) ; |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
return $theObject ; |
102
|
|
|
|
|
|
|
} ; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub doKernel |
105
|
|
|
|
|
|
|
{ |
106
|
0
|
|
|
0
|
0
|
|
my $theObject = shift ; |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
$theObject->run('make bzImage') ; |
109
|
|
|
|
|
|
|
} ; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub doMovefiles |
112
|
|
|
|
|
|
|
{ |
113
|
0
|
|
|
0
|
0
|
|
my $theObject = shift ; |
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
$theObject->SUPER::doMovefiles() ; |
116
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
my $theBuildDirectory = $theObject->buildDirectory() ; |
118
|
0
|
|
|
|
|
|
my $theReleaseTag = $theObject->releaseTag() ; |
119
|
|
|
|
|
|
|
|
120
|
0
|
0
|
|
|
|
|
if (-e "$theBuildDirectory/arch/i386/boot/bzImage") |
121
|
|
|
|
|
|
|
{ |
122
|
0
|
0
|
0
|
|
|
|
copy("$theBuildDirectory/arch/i386/boot/bzImage", "/boot/vmlinuz-$theReleaseTag") or croak "Copy failed: $!" |
123
|
|
|
|
|
|
|
if (!$theObject->testFlag()) ; |
124
|
0
|
|
|
|
|
|
$theObject->_print("Copied $theBuildDirectory/arch/i386/boot/bzImage => /boot/vmlinuz-$theReleaseTag\n", 1) ; |
125
|
|
|
|
|
|
|
} ; |
126
|
|
|
|
|
|
|
} ; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1; |