Mageia Bugzilla – Attachment 8957 Details for
Bug 20161
On non-GPT disk an empty partition is created when diskdrake does the partitioning, because it mistakenly thinks a BIOS boot partition is needed.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
Patch to allow the user to choose any disk for the BIOS boot partition
0010-Allow-a-BIOS-boot-partition-to-be-located-on-any-dis.patch (text/plain), 3.19 KB, created by
Martin Whitaker
on 2017-02-13 10:03:13 CET
(
hide
)
Description:
Patch to allow the user to choose any disk for the BIOS boot partition
Filename:
MIME Type:
Creator:
Martin Whitaker
Created:
2017-02-13 10:03:13 CET
Size:
3.19 KB
patch
obsolete
>From e3662f1c4b563d148b8d6e7e650e93eff89b6df1 Mon Sep 17 00:00:00 2001 >From: Martin Whitaker <mageia@martin-whitaker.me.uk> >Date: Sun, 5 Feb 2017 00:03:41 +0000 >Subject: [PATCH 10/14] Allow a BIOS boot partition to be located on any disk > (mga#20161). > >This relaxes the rules in fs::any::is_boot_bios_part_needed to allow >the BIOS boot partition to be located on any disk, not just the disk >containing the root partition. It also ensures that a BIOS boot >partition is never forcibly required in a system with non-GPT disks. > >diff --git a/perl-install/fs/any.pm b/perl-install/fs/any.pm >index b47ac9f..d2fea55 100644 >--- a/perl-install/fs/any.pm >+++ b/perl-install/fs/any.pm >@@ -77,7 +77,7 @@ sub check_hds_boot_and_root { > die N("You must have a ESP FAT32 partition mounted in /boot/EFI"); > } > } else { >- if (is_boot_bios_part_needed($all_hds, $fstab)) { >+ if (is_boot_bios_part_needed($all_hds)) { > die N("You must have a BIOS boot partition for non-UEFI GPT-partitioned disks. Please create one before continuing."); > } > } >@@ -145,31 +145,30 @@ sub getAvailableSpace_raw { > die "missing root partition"; > } > >-=head3 is_boot_bios_part_needed($all_hds, $fstab) >+=head3 is_boot_bios_part_needed($all_hds) > > Returns whether a Boot BIOS Partition is needed >-(aka the device holding /boot is GPT partitionned but doesn't already have one). >+ >+Returns true if all of the following are true: >+ - legacy boot (not UEFI) >+ - all disks are (or will be) GPT >+ - no disks have a BIOS boot partition > > =cut > > sub is_boot_bios_part_needed { >- my ($all_hds, $fstab) = @_; >- # failsafe: >+ my ($all_hds) = @_; >+ # never needed for UEFI boot > 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) { >- $rootDev = "/dev/" . $rootDev if $rootDev !~ m!/!; >- # is it GPT? >- return if c::get_disk_type($rootDev) ne 'gpt'; >- ($boot_hd) = find { $_->{device} eq $rootDev } fs::get::hds($all_hds); >+ # do we already have one? >+ my @parts = map { partition_table::get_normal_parts($_) } fs::get::hds($all_hds); >+ return if any { isBIOS_GRUB($_) } @parts; >+ # do we have any non-GPT disks? >+ foreach my $hd (@{$all_hds->{hds}}) { >+ my $type = $hd->{pt_table_type} || partition_table::default_type($hd); >+ return if $type ne 'gpt'; > } >- # 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; > } > > 1; >diff --git a/perl-install/fs/partitioning_wizard.pm b/perl-install/fs/partitioning_wizard.pm >index 6158dd4..eef836c 100644 >--- a/perl-install/fs/partitioning_wizard.pm >+++ b/perl-install/fs/partitioning_wizard.pm >@@ -78,7 +78,7 @@ Then choose action ``Mount point'' and set it to `/'"), 1) or return; > $ok = ''; > } > } else { >- if (fs::any::is_boot_bios_part_needed($all_hds, \@fstab)) { >+ if (fs::any::is_boot_bios_part_needed($all_hds)) { > $in->ask_warn('', N("You must have a BIOS boot partition for non-UEFI GPT-partitioned disks. Please create one before continuing.")); > $ok = ''; > } >-- >2.10.2 >
From e3662f1c4b563d148b8d6e7e650e93eff89b6df1 Mon Sep 17 00:00:00 2001 From: Martin Whitaker <mageia@martin-whitaker.me.uk> Date: Sun, 5 Feb 2017 00:03:41 +0000 Subject: [PATCH 10/14] Allow a BIOS boot partition to be located on any disk (mga#20161). This relaxes the rules in fs::any::is_boot_bios_part_needed to allow the BIOS boot partition to be located on any disk, not just the disk containing the root partition. It also ensures that a BIOS boot partition is never forcibly required in a system with non-GPT disks. diff --git a/perl-install/fs/any.pm b/perl-install/fs/any.pm index b47ac9f..d2fea55 100644 --- a/perl-install/fs/any.pm +++ b/perl-install/fs/any.pm @@ -77,7 +77,7 @@ sub check_hds_boot_and_root { die N("You must have a ESP FAT32 partition mounted in /boot/EFI"); } } else { - if (is_boot_bios_part_needed($all_hds, $fstab)) { + if (is_boot_bios_part_needed($all_hds)) { die N("You must have a BIOS boot partition for non-UEFI GPT-partitioned disks. Please create one before continuing."); } } @@ -145,31 +145,30 @@ sub getAvailableSpace_raw { die "missing root partition"; } -=head3 is_boot_bios_part_needed($all_hds, $fstab) +=head3 is_boot_bios_part_needed($all_hds) Returns whether a Boot BIOS Partition is needed -(aka the device holding /boot is GPT partitionned but doesn't already have one). + +Returns true if all of the following are true: + - legacy boot (not UEFI) + - all disks are (or will be) GPT + - no disks have a BIOS boot partition =cut sub is_boot_bios_part_needed { - my ($all_hds, $fstab) = @_; - # failsafe: + my ($all_hds) = @_; + # never needed for UEFI boot 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) { - $rootDev = "/dev/" . $rootDev if $rootDev !~ m!/!; - # is it GPT? - return if c::get_disk_type($rootDev) ne 'gpt'; - ($boot_hd) = find { $_->{device} eq $rootDev } fs::get::hds($all_hds); + # do we already have one? + my @parts = map { partition_table::get_normal_parts($_) } fs::get::hds($all_hds); + return if any { isBIOS_GRUB($_) } @parts; + # do we have any non-GPT disks? + foreach my $hd (@{$all_hds->{hds}}) { + my $type = $hd->{pt_table_type} || partition_table::default_type($hd); + return if $type ne 'gpt'; } - # 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; } 1; diff --git a/perl-install/fs/partitioning_wizard.pm b/perl-install/fs/partitioning_wizard.pm index 6158dd4..eef836c 100644 --- a/perl-install/fs/partitioning_wizard.pm +++ b/perl-install/fs/partitioning_wizard.pm @@ -78,7 +78,7 @@ Then choose action ``Mount point'' and set it to `/'"), 1) or return; $ok = ''; } } else { - if (fs::any::is_boot_bios_part_needed($all_hds, \@fstab)) { + if (fs::any::is_boot_bios_part_needed($all_hds)) { $in->ask_warn('', N("You must have a BIOS boot partition for non-UEFI GPT-partitioned disks. Please create one before continuing.")); $ok = ''; } -- 2.10.2
View Attachment As Raw
Actions:
View
Attachments on
bug 20161
:
8884
|
8885
|
8896
|
8897
|
8929
|
8930
|
8931
|
8932
|
8956
| 8957