You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

209 lines
8.1 KiB

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