Accepting request 519106 from home:sparschauer:branches:Base:System

- Drop using deprecated configure option "--disable-Werror"
- Drop (SUSE specific) support for hybrid pMBR (gpt_sync_mbr
  label) (fate#317849, bsc#1041322)
  - remove: parted-gpt-mbr-sync.patch
  - remove: libparted-ppc-prepboot-in-syncmbr.patch
  - remove: parted-workaround-windows7-gpt-implementation.patch
  - refresh patches
- libparted: Fix starting CHS in protective MBR (bsc#969165)
  - add: libparted-fix-starting-CHS-in-protective-MBR.patch

OBS-URL: https://build.opensuse.org/request/show/519106
OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=132
This commit is contained in:
Sebastian Parschauer 2017-08-28 11:36:52 +00:00 committed by Git OBS Bridge
parent d2638b4319
commit 528c9a93d2
8 changed files with 70 additions and 424 deletions

View File

@ -0,0 +1,30 @@
From: Petr Uzel <petr.uzel@suse.cz>
Date: Thu, 10 Mar 2016 14:18:52 +0100
Subject: libparted: Fix starting CHS in protective MBR
References: bsc#969165
Patch-mainline: v3.3
Git-commit: df6770d213b60320426a3ee0bed118d063b40fc5
The CHS address for protective partition start in protective MBR
should be 0/0/2, according to UEFI spec (v2.6, section 5.2.1).
* libparted/labels/gpt.c (_write_pmbr): Fix starting CHS address
Reported by Steffen Winterfeldt in https://bugzilla.suse.com/969165
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
---
libparted/labels/gpt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -1143,7 +1143,7 @@ _write_pmbr (PedDevice *dev, bool pmbr_b
pmbr->Signature = PED_CPU_TO_LE16 (MSDOS_MBR_SIGNATURE);
pmbr->PartitionRecord[0].OSType = EFI_PMBR_OSTYPE_EFI;
- pmbr->PartitionRecord[0].StartSector = 1;
+ pmbr->PartitionRecord[0].StartSector = 2;
pmbr->PartitionRecord[0].EndHead = 0xFE;
pmbr->PartitionRecord[0].EndSector = 0xFF;
pmbr->PartitionRecord[0].EndTrack = 0xFF;

View File

@ -2,11 +2,9 @@
libparted/arch/linux.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
Index: parted-3.1/libparted/arch/linux.c
===================================================================
--- parted-3.1.orig/libparted/arch/linux.c
+++ parted-3.1/libparted/arch/linux.c
@@ -40,6 +40,7 @@
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -39,6 +39,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/utsname.h> /* for uname() */
@ -14,7 +12,7 @@ Index: parted-3.1/libparted/arch/linux.c
#include <scsi/scsi.h>
#include <assert.h>
#ifdef ENABLE_DEVICE_MAPPER
@@ -2901,14 +2902,15 @@ static int
@@ -3102,14 +3103,15 @@ static int
_kernel_reread_part_table (PedDevice* dev)
{
LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev);
@ -33,7 +31,7 @@ Index: parted-3.1/libparted/arch/linux.c
if (!retry_count) {
ped_exception_throw (
@@ -2918,10 +2920,12 @@ _kernel_reread_part_table (PedDevice* de
@@ -3119,10 +3121,12 @@ _kernel_reread_part_table (PedDevice* de
"table on %s (%s). As a result, it may not "
"reflect all of your changes until after reboot."),
dev->path, strerror (errno));

View File

@ -1,18 +0,0 @@
---
libparted/labels/gpt.c | 3 +++
1 file changed, 3 insertions(+)
Index: parted-3.2/libparted/labels/gpt.c
===================================================================
--- parted-3.2.orig/libparted/labels/gpt.c
+++ parted-3.2/libparted/labels/gpt.c
@@ -1216,6 +1216,9 @@ _part_to_ostype (PedPartition* part)
if (strncmp (part->fs_type->name, "hfs", 3) == 0) return 0xaf;
if (strstr (part->fs_type->name, "swap")) return 0x82;
}
+#ifdef __PPC__
+ if (part->num == 1) return 0x41; /* PARTITION_PREP */
+#endif
return 0x83; // Everything else is Linux
}

View File

@ -25,7 +25,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
int raid;
int boot;
int bios_grub;
@@ -918,7 +919,8 @@ _parse_part_entry (PedDisk *disk, GuidPa
@@ -818,7 +819,8 @@ _parse_part_entry (PedDisk *disk, GuidPa
gpt_part_data->name[i] = 0;
gpt_part_data->translated_name = 0;
@ -35,7 +35,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
= gpt_part_data->boot = gpt_part_data->hp_service
= gpt_part_data->hidden = gpt_part_data->msftres
= gpt_part_data->msftdata
@@ -941,6 +943,8 @@ _parse_part_entry (PedDisk *disk, GuidPa
@@ -841,6 +843,8 @@ _parse_part_entry (PedDisk *disk, GuidPa
gpt_part_data->raid = 1;
else if (!guid_cmp (gpt_part_data->type, PARTITION_LVM_GUID))
gpt_part_data->lvm = 1;
@ -44,7 +44,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
else if (!guid_cmp (gpt_part_data->type, PARTITION_HPSERVICE_GUID))
gpt_part_data->hp_service = 1;
else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RESERVED_GUID))
@@ -1568,6 +1572,7 @@ gpt_partition_new (const PedDisk *disk,
@@ -1361,6 +1365,7 @@ gpt_partition_new (const PedDisk *disk,
gpt_part_data->type = PARTITION_LINUX_DATA_GUID;
gpt_part_data->lvm = 0;
@ -52,7 +52,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
gpt_part_data->raid = 0;
gpt_part_data->boot = 0;
gpt_part_data->bios_grub = 0;
@@ -1656,6 +1661,11 @@ gpt_partition_set_system (PedPartition *
@@ -1449,6 +1454,11 @@ gpt_partition_set_system (PedPartition *
gpt_part_data->type = PARTITION_LVM_GUID;
return 1;
}
@ -64,7 +64,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
if (gpt_part_data->raid)
{
gpt_part_data->type = PARTITION_RAID_GUID;
@@ -1720,11 +1730,6 @@ gpt_partition_set_system (PedPartition *
@@ -1513,11 +1523,6 @@ gpt_partition_set_system (PedPartition *
gpt_part_data->type = PARTITION_APPLE_HFS_GUID;
return 1;
}
@ -76,7 +76,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
}
gpt_part_data->type = PARTITION_LINUX_DATA_GUID;
@@ -1843,6 +1848,7 @@ gpt_partition_set_flag (PedPartition *pa
@@ -1636,6 +1641,7 @@ gpt_partition_set_flag (PedPartition *pa
if (state)
gpt_part_data->raid
= gpt_part_data->lvm
@ -84,7 +84,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
@@ -1857,6 +1863,7 @@ gpt_partition_set_flag (PedPartition *pa
@@ -1650,6 +1656,7 @@ gpt_partition_set_flag (PedPartition *pa
if (state)
gpt_part_data->raid
= gpt_part_data->lvm
@ -92,7 +92,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
= gpt_part_data->boot
= gpt_part_data->hp_service
= gpt_part_data->msftres
@@ -1871,6 +1878,7 @@ gpt_partition_set_flag (PedPartition *pa
@@ -1664,6 +1671,7 @@ gpt_partition_set_flag (PedPartition *pa
if (state)
gpt_part_data->boot
= gpt_part_data->lvm
@ -100,7 +100,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
@@ -1884,6 +1892,22 @@ gpt_partition_set_flag (PedPartition *pa
@@ -1677,6 +1685,22 @@ gpt_partition_set_flag (PedPartition *pa
gpt_part_data->lvm = state;
if (state)
gpt_part_data->boot
@ -123,7 +123,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
= gpt_part_data->raid
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
@@ -1900,6 +1924,7 @@ gpt_partition_set_flag (PedPartition *pa
@@ -1693,6 +1717,7 @@ gpt_partition_set_flag (PedPartition *pa
gpt_part_data->boot
= gpt_part_data->raid
= gpt_part_data->lvm
@ -131,7 +131,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
= gpt_part_data->bios_grub
= gpt_part_data->msftres
= gpt_part_data->msftdata
@@ -1914,6 +1939,7 @@ gpt_partition_set_flag (PedPartition *pa
@@ -1707,6 +1732,7 @@ gpt_partition_set_flag (PedPartition *pa
gpt_part_data->boot
= gpt_part_data->raid
= gpt_part_data->lvm
@ -139,7 +139,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftdata
@@ -1928,6 +1954,7 @@ gpt_partition_set_flag (PedPartition *pa
@@ -1721,6 +1747,7 @@ gpt_partition_set_flag (PedPartition *pa
gpt_part_data->boot
= gpt_part_data->raid
= gpt_part_data->lvm
@ -147,7 +147,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
@@ -1946,6 +1973,7 @@ gpt_partition_set_flag (PedPartition *pa
@@ -1739,6 +1766,7 @@ gpt_partition_set_flag (PedPartition *pa
gpt_part_data->boot
= gpt_part_data->raid
= gpt_part_data->lvm
@ -155,7 +155,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftdata
@@ -1960,6 +1988,7 @@ gpt_partition_set_flag (PedPartition *pa
@@ -1753,6 +1781,7 @@ gpt_partition_set_flag (PedPartition *pa
gpt_part_data->boot
= gpt_part_data->raid
= gpt_part_data->lvm
@ -163,7 +163,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
@@ -1973,6 +2002,7 @@ gpt_partition_set_flag (PedPartition *pa
@@ -1766,6 +1795,7 @@ gpt_partition_set_flag (PedPartition *pa
gpt_part_data->boot
= gpt_part_data->raid
= gpt_part_data->lvm
@ -171,7 +171,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
@@ -1986,6 +2016,7 @@ gpt_partition_set_flag (PedPartition *pa
@@ -1779,6 +1809,7 @@ gpt_partition_set_flag (PedPartition *pa
gpt_part_data->boot
= gpt_part_data->raid
= gpt_part_data->lvm
@ -179,7 +179,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
@@ -2000,7 +2031,6 @@ gpt_partition_set_flag (PedPartition *pa
@@ -1793,7 +1824,6 @@ gpt_partition_set_flag (PedPartition *pa
case PED_PARTITION_LEGACY_BOOT:
gpt_part_data->legacy_boot = state;
return 1;
@ -187,7 +187,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
case PED_PARTITION_ROOT:
case PED_PARTITION_LBA:
default:
@@ -2046,6 +2076,7 @@ gpt_partition_get_flag (const PedPartiti
@@ -1839,6 +1869,7 @@ gpt_partition_get_flag (const PedPartiti
case PED_PARTITION_IRST:
return gpt_part_data->irst;
case PED_PARTITION_SWAP:
@ -195,7 +195,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
case PED_PARTITION_LBA:
case PED_PARTITION_ROOT:
default:
@@ -2062,6 +2093,7 @@ gpt_partition_is_flag_available (const P
@@ -1855,6 +1886,7 @@ gpt_partition_is_flag_available (const P
{
case PED_PARTITION_RAID:
case PED_PARTITION_LVM:
@ -203,7 +203,7 @@ Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
case PED_PARTITION_BOOT:
case PED_PARTITION_BIOS_GRUB:
case PED_PARTITION_HPSERVICE:
@@ -2075,7 +2107,6 @@ gpt_partition_is_flag_available (const P
@@ -1868,7 +1900,6 @@ gpt_partition_is_flag_available (const P
case PED_PARTITION_IRST:
case PED_PARTITION_ESP:
return 1;

View File

@ -1,354 +0,0 @@
---
libparted/labels/gpt.c | 240 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 236 insertions(+), 4 deletions(-)
Index: parted-3.2/libparted/labels/gpt.c
===================================================================
--- parted-3.2.orig/libparted/labels/gpt.c
+++ parted-3.2/libparted/labels/gpt.c
@@ -305,6 +305,7 @@ typedef struct _GPTPartitionData
} GPTPartitionData;
static PedDiskType gpt_disk_type;
+static PedDiskType gpt_sync_mbr_disk_type;
static inline uint32_t
pth_get_size (const PedDevice *dev)
@@ -473,8 +474,50 @@ _pmbr_is_valid (const LegacyMBR_t *mbr)
return 0;
}
+/* checks if device has a hybrid protective MBR partition table
+ *
+ * If the 1st partition has type 0xEE that spans the entire
+ * size of the disk from sector 1 to the last sector
+ * (or 2 TiB, whichever is smaller), we consider it 'normal' GPT.
+ * Otherwise it is synced GPT with hybridized pMBR.
+ */
+static inline int
+_has_hybrid_pmbr (const PedDevice *dev)
+{
+ int has_hybrid_pmbr = 1;
+
+ PED_ASSERT (dev != NULL);
+
+ void *label;
+ if (!ptt_read_sector (dev, 0, &label))
+ return 0;
+
+ LegacyMBR_t mbr;
+ memcpy(&mbr, label, sizeof(mbr));
+
+ if (mbr.Signature != PED_CPU_TO_LE16 (MSDOS_MBR_SIGNATURE)) {
+ free(label);
+ return 0;
+ }
+
+ uint32_t efi_gpt_expected_size;
+ if ((dev->length - 1ULL) > 0xFFFFFFFFULL)
+ efi_gpt_expected_size = 0xFFFFFFFF;
+ else
+ efi_gpt_expected_size = dev->length - 1UL;
+
+ if ((mbr.PartitionRecord[0].OSType == EFI_PMBR_OSTYPE_EFI) &&
+ (mbr.PartitionRecord[0].StartingLBA == PED_CPU_TO_LE32(1)) &&
+ (mbr.PartitionRecord[0].SizeInLBA == PED_CPU_TO_LE32(efi_gpt_expected_size)))
+ /* pMBR is not hybrid */
+ has_hybrid_pmbr = 0;
+
+ free(label);
+ return has_hybrid_pmbr;
+}
+
static int
-gpt_probe (const PedDevice *dev)
+_gpt_probe_generic(const PedDevice *dev)
{
int gpt_sig_found = 0;
@@ -508,6 +551,19 @@ gpt_probe (const PedDevice *dev)
return gpt_sig_found;
}
+static int
+gpt_probe (const PedDevice *dev)
+{
+ return _gpt_probe_generic(dev) && !_has_hybrid_pmbr(dev);
+}
+
+
+static int
+gpt_sync_mbr_probe (const PedDevice *dev)
+{
+ return _gpt_probe_generic(dev) && _has_hybrid_pmbr(dev);
+}
+
static PedDisk *
gpt_alloc (const PedDevice *dev)
{
@@ -553,6 +609,50 @@ error:
}
static PedDisk *
+gpt_sync_mbr_alloc (const PedDevice *dev)
+{
+ PedDisk *disk;
+ GPTDiskData *gpt_disk_data;
+ PedSector data_start, data_end;
+
+ disk = _ped_disk_alloc ((PedDevice *) dev, &gpt_sync_mbr_disk_type);
+ if (!disk)
+ goto error;
+
+ data_start = 2 + GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / dev->sector_size;
+ data_end = dev->length - 2
+ - GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / dev->sector_size;
+
+ /* If the device is too small to accommodate GPT headers and one data
+ sector, reject it. */
+ if (data_end < data_start)
+ {
+ ped_exception_throw (PED_EXCEPTION_ERROR,
+ PED_EXCEPTION_OK,
+ _("device is too small for GPT"));
+ goto error_free_disk;
+ }
+
+ disk->disk_specific = gpt_disk_data = ped_malloc (sizeof (GPTDiskData));
+ if (!disk->disk_specific)
+ goto error_free_disk;
+
+ gpt_disk_data->AlternateLBA = dev->length - 1;
+ ped_geometry_init (&gpt_disk_data->data_area, dev, data_start,
+ data_end - data_start + 1);
+ gpt_disk_data->entry_count = GPT_DEFAULT_PARTITION_ENTRIES;
+ uuid_generate ((unsigned char *) &gpt_disk_data->uuid);
+ swap_uuid_and_efi_guid ((unsigned char *) (&gpt_disk_data->uuid));
+ gpt_disk_data->pmbr_boot = 0;
+ return disk;
+
+error_free_disk:
+ free (disk);
+error:
+ return NULL;
+}
+
+static PedDisk *
gpt_duplicate (const PedDisk *disk)
{
PedDisk *new_disk;
@@ -963,7 +1063,7 @@ gpt_read (PedDisk *disk)
/* motivation: let the user decide about the pmbr... during
ped_disk_probe(), they probably didn't get a choice... */
- if (!gpt_probe (disk->dev))
+ if (!gpt_probe (disk->dev) && !gpt_sync_mbr_probe(disk->dev))
goto error;
GuidPartitionTableHeader_t *gpt = NULL;
@@ -1120,11 +1220,59 @@ error:
return 0;
}
+
+static inline unsigned char
+_part_to_ostype (PedPartition* part)
+{
+ if (part->fs_type) {
+ if (strncmp (part->fs_type->name, "fat", 3) == 0) return 0xc;
+ if (strncmp (part->fs_type->name, "ntfs", 4) == 0) return 0x7;
+ if (strncmp (part->fs_type->name, "hfs", 3) == 0) return 0xaf;
+ if (strstr (part->fs_type->name, "swap")) return 0x82;
+ }
+ return 0x83; // Everything else is Linux
+}
+
+static inline PedPartition*
+_find_first_part (const PedDisk* disk)
+{
+ PedPartition *retval = NULL, *part = NULL;
+ uint64_t lowest_end = 0xffffffffffffffff;
+ while (part = ped_disk_next_partition (disk, part)) {
+ if (part->geom.start == 0 || part->type == PED_PARTITION_METADATA
+ || part->type == PED_PARTITION_FREESPACE)
+ continue;
+ if (part->geom.end < lowest_end) {
+ retval = part;
+ lowest_end = part->geom.end;
+ }
+ }
+ return retval;
+}
+
+static inline uint32_t
+_part_32bitmax (uint64_t in)
+{
+ if (in > 0xFFFFFFFFULL)
+ return 0xFFFFFFFF;
+ else
+ return (uint32_t)in;
+}
+
+
#ifndef DISCOVER_ONLY
/* Write the protective MBR (to keep DOS happy) */
static int
-_write_pmbr (PedDevice *dev, bool pmbr_boot)
+_write_pmbr (const PedDisk *disk, bool pmbr_boot)
{
+ PedDevice * dev = disk->dev;
+
+ /* need sync GPT -> hybrid pMBR ? */
+ int sync_pmbr = !strcmp(disk->type->name, "gpt_sync_mbr") ? 1 : 0;
+
+ int i, pmbr_id, first_entry = 0, last_entry = 3;
+ PedPartition *part = NULL, *esp;
+
/* The UEFI spec is not clear about what to do with the following
elements of the Protective MBR (pmbr): BootCode (0-440B),
UniqueMBRSignature (440B-444B) and Unknown (444B-446B).
@@ -1138,6 +1286,8 @@ _write_pmbr (PedDevice *dev, bool pmbr_b
memset (pmbr->PartitionRecord, 0, sizeof pmbr->PartitionRecord);
pmbr->Signature = PED_CPU_TO_LE16 (MSDOS_MBR_SIGNATURE);
+
+ if (!sync_pmbr) {
pmbr->PartitionRecord[0].OSType = EFI_PMBR_OSTYPE_EFI;
pmbr->PartitionRecord[0].StartSector = 1;
pmbr->PartitionRecord[0].EndHead = 0xFE;
@@ -1150,6 +1300,60 @@ _write_pmbr (PedDevice *dev, bool pmbr_b
pmbr->PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32 (dev->length - 1UL);
if (pmbr_boot)
pmbr->PartitionRecord[0].BootIndicator = 0x80;
+ } else {
+ /* Search for an EFI System Partition */
+ esp = _find_first_part(disk);
+ if (!esp || !esp->fs_type || strncmp (esp->fs_type->name, "fat", 3) != 0)
+ esp = NULL;
+
+ pmbr_id = 3;
+ if (esp) {
+ pmbr_id = 0;
+ first_entry = 1;
+ last_entry = 4;
+ }
+
+ /* Write a pseudo-PMBR so Linux is happy */
+ pmbr->PartitionRecord[pmbr_id].OSType = EFI_PMBR_OSTYPE_EFI;
+ pmbr->PartitionRecord[pmbr_id].StartSector = 1;
+ pmbr->PartitionRecord[pmbr_id].EndHead = 0xFE;
+ pmbr->PartitionRecord[pmbr_id].EndSector = 0xFF;
+ pmbr->PartitionRecord[pmbr_id].EndTrack = 0xFF;
+ pmbr->PartitionRecord[pmbr_id].StartingLBA = PED_CPU_TO_LE32(1);
+ pmbr->PartitionRecord[pmbr_id].SizeInLBA = PED_CPU_TO_LE32 (1);
+ if (esp)
+ pmbr->PartitionRecord[pmbr_id].SizeInLBA = PED_CPU_TO_LE32 (esp->geom.end - 1);
+
+ /* sync the first 3 GPT entries to MBR primary partitions */
+ for (i=first_entry; i < last_entry; i++) {
+ part = ped_disk_next_partition (disk, part);
+ if (part == NULL)
+ break;
+ /* we might get a starting garbage partition */
+ if (part->geom.start == 0 || part->type == PED_PARTITION_METADATA || part->type == PED_PARTITION_FREESPACE || part == esp) {
+ i--;
+ continue;
+ }
+
+ /* partition can not be represented by dos label - don't sync it */
+ if (part->geom.start > 0xFFFFFFFF ||
+ (part->geom.end - part->geom.start + 1) > 0xFFFFFFFF) {
+ continue;
+ }
+
+ pmbr->PartitionRecord[i].OSType = _part_to_ostype(part);
+ pmbr->PartitionRecord[i].StartHead = 0xFE;
+ pmbr->PartitionRecord[i].StartSector = 0xFF;
+ pmbr->PartitionRecord[i].StartTrack = 0xFF;
+ pmbr->PartitionRecord[i].EndHead = 0xFE;
+ pmbr->PartitionRecord[i].EndSector = 0xFF;
+ pmbr->PartitionRecord[i].EndTrack = 0xFF;
+ pmbr->PartitionRecord[i].StartingLBA = PED_CPU_TO_LE32 (_part_32bitmax(part->geom.start));
+ if(((GPTPartitionData*)part->disk_specific)->boot)
+ pmbr->PartitionRecord[i].BootIndicator = 0x80;
+ pmbr->PartitionRecord[i].SizeInLBA = PED_CPU_TO_LE32 (_part_32bitmax(part->geom.end - part->geom.start + 1));
+ }
+ }
int write_ok = ped_device_write (dev, pmbr, GPT_PMBR_LBA,
GPT_PMBR_SECTORS);
@@ -1269,7 +1473,7 @@ gpt_write (const PedDisk *disk)
ptes_crc = efi_crc32 (ptes, ptes_bytes);
/* Write protective MBR */
- if (!_write_pmbr (disk->dev, gpt_disk_data->pmbr_boot))
+ if (!_write_pmbr (disk, gpt_disk_data->pmbr_boot))
goto error_free_ptes;
/* Write PTH and PTEs */
@@ -2034,6 +2238,38 @@ static PedDiskOps gpt_disk_ops =
PT_op_function_initializers (gpt)
};
+static PedDiskOps gpt_sync_mbr_disk_ops =
+{
+ clobber: NULL,
+ write: NULL_IF_DISCOVER_ONLY (gpt_write),
+
+ partition_set_name: gpt_partition_set_name,
+ partition_get_name: gpt_partition_get_name,
+
+ /* probe function redefined */
+ probe: gpt_sync_mbr_probe,
+ /* alloc function redefined */
+ alloc: gpt_sync_mbr_alloc,
+ duplicate: gpt_duplicate,
+ free: gpt_free,
+ read: gpt_read,
+ partition_new: gpt_partition_new,
+ partition_duplicate: gpt_partition_duplicate,
+ partition_set_flag: gpt_partition_set_flag,
+ partition_get_flag: gpt_partition_get_flag,
+ partition_set_system: gpt_partition_set_system,
+ partition_is_flag_available: gpt_partition_is_flag_available,
+ partition_align: gpt_partition_align,
+ partition_destroy: gpt_partition_destroy,
+ partition_enumerate: gpt_partition_enumerate,
+ alloc_metadata: gpt_alloc_metadata,
+ get_max_primary_partition_count: gpt_get_max_primary_partition_count,
+ get_max_supported_partition_count: gpt_get_max_supported_partition_count,
+ partition_check: gpt_partition_check,
+ max_length: gpt_partition_max_length,
+ max_start_sector: gpt_partition_max_start_sector
+};
+
static PedDiskType gpt_disk_type =
{
next: NULL,
@@ -2042,16 +2278,26 @@ static PedDiskType gpt_disk_type =
features: PED_DISK_TYPE_PARTITION_NAME
};
+static PedDiskType gpt_sync_mbr_disk_type =
+{
+ next: NULL,
+ name: "gpt_sync_mbr",
+ ops: &gpt_sync_mbr_disk_ops,
+ features: PED_DISK_TYPE_PARTITION_NAME
+};
+
void
ped_disk_gpt_init ()
{
ped_disk_type_register (&gpt_disk_type);
+ ped_disk_type_register (&gpt_sync_mbr_disk_type);
}
void
ped_disk_gpt_done ()
{
ped_disk_type_unregister (&gpt_disk_type);
+ ped_disk_type_unregister (&gpt_sync_mbr_disk_type);
}
verify (sizeof (GuidPartitionEntryAttributes_t) == 8);

View File

@ -1,18 +0,0 @@
bnc#781688
---
libparted/labels/gpt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: parted-3.2/libparted/labels/gpt.c
===================================================================
--- parted-3.2.orig/libparted/labels/gpt.c
+++ parted-3.2/libparted/labels/gpt.c
@@ -508,7 +508,7 @@ _has_hybrid_pmbr (const PedDevice *dev)
if ((mbr.PartitionRecord[0].OSType == EFI_PMBR_OSTYPE_EFI) &&
(mbr.PartitionRecord[0].StartingLBA == PED_CPU_TO_LE32(1)) &&
- (mbr.PartitionRecord[0].SizeInLBA == PED_CPU_TO_LE32(efi_gpt_expected_size)))
+ ((mbr.PartitionRecord[0].SizeInLBA == PED_CPU_TO_LE32(efi_gpt_expected_size)) || (mbr.PartitionRecord[0].SizeInLBA == PED_CPU_TO_LE32(0xFFFFFFFF))))
/* pMBR is not hybrid */
has_hybrid_pmbr = 0;

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Thu Aug 24 16:51:37 CEST 2017 - sparschauer@suse.de
- Drop using deprecated configure option "--disable-Werror"
- Drop (SUSE specific) support for hybrid pMBR (gpt_sync_mbr
label) (fate#317849, bsc#1041322)
- remove: parted-gpt-mbr-sync.patch
- remove: libparted-ppc-prepboot-in-syncmbr.patch
- remove: parted-workaround-windows7-gpt-implementation.patch
- refresh patches
- libparted: Fix starting CHS in protective MBR (bsc#969165)
- add: libparted-fix-starting-CHS-in-protective-MBR.patch
-------------------------------------------------------------------
Tue Aug 15 17:21:02 CEST 2017 - sparschauer@suse.de

View File

@ -37,9 +37,6 @@ Patch11: parted-wipeaix.patch
Patch12: libparted-partition-naming.patch
#PATCH-FEATURE-SUSE more-reliable-informing-the-kernel.patch bnc#657360 petr.uzel@suse.cz
Patch13: more-reliable-informing-the-kernel.patch
Patch14: parted-gpt-mbr-sync.patch
Patch15: libparted-ppc-prepboot-in-syncmbr.patch
Patch16: parted-workaround-windows7-gpt-implementation.patch
Patch17: dummy-bootcode-only-for-x86.patch
Patch18: parted-type.patch
Patch19: parted-mac.patch
@ -80,6 +77,7 @@ Patch48: parted-mkpart-set-a-swap-flag-if-available.patch
Patch49: libparted-set-swap-flag-on-GPT-partitions.patch
Patch50: libparted-dasd-add-swap-flag-handling-for-DASD-CDL.patch
Patch51: parted-mkpart-allow-empty-gpt-part-name.patch
Patch52: libparted-fix-starting-CHS-in-protective-MBR.patch
Patch100: parted-fatresize-autoconf.patch
BuildRequires: check-devel
BuildRequires: device-mapper-devel >= 1.02.33
@ -136,9 +134,6 @@ to develop applications that require these.
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
@ -174,6 +169,7 @@ to develop applications that require these.
%patch49 -p1
%patch50 -p1
%patch51 -p1
%patch52 -p1
%patch100 -p1
%build
@ -184,7 +180,6 @@ AUTOPOINT=true autoreconf --force --install
--enable-device-mapper=yes \
--enable-dynamic-loading=no \
--enable-selinux \
--disable-Werror \
--disable-silent-rules
make %{?_smp_mflags}