From 5f05559584f8d23c6e79b4ab197ba67ff6f43f49 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 27 Feb 2003 19:34:23 +0000 Subject: use lilo-like code for selecting mapdrive or not (it was buggy, always generating "map (0x81) (0x80)", even for hd2) --- perl-install/bootloader.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'perl-install') diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index c60e84f77..2181b5b6c 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -1014,13 +1014,16 @@ sub write_grub_config { print F "initrd ", $file2grub->($_->{initrd}) if $_->{initrd}; } else { print F "root ", dev2grub($_->{kernel_or_dev}, \%dev2bios); - if ($_->{kernel_or_dev} !~ /fd/) { - #- boot off the second drive, so reverse the BIOS maps - $_->{mapdrive} ||= { '0x80' => '0x81', '0x81' => '0x80' } - if $_->{table} && ($bootloader->{first_hd_device} || $bootloader->{boot}) !~ /$_->{table}/; - - map_each { print F "map ($::b) ($::a)" } %{$_->{mapdrive} || {}}; + if (my ($dev) = $_->{table} =~ m|/dev/(.*)|) { + if ($dev2bios{$dev} =~ /hd([1-9])/) { + #- boot off the nth drive, so reverse the BIOS maps + my $nb = sprintf("0x%x", 0x80 + $1); + $_->{mapdrive} ||= { '0x80' => $nb, $nb => '0x80' }; + } + } + if ($_->{mapdrive}) { + map_each { print F "map ($::b) ($::a)" } %{$_->{mapdrive}}; print F "makeactive"; } print F "chainloader +1"; -- cgit v1.2.1