From d151cc20af79c89383ffacc89c1f646f831fc3e6 Mon Sep 17 00:00:00 2001 From: Daniel Battaiola Kreling 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, \ @@ -286,6 +290,7 @@ typedef struct _GPTPartitionData int atvrecv; int msftrecv; int legacy_boot; + int prep; int irst; } GPTPartitionData; @@ -888,6 +893,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; @@ -912,6 +918,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; @@ -1526,6 +1534,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)); @@ -1600,6 +1609,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; @@ -1735,6 +1749,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); @@ -1747,6 +1762,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); @@ -1759,6 +1775,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); @@ -1771,6 +1788,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); @@ -1783,6 +1801,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); @@ -1795,6 +1814,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); @@ -1807,6 +1827,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); @@ -1819,9 +1840,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) @@ -1832,6 +1866,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: @@ -1878,6 +1913,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: @@ -1906,6 +1943,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: