From 091353cf267810593f5c72f014a8d9a6a0d0fbc9 Mon Sep 17 00:00:00 2001 From: Stew Benedict Date: Sat, 3 Mar 2001 01:48:49 +0000 Subject: *** empty log message *** --- perl-install/ChangeLog | 10 ++++ perl-install/bootloader.pm | 98 +++++++++++++++++++++++++++++++++++-- perl-install/commands.pm | 2 +- perl-install/install_interactive.pm | 7 ++- perl-install/install_steps.pm | 4 +- 5 files changed, 114 insertions(+), 7 deletions(-) (limited to 'perl-install') diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog index 4f28d157e..97154423d 100644 --- a/perl-install/ChangeLog +++ b/perl-install/ChangeLog @@ -1,3 +1,13 @@ +2001/03/02 stew + + * commands.pm - fdisk locks up machine on report_bug - replace with pdisk PPC + + * install_steps.pm - no bootfloppy, added yaboot.conf + + * install_interactive.pm - pdisk vs. fdisk + + * bootloader.pm - added code to create yaboot.conf, run ybin - vmlinux vs. vmlinuz + 2001/03/02 stew * c/smp.c -stanza for PPC 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 = ; + 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}; diff --git a/perl-install/commands.pm b/perl-install/commands.pm index 5cb0e5f5f..9415c7f05 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -579,7 +579,7 @@ sub report_bug { join '', map { chomp; "$_\n" } header("lspci"), detect_devices::stringlist(), header("pci_devices"), cat_("/proc/bus/pci/devices"), - header("fdisk"), `fdisk -l`, + header("fdisk"), arch() =~ /ppc/ ? `pdisk -l` : `fdisk -l`, header("scsi"), cat_("/proc/scsi/scsi"), header("lsmod"), cat_("/proc/modules"), header("cmdline"), cat_("/proc/cmdline"), diff --git a/perl-install/install_interactive.pm b/perl-install/install_interactive.pm index f38159fa5..789e557d1 100644 --- a/perl-install/install_interactive.pm +++ b/perl-install/install_interactive.pm @@ -172,7 +172,12 @@ When sure, press Ok.")) or return; print "\n" x 10, _("You can now partition %s. When you are done, don't forget to save using `w'", partition_table_raw::description($_)); print "\n\n"; - my $pid = fork or exec "fdisk", devices::make($_->{device}); + my $pid = 0; + if (arch() =~ /ppc/) { + $pid = fork or exec "pdisk", devices::make($_->{device}); + } else { + $pid = fork or exec "fdisk", devices::make($_->{device}); + } waitpid($pid, 0); } $o->leave_console; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 9700b1b5b..8270f663d 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -640,7 +640,7 @@ sub readBootloaderConfigBeforeInstall { my ($image, $v); require bootloader; - add2hash($o->{bootloader} ||= {}, bootloader::read($o->{prefix}, arch() =~ /sparc/ ? "/etc/silo.conf" : "/etc/lilo.conf")); + add2hash($o->{bootloader} ||= {}, bootloader::read($o->{prefix}, arch() =~ /sparc/ ? "/etc/silo.conf" : arch() =~ /ppc/ ? "/etc/yaboot.conf" : "/etc/lilo.conf")); #- since kernel or kernel-smp may not be upgraded, it should be checked #- if there is a need to update existing lilo.conf entries by following @@ -678,7 +678,9 @@ sub setupBootloaderBefore { #- propose the default fb mode for kernel fb, if aurora is installed too. bootloader::suggest($o->{prefix}, $o->{bootloader}, $o->{hds}, $o->{fstab}, install_any::kernelVersion($o), pkgs::packageFlagInstalled(pkgs::packageByName($o->{packages}, $::expert ? 'Aurora-wsMonitor' : 'Aurora-mwsMonitor') || {}) && $vga); + if (arch() !~ /ppc/) { bootloader::suggest_floppy($o->{bootloader}) if $o->{security} <= 3; + } $o->{bootloader}{keytable} ||= keyboard::keyboard2kmap($o->{keyboard}); } } -- cgit v1.2.1