summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/NEWS1
-rw-r--r--perl-install/fs/any.pm33
-rw-r--r--perl-install/fs/partitioning_wizard.pm5
-rw-r--r--perl-install/fsedit.pm3
-rw-r--r--perl-install/install/NEWS1
-rw-r--r--perl-install/partition_table/gpt.pm3
6 files changed, 45 insertions, 1 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 82b22b5ee..113d43e1a 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,4 +1,5 @@
- diskdrake:
+ o add a GRUB_BIOS partitions if needed (mga#18656)
o MBR limit really is 2TiB, not 4, so use GPT for disks > 2TiB
Version 17.34 - 6 June 2016
diff --git a/perl-install/fs/any.pm b/perl-install/fs/any.pm
index 5471980d2..f8b314a34 100644
--- a/perl-install/fs/any.pm
+++ b/perl-install/fs/any.pm
@@ -3,9 +3,12 @@ package fs::any;
use diagnostics;
use strict;
+use c;
use common;
use fsedit;
+use fs::get;
use fs::mount_point;
+use fs::type;
use run_program;
sub get_hds {
@@ -71,6 +74,10 @@ sub check_hds_boot_and_root {
if (!fs::get::has_mntpoint("/boot/EFI", $all_hds)) {
die N("You must have a ESP FAT32 partition mounted in /boot/EFI");
}
+ } else {
+ if (is_boot_bios_part_needed($all_hds, $fstab)) {
+ die N("You must have a Boot BIOS partition");
+ }
}
}
@@ -136,4 +143,30 @@ sub getAvailableSpace_raw {
die "missing root partition";
}
+=head3 is_boot_bios_part_needed($fstab)
+
+Returns whether a Boot BIOS Partition is needed
+(aka the device holding /boot is GPT partitionned but doesn't already have one).
+
+=cut
+
+sub is_boot_bios_part_needed {
+ my ($all_hds, $fstab) = @_;
+ # failsafe:
+ return if is_uefi();
+ return if !@$fstab;
+ # mount point holding /boot:
+ my $root = fs::get::root($fstab, 1);
+ my $rootDev = $root->{rootDevice};
+ my $boot_hd;
+ if ($rootDev) {
+ # is it GPT?
+ return if c::get_disk_type($rootDev) ne 'gpt';
+ ($boot_hd) = find { $_->{device} eq $rootDev } fs::get::hds($all_hds);
+ }
+ # finally check if there's already a Boot BIOS Partition:
+ my @parts = map { partition_table::get_normal_parts($_) } $boot_hd || fs::get::hds($all_hds);
+ return !any { isBIOS_GRUB($_) } @parts;
+}
+
1;
diff --git a/perl-install/fs/partitioning_wizard.pm b/perl-install/fs/partitioning_wizard.pm
index d04a5bba3..82f03d24d 100644
--- a/perl-install/fs/partitioning_wizard.pm
+++ b/perl-install/fs/partitioning_wizard.pm
@@ -77,6 +77,11 @@ Then choose action ``Mount point'' and set it to `/'"), 1) or return;
$in->ask_warn('', N("You must have a ESP FAT32 partition mounted in /boot/EFI"));
$ok = '';
}
+ } else {
+ if (!fs::any::is_boot_bios_part_needed($all_hds, $fstab)) {
+ $in->ask_warn('', N("You must have a Boot BIOS partition"));
+ $ok = '';
+ }
}
} until $ok;
1;
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index 672cba2fd..8508391d5 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -55,6 +55,9 @@ 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) {
diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS
index b4038331d..024dcad34 100644
--- a/perl-install/install/NEWS
+++ b/perl-install/install/NEWS
@@ -5,6 +5,7 @@
o fix loadkeys in debug mode on tty1
o include cfdisk too
- partionning:
+ o add a GRUB_BIOS partitions if needed (mga#18656)
o MBR limit really is 2TiB, not 4, so use GPT for disks > 2TiB
Version 17.35.1 - 7 June 2016
diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm
index 472976377..7e1e9cd84 100644
--- a/perl-install/partition_table/gpt.pm
+++ b/perl-install/partition_table/gpt.pm
@@ -129,7 +129,8 @@ sub read_one {
if ($_->{flag} eq 'ESP') {
$_->{pt_type} = 0xef;
} elsif ($_->{flag} eq 'BIOS_GRUB') {
- $_->{pt_type} = $_->{flag};
+ $_->{fs_type} = $_->{flag}; # hack to prevent it to land in hd->{raw}
+ $_->{pt_type} = $_->{flag}; # hack...
} elsif ($_->{flag} eq 'LVM') {
$_->{pt_type} = 0x8e;
} elsif ($_->{flag} eq 'RAID') {