Blame SOURCES/0027-GPT-add-support-for-PReP-GUID-1108196.patch

75c9f6
From cfb23fa541ada431b8225760371bb4d5029893b1 Mon Sep 17 00:00:00 2001
75c9f6
From: Daniel Battaiola Kreling <dbkreling@br.ibm.com>
75c9f6
Date: Mon, 7 Oct 2013 11:51:50 +0530
75c9f6
Subject: [PATCH] GPT: add support for PReP GUID (#1108196)
75c9f6
75c9f6
PReP (PowerPC Reference Platform) boot partition is the first partition used in
75c9f6
PowerPC platform for containing the bootable kernel or bootloader. The firmware
75c9f6
searches for this partition and jumps to it for booting. So far no GUID was
75c9f6
specified for this partition type and hence booting from GPT disk was not
75c9f6
supported on this platform. A new GUID 9e1a2d38-c612-4316-aa26-8b49521e5a8b for
75c9f6
PReP partition is proposed to be included in GPT.
75c9f6
75c9f6
Resolves: rhbz#1108196
75c9f6
75c9f6
Signed-off-by: Brian C. Lane <bcl@redhat.com>
75c9f6
---
75c9f6
 NEWS                   |  7 +++++++
75c9f6
 doc/parted.texi        |  2 +-
75c9f6
 libparted/labels/gpt.c | 37 +++++++++++++++++++++++++++++++++++++
75c9f6
 3 files changed, 45 insertions(+), 1 deletion(-)
75c9f6
75c9f6
diff --git a/NEWS b/NEWS
75c9f6
index 80a62d6..4d30b1b 100644
75c9f6
--- a/NEWS
75c9f6
+++ b/NEWS
75c9f6
@@ -1,5 +1,12 @@
75c9f6
 GNU parted NEWS                                    -*- outline -*-
75c9f6
 
75c9f6
+* Noteworthy changes in release 3.1-18 (2014-08-12) [RHEL7.1]
75c9f6
+
75c9f6
+** New features
75c9f6
+
75c9f6
+  Add support for prep flag to GPT to select PowerPC Reference Platform
75c9f6
+  boot partition type.
75c9f6
+
75c9f6
 * Noteworthy changes in release 3.1-16 (2014-01-22) [RHEL7]
75c9f6
 
75c9f6
 ** Bug Fixes
75c9f6
diff --git a/doc/parted.texi b/doc/parted.texi
75c9f6
index 2b1ce64..f10d5e1 100644
75c9f6
--- a/doc/parted.texi
75c9f6
+++ b/doc/parted.texi
75c9f6
@@ -823,7 +823,7 @@ physical volume.
75c9f6
 by the Linux/PA-RISC boot loader, palo.
75c9f6
 
75c9f6
 @item PREP
75c9f6
-(MS-DOS) - this flag can be enabled so that the partition can be used
75c9f6
+(MS-DOS, GPT) - this flag can be enabled so that the partition can be used
75c9f6
 as a PReP boot partition on PowerPC PReP or IBM RS6K/CHRP hardware.
75c9f6
 
75c9f6
 @item DIAG
75c9f6
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
75c9f6
index 6ca33c8..f9332bd 100644
75c9f6
--- a/libparted/labels/gpt.c
75c9f6
+++ b/libparted/labels/gpt.c
75c9f6
@@ -142,6 +142,10 @@ typedef struct
75c9f6
     ((efi_guid_t) { PED_CPU_TO_LE32 (0x5265636F), PED_CPU_TO_LE16 (0x7665), \
75c9f6
                     PED_CPU_TO_LE16 (0x11AA), 0xaa, 0x11, \
75c9f6
                     { 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC }})
75c9f6
+#define PARTITION_PREP_GUID \
75c9f6
+    ((efi_guid_t) { PED_CPU_TO_LE32 (0x9e1a2d38), PED_CPU_TO_LE16 (0xc612), \
75c9f6
+                    PED_CPU_TO_LE16 (0x4316), 0xaa, 0x26, \
75c9f6
+                    { 0x8b, 0x49, 0x52, 0x1e, 0x5a, 0x8b }})
75c9f6
 
75c9f6
 struct __attribute__ ((packed)) _GuidPartitionTableHeader_t
75c9f6
 {
75c9f6
@@ -283,6 +287,7 @@ typedef struct _GPTPartitionData
75c9f6
   int atvrecv;
75c9f6
   int msftrecv;
75c9f6
   int legacy_boot;
75c9f6
+  int prep;
75c9f6
 } GPTPartitionData;
75c9f6
 
75c9f6
 static PedDiskType gpt_disk_type;
75c9f6
@@ -782,6 +787,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
75c9f6
     = gpt_part_data->hidden = gpt_part_data->msftres
75c9f6
     = gpt_part_data->msftrecv
75c9f6
     = gpt_part_data->legacy_boot
75c9f6
+    = gpt_part_data->prep
75c9f6
     = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0;
75c9f6
 
75c9f6
   if (pte->Attributes.RequiredToFunction & 0x1)
75c9f6
@@ -805,6 +811,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
75c9f6
     gpt_part_data->msftrecv = 1;
75c9f6
   else if (!guid_cmp (gpt_part_data->type, PARTITION_APPLE_TV_RECOVERY_GUID))
75c9f6
     gpt_part_data->atvrecv = 1;
75c9f6
+  else if (!guid_cmp (gpt_part_data->type, PARTITION_PREP_GUID))
75c9f6
+    gpt_part_data->prep = 1;
75c9f6
 
75c9f6
   return part;
75c9f6
 }
