This commit is contained in:
parent
1a965977aa
commit
14c45bae00
@ -14,7 +14,7 @@ Index: libparted/labels/gpt.c
|
|||||||
#define EFI_PMBR_OSTYPE_EFI 0xEE
|
#define EFI_PMBR_OSTYPE_EFI 0xEE
|
||||||
#define MSDOS_MBR_SIGNATURE 0xaa55
|
#define MSDOS_MBR_SIGNATURE 0xaa55
|
||||||
|
|
||||||
@@ -928,15 +933,66 @@ error:
|
@@ -928,15 +933,68 @@ error:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,14 +35,16 @@ Index: libparted/labels/gpt.c
|
|||||||
+static inline PedPartition*
|
+static inline PedPartition*
|
||||||
+_find_first_part (PedDisk* disk)
|
+_find_first_part (PedDisk* disk)
|
||||||
+{
|
+{
|
||||||
+ PedPartition *retval = NULL, *part;
|
+ PedPartition *retval = NULL, *part = NULL;
|
||||||
+ uint64_t lowest_end = 0xffffffffffffffff;
|
+ uint64_t lowest_end = 0xffffffffffffffff;
|
||||||
+ while (part = ped_disk_next_partition (disk, part)) {
|
+ while (part = ped_disk_next_partition (disk, part)) {
|
||||||
+ if (part->geom.start == 0 || part->type == PED_PARTITION_METADATA
|
+ if (part->geom.start == 0 || part->type == PED_PARTITION_METADATA
|
||||||
+ || part->type == PED_PARTITION_FREESPACE)
|
+ || part->type == PED_PARTITION_FREESPACE)
|
||||||
+ continue;
|
+ continue;
|
||||||
+ if (part->geom.end < lowest_end)
|
+ if (part->geom.end < lowest_end) {
|
||||||
+ retval = part;
|
+ retval = part;
|
||||||
|
+ lowest_end = part->geom.end;
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ return retval;
|
+ return retval;
|
||||||
+}
|
+}
|
||||||
@ -66,7 +68,7 @@ Index: libparted/labels/gpt.c
|
|||||||
+ PedDevice * dev = disk->dev;
|
+ PedDevice * dev = disk->dev;
|
||||||
LegacyMBR_t pmbr;
|
LegacyMBR_t pmbr;
|
||||||
+#ifdef GPT_SYNC_MBR
|
+#ifdef GPT_SYNC_MBR
|
||||||
+ int i,pmbr_id;
|
+ int i, pmbr_id, first_entry = 0, last_entry = 3;
|
||||||
+ PedPartition *part = NULL, *esp;
|
+ PedPartition *part = NULL, *esp;
|
||||||
+#endif
|
+#endif
|
||||||
|
|
||||||
@ -82,19 +84,22 @@ Index: libparted/labels/gpt.c
|
|||||||
pmbr.PartitionRecord[0].OSType = EFI_PMBR_OSTYPE_EFI;
|
pmbr.PartitionRecord[0].OSType = EFI_PMBR_OSTYPE_EFI;
|
||||||
pmbr.PartitionRecord[0].StartSector = 1;
|
pmbr.PartitionRecord[0].StartSector = 1;
|
||||||
pmbr.PartitionRecord[0].EndHead = 0xFE;
|
pmbr.PartitionRecord[0].EndHead = 0xFE;
|
||||||
@@ -947,6 +1003,51 @@ _write_pmbr (PedDevice * dev)
|
@@ -947,6 +1005,54 @@ _write_pmbr (PedDevice * dev)
|
||||||
pmbr.PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32(0xFFFFFFFF);
|
pmbr.PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32(0xFFFFFFFF);
|
||||||
else
|
else
|
||||||
pmbr.PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32(dev->length - 1UL);
|
pmbr.PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32(dev->length - 1UL);
|
||||||
+#else
|
+#else
|
||||||
+ /* Search for an EFI System Partition */
|
+ /* Search for an EFI System Partition */
|
||||||
+ esp = _find_first_part(disk);
|
+ esp = _find_first_part(disk);
|
||||||
+ if (esp && strncmp (esp->fs_type->name, "fat", 3) != 0)
|
+ if (!esp || !esp->fs_type || strncmp (esp->fs_type->name, "fat", 3) != 0)
|
||||||
+ esp = NULL;
|
+ esp = NULL;
|
||||||
+
|
+
|
||||||
+ pmbr_id = 3;
|
+ pmbr_id = 3;
|
||||||
+ if (esp)
|
+ if (esp) {
|
||||||
+ pmbr_id = 0;
|
+ pmbr_id = 0;
|
||||||
|
+ first_entry = 1;
|
||||||
|
+ last_entry = 4;
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ /* Write a pseudo-PMBR so Linux is happy */
|
+ /* Write a pseudo-PMBR so Linux is happy */
|
||||||
+ pmbr.PartitionRecord[pmbr_id].OSType = EFI_PMBR_OSTYPE_EFI;
|
+ pmbr.PartitionRecord[pmbr_id].OSType = EFI_PMBR_OSTYPE_EFI;
|
||||||
@ -108,7 +113,7 @@ Index: libparted/labels/gpt.c
|
|||||||
+ pmbr.PartitionRecord[pmbr_id].SizeInLBA = esp->geom.end - 1;
|
+ pmbr.PartitionRecord[pmbr_id].SizeInLBA = esp->geom.end - 1;
|
||||||
+
|
+
|
||||||
+ /* sync the first 3 GPT entries to MBR primary partitions */
|
+ /* sync the first 3 GPT entries to MBR primary partitions */
|
||||||
+ for (i=0; i < 3; i++) {
|
+ for (i=first_entry; i < last_entry; i++) {
|
||||||
+ part = ped_disk_next_partition (disk, part);
|
+ part = ped_disk_next_partition (disk, part);
|
||||||
+ if (part == NULL)
|
+ if (part == NULL)
|
||||||
+ break;
|
+ break;
|
||||||
@ -134,7 +139,7 @@ Index: libparted/labels/gpt.c
|
|||||||
|
|
||||||
return ped_device_write (dev, &pmbr, GPT_PMBR_LBA, GPT_PMBR_SECTORS);
|
return ped_device_write (dev, &pmbr, GPT_PMBR_LBA, GPT_PMBR_SECTORS);
|
||||||
}
|
}
|
||||||
@@ -1050,7 +1151,7 @@ gpt_write(const PedDisk * disk)
|
@@ -1050,7 +1156,7 @@ gpt_write(const PedDisk * disk)
|
||||||
ptes_crc = efi_crc32 (ptes, ptes_size);
|
ptes_crc = efi_crc32 (ptes, ptes_size);
|
||||||
|
|
||||||
/* Write protective MBR */
|
/* Write protective MBR */
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Aug 21 11:34:51 CEST 2008 - agraf@suse.de
|
||||||
|
|
||||||
|
- fix the GPT sync to work properly on Macs
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Aug 11 16:27:24 CEST 2008 - agraf@suse.de
|
Mon Aug 11 16:27:24 CEST 2008 - agraf@suse.de
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ License: GPL v2 or later
|
|||||||
Group: System/Filesystems
|
Group: System/Filesystems
|
||||||
Summary: GNU partitioner
|
Summary: GNU partitioner
|
||||||
Version: 1.8.8
|
Version: 1.8.8
|
||||||
Release: 65
|
Release: 72
|
||||||
Source0: %{name}-%{version}.tar.bz2
|
Source0: %{name}-%{version}.tar.bz2
|
||||||
Patch: always-resize-part.dif
|
Patch: always-resize-part.dif
|
||||||
Patch1: parted-type.patch
|
Patch1: parted-type.patch
|
||||||
@ -143,6 +143,8 @@ rm -rf "$RPM_BUILD_ROOT"
|
|||||||
%{_libdir}/*.so
|
%{_libdir}/*.so
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Aug 21 2008 agraf@suse.de
|
||||||
|
- fix the GPT sync to work properly on Macs
|
||||||
* Mon Aug 11 2008 agraf@suse.de
|
* Mon Aug 11 2008 agraf@suse.de
|
||||||
- make GPT sync more compatible:
|
- make GPT sync more compatible:
|
||||||
- don't sync on IA64
|
- don't sync on IA64
|
||||||
|
Loading…
Reference in New Issue
Block a user