summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2017-02-04 23:46:14 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2017-02-12 11:54:53 +0000
commit02ba0f311a04e3fe93985bb75b6e7e99c6315b73 (patch)
tree3a6b398284cd4d146839a77a5a144c970f357da4
parentaeccd33e13b5bd532fe08e5b3f1630935bbd9cfb (diff)
downloaddrakx-02ba0f311a04e3fe93985bb75b6e7e99c6315b73.tar
drakx-02ba0f311a04e3fe93985bb75b6e7e99c6315b73.tar.gz
drakx-02ba0f311a04e3fe93985bb75b6e7e99c6315b73.tar.bz2
drakx-02ba0f311a04e3fe93985bb75b6e7e99c6315b73.tar.xz
drakx-02ba0f311a04e3fe93985bb75b6e7e99c6315b73.zip
Fix auto-allocation of BIOS boot partitions (mga#20161, mga#19888).
This adds a specific subroutine, fsedit::auto_allocate_boot_bios_parts that detects if a BIOS boot partition is needed and allocates it if so. This allows us to relax the rules in fs::any::is_boot_bios_part_needed to allow the user to manually allocate the BIOS boot partition on a different device if they so wish. In the normal case that installation is confined to a single disk, this will allocate a single BIOS boot partition on that disk. In the rare case that installation is spread over multiple disks, it will allocate a BIOS boot partition on every disk. Given that the BIOS boot partitions are very small and that this is not a normal use case (see mga#16055), this seems an acceptable quirk - and does allow the user to then choose any disk when installing the boot loader.
-rw-r--r--perl-install/fsedit.pm21
-rw-r--r--perl-install/partition_table.pm1
2 files changed, 19 insertions, 3 deletions
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index 114039baf..03c73bd5c 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -56,9 +56,6 @@ sub init_mntpnt_suggestions {
if (!any { isESP($_) } @$fstab) {
$mntpoint = { mntpoint => "/boot/EFI", size => MB(100), pt_type => 0xef, ratio => 1, maxsize => MB(300) };
}
- } elsif (fs::any::is_boot_bios_part_needed($all_hds, $fstab)) {
- # suggests a Boot BIOS partition if none is present and if needed (aka !UEFI but disk is GPT partitionned)
- $mntpoint = { mntpoint => "", size => MB(1), pt_type => 'BIOS_BOOT', ratio => 1, maxsize => MB(2) };
}
return if !$mntpoint;
foreach (keys %suggestions) {
@@ -518,6 +515,8 @@ sub auto_allocate {
my ($all_hds, $o_suggestions, $o_target) = @_;
my $before = listlength(fs::get::fstab($all_hds));
+ auto_allocate_bios_boot_parts($all_hds, $o_target) if !is_uefi();
+
my $suggestions = $o_suggestions || $suggestions{simple};
allocatePartitions($all_hds, $suggestions, $o_target);
@@ -545,6 +544,22 @@ sub auto_allocate {
fs::mount_point::suggest_mount_points_always(\@fstab);
}
+sub auto_allocate_bios_boot_parts {
+ my ($all_hds, $o_hd) = @_;
+ foreach my $hd (@{$all_hds->{hds}}) {
+ # skip if not the selected device
+ next if $o_hd && ($o_hd->{device} ne $hd->{device});
+ # skip non-GPT disks
+ next if ($hd->{pt_table_type} || partition_table::default_type($hd)) ne 'gpt';
+ # check if a BIOS boot partition already exists
+ my @parts = map { partition_table::get_normal_parts($_) } $hd;
+ next if any { isBIOS_GRUB($_) } @parts;
+ # try to allocate a BIOS boot partition
+ $suggest = { mntpoint => "", size => MB(1), pt_type => 'BIOS_GRUB', ratio => 1, maxsize => MB(2) };
+ allocatePartitions($all_hds, [ $suggest ], $hd);
+ }
+}
+
sub auto_allocate_raids {
my ($all_hds, $suggestions) = @_;
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index f0cfc0ec2..4b357abb0 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -310,6 +310,7 @@ sub read_primary {
bless $hd, "partition_table::$_";
if ($hd->read_primary) {
log::l("found a $_ partition table on $hd->{file} at sector 0");
+ $hd->{pt_table_type} = $_ if $_ ne 'empty';
return 1;
}
}