75c9f6
@@ -1321,6 +1329,7 @@ gpt_partition_new (const PedDisk *disk,
75c9f6
   gpt_part_data->msftrecv = 0;
75c9f6
   gpt_part_data->atvrecv = 0;
75c9f6
   gpt_part_data->legacy_boot = 0;
75c9f6
+  gpt_part_data->prep = 0;
75c9f6
   uuid_generate ((unsigned char *) &gpt_part_data->uuid);
75c9f6
   swap_uuid_and_efi_guid ((unsigned char *) (&gpt_part_data->uuid));
75c9f6
   memset (gpt_part_data->name, 0, sizeof gpt_part_data->name);
75c9f6
@@ -1394,6 +1403,11 @@ gpt_partition_set_system (PedPartition *part,
75c9f6
       gpt_part_data->type = PARTITION_RAID_GUID;
75c9f6
       return 1;
75c9f6
     }
75c9f6
+  if (gpt_part_data->prep)
75c9f6
+    {
75c9f6
+      gpt_part_data->type = PARTITION_PREP_GUID;
75c9f6
+      return 1;
75c9f6
+    }
75c9f6
   if (gpt_part_data->boot)
75c9f6
     {
75c9f6
       gpt_part_data->type = PARTITION_SYSTEM_GUID;
75c9f6
@@ -1564,6 +1578,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
75c9f6
           = gpt_part_data->hp_service
75c9f6
           = gpt_part_data->msftres
75c9f6
           = gpt_part_data->msftrecv
75c9f6
+          = gpt_part_data->prep
75c9f6
           = gpt_part_data->atvrecv = 0;
75c9f6
       return gpt_partition_set_system (part, part->fs_type);
75c9f6
     case PED_PARTITION_BIOS_GRUB:
75c9f6
@@ -1575,6 +1590,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
75c9f6
           = gpt_part_data->hp_service
75c9f6
           = gpt_part_data->msftres
75c9f6
           = gpt_part_data->msftrecv
75c9f6
+          = gpt_part_data->prep
75c9f6
           = gpt_part_data->atvrecv = 0;
75c9f6
       return gpt_partition_set_system (part, part->fs_type);
75c9f6
     case PED_PARTITION_RAID:
75c9f6
@@ -1586,6 +1602,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
75c9f6
           = gpt_part_data->hp_service
75c9f6
           = gpt_part_data->msftres
75c9f6
           = gpt_part_data->msftrecv
75c9f6
+          = gpt_part_data->prep
75c9f6
           = gpt_part_data->atvrecv = 0;
75c9f6
       return gpt_partition_set_system (part, part->fs_type);
75c9f6
     case PED_PARTITION_LVM:
75c9f6
@@ -1597,6 +1614,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
75c9f6
           = gpt_part_data->hp_service
75c9f6
           = gpt_part_data->msftres
75c9f6
           = gpt_part_data->msftrecv
75c9f6
+          = gpt_part_data->prep
75c9f6
           = gpt_part_data->atvrecv = 0;
75c9f6
       return gpt_partition_set_system (part, part->fs_type);
75c9f6
     case PED_PARTITION_HPSERVICE:
75c9f6
@@ -1608,6 +1626,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
75c9f6
           = gpt_part_data->bios_grub
75c9f6
           = gpt_part_data->msftres
75c9f6
           = gpt_part_data->msftrecv
75c9f6
+          = gpt_part_data->prep
75c9f6
           = gpt_part_data->atvrecv = 0;
75c9f6
       return gpt_partition_set_system (part, part->fs_type);
75c9f6
     case PED_PARTITION_MSFT_RESERVED:
75c9f6
@@ -1619,6 +1638,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
75c9f6
           = gpt_part_data->bios_grub
75c9f6
           = gpt_part_data->hp_service
75c9f6
           = gpt_part_data->msftrecv
75c9f6
+          = gpt_part_data->prep
75c9f6
           = gpt_part_data->atvrecv = 0;
75c9f6
       return gpt_partition_set_system (part, part->fs_type);
75c9f6
     case PED_PARTITION_DIAG:
75c9f6
@@ -1630,6 +1650,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
75c9f6
           = gpt_part_data->bios_grub
75c9f6
           = gpt_part_data->hp_service
75c9f6
           = gpt_part_data->msftres
75c9f6
+          = gpt_part_data->prep
75c9f6
           = gpt_part_data->atvrecv = 0;
75c9f6
       return gpt_partition_set_system (part, part->fs_type);
75c9f6
     case PED_PARTITION_APPLE_TV_RECOVERY:
75c9f6
@@ -1641,8 +1662,21 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
75c9f6
           = gpt_part_data->bios_grub
75c9f6
           = gpt_part_data->hp_service
75c9f6
           = gpt_part_data->msftres
75c9f6
+          = gpt_part_data->prep
75c9f6
           = gpt_part_data->msftrecv = 0;
75c9f6
       return gpt_partition_set_system (part, part->fs_type);
75c9f6
+    case PED_PARTITION_PREP:
75c9f6
+      gpt_part_data->prep = state;
75c9f6
+      if (state)
75c9f6
+        gpt_part_data->boot
75c9f6
+          = gpt_part_data->raid
75c9f6
+          = gpt_part_data->lvm
75c9f6
+          = gpt_part_data->bios_grub
75c9f6
+          = gpt_part_data->hp_service
75c9f6
+          = gpt_part_data->msftres
75c9f6
+          = gpt_part_data->msftrecv
75c9f6
+          = gpt_part_data->atvrecv = 0;
75c9f6
+      return gpt_partition_set_system (part, part->fs_type);
75c9f6
     case PED_PARTITION_HIDDEN:
75c9f6
       gpt_part_data->hidden = state;
75c9f6
       return 1;
75c9f6
@@ -1687,6 +1721,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag)
75c9f6
       return gpt_part_data->hidden;
75c9f6
     case PED_PARTITION_LEGACY_BOOT:
75c9f6
       return gpt_part_data->legacy_boot;
75c9f6
+    case PED_PARTITION_PREP:
75c9f6
+      return gpt_part_data->prep;
75c9f6
     case PED_PARTITION_SWAP:
75c9f6
     case PED_PARTITION_LBA:
75c9f6
     case PED_PARTITION_ROOT:
75c9f6
@@ -1712,6 +1748,7 @@ gpt_partition_is_flag_available (const PedPartition *part,
75c9f6
     case PED_PARTITION_APPLE_TV_RECOVERY:
75c9f6
     case PED_PARTITION_HIDDEN:
75c9f6
     case PED_PARTITION_LEGACY_BOOT:
75c9f6
+    case PED_PARTITION_PREP:
75c9f6
       return 1;
75c9f6
     case PED_PARTITION_SWAP:
75c9f6
     case PED_PARTITION_ROOT:
75c9f6
-- 
75c9f6
1.9.3
75c9f6