summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table/raw.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/partition_table/raw.pm')
-rw-r--r--perl-install/partition_table/raw.pm54
1 files changed, 53 insertions, 1 deletions
diff --git a/perl-install/partition_table/raw.pm b/perl-install/partition_table/raw.pm
index 8cbe0ec14..0e87cda9d 100644
--- a/perl-install/partition_table/raw.pm
+++ b/perl-install/partition_table/raw.pm
@@ -20,6 +20,7 @@ if_(arch() =~ /ppc/,
[ 'grub', 0, "\xEBH", 0x181, "GRUB \0" ],
[ 'lilo', 0x2, "LILO" ],
[ 'lilo', 0x6, "LILO" ],
+ [ 'lilo', 0x6 + 0x40, "LILO" ], #- when relocated in lilo's bsect_update(), variable "space" on paragraph boundary gives 0x40
[ 'grub', 0x6, "GRUB" ],
[ 'osbs', 0x2, "OSBS" ], #- http://www.prz.tu-berlin.de/~wolf/os-bs.html
[ 'pqmagic', 0xef, "PQV" ],
@@ -94,7 +95,58 @@ sub compute_nb_cylinders {
$geom->{cylinders} = int $totalsectors / $geom->{heads} / $geom->{sectors};
}
-sub get_geometry($) {
+sub keep_non_duplicates {
+ my %l;
+ $l{$_->[0]}++ foreach @_;
+ map { @$_ } grep { $l{$_->[0]} == 1 } @_;
+}
+
+sub get_geometries {
+ my (@hds) = @_;
+
+ @hds = grep {
+ if (my $h = get_geometry($_->{file})) {
+ add2hash_($_, $h);
+ 1;
+ } else {
+ log::l("An error occurred while getting the geometry of block device $_->{file}: $!");
+ 0;
+ }
+ } @hds;
+
+ my %id2hd = keep_non_duplicates(map {
+ my $F = openit($_) or log::l("failed to open device $_->{device}");
+ my $tmp;
+ if ($F && c::lseek_sector(fileno($F), 0, 0x1b8) && sysread($F, $tmp, 4)) {
+ [ sprintf('0x%08x', unpack('V', $tmp)), $_ ];
+ } else {
+ ();
+ }
+ } @hds);
+
+
+ my %id2edd = keep_non_duplicates(map { [ chomp_(cat_("$_/mbr_signature")), $_ ] } glob("/sys/firmware/edd/int13_dev*"));
+
+ log::l("id2hd: " . join(' ', map_each { "$::a=>$::b->{device}" } %id2hd));
+ log::l("id2edd: " . join(' ', map_each { "$::a=>$::b" } %id2edd));
+
+ foreach my $id (keys %id2hd) {
+ my $hd = $id2hd{$id};
+ $hd->{volume_id} = $id;
+
+ if (my $edd_dir = $id2edd{$id}) {
+ $hd->{bios_from_edd} = $1 if $edd_dir =~ /int13_dev(.*)/;
+
+ require partition_table::dos;
+ my $geom = partition_table::dos::geometry_from_edd($hd, $edd_dir);
+ $hd->{geom} = $geom if $geom;
+ }
+ }
+
+ @hds;
+}
+
+sub get_geometry {
my ($dev) = @_;
my $g = "";