summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2016-06-08 22:48:20 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2016-06-11 09:39:32 +0200
commit83565d0739e5746ea02c210106a2d1f1d1477eda (patch)
tree26f2c7d16ac0db03877aba5f03c09909d22048e6
parente07551ebb52e93af424de2d3a2bf07b01c94de92 (diff)
downloaddrakx-83565d0739e5746ea02c210106a2d1f1d1477eda.tar
drakx-83565d0739e5746ea02c210106a2d1f1d1477eda.tar.gz
drakx-83565d0739e5746ea02c210106a2d1f1d1477eda.tar.bz2
drakx-83565d0739e5746ea02c210106a2d1f1d1477eda.tar.xz
drakx-83565d0739e5746ea02c210106a2d1f1d1477eda.zip
detect GRUB_BIOS partitions (mga#18656)
let's abuse ->{pt_type} for tracking such partitions
-rwxr-xr-xperl-install/c/stuff.xs.pl4
-rw-r--r--perl-install/fs/type.pm8
-rw-r--r--perl-install/partition_table/gpt.pm4
3 files changed, 13 insertions, 3 deletions
diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl
index 72af65f27..a0fffc6c7 100755
--- a/perl-install/c/stuff.xs.pl
+++ b/perl-install/c/stuff.xs.pl
@@ -122,6 +122,8 @@ PedPartitionFlag string_to_pedpartflag(char*type) {
PedPartitionFlag flag = 0;
if (!strcmp(type, "ESP")) {
flag = PED_PARTITION_ESP;
+ } else if (!strcmp(type, "BIOS_GRUB")) {
+ flag = PED_PARTITION_BIOS_GRUB;
} else if (!strcmp(type, "LVM")) {
flag = PED_PARTITION_LVM;
} else if (!strcmp(type, "RAID")) {
@@ -687,6 +689,8 @@ get_disk_partitions(char * device_path)
char *flag = "";
if (ped_partition_get_flag(part, PED_PARTITION_ESP)) {
flag = "ESP";
+ } else if (ped_partition_get_flag(part, PED_PARTITION_BIOS_GRUB)) {
+ flag = "BIOS_GRUB";
} else if (ped_partition_get_flag(part, PED_PARTITION_LVM)) {
flag = "LVM";
} else if (ped_partition_get_flag(part, PED_PARTITION_RAID)) {
diff --git a/perl-install/fs/type.pm b/perl-install/fs/type.pm
index ef296fa53..eeb81fec7 100644
--- a/perl-install/fs/type.pm
+++ b/perl-install/fs/type.pm
@@ -9,7 +9,7 @@ use devices;
our @ISA = qw(Exporter);
our @EXPORT = qw(
- isEmpty isExtended isTrueLocalFS isTrueFS isDos isSwap isOtherAvailableFS isRawLVM isRawRAID isRawLUKS isRAID isLVM isLUKS isMountableRW isNonMountable isPartOfLVM isPartOfRAID isPartOfLoopback isLoopback isMounted isBusy isSpecial isApple isAppleBootstrap isESP isFat_or_NTFS isnormal_Fat_or_NTFS isRecovery
+ isEmpty isExtended isTrueLocalFS isTrueFS isDos isSwap isOtherAvailableFS isRawLVM isRawRAID isRawLUKS isRAID isLVM isLUKS isMountableRW isNonMountable isPartOfLVM isPartOfRAID isPartOfLoopback isLoopback isMounted isBusy isSpecial isApple isAppleBootstrap isBIOS_GRUB isESP isFat_or_NTFS isnormal_Fat_or_NTFS isRecovery
maybeFormatted set_isFormatted defaultFS
);
@@ -24,8 +24,9 @@ my (%type_name2pt_type, %type_name2fs_type, %fs_type2pt_type, %pt_type2fs_type,
0x83 => 'ext3', 'Journalised FS: ext3',
0x83 => 'ext4', 'Journalised FS: ext4',
0x83 => 'btrfs', 'Journalised FS: Btrfs',
-if_(is_uefi(),
- 0xef => 'vfat', 'EFI System Partition',
+(is_uefi() ?
+ (0xef => 'vfat', 'EFI System Partition') :
+ ('BIOS_GRUB' => '', 'BIOS boot partition'),
),
if_(arch() =~ /i.86|x86_64/,
0x83 => 'xfs', 'Journalised FS: XFS',
@@ -291,6 +292,7 @@ sub defaultFS() { 'ext4' }
sub true_local_fs_types() { qw(btrfs ext3 ext2 ext4 reiserfs xfs jfs) }
sub isEmpty { !$_[0]{fs_type} && $_[0]{pt_type} == 0 }
+sub isBIOS_GRUB { $_[0]{pt_type} == 'BIOS_GRUB' }
sub isESP { $_[0]{pt_type} == 0xef && $_[0]{fs_type} eq 'vfat' }
sub isExtended { $_[0]{pt_type} == 5 || $_[0]{pt_type} == 0xf || $_[0]{pt_type} == 0x85 }
sub isRawLVM { $_[0]{pt_type} == 0x8e || $_[0]{type_name} eq 'Linux Logical Volume Manager' }
diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm
index 4a277f7b6..472976377 100644
--- a/perl-install/partition_table/gpt.pm
+++ b/perl-install/partition_table/gpt.pm
@@ -128,6 +128,8 @@ sub read_one {
# fix detecting ESP (special case are they're detected through pt_type):
if ($_->{flag} eq 'ESP') {
$_->{pt_type} = 0xef;
+ } elsif ($_->{flag} eq 'BIOS_GRUB') {
+ $_->{pt_type} = $_->{flag};
} elsif ($_->{flag} eq 'LVM') {
$_->{pt_type} = 0x8e;
} elsif ($_->{flag} eq 'RAID') {
@@ -169,6 +171,8 @@ sub write {
my $flag;
if (isESP($part)) {
$flag = 'ESP';
+ } elsif (isBIOS_GRUB($part)) {
+ $flag = 'BIOS_GRUB';
} elsif (isRawLVM($part)) {
$flag = 'LVM';
} elsif (isRawRAID($part)) {