1
From aa1a5c861bb8a47c76519eac841321def7d011b0 Mon Sep 17 00:00:00 2001
2
From: Daniel Battaiola Kreling <dbkreling@br.ibm.com>
3
Date: Mon, 7 Oct 2013 11:51:50 +0530
4
Subject: GPT: add support for PReP GUID
6
PReP (PowerPC Reference Platform) boot partition is the first partition used in
7
PowerPC platform for containing the bootable kernel or bootloader. The firmware
8
searches for this partition and jumps to it for booting. So far no GUID was
9
specified for this partition type and hence booting from GPT disk was not
10
supported on this platform. A new GUID 9e1a2d38-c612-4316-aa26-8b49521e5a8b for
11
PReP partition is proposed to be included in GPT.
13
Origin: backport, http://git.savannah.gnu.org/cgit/parted.git/commit/?id=d151cc20af79c89383ffacc89c1f646f831fc3e6
14
Last-Update: 2014-01-31
16
Patch-Name: gpt-prep.patch
18
doc/parted.texi | 2 +-
19
libparted/labels/gpt.c | 38 ++++++++++++++++++++++++++++++++++++++
20
2 files changed, 39 insertions(+), 1 deletion(-)
22
diff --git a/doc/parted.texi b/doc/parted.texi
23
index 0525b5f..b09431a 100644
26
@@ -836,7 +836,7 @@ physical volume.
27
by the Linux/PA-RISC boot loader, palo.
30
-(MS-DOS) - this flag can be enabled so that the partition can be used
31
+(MS-DOS, GPT) - this flag can be enabled so that the partition can be used
32
as a PReP boot partition on PowerPC PReP or IBM RS6K/CHRP hardware.
35
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
36
index d6e217a..daf34d6 100644
37
--- a/libparted/labels/gpt.c
38
+++ b/libparted/labels/gpt.c
39
@@ -157,6 +157,10 @@ typedef struct
40
((efi_guid_t) { PED_CPU_TO_LE32 (0x516e7cb6), PED_CPU_TO_LE16 (0x6ecf), \
41
PED_CPU_TO_LE16 (0x11d6), 0x8f, 0xf8, \
42
{ 0x00, 0x02, 0x2d, 0x09, 0x71, 0x2b }})
43
+#define PARTITION_PREP_GUID \
44
+ ((efi_guid_t) { PED_CPU_TO_LE32 (0x9e1a2d38), PED_CPU_TO_LE16 (0xc612), \
45
+ PED_CPU_TO_LE16 (0x4316), 0xaa, 0x26, \
46
+ { 0x8b, 0x49, 0x52, 0x1e, 0x5a, 0x8b }})
48
struct __attribute__ ((packed)) _GuidPartitionTableHeader_t
50
@@ -299,6 +303,7 @@ typedef struct _GPTPartitionData
57
static PedDiskType gpt_disk_type;
58
@@ -1071,6 +1076,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
59
= gpt_part_data->msftdata
60
= gpt_part_data->msftrecv
61
= gpt_part_data->legacy_boot
62
+ = gpt_part_data->prep
63
= gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0;
65
if (pte->Attributes.RequiredToFunction & 0x1)
66
@@ -1096,6 +1102,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
67
gpt_part_data->msftrecv = 1;
68
else if (!guid_cmp (gpt_part_data->type, PARTITION_APPLE_TV_RECOVERY_GUID))
69
gpt_part_data->atvrecv = 1;
70
+ else if (!guid_cmp (gpt_part_data->type, PARTITION_PREP_GUID))
71
+ gpt_part_data->prep = 1;
75
@@ -1746,6 +1754,7 @@ gpt_partition_new (const PedDisk *disk,
76
gpt_part_data->msftrecv = 0;
77
gpt_part_data->atvrecv = 0;
78
gpt_part_data->legacy_boot = 0;
79
+ gpt_part_data->prep = 0;
80
uuid_generate ((unsigned char *) &gpt_part_data->uuid);
81
swap_uuid_and_efi_guid ((unsigned char *) (&gpt_part_data->uuid));
82
memset (gpt_part_data->name, 0, sizeof gpt_part_data->name);
83
@@ -1819,6 +1828,11 @@ gpt_partition_set_system (PedPartition *part,
84
gpt_part_data->type = PARTITION_RAID_GUID;
87
+ if (gpt_part_data->prep)
89
+ gpt_part_data->type = PARTITION_PREP_GUID;
92
if (gpt_part_data->boot)
94
gpt_part_data->type = PARTITION_SYSTEM_GUID;
95
@@ -2000,6 +2014,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
96
= gpt_part_data->msftres
97
= gpt_part_data->msftdata
98
= gpt_part_data->msftrecv
99
+ = gpt_part_data->prep
100
= gpt_part_data->atvrecv = 0;
101
return gpt_partition_set_system (part, part->fs_type);
102
case PED_PARTITION_BIOS_GRUB:
103
@@ -2012,6 +2027,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
104
= gpt_part_data->msftres
105
= gpt_part_data->msftdata
106
= gpt_part_data->msftrecv
107
+ = gpt_part_data->prep
108
= gpt_part_data->atvrecv = 0;
109
return gpt_partition_set_system (part, part->fs_type);
110
case PED_PARTITION_RAID:
111
@@ -2024,6 +2040,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
112
= gpt_part_data->msftres
113
= gpt_part_data->msftdata
114
= gpt_part_data->msftrecv
115
+ = gpt_part_data->prep
116
= gpt_part_data->atvrecv = 0;
117
return gpt_partition_set_system (part, part->fs_type);
118
case PED_PARTITION_LVM:
119
@@ -2036,6 +2053,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
120
= gpt_part_data->msftres
121
= gpt_part_data->msftdata
122
= gpt_part_data->msftrecv
123
+ = gpt_part_data->prep
124
= gpt_part_data->atvrecv = 0;
125
return gpt_partition_set_system (part, part->fs_type);
126
case PED_PARTITION_HPSERVICE:
127
@@ -2048,6 +2066,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
128
= gpt_part_data->msftres
129
= gpt_part_data->msftdata
130
= gpt_part_data->msftrecv
131
+ = gpt_part_data->prep
132
= gpt_part_data->atvrecv = 0;
133
return gpt_partition_set_system (part, part->fs_type);
134
case PED_PARTITION_MSFT_RESERVED:
135
@@ -2060,6 +2079,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
136
= gpt_part_data->hp_service
137
= gpt_part_data->msftdata
138
= gpt_part_data->msftrecv
139
+ = gpt_part_data->prep
140
= gpt_part_data->atvrecv = 0;
141
return gpt_partition_set_system (part, part->fs_type);
142
case PED_PARTITION_MSFT_DATA:
143
@@ -2073,6 +2093,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
144
= gpt_part_data->msftres
145
= gpt_part_data->msftdata
146
= gpt_part_data->msftrecv
147
+ = gpt_part_data->prep
148
= gpt_part_data->atvrecv = 0;
149
gpt_part_data->msftdata = 1;
151
@@ -2089,6 +2110,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
152
= gpt_part_data->hp_service
153
= gpt_part_data->msftdata
154
= gpt_part_data->msftres
155
+ = gpt_part_data->prep
156
= gpt_part_data->atvrecv = 0;
157
return gpt_partition_set_system (part, part->fs_type);
158
case PED_PARTITION_APPLE_TV_RECOVERY:
159
@@ -2101,8 +2123,21 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
160
= gpt_part_data->hp_service
161
= gpt_part_data->msftres
162
= gpt_part_data->msftdata
163
+ = gpt_part_data->prep
164
= gpt_part_data->msftrecv = 0;
165
return gpt_partition_set_system (part, part->fs_type);
166
+ case PED_PARTITION_PREP:
167
+ gpt_part_data->prep = state;
169
+ gpt_part_data->boot
170
+ = gpt_part_data->raid
171
+ = gpt_part_data->lvm
172
+ = gpt_part_data->bios_grub
173
+ = gpt_part_data->hp_service
174
+ = gpt_part_data->msftres
175
+ = gpt_part_data->msftrecv
176
+ = gpt_part_data->atvrecv = 0;
177
+ return gpt_partition_set_system (part, part->fs_type);
178
case PED_PARTITION_HIDDEN:
179
gpt_part_data->hidden = state;
181
@@ -2149,6 +2184,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag)
182
return gpt_part_data->hidden;
183
case PED_PARTITION_LEGACY_BOOT:
184
return gpt_part_data->legacy_boot;
185
+ case PED_PARTITION_PREP:
186
+ return gpt_part_data->prep;
187
case PED_PARTITION_SWAP:
188
case PED_PARTITION_LBA:
189
case PED_PARTITION_ROOT:
190
@@ -2175,6 +2212,7 @@ gpt_partition_is_flag_available (const PedPartition *part,
191
case PED_PARTITION_APPLE_TV_RECOVERY:
192
case PED_PARTITION_HIDDEN:
193
case PED_PARTITION_LEGACY_BOOT:
194
+ case PED_PARTITION_PREP:
196
case PED_PARTITION_SWAP:
197
case PED_PARTITION_ROOT: