parted/parted-GPT-add-support-for-PReP-GUID.patch

212 lines
8.2 KiB
Diff

From d151cc20af79c89383ffacc89c1f646f831fc3e6 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
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.
---
NEWS | 7 +++++++
doc/parted.texi | 2 +-
libparted/labels/gpt.c | 38 ++++++++++++++++++++++++++++++++++++++
3 files changed, 46 insertions(+), 1 deletion(-)
Index: parted-3.1/NEWS
===================================================================
--- parted-3.1.orig/NEWS
+++ parted-3.1/NEWS
@@ -1,5 +1,12 @@
GNU parted NEWS -*- outline -*-
+* Noteworthy changes post release 3.1
+
+** New features
+
+ Add support for prep flag to GPT to select PowerPC Reference Platform
+ boot partition type.
+
* Noteworthy changes in release 3.1 (2012-03-02) [stable]
** New features
Index: parted-3.1/doc/parted.texi
===================================================================
--- parted-3.1.orig/doc/parted.texi
+++ parted-3.1/doc/parted.texi
@@ -822,7 +822,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
Index: parted-3.1/libparted/labels/gpt.c
===================================================================
--- parted-3.1.orig/libparted/labels/gpt.c
+++ parted-3.1/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 }})
#define PARTITION_IRST_GUID \
((efi_guid_t) { PED_CPU_TO_LE32 (0xD3BFE2DE), PED_CPU_TO_LE16 (0x3DAF), \
PED_CPU_TO_LE16 (0x11DF), 0xba, 0x40, \
@@ -287,6 +291,7 @@ typedef struct _GPTPartitionData
int atvrecv;
int msftrecv;
int legacy_boot;
+ int prep;
int irst;
} GPTPartitionData;
@@ -890,6 +895,7 @@ _parse_part_entry (PedDisk *disk, GuidPa
= gpt_part_data->hidden = gpt_part_data->msftres
= gpt_part_data->msftrecv
= gpt_part_data->legacy_boot
+ = gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0;
@@ -914,6 +920,8 @@ _parse_part_entry (PedDisk *disk, GuidPa
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;
else if (!guid_cmp (gpt_part_data->type, PARTITION_IRST_GUID))
gpt_part_data->irst = 1;
@@ -1539,6 +1547,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;
gpt_part_data->irst = 0;
uuid_generate ((unsigned char *) &gpt_part_data->uuid);
swap_uuid_and_efi_guid ((unsigned char *) (&gpt_part_data->uuid));
@@ -1613,6 +1622,11 @@ gpt_partition_set_system (PedPartition *
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;
@@ -1788,6 +1802,7 @@ gpt_partition_set_flag (PedPartition *pa
= gpt_part_data->hp_service
= gpt_part_data->msftres
= gpt_part_data->msftrecv
+ = gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
@@ -1800,6 +1815,7 @@ gpt_partition_set_flag (PedPartition *pa
= gpt_part_data->hp_service
= gpt_part_data->msftres
= gpt_part_data->msftrecv
+ = gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
@@ -1812,6 +1828,7 @@ gpt_partition_set_flag (PedPartition *pa
= gpt_part_data->hp_service
= gpt_part_data->msftres
= gpt_part_data->msftrecv
+ = gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
@@ -1824,6 +1841,7 @@ gpt_partition_set_flag (PedPartition *pa
= gpt_part_data->hp_service
= gpt_part_data->msftres
= gpt_part_data->msftrecv
+ = gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
@@ -1836,6 +1854,7 @@ gpt_partition_set_flag (PedPartition *pa
= gpt_part_data->bios_grub
= gpt_part_data->msftres
= gpt_part_data->msftrecv
+ = gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
@@ -1848,6 +1867,7 @@ gpt_partition_set_flag (PedPartition *pa
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftrecv
+ = gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
@@ -1860,6 +1880,7 @@ gpt_partition_set_flag (PedPartition *pa
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
+ = gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
@@ -1872,9 +1893,22 @@ gpt_partition_set_flag (PedPartition *pa
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
+ = gpt_part_data->prep
= gpt_part_data->irst
= 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_IRST:
gpt_part_data->irst = state;
if (state)
@@ -1885,6 +1919,7 @@ gpt_partition_set_flag (PedPartition *pa
= 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_HIDDEN:
@@ -1931,6 +1966,8 @@ gpt_partition_get_flag (const PedPartiti
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_IRST:
return gpt_part_data->irst;
case PED_PARTITION_SWAP:
@@ -1959,6 +1996,7 @@ gpt_partition_is_flag_available (const P
case PED_PARTITION_HIDDEN:
case PED_PARTITION_LEGACY_BOOT:
case PED_PARTITION_IRST:
+ case PED_PARTITION_PREP:
return 1;
case PED_PARTITION_SWAP:
case PED_PARTITION_ROOT: