summaryrefslogtreecommitdiffstats
path: root/perl-install/bootloader.pm
diff options
context:
space:
mode:
authorStew Benedict <stewb@mandriva.org>2001-03-03 01:48:49 +0000
committerStew Benedict <stewb@mandriva.org>2001-03-03 01:48:49 +0000
commit091353cf267810593f5c72f014a8d9a6a0d0fbc9 (patch)
treef650a50b38ca7a4244b8f39524f9d276655b3bab /perl-install/bootloader.pm
parent348d706236d2bf7e09bc8214b657faef0b0a30c5 (diff)
downloaddrakx-backup-do-not-use-091353cf267810593f5c72f014a8d9a6a0d0fbc9.tar
drakx-backup-do-not-use-091353cf267810593f5c72f014a8d9a6a0d0fbc9.tar.gz
drakx-backup-do-not-use-091353cf267810593f5c72f014a8d9a6a0d0fbc9.tar.bz2
drakx-backup-do-not-use-091353cf267810593f5c72f014a8d9a6a0d0fbc9.tar.xz
drakx-backup-do-not-use-091353cf267810593f5c72f014a8d9a6a0d0fbc9.zip
*** empty log message ***
Diffstat (limited to 'perl-install/bootloader.pm')
-rw-r--r--perl-install/bootloader.pm98
1 files changed, 94 insertions, 4 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index f30e664df..20ee4ae75 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -150,7 +150,11 @@ sub add_entry($$) {
sub add_kernel($$$$$) {
my ($prefix, $lilo, $kernelVersion, $specific, $v) = @_;
my $ext = $specific && "-$specific"; $specific eq 'hack' and $specific = '';
- my ($vmlinuz, $image, $initrdImage) = ("vmlinuz-$kernelVersion$specific", "/boot/vmlinuz$ext", "/boot/initrd$ext.img");
+ my $kname = "vmlinuz";
+ if (arch() =~ /ppc/) {
+ $kname = "vmlinux";
+ }
+ my ($vmlinuz, $image, $initrdImage) = ("$kname-$kernelVersion$specific", "/boot/$kname$ext", "/boot/initrd$ext.img");
-e "$prefix/boot/$vmlinuz" or log::l("unable to find kernel image $prefix/boot/$vmlinuz"), return;
{
my $f = "initrd-$kernelVersion$specific.img";
@@ -230,6 +234,16 @@ sub suggest {
root => "/dev/$root",
partition => $partition || 1,
boot => $root eq $boot && "/boot", #- this helps for getting default partition for silo.
+ } : arch =~ /ppc/ ?
+ {
+ defaultos => "linux",
+ default => "linux",
+ entries => [],
+ initmsg => "Welcome to Mandrake Linux!",
+ delay => 30, #- OpenFirmware delay
+ timeout => 50,
+ enableofboot => 1,
+ enablecdboot => 1,
} :
{
boot => "/dev/" . ($onmbr ? $hds->[0]{device} : fsedit::get_root($fstab, 'boot')->{device}),
@@ -317,6 +331,15 @@ wait %d seconds for default boot.
}) if $path && isSunOS($_) && type2name($_->{type}) =~ /root/i;
}
}
+ } elsif (arch() =~ /ppc/) {
+ #- if we identified a MacOS partition earlier - add it
+ if (defined $partition_table_mac'macos_part) {
+ add_entry($lilo->{entries},
+ {
+ label => "macos",
+ kernel_or_dev => $partition_table_mac'macos_part
+ });
+ }
} else {
#- search for dos (or windows) boot partition. Don't look in extended partitions!
my ($dos, $win) = 0, 0;
@@ -334,10 +357,11 @@ wait %d seconds for default boot.
}
}
my %l = (
+ yaboot => bool(arch() =~ /ppc/),
silo => bool(arch() =~ /sparc/),
- lilo => bool(arch() !~ /sparc/) && !isLoopback(fsedit::get_root($fstab)),
- grub => bool(arch() !~ /sparc/ && availableRamMB() < 800), #- don't use grub if more than 800MB
- loadlin => bool(arch() !~ /sparc/) && -e "/initrd/loopfs/lnx4win",
+ lilo => bool(arch() !~ /sparc|ppc/) && !isLoopback(fsedit::get_root($fstab)),
+ grub => bool(arch() !~ /sparc|ppc/ && availableRamMB() < 800), #- don't use grub if more than 800MB
+ loadlin => bool(arch() !~ /sparc|ppc/) && -e "/initrd/loopfs/lnx4win",
);
unless ($lilo->{methods}) {
$lilo->{methods} ||= { map { $_ => 1 } grep { $l{$_} } keys %l };
@@ -389,6 +413,72 @@ sub set_profiles {
}
+sub get_of_dev($) {
+ my ($unix_dev) = @_;
+ open(INPIPE, "/usr/local/sbin/ofpath $unix_dev|") || die "Couldn't find ofpath";
+ my $of_dev = <INPIPE>;
+ close(INPIPE);
+ chop($of_dev);
+ log::l("OF Device: $of_dev");
+ $of_dev;
+}
+
+sub install_yaboot($$$) {
+ my ($prefix, $lilo) = @_;
+ $lilo->{prompt} = $lilo->{timeout};
+
+ if ($lilo->{message}) {
+ local *F;
+ open F, ">$prefix/boot/message" and print F $lilo->{message} or $lilo->{message} = 0;
+ }
+ {
+ local *F;
+ local $\ = "\n";
+ my $f = "$prefix/etc/yaboot.conf";
+ open F, ">$f" or die "cannot create yaboot config file: $f";
+ log::l("writing yaboot config to $f");
+
+ print F "#yaboot.conf - generated by DrakX";
+ print F "init-message=\"\\n$lilo->{initmsg}\\n\"" if $lilo->{initmsg};
+
+ if ($lilo->{boot}) {
+ print F "boot=$lilo->{boot}";
+ my $of_dev = get_of_dev($lilo->{boot});
+ print F "ofboot=$of_dev";
+ } else {
+ die "no bootstrap partition defined."
+ }
+
+ $lilo->{$_} and print F "$_=$lilo->{$_}" foreach qw(delay timeout);
+ print F "install=/usr/local/lib/yaboot/yaboot";
+ print F "magicboot=/usr/local/lib/yaboot/ofboot";
+ $lilo->{$_} and print F $_ foreach qw(enablecdboot enableofboot);
+ $lilo->{$_} and print F "$_=$lilo->{$_}" foreach qw(defaultos default);
+ print F "nonvram";
+
+ foreach (@{$lilo->{entries}}) { #- at the moment we only automatically do the 1st HD
+
+ if ($_->{type} eq "image") {
+ my $of_dev = get_of_dev($_->{root});
+ print F "$_->{type}=$of_dev,$_->{kernel_or_dev}";
+ print F "\tlabel=", substr($_->{label}, 0, 15); #- lilo doesn't handle more than 15 char long labels
+ print F "\troot=$_->{root}";
+ print F "\tinitrd=$_->{initrd}" if $_->{initrd};
+ print F "\tappend=\"$_->{append}\"" if $_->{append};
+ print F "\tread-write" if $_->{'read-write'};
+ print F "\tread-only" if !$_->{'read-write'};
+ } else {
+ my $of_dev = get_of_dev($_->{kernel_or_dev});
+ print F "$_->{label}=$of_dev";
+ }
+ }
+ }
+ log::l("Installing boot loader...");
+ $::testing and return;
+ run_program::rooted($prefix, "/sbin/ybin", "2>", "/tmp/.error") or die "ybin failed";
+ unlink "$prefix/tmp/.error";
+}
+
sub install_silo($$$) {
my ($prefix, $silo, $fstab) = @_;
my $boot = fsedit::get_root($fstab, 'boot')->{device};