From 4239729f41a697b744609b24993e756ec48a1303 Mon Sep 17 00:00:00 2001 From: Stew Benedict Date: Wed, 18 Jul 2001 15:54:47 +0000 Subject: roll back some changes from PPC beta - OldWorld vs NewWorld bootloader modem detection on ttyS0, new sound module in 2.4.4 --- perl-install/detect_devices.pm | 20 +++++++++++++++++--- perl-install/install_steps.pm | 6 +++++- perl-install/install_steps_interactive.pm | 24 ++++++++++++++++-------- perl-install/modules.pm | 4 ++-- perl-install/partition_table_mac.pm | 9 ++++++--- tools/serial_probe/serial.c | 8 ++++++++ 6 files changed, 54 insertions(+), 17 deletions(-) diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 4afe2a120..81a106098 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -54,9 +54,23 @@ sub IDEburners { grep { $_->{type} eq 'cdrom' && isBurner($_) } getIDE() } sub dvdroms { grep { $_->{type} eq 'cdrom' && isDvdDrive($_) } get() } sub get_mac_model() { - my $mac_model = cat_("/proc/device-tree/model") || die "Can't open /proc/device-tree/model"; - log::l("Mac model: $mac_model"); - $mac_model; + my $mac_model = cat_("/proc/device-tree/model") || die "Can't open /proc/device-tree/model"; + log::l("Mac model: $mac_model"); + $mac_model; +} + +sub get_mac_generation() { + my $generation = cat_("/proc/cpuinfo") || die "Can't open /proc/cpuinfo"; + my @genarray = split(/\n/, $generation); + my $count = 0; + while ($count <= @genarray) { + if ($genarray[$count] =~ /pmac-generation/) { + @genarray = split(/:/, $genarray[$count]); + return $genarray[1]; + } + $count++; + } + return "Unknown Generation"; } sub floppies() { diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 31f6e6856..3ee069165 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -151,7 +151,11 @@ sub doPartitionDisksAfter { $o->{fstab} = [ fsedit::get_fstab(@{$o->{hds}}, @{$o->{lvms}}, $o->{raid}) ]; fsedit::get_root_($o->{fstab}) or die "Oops, no root partition"; - + + if (arch() =~ /ppc/ && detect_devices::get_mac_generation =~ /NewWorld/) { + die "Need bootstrap partition to boot system!" if !(defined $partition_table_mac::bootstrap_part); + } + if (arch() =~ /ia64/ && !fsedit::has_mntpoint("/boot/efi", $o->{hds})) { die _("You must have a FAT partition mounted in /boot/efi"); } diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index f5ac81839..05b514622 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -336,12 +336,12 @@ Do you agree to loose all the partitions? _("DiskDrake failed to read correctly the partition table. Continue at your own risk!")); - if (arch() =~ /ppc/) { #- need to make bootstrap part if recommended install - thx Pixel ;^) + if (arch() =~ /ppc/ && detect_devices::get_mac_generation =~ /NewWorld/) { #- need to make bootstrap part if NewWorld machine - thx Pixel ;^) if (defined $partition_table_mac::bootstrap_part) { #- don't do anything if we've got the bootstrap setup #- otherwise, go ahead and create one somewhere in the drive free space } else { - if (defined $partition_table_mac::freepart_start && $partition_table_mac::freepart_size >= 1) { + if (defined $partition_table_mac::freepart_start && $partition_table_mac::freepart_size >= 1) { my ($hd) = $partition_table_mac::freepart_device; log::l("creating bootstrap partition on drive /dev/$hd->{device}, block $partition_table_mac::freepart_start"); $partition_table_mac::bootstrap_part = $partition_table_mac::freepart_part; @@ -349,7 +349,7 @@ Continue at your own risk!")); fsedit::add($hd, { start => $partition_table_mac::freepart_start, size => 1 << 11, type => 0x401, mntpoint => '' }, $o->{hds}, { force => 1, primaryOrExtended => 'Primary' }); $new_bootstrap = 1; } else { - die "no free space for 1MB bootstrap"; + $o->ask_warn('',_("No free space for 1MB bootstrap! Install will continue, but to boot your system, you'll need to create the bootstrap partition in DiskDrake")); } } } @@ -1065,6 +1065,14 @@ sub setupBootloaderBefore { #------------------------------------------------------------------------------ sub setupBootloader { my ($o, $more) = @_; + if (arch() =~ /ppc/) { + my $machtype = detect_devices::get_mac_generation(); + if ($machtype !~ /NewWorld/) { + $o->ask_warn('', _("You appear to have an OldWorld or Unknown\n machine, the yaboot bootloader will not work for you.\nThe install will continue, but you'll\n need to use BootX to boot your machine")); + log::l("OldWorld or Unknown Machine - no yaboot setup"); + return; + } + } if (arch() =~ /^alpha/) { $o->ask_yesorno('', _("Do you want to use aboot?"), 1) or return; catch_cdie { $o->SUPER::setupBootloader } sub { @@ -1083,11 +1091,11 @@ try to force installation even if that destroys the first partition?")); unlink "$o->{prefix}/tmp/.error"; die "already displayed"; } elsif (arch() =~ /ppc/) { - my $of_boot = cat_("$o->{prefix}/tmp/of_boot_dev") || die "Can't open $o->{prefix}/tmp/of_boot_dev"; - chop($of_boot); - unlink "$o->{prefix}/tmp/.error"; - $o->ask_warn('', _("You may need to change your Open Firmware boot-device to\n enable the bootloader. If you don't see the bootloader prompt at\n reboot, hold down Command-Option-O-F at reboot and enter:\n setenv boot-device $of_boot,\\\\:tbxi\n Then type: shut-down\nAt your next boot you should see the bootloader prompt.")); - } + my $of_boot = cat_("$o->{prefix}/tmp/of_boot_dev") || die "Can't open $o->{prefix}/tmp/of_boot_dev"; + chop($of_boot); + unlink "$o->{prefix}/tmp/.error"; + $o->ask_warn('', _("You may need to change your Open Firmware boot-device to\n enable the bootloader. If you don't see the bootloader prompt at\n reboot, hold down Command-Option-O-F at reboot and enter:\n setenv boot-device $of_boot,\\\\:tbxi\n Then type: shut-down\nAt your next boot you should see the bootloader prompt.")); + } } } diff --git a/perl-install/modules.pm b/perl-install/modules.pm index a9dcd2218..354665395 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -255,7 +255,7 @@ if_(arch() !~ /alpha/ && arch() !~ /sparc/, }], [ 'sound', { if_(arch() =~ /ppc/, - "dmasound" => "Amiga or PowerMac DMA sound", + "dmasound_awacs" => "Amiga or PowerMac DMA sound", ), if_(arch() !~ /^sparc/, "cmpci" => "C-Media Electronics CMI8338A CMI8338B CMI8738", @@ -717,7 +717,7 @@ sub load_thiskind { if_(arch() =~ /ppc/, if_($type =~ /scsi/, 'mesh', 'mac53c94'), if_($type =~ /net/, 'bmac', 'gmac', 'mace'), - if_($type =~ /sound/, 'dmasound'), + if_($type =~ /sound/, 'dmasound_awacs'), ), ); grep { diff --git a/perl-install/partition_table_mac.pm b/perl-install/partition_table_mac.pm index 52486a776..cf8678f9c 100644 --- a/perl-install/partition_table_mac.pm +++ b/perl-install/partition_table_mac.pm @@ -147,8 +147,8 @@ sub read($$) { $freepart_part = "/dev/" . $hd->{device} . ($i+1); log::l("free apple partition found on drive /dev/$freepart_device->{device}, block $freepart_start, size $freepart_size"); } - next; - #$h{type} = 0x0; + $h{type} = 0x0; + $h{pName} = 'Extra'; } elsif ($h{pType} =~ /^Apple_HFS/i) { $h{type} = 0x402; if (defined $macos_part) { @@ -293,7 +293,10 @@ sub write($$$;$) { $_->{pType} = "Apple_Bootstrap"; $_->{pName} = "bootstrap"; $_->{pFlags} = 0x33; - $_->{isBoot} = 1; + $_->{isBoot} = 1; + log::l("writing a bootstrap at /dev/$_->{device}"); + $install_steps_interactive::new_bootstrap = 1 if !(defined $partition_table_mac::bootstrap_part); + $bootstrap_part = "/dev/" . $_->{device}; } elsif ($_->{type} == 0x82) { $_->{pType} = "Apple_UNIX_SVR2"; $_->{pName} = "swap"; diff --git a/tools/serial_probe/serial.c b/tools/serial_probe/serial.c index ef575d6c3..14b315817 100644 --- a/tools/serial_probe/serial.c +++ b/tools/serial_probe/serial.c @@ -997,6 +997,11 @@ struct device *serialProbe(enum deviceClass probeClass, int probeFlags, maj = major(sb.st_rdev); if (maj != 4 && (maj < 136 || maj > 143)) { if (ioctl (fd, TIOCLINUX, &twelve) < 0) { + #ifdef __powerpc__ + // we could have gotten an error for another reason - like EINVAL + // skipping ttyS0 on PPC - which is where most modems reside + if (errno == ENOTTY) { + #endif if (ioctl (fd, TIOCGSERIAL, &si) >= 0) { if (si.line > 0) { console = 1 << si.line; @@ -1004,6 +1009,9 @@ struct device *serialProbe(enum deviceClass probeClass, int probeFlags, console = 0; } } else console = 0; + #ifdef __powerpc__ + } + #endif } } close(fd); -- cgit v1.2.1