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

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