summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-04-25 12:26:16 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-04-25 12:26:16 +0000
commit126777bc019a54afb4ec51299f2cf9d2841698aa (patch)
tree97f76e571902ead55ba138f1156a4b4f00b9b779 /perl-install/partition_table
parentf1f67448efc714873378dfeb8279fae68054a90a (diff)
downloaddrakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar
drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.gz
drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.bz2
drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.xz
drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.zip
re-sync after the big svn loss
Diffstat (limited to 'perl-install/partition_table')
-rw-r--r--perl-install/partition_table/dos.pm4
-rw-r--r--perl-install/partition_table/mac.pm4
-rw-r--r--perl-install/partition_table/raw.pm19
3 files changed, 19 insertions, 8 deletions
diff --git a/perl-install/partition_table/dos.pm b/perl-install/partition_table/dos.pm
index 90b86b9c2..0ac56d453 100644
--- a/perl-install/partition_table/dos.pm
+++ b/perl-install/partition_table/dos.pm
@@ -104,8 +104,8 @@ sub is_geometry_valid_for_the_partition_table {
my ($chs_start_v1, $chs_end_v1) = map { join(',', @$_) } CHS_from_part_rawCHS($_) or next;
my ($chs_start_v2, $chs_end_v2) = map { join(',', @$_) } map { [ min($_->[0], 1023), $_->[1], $_->[2] ] } CHS_from_part_linear($geom, $_);
if (!$no_log) {
- $chs_start_v1 eq $chs_start_v2 or log::l("check_geometry_using_the_partition_table failed for ($_->{device}, $_->{start}): $chs_start_v1 vs $chs_start_v2 with geometry " . geometry_to_string($geom));
- $chs_end_v1 eq $chs_end_v2 or log::l("check_geometry_using_the_partition_table failed for ($_->{device}, " . ($_->{start} + $_->{size} - 1) . "): $chs_end_v1 vs $chs_end_v2 with geometry " . geometry_to_string($geom));
+ $chs_start_v1 eq $chs_start_v2 or log::l("is_geometry_valid_for_the_partition_table failed for ($_->{device}, $_->{start}): $chs_start_v1 vs $chs_start_v2 with geometry " . geometry_to_string($geom));
+ $chs_end_v1 eq $chs_end_v2 or log::l("is_geometry_valid_for_the_partition_table failed for ($_->{device}, " . ($_->{start} + $_->{size} - 1) . "): $chs_end_v1 vs $chs_end_v2 with geometry " . geometry_to_string($geom));
}
$chs_start_v1 eq $chs_start_v2 && $chs_end_v1 eq $chs_end_v2;
} @{$hd->{primary}{normal} || []};
diff --git a/perl-install/partition_table/mac.pm b/perl-install/partition_table/mac.pm
index 93b9d0934..ef638f2b6 100644
--- a/perl-install/partition_table/mac.pm
+++ b/perl-install/partition_table/mac.pm
@@ -2,7 +2,7 @@ package partition_table::mac; # $Id$
use diagnostics;
#use strict; - fixed other PPC code to comply, but program bails on empty partition table - sbenedict
-use vars qw(@ISA $freepart $bootstrap_part $macos_part);
+use vars qw(@ISA $freepart $bootstrap_part $macos_part $new_bootstrap);
@ISA = qw(partition_table::raw);
@@ -296,7 +296,7 @@ sub write($$$;$) {
$_->{pFlags} = 0x33;
$_->{isBoot} = 1;
log::l("writing a bootstrap at /dev/$_->{device}");
- $install_steps_interactive::new_bootstrap = 1 if !(defined $bootstrap_part);
+ $new_bootstrap = 1 if !(defined $bootstrap_part);
$bootstrap_part = "/dev/" . $_->{device};
} elsif (isSwap($_)) {
$_->{pType} = "Apple_UNIX_SVR2";
diff --git a/perl-install/partition_table/raw.pm b/perl-install/partition_table/raw.pm
index 82d2c3cd9..35a67ebd8 100644
--- a/perl-install/partition_table/raw.pm
+++ b/perl-install/partition_table/raw.pm
@@ -18,8 +18,16 @@ if_(arch() =~ /ppc/,
[ 'grub', 0, "\xEBG", 0x17d, "stage1 \0" ],
[ 'grub', 0, "\xEBH", 0x17e, "stage1 \0" ],
[ 'grub', 0, "\xEBH", 0x18a, "stage1 \0" ],
- [ 'grub', 0, "\xEBH", 0x181, "GRUB \0" ],
- [ 'grub', 0, "\xEBH", 0x176, "GRUB \0" ], #- Conectiva 10
+ sub { my ($F) = @_;
+ #- standard grub has no good magic (Mandriva's grub is patched to have "GRUB" at offset 6)
+ #- so scanning a range of possible places where grub can have its string
+ #- 0x176 found on Conectiva 10
+ my ($min, $max, $magic) = (0x176, 0x181, "GRUB \0");
+ my $tmp;
+ sysseek($F, 0, 0) && sysread($F, $tmp, $max + length($magic)) or return;
+ substr($tmp, 0, 2) eq "\xEBH" or return;
+ index($tmp, $magic, $min) >= 0 && "grub";
+ },
[ 'lilo', 0x2, "LILO" ],
[ 'lilo', 0x6, "LILO" ],
[ 'lilo', 0x6 + 0x40, "LILO" ], #- when relocated in lilo's bsect_update(), variable "space" on paragraph boundary gives 0x40
@@ -94,7 +102,9 @@ sub adjustEnd($$) {
sub compute_nb_cylinders {
my ($geom, $totalsectors) = @_;
- $geom->{cylinders} = int $totalsectors / $geom->{heads} / $geom->{sectors};
+ if ($geom->{heads} && $geom->{sectors}) {
+ $geom->{cylinders} = int $totalsectors / $geom->{heads} / $geom->{sectors};
+ }
}
sub keep_non_duplicates {
@@ -158,6 +168,7 @@ sub get_geometry {
my %geom;
if (ioctl($F, c::HDIO_GETGEO(), $g)) {
@geom{qw(heads sectors cylinders start)} = unpack "CCSL", $g;
+ log::l("HDIO_GETGEO on $dev succeeded: heads=$geom{heads} sectors=$geom{sectors} cylinders=$geom{cylinders} start=$geom{start}");
$geom{totalcylinders} = $geom{cylinders};
#- $geom{cylinders} is no good (only a ushort, that means less than 2^16 => at best 512MB)
@@ -232,7 +243,7 @@ sub test_for_bad_drives {
my ($hd) = @_;
log::l("test_for_bad_drives($hd->{file})");
- my $sector = $hd->{geom}{sectors} - 1;
+ my $sector = $hd->{geom} ? $hd->{geom}{sectors} - 1 : 0;
sub error { die "$_[0] error: $_[1]" }