- Drop hfs_esp patch. Idea didn't work.

This commit is contained in:
Brian C. Lane 2014-02-27 13:23:51 -08:00
parent 7d372625f4
commit 191b34d33b
6 changed files with 26 additions and 309 deletions

View File

@ -1,286 +0,0 @@
From a5542113ab8bde419edfcc5ac46f6a5f6e575dd5 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 27 Aug 2013 11:52:54 -0700
Subject: [PATCH 67/69] libparted: Add hfs_esp partition flag to GPT.
Mac uses a HFS+ formatted partition for ESP. When dual booting with
Linux we need a way to differentiate between the Mac partition and the
one created by Linux which contains just enough stuff to fake OSX into
displaying a nice logo and allowing it to be selected for boot. I
generated a GUID (47CB5633-7E3E-408B-B7B8-2D915B7B21B1) and added a new
flag to control it.
* NEWS (Changes in behavior): Mention it.
* doc/C/parted.8: Document hfs_esp flag.
* doc/parted.texti: Document hfs_esp flag.
* include/parted/disk.in.h (_PedPartitionFlag): Add PED_PARTITION_HFS_ESP flag
* libparted/disk.c (ped_partition_flag_get_name): Add hfs_esp flag
* libparted/labels/gpt.c: Add PARTITION_HFS_ESP_GUID
(GPTPartitionData): Add hfs_esp flag
(_parse_part_entry): Likewise
(gpt_partition_new): Likewise
(gpt_partition_set_system): Set PARTITION_HFS_ESP_GUID
(gpt_partition_set_flag): Add hfs_esp and PED_PARTITION_HFS_ESP
(gpt_partition_get_flag): Likewise
(gpt_partition_is_flag_available): Likewise
---
NEWS | 8 ++++++++
doc/C/parted.8 | 2 +-
doc/parted.texi | 4 ++++
include/parted/disk.in.h | 5 +++--
libparted/disk.c | 2 ++
libparted/labels/gpt.c | 41 +++++++++++++++++++++++++++++++++++++++++
6 files changed, 59 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index 541ea1c..026e897 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,14 @@ GNU parted NEWS -*- outline -*-
** Changes in behavior
+ Added new GPT partition type flag, hfs_esp, that sets the GUID to
+ 47CB5633-7E3E-408B-B7B8-2D915B7B21B1 so that you can distinguish
+ between OSX's native HFS+ partition and one used Linux on UEFI. The
+ way Mac handles UEFI is unique, it only uses the standard ESP for
+ firmware updates and needs a HFS+ formatted partition for UEFI. This
+ GUID will allow dual booting Linux systems to determine the correct
+ partition to use when upgrading or re-installing systems.
+
Added new partition type flag, esp, to set the type to 0xEF on MS-DOS.
Also aliased to boot on GPT to set the UEFI ESP GUID.
diff --git a/doc/C/parted.8 b/doc/C/parted.8
index f8e6a3d..ccbfd18 100644
--- a/doc/C/parted.8
+++ b/doc/C/parted.8
@@ -104,7 +104,7 @@ or an LVM logical volume if necessary.
.B set \fIpartition\fP \fIflag\fP \fIstate\fP
Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP.
Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba",
-"legacy_boot", "irst", "esp" and "palo".
+"legacy_boot", "irst", "esp", "hfs_esp" and "palo".
\fIstate\fP should be either "on" or "off".
.TP
.B unit \fIunit\fP
diff --git a/doc/parted.texi b/doc/parted.texi
index a5effd5..ee5b3f7 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -844,6 +844,10 @@ partition.
(MS-DOS, GPT) - this flag identifies a UEFI System Partition. On GPT
it is an alias for boot.
+@item hfs_esp
+(GPT) - this flag identifies a special UEFI HFS+ ESP for use with Mac
+hardware.
+
@item lba
(MS-DOS) - this flag can be enabled to tell MS DOS, MS Windows 9x and
MS Windows ME based operating systems to use Linear (LBA) mode.
diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
index d144e21..c34c294 100644
--- a/include/parted/disk.in.h
+++ b/include/parted/disk.in.h
@@ -75,10 +75,11 @@ enum _PedPartitionFlag {
PED_PARTITION_LEGACY_BOOT=15,
PED_PARTITION_MSFT_DATA=16,
PED_PARTITION_IRST=17,
- PED_PARTITION_ESP=18
+ PED_PARTITION_ESP=18,
+ PED_PARTITION_HFS_ESP=19
};
#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT
-#define PED_PARTITION_LAST_FLAG PED_PARTITION_ESP
+#define PED_PARTITION_LAST_FLAG PED_PARTITION_HFS_ESP
enum _PedDiskTypeFeature {
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
diff --git a/libparted/disk.c b/libparted/disk.c
index c22b2a2..7d24f74 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -2445,6 +2445,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag)
return N_("irst");
case PED_PARTITION_ESP:
return N_("esp");
+ case PED_PARTITION_HFS_ESP:
+ return N_("hfs_esp");
default:
ped_exception_throw (
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 64b92b4..c72573c 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -150,6 +150,10 @@ typedef struct
((efi_guid_t) { PED_CPU_TO_LE32 (0xD3BFE2DE), PED_CPU_TO_LE16 (0x3DAF), \
PED_CPU_TO_LE16 (0x11DF), 0xba, 0x40, \
{ 0xE3, 0xA5, 0x56, 0xD8, 0x95, 0x93 }})
+#define PARTITION_HFS_ESP_GUID \
+ ((efi_guid_t) { PED_CPU_TO_LE32 (0x47CB5633), PED_CPU_TO_LE16 (0x7E3E), \
+ PED_CPU_TO_LE16 (0x408B), 0xB7, 0xB8, \
+ { 0x2D, 0x91, 0x5B, 0x7B, 0x21, 0xB1 }})
struct __attribute__ ((packed)) _GuidPartitionTableHeader_t
{
@@ -293,6 +297,7 @@ typedef struct _GPTPartitionData
int msftrecv;
int legacy_boot;
int irst;
+ int hfs_esp;
} GPTPartitionData;
static PedDiskType gpt_disk_type;
@@ -803,6 +808,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
= gpt_part_data->msftrecv
= gpt_part_data->legacy_boot
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0;
if (pte->Attributes.RequiredToFunction & 0x1)
@@ -830,6 +836,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
gpt_part_data->atvrecv = 1;
else if (!guid_cmp (gpt_part_data->type, PARTITION_IRST_GUID))
gpt_part_data->irst = 1;
+ else if (!guid_cmp (gpt_part_data->type, PARTITION_HFS_ESP_GUID))
+ gpt_part_data->hfs_esp = 1;
return part;
}
@@ -1348,6 +1356,7 @@ gpt_partition_new (const PedDisk *disk,
gpt_part_data->atvrecv = 0;
gpt_part_data->legacy_boot = 0;
gpt_part_data->irst = 0;
+ gpt_part_data->hfs_esp = 0;
uuid_generate ((unsigned char *) &gpt_part_data->uuid);
swap_uuid_and_efi_guid ((unsigned char *) (&gpt_part_data->uuid));
memset (gpt_part_data->name, 0, sizeof gpt_part_data->name);
@@ -1461,6 +1470,11 @@ gpt_partition_set_system (PedPartition *part,
gpt_part_data->type = PARTITION_IRST_GUID;
return 1;
}
+ if (gpt_part_data->hfs_esp)
+ {
+ gpt_part_data->type = PARTITION_HFS_ESP_GUID;
+ return 1;
+ }
if (fs_type)
{
@@ -1604,6 +1618,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_BIOS_GRUB:
@@ -1617,6 +1632,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_RAID:
@@ -1630,6 +1646,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_LVM:
@@ -1643,6 +1660,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HPSERVICE:
@@ -1656,6 +1674,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_MSFT_RESERVED:
@@ -1669,6 +1688,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_MSFT_DATA:
@@ -1682,6 +1702,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->msftrecv
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->atvrecv = 0;
gpt_part_data->msftdata = 1;
} else {
@@ -1699,6 +1720,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftdata
= gpt_part_data->msftres
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_APPLE_TV_RECOVERY:
@@ -1712,6 +1734,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->msftdata
= gpt_part_data->irst
+ = gpt_part_data->hfs_esp
= gpt_part_data->msftrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_IRST:
@@ -1725,6 +1748,21 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
+ = gpt_part_data->hfs_esp
+ = gpt_part_data->atvrecv = 0;
+ return gpt_partition_set_system (part, part->fs_type);
+ case PED_PARTITION_HFS_ESP:
+ gpt_part_data->hfs_esp = state;
+ if (state)
+ gpt_part_data->boot
+ = gpt_part_data->raid
+ = gpt_part_data->lvm
+ = gpt_part_data->bios_grub
+ = gpt_part_data->hp_service
+ = gpt_part_data->msftres
+ = gpt_part_data->msftdata
+ = gpt_part_data->msftrecv
+ = gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HIDDEN:
@@ -1776,6 +1814,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag)
return gpt_part_data->legacy_boot;
case PED_PARTITION_IRST:
return gpt_part_data->irst;
+ case PED_PARTITION_HFS_ESP:
+ return gpt_part_data->hfs_esp;
case PED_PARTITION_SWAP:
case PED_PARTITION_LBA:
case PED_PARTITION_ROOT:
@@ -1804,6 +1844,7 @@ gpt_partition_is_flag_available (const PedPartition *part,
case PED_PARTITION_LEGACY_BOOT:
case PED_PARTITION_IRST:
case PED_PARTITION_ESP:
+ case PED_PARTITION_HFS_ESP:
return 1;
case PED_PARTITION_SWAP:
case PED_PARTITION_ROOT:
--
1.8.3.1

View File

@ -1,7 +1,7 @@
From 7e43d97d8cbad8fbb51a818362293d6c2ab82304 Mon Sep 17 00:00:00 2001 From d1667924c6b9de17b335864293aecd43b4701a3c Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com> From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 27 Aug 2013 17:27:07 -0700 Date: Tue, 27 Aug 2013 17:27:07 -0700
Subject: [PATCH 68/69] libparted: Recognize btrfs filesystem Subject: [PATCH 67/70] libparted: Recognize btrfs filesystem
Add support for showing 'btrfs' in the 'file system' column. Also Add support for showing 'btrfs' in the 'file system' column. Also
allows the used to enter btrfs as the fs type. It doesn't really do allows the used to enter btrfs as the fs type. It doesn't really do
@ -22,7 +22,7 @@ anything -- just sets the partition type to linux.
create mode 100644 libparted/fs/btrfs/btrfs.c create mode 100644 libparted/fs/btrfs/btrfs.c
diff --git a/NEWS b/NEWS diff --git a/NEWS b/NEWS
index 026e897..df259d6 100644 index 541ea1c..3292fa9 100644
--- a/NEWS --- a/NEWS
+++ b/NEWS +++ b/NEWS
@@ -25,6 +25,9 @@ GNU parted NEWS -*- outline -*- @@ -25,6 +25,9 @@ GNU parted NEWS -*- outline -*-
@ -32,11 +32,11 @@ index 026e897..df259d6 100644
+ Added support for recognizing btrfs filesystem. This simply displays + Added support for recognizing btrfs filesystem. This simply displays
+ btrfs in the 'file system' column of the parted output. + btrfs in the 'file system' column of the parted output.
+ +
Added new GPT partition type flag, hfs_esp, that sets the GUID to Added new partition type flag, esp, to set the type to 0xEF on MS-DOS.
47CB5633-7E3E-408B-B7B8-2D915B7B21B1 so that you can distinguish Also aliased to boot on GPT to set the UEFI ESP GUID.
between OSX's native HFS+ partition and one used Linux on UEFI. The
diff --git a/doc/parted.texi b/doc/parted.texi diff --git a/doc/parted.texi b/doc/parted.texi
index ee5b3f7..03522e7 100644 index a5effd5..ea2c771 100644
--- a/doc/parted.texi --- a/doc/parted.texi
+++ b/doc/parted.texi +++ b/doc/parted.texi
@@ -575,6 +575,7 @@ partition table. @@ -575,6 +575,7 @@ partition table.
@ -180,5 +180,5 @@ index 9923bfa..3afbf8e 100644
static void _done() __attribute__ ((destructor)); static void _done() __attribute__ ((destructor));
-- --
1.8.3.1 1.8.5.3

View File

@ -1,7 +1,7 @@
From 17027da1eda39d20b2d6dca0a59ac4afc5409318 Mon Sep 17 00:00:00 2001 From 39cc999710703bb5577e4ef276ca3926cb00af92 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com> From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 28 Aug 2013 08:47:26 -0700 Date: Wed, 28 Aug 2013 08:47:26 -0700
Subject: [PATCH 69/69] tests: Add btrfs and xfs to the fs probe test Subject: [PATCH 68/70] tests: Add btrfs and xfs to the fs probe test
* tests/tests/t1700-probe-fs.sh: Add btrfs and xfs * tests/tests/t1700-probe-fs.sh: Add btrfs and xfs
--- ---
@ -22,5 +22,5 @@ index 7ce53d0..0418e73 100755
( mkfs.$type -V ) >/dev/null 2>&1 \ ( mkfs.$type -V ) >/dev/null 2>&1 \
|| { warn_ "$ME: no $type support"; continue; } || { warn_ "$ME: no $type support"; continue; }
-- --
1.8.3.1 1.8.5.3

View File

@ -1,7 +1,7 @@
From 115c74f3df2cb10e1f75d711175e8cbb301db594 Mon Sep 17 00:00:00 2001 From eee862e3c183946a2e71f7606e98eca67ab363e9 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com> From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 4 Sep 2013 11:45:44 -0700 Date: Wed, 4 Sep 2013 11:45:44 -0700
Subject: [PATCH] libparted: Flush parent device on open (#962611) Subject: [PATCH 69/70] libparted: Flush parent device on open (#962611)
Parted probes for filesystems using geometry offsets into the parent Parted probes for filesystems using geometry offsets into the parent
device, not the partition device itself. This means it may get stale device, not the partition device itself. This means it may get stale
@ -31,5 +31,5 @@ index 375be83..492f828 100644
return 1; return 1;
} }
-- --
1.8.3.1 1.8.5.3

View File

@ -1,7 +1,8 @@
From 990ca85d9986c9041801ecca04aed1a0f13867a2 Mon Sep 17 00:00:00 2001 From 54e59b08f70cb5b3419ef02137e0b42da0fab617 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com> From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 11 Sep 2013 09:09:42 -0700 Date: Wed, 11 Sep 2013 09:09:42 -0700
Subject: [PATCH] tests: Restrict gpt-header-munge to little-endian systems Subject: [PATCH 70/70] tests: Restrict gpt-header-munge to little-endian
systems
gpt-header-munge uses perl to manipulate the gpt header for the test. It gpt-header-munge uses perl to manipulate the gpt header for the test. It
only works on 64 bit little-endian systems so restrict it to x86_64 only works on 64 bit little-endian systems so restrict it to x86_64
@ -47,5 +48,5 @@ index 58625a2..a87e753 100644
ns=100 # Initial number of sectors. ns=100 # Initial number of sectors.
-- --
1.8.3.1 1.8.5.3

View File

@ -4,7 +4,7 @@
Summary: The GNU disk partition manipulation program Summary: The GNU disk partition manipulation program
Name: parted Name: parted
Version: 3.1 Version: 3.1
Release: 16%{?dist} Release: 17%{?dist}
License: GPLv3+ License: GPLv3+
Group: Applications/System Group: Applications/System
URL: http://www.gnu.org/software/parted URL: http://www.gnu.org/software/parted
@ -86,11 +86,10 @@ Patch0063: 0063-libparted-don-t-canonicalize-dev-md-paths-872361.patch
Patch0064: 0064-tests-rewrite-t6001-to-use-dev-mapper.patch Patch0064: 0064-tests-rewrite-t6001-to-use-dev-mapper.patch
Patch0065: 0065-libparted-Add-Intel-Rapid-Start-Technology-partition.patch Patch0065: 0065-libparted-Add-Intel-Rapid-Start-Technology-partition.patch
Patch0066: 0066-libparted-Add-UEFI-System-Partition-flag.patch Patch0066: 0066-libparted-Add-UEFI-System-Partition-flag.patch
Patch0067: 0067-libparted-Add-hfs_esp-partition-flag-to-GPT.patch Patch0068: 0067-libparted-Recognize-btrfs-filesystem.patch
Patch0068: 0068-libparted-Recognize-btrfs-filesystem.patch Patch0069: 0068-tests-Add-btrfs-and-xfs-to-the-fs-probe-test.patch
Patch0069: 0069-tests-Add-btrfs-and-xfs-to-the-fs-probe-test.patch Patch0070: 0069-libparted-Flush-parent-device-on-open-962611.patch
Patch0070: 0070-libparted-Flush-parent-device-on-open-962611.patch Patch0071: 0070-tests-Restrict-gpt-header-munge-to-little-endian-sys.patch
Patch0071: 0071-tests-Restrict-gpt-header-munge-to-little-endian-sys.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: e2fsprogs-devel BuildRequires: e2fsprogs-devel
@ -227,6 +226,9 @@ fi
%changelog %changelog
* Thu Feb 27 2014 Brian C. Lane <bcl@redhat.com> 3.1-17
- Drop hfs_esp patch. Idea didn't work.
* Wed Sep 11 2013 Brian C. Lane <bcl@redhat.com> 3.1-16 * Wed Sep 11 2013 Brian C. Lane <bcl@redhat.com> 3.1-16
- tests: Restrict gpt header munge to little-endian systems - tests: Restrict gpt header munge to little-endian systems
- Add perl Digest::CRC as a build requirement so more tests will run - Add perl Digest::CRC as a build requirement so more tests will run