- Add chromeos_kernel partition flag for gpt disklabels

- Add bls_boot partition flag for msdos and gpt disklabels
This commit is contained in:
Brian C. Lane 2020-03-02 09:00:47 -08:00
parent 5dbd295bd4
commit ac53ea06ad
4 changed files with 677 additions and 0 deletions

View File

@ -0,0 +1,283 @@
From e29dfafcf2d9a6886a66506bc84efb4badc5f6d6 Mon Sep 17 00:00:00 2001
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Date: Thu, 10 Oct 2019 21:03:22 +0300
Subject: [PATCH] libparted: Add ChromeOS Kernel partition flag
This adds a GPT-only partition type flag, chromeos_kernel, for use on
Chrome OS machines, with GUID FE3A2A5D-4F32-41A7-B725-ACCC3285A309.
The firmware/bootloader in these machines relies on special images being
written to partitions of this type. Among multiple such partitions, it
decides which one it will boot from based on the GUID-specific partition
attributes. This patch is not intended to and does not manipulate these
bits.
Google refers to these partitions as "ChromeOS kernel" partitions. They
also define partitions for rootfs, firmware, and a reserved one; but
these are not necessary for the boot flow and are not included here.
Relevant ChromiumOS documentation:
https://www.chromium.org/chromium-os/chromiumos-design-docs/disk-format
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
---
doc/C/parted.8 | 2 +-
doc/parted.texi | 4 ++++
include/parted/disk.in.h | 5 +++--
libparted/disk.c | 2 ++
libparted/labels/gpt.c | 45 ++++++++++++++++++++++++++++++++++++++++
5 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/doc/C/parted.8 b/doc/C/parted.8
index 15932c2..d40279e 100644
--- a/doc/C/parted.8
+++ b/doc/C/parted.8
@@ -112,7 +112,7 @@ or an LVM logical volume if necessary.
.B set \fIpartition\fP \fIflag\fP \fIstate\fP
Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP.
Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba",
-"legacy_boot", "irst", "msftres", "esp" and "palo".
+"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel" and "palo".
\fIstate\fP should be either "on" or "off".
.TP
.B unit \fIunit\fP
diff --git a/doc/parted.texi b/doc/parted.texi
index 77c9628..f983d2c 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -874,6 +874,10 @@ partition.
(MS-DOS, GPT) - this flag identifies a UEFI System Partition. On GPT
it is an alias for boot.
+@item chromeos_kernel
+(GPT) - this flag indicates a partition that can be used with the Chrome OS
+bootloader and verified boot implementation.
+
@item lba
(MS-DOS) - this flag can be enabled to tell MS DOS, MS Windows 9x and
MS Windows ME based operating systems to use Linear (LBA) mode.
diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
index a3b380d..b257c27 100644
--- a/include/parted/disk.in.h
+++ b/include/parted/disk.in.h
@@ -75,10 +75,11 @@ enum _PedPartitionFlag {
PED_PARTITION_LEGACY_BOOT=15,
PED_PARTITION_MSFT_DATA=16,
PED_PARTITION_IRST=17,
- PED_PARTITION_ESP=18
+ PED_PARTITION_ESP=18,
+ PED_PARTITION_CHROMEOS_KERNEL=19
};
#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT
-#define PED_PARTITION_LAST_FLAG PED_PARTITION_ESP
+#define PED_PARTITION_LAST_FLAG PED_PARTITION_CHROMEOS_KERNEL
enum _PedDiskTypeFeature {
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
diff --git a/libparted/disk.c b/libparted/disk.c
index 5aaac5a..d1f1077 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -2407,6 +2407,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag)
return N_("irst");
case PED_PARTITION_ESP:
return N_("esp");
+ case PED_PARTITION_CHROMEOS_KERNEL:
+ return N_("chromeos_kernel");
default:
ped_exception_throw (
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 8e9500b..b8b58cd 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -156,6 +156,10 @@ typedef struct
((efi_guid_t) { PED_CPU_TO_LE32 (0xD3BFE2DE), PED_CPU_TO_LE16 (0x3DAF), \
PED_CPU_TO_LE16 (0x11DF), 0xba, 0x40, \
{ 0xE3, 0xA5, 0x56, 0xD8, 0x95, 0x93 }})
+#define PARTITION_CHROMEOS_KERNEL_GUID \
+ ((efi_guid_t) { PED_CPU_TO_LE32 (0xfe3a2a5d), PED_CPU_TO_LE16 (0x4f32), \
+ PED_CPU_TO_LE16 (0x41a7), 0xb7, 0x25, \
+ { 0xac, 0xcc, 0x32, 0x85, 0xa3, 0x09 }})
struct __attribute__ ((packed)) _GuidPartitionTableHeader_t
{
@@ -303,6 +307,7 @@ typedef struct _GPTPartitionData
int legacy_boot;
int prep;
int irst;
+ int chromeos_kernel;
} GPTPartitionData;
static PedDiskType gpt_disk_type;
@@ -826,6 +831,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
= gpt_part_data->legacy_boot
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0;
if (pte->Attributes.RequiredToFunction & 0x1)
@@ -857,6 +863,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
gpt_part_data->prep = 1;
else if (!guid_cmp (gpt_part_data->type, PARTITION_IRST_GUID))
gpt_part_data->irst = 1;
+ else if (!guid_cmp (gpt_part_data->type, PARTITION_CHROMEOS_KERNEL_GUID))
+ gpt_part_data->chromeos_kernel = 1;
return part;
}
@@ -1377,6 +1385,7 @@ gpt_partition_new (const PedDisk *disk,
gpt_part_data->prep = 0;
gpt_part_data->translated_name = 0;
gpt_part_data->irst = 0;
+ gpt_part_data->chromeos_kernel = 0;
uuid_generate ((unsigned char *) &gpt_part_data->uuid);
swap_uuid_and_efi_guid (&gpt_part_data->uuid);
memset (gpt_part_data->name, 0, sizeof gpt_part_data->name);
@@ -1507,6 +1516,11 @@ gpt_partition_set_system (PedPartition *part,
gpt_part_data->type = PARTITION_IRST_GUID;
return 1;
}
+ if (gpt_part_data->chromeos_kernel)
+ {
+ gpt_part_data->type = PARTITION_CHROMEOS_KERNEL_GUID;
+ return 1;
+ }
if (fs_type)
{
@@ -1653,6 +1667,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_BIOS_GRUB:
@@ -1668,6 +1683,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_RAID:
@@ -1683,6 +1699,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_LVM:
@@ -1698,6 +1715,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_SWAP:
@@ -1713,6 +1731,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HPSERVICE:
@@ -1728,6 +1747,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_MSFT_RESERVED:
@@ -1743,6 +1763,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_MSFT_DATA:
@@ -1758,6 +1779,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
gpt_part_data->msftdata = 1;
} else {
@@ -1777,6 +1799,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_APPLE_TV_RECOVERY:
@@ -1791,6 +1814,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->msftdata
= gpt_part_data->prep
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->msftrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_PREP:
@@ -1805,6 +1829,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->irst
= gpt_part_data->atvrecv
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->msftrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_IRST:
@@ -1820,8 +1845,25 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->prep
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
+ case PED_PARTITION_CHROMEOS_KERNEL:
+ gpt_part_data->chromeos_kernel = state;
+ if (state)
+ gpt_part_data->boot
+ = gpt_part_data->bios_grub
+ = gpt_part_data->raid
+ = gpt_part_data->lvm
+ = gpt_part_data->swap
+ = gpt_part_data->hp_service
+ = gpt_part_data->msftres
+ = gpt_part_data->msftdata
+ = gpt_part_data->msftrecv
+ = gpt_part_data->atvrecv
+ = gpt_part_data->prep
+ = gpt_part_data->irst = 0;
+ return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HIDDEN:
gpt_part_data->hidden = state;
return 1;
@@ -1874,6 +1916,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag)
return gpt_part_data->irst;
case PED_PARTITION_SWAP:
return gpt_part_data->swap;
+ case PED_PARTITION_CHROMEOS_KERNEL:
+ return gpt_part_data->chromeos_kernel;
case PED_PARTITION_LBA:
case PED_PARTITION_ROOT:
default:
@@ -1903,6 +1947,7 @@ gpt_partition_is_flag_available (const PedPartition *part,
case PED_PARTITION_PREP:
case PED_PARTITION_IRST:
case PED_PARTITION_ESP:
+ case PED_PARTITION_CHROMEOS_KERNEL:
return 1;
case PED_PARTITION_ROOT:
case PED_PARTITION_LBA:
--
2.24.1

View File

@ -0,0 +1,139 @@
From d6056299028f60b96802487de0d1d65e51e1fd33 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 19 Dec 2019 16:05:59 -0800
Subject: [PATCH 6/7] libparted: Add support for MSDOS partition type bls_boot
(0xea)
This type is used by the Boot Loader Specification to identify a
compatible /boot boot partition.
---
doc/C/parted.8 | 2 +-
libparted/labels/dos.c | 33 ++++++++++++++++++++-------------
2 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/doc/C/parted.8 b/doc/C/parted.8
index d40279e..297c39a 100644
--- a/doc/C/parted.8
+++ b/doc/C/parted.8
@@ -112,7 +112,7 @@ or an LVM logical volume if necessary.
.B set \fIpartition\fP \fIflag\fP \fIstate\fP
Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP.
Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba",
-"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel" and "palo".
+"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot" and "palo".
\fIstate\fP should be either "on" or "off".
.TP
.B unit \fIunit\fP
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index ed1341e..d859b33 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -92,6 +92,7 @@ static const char MBR_BOOT_CODE[] = {
#define PARTITION_HFS 0xaf
#define PARTITION_SUN_UFS 0xbf
#define PARTITION_DELL_DIAG 0xde
+#define PARTITION_BLS_BOOT 0xea
#define PARTITION_GPT 0xee
#define PARTITION_ESP 0xef
#define PARTITION_PALO 0xf0
@@ -165,6 +166,7 @@ typedef struct {
int diag;
int irst;
int esp;
+ int bls_boot;
OrigState* orig; /* used for CHS stuff */
} DosPartitionData;
@@ -961,6 +963,7 @@ raw_part_parse (const PedDisk* disk, const DosRawPartition* raw_part,
dos_data->prep = raw_part->type == PARTITION_PREP;
dos_data->irst = raw_part->type == PARTITION_IRST;
dos_data->esp = raw_part->type == PARTITION_ESP;
+ dos_data->bls_boot = raw_part->type == PARTITION_BLS_BOOT;
dos_data->orig = ped_malloc (sizeof (OrigState));
if (!dos_data->orig) {
ped_partition_destroy (part);
@@ -1340,22 +1343,10 @@ msdos_partition_new (const PedDisk* disk, PedPartitionType part_type,
if (ped_partition_is_active (part)) {
part->disk_specific
- = dos_data = ped_malloc (sizeof (DosPartitionData));
+ = dos_data = ped_calloc (sizeof (DosPartitionData));
if (!dos_data)
goto error_free_part;
- dos_data->orig = NULL;
dos_data->system = PARTITION_LINUX;
- dos_data->hidden = 0;
- dos_data->msftres = 0;
- dos_data->boot = 0;
- dos_data->diag = 0;
- dos_data->raid = 0;
- dos_data->lvm = 0;
- dos_data->lba = 0;
- dos_data->palo = 0;
- dos_data->prep = 0;
- dos_data->irst = 0;
- dos_data->esp = 0;
} else {
part->disk_specific = NULL;
}
@@ -1394,6 +1385,7 @@ msdos_partition_duplicate (const PedPartition* part)
new_dos_data->prep = old_dos_data->prep;
new_dos_data->irst = old_dos_data->irst;
new_dos_data->esp = old_dos_data->esp;
+ new_dos_data->bls_boot = old_dos_data->bls_boot;
if (old_dos_data->orig) {
new_dos_data->orig = ped_malloc (sizeof (OrigState));
@@ -1492,6 +1484,10 @@ msdos_partition_set_system (PedPartition* part,
dos_data->system = PARTITION_ESP;
return 1;
}
+ if (dos_data->bls_boot) {
+ dos_data->system = PARTITION_BLS_BOOT;
+ return 1;
+ }
if (!fs_type)
dos_data->system = PARTITION_LINUX;
@@ -1534,6 +1530,7 @@ clear_flags (DosPartitionData *dos_data)
dos_data->irst = 0;
dos_data->esp = 0;
dos_data->raid = 0;
+ dos_data->bls_boot = 0;
}
static int
@@ -1635,6 +1632,12 @@ msdos_partition_set_flag (PedPartition* part,
dos_data->esp = state;
return ped_partition_set_system (part, part->fs_type);
+ case PED_PARTITION_BLS_BOOT:
+ if (state)
+ clear_flags (dos_data);
+ dos_data->bls_boot = state;
+ return ped_partition_set_system (part, part->fs_type);
+
default:
return 0;
}
@@ -1689,6 +1692,9 @@ msdos_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
case PED_PARTITION_ESP:
return dos_data->esp;
+ case PED_PARTITION_BLS_BOOT:
+ return dos_data->bls_boot;
+
default:
return 0;
}
@@ -1719,6 +1725,7 @@ msdos_partition_is_flag_available (const PedPartition* part,
case PED_PARTITION_PREP:
case PED_PARTITION_IRST:
case PED_PARTITION_ESP:
+ case PED_PARTITION_BLS_BOOT:
case PED_PARTITION_DIAG:
return 1;
--
2.24.1

View File

@ -0,0 +1,248 @@
From e5fe9328c890a266544a7ef0d272150519fdfc5d Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 20 Dec 2019 10:52:35 -0800
Subject: [PATCH 7/7] libparted: Add support for bls_boot to GPT disks
This sets the partition GUID to bc13c2ff-59e6-4262-a352-b275fd6f7172 to
indicate that the partition is a Boot Loader Specification compatible
/boot partition.
---
doc/parted.texi | 4 ++++
include/parted/disk.in.h | 5 +++--
libparted/disk.c | 2 ++
libparted/labels/gpt.c | 47 +++++++++++++++++++++++++++++++++++++++-
4 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/doc/parted.texi b/doc/parted.texi
index f983d2c..213fc84 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -844,6 +844,10 @@ GRUB BIOS partition.
(GPT) - this flag is used to tell special purpose software that the GPT
partition may be bootable.
+@item bls_boot
+(MS-DOS, GPT) - Enable this to indicate that the selected partition is a
+Linux Boot Loader Specification compatible /boot partition.
+
@item boot
(Mac, MS-DOS, PC98) - should be enabled if you want to boot off the
partition. The semantics vary between disk labels. For MS-DOS disk
diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
index b257c27..fadb995 100644
--- a/include/parted/disk.in.h
+++ b/include/parted/disk.in.h
@@ -76,10 +76,11 @@ enum _PedPartitionFlag {
PED_PARTITION_MSFT_DATA=16,
PED_PARTITION_IRST=17,
PED_PARTITION_ESP=18,
- PED_PARTITION_CHROMEOS_KERNEL=19
+ PED_PARTITION_CHROMEOS_KERNEL=19,
+ PED_PARTITION_BLS_BOOT=20
};
#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT
-#define PED_PARTITION_LAST_FLAG PED_PARTITION_CHROMEOS_KERNEL
+#define PED_PARTITION_LAST_FLAG PED_PARTITION_BLS_BOOT
enum _PedDiskTypeFeature {
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
diff --git a/libparted/disk.c b/libparted/disk.c
index d1f1077..099837b 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -2409,6 +2409,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag)
return N_("esp");
case PED_PARTITION_CHROMEOS_KERNEL:
return N_("chromeos_kernel");
+ case PED_PARTITION_BLS_BOOT:
+ return N_("bls_boot");
default:
ped_exception_throw (
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index b8b58cd..93f7add 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -160,6 +160,10 @@ typedef struct
((efi_guid_t) { PED_CPU_TO_LE32 (0xfe3a2a5d), PED_CPU_TO_LE16 (0x4f32), \
PED_CPU_TO_LE16 (0x41a7), 0xb7, 0x25, \
{ 0xac, 0xcc, 0x32, 0x85, 0xa3, 0x09 }})
+#define PARTITION_BLS_BOOT_GUID \
+ ((efi_guid_t) { PED_CPU_TO_LE32 (0xbc13c2ff), PED_CPU_TO_LE16 (0x59e6), \
+ PED_CPU_TO_LE16 (0x4262), 0xa3, 0x52, \
+ { 0xb2, 0x75, 0xfd, 0x6f, 0x71, 0x72 }})
struct __attribute__ ((packed)) _GuidPartitionTableHeader_t
{
@@ -308,6 +312,7 @@ typedef struct _GPTPartitionData
int prep;
int irst;
int chromeos_kernel;
+ int bls_boot;
} GPTPartitionData;
static PedDiskType gpt_disk_type;
@@ -832,6 +837,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0;
if (pte->Attributes.RequiredToFunction & 0x1)
@@ -865,6 +871,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
gpt_part_data->irst = 1;
else if (!guid_cmp (gpt_part_data->type, PARTITION_CHROMEOS_KERNEL_GUID))
gpt_part_data->chromeos_kernel = 1;
+ else if (!guid_cmp (gpt_part_data->type, PARTITION_BLS_BOOT_GUID))
+ gpt_part_data->bls_boot = 1;
return part;
}
@@ -1386,6 +1394,7 @@ gpt_partition_new (const PedDisk *disk,
gpt_part_data->translated_name = 0;
gpt_part_data->irst = 0;
gpt_part_data->chromeos_kernel = 0;
+ gpt_part_data->bls_boot = 0;
uuid_generate ((unsigned char *) &gpt_part_data->uuid);
swap_uuid_and_efi_guid (&gpt_part_data->uuid);
memset (gpt_part_data->name, 0, sizeof gpt_part_data->name);
@@ -1521,6 +1530,11 @@ gpt_partition_set_system (PedPartition *part,
gpt_part_data->type = PARTITION_CHROMEOS_KERNEL_GUID;
return 1;
}
+ if (gpt_part_data->bls_boot)
+ {
+ gpt_part_data->type = PARTITION_BLS_BOOT_GUID;
+ return 1;
+ }
if (fs_type)
{
@@ -1668,6 +1682,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_BIOS_GRUB:
@@ -1684,6 +1699,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_RAID:
@@ -1700,6 +1716,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_LVM:
@@ -1716,6 +1733,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_SWAP:
@@ -1732,6 +1750,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HPSERVICE:
@@ -1748,6 +1767,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_MSFT_RESERVED:
@@ -1764,6 +1784,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_MSFT_DATA:
@@ -1780,6 +1801,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
gpt_part_data->msftdata = 1;
} else {
@@ -1830,6 +1852,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->irst
= gpt_part_data->atvrecv
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->msftrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_IRST:
@@ -1846,6 +1869,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_CHROMEOS_KERNEL:
@@ -1862,7 +1886,25 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->atvrecv
= gpt_part_data->prep
- = gpt_part_data->irst = 0;
+ = gpt_part_data->irst
+ = gpt_part_data->bls_boot = 0;
+ return gpt_partition_set_system (part, part->fs_type);
+ case PED_PARTITION_BLS_BOOT:
+ gpt_part_data->bls_boot = state;
+ if (state)
+ gpt_part_data->boot
+ = gpt_part_data->raid
+ = gpt_part_data->lvm
+ = gpt_part_data->swap
+ = gpt_part_data->bios_grub
+ = gpt_part_data->hp_service
+ = gpt_part_data->msftres
+ = gpt_part_data->msftdata
+ = gpt_part_data->msftrecv
+ = gpt_part_data->prep
+ = gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
+ = gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HIDDEN:
gpt_part_data->hidden = state;
@@ -1914,6 +1956,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag)
return gpt_part_data->prep;
case PED_PARTITION_IRST:
return gpt_part_data->irst;
+ case PED_PARTITION_BLS_BOOT:
+ return gpt_part_data->bls_boot;
case PED_PARTITION_SWAP:
return gpt_part_data->swap;
case PED_PARTITION_CHROMEOS_KERNEL:
@@ -1948,6 +1992,7 @@ gpt_partition_is_flag_available (const PedPartition *part,
case PED_PARTITION_IRST:
case PED_PARTITION_ESP:
case PED_PARTITION_CHROMEOS_KERNEL:
+ case PED_PARTITION_BLS_BOOT:
return 1;
case PED_PARTITION_ROOT:
case PED_PARTITION_LBA:
--
2.24.1

View File

@ -17,6 +17,9 @@ Source3: pubkey.brian.lane
Patch0001: 0001-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch
Patch0002: 0003-tests-Test-incomplete-resizepart-command.patch
Patch0003: 0004-Fix-end_input-usage-in-do_resizepart.patch
Patch0004: 0005-libparted-Add-ChromeOS-Kernel-partition-flag.patch
Patch0005: 0006-libparted-Add-support-for-MSDOS-partition-type-bls_b.patch
Patch0006: 0007-libparted-Add-support-for-bls_boot-to-GPT-disks.patch
BuildRequires: gcc
BuildRequires: e2fsprogs-devel
@ -128,6 +131,10 @@ make check
%changelog
* Fri Mar 06 2020 Brian C. Lane <bcl@redhat.com> - 3.3-3
- Add chromeos_kernel partition flag for gpt disklabels
- Add bls_boot partition flag for msdos and gpt disklabels
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild