summaryrefslogtreecommitdiff
path: root/firmware/lib/cgptlib/cgptlib_internal.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@chromium.org>2016-09-07 16:45:48 -0400
committerchrome-bot <chrome-bot@chromium.org>2016-09-08 15:36:23 -0700
commit6c18af501798c9b597839a3628c8374a2f8d7483 (patch)
treee846d7253980759aed453ba8649653cc7a4b60b9 /firmware/lib/cgptlib/cgptlib_internal.c
parent6764405c93664efcf9742bf4973225099f65b6ec (diff)
downloadvboot-6c18af501798c9b597839a3628c8374a2f8d7483.tar.gz
cgpt: add support for managing the legacy boot gpt bitstabilize-kevin-8785.94.B
Bit 2 in the GPT partition attributes has been allocated as the legacy bios boot (equivalent to the "active" or "boot" flag in MBR). If we try to boot images on newer x86 systems, syslinux dies because it can't find any GPT partition marked bootable. Update the various parts of cgpt add & show to manage this bit. Now we can run: cgpt add -i 12 -B 1 chromiumos_image.bin And the EFI partition will be marked bootable. BUG=chromium:644845 TEST=vboot_reference unittests pass TEST=booted an amd64-generic disk image via USB on a generic laptop BRANCH=None Change-Id: I78e17b8df5b0c61e9e2d8a3c703e6d5ad230fe92 Reviewed-on: https://chromium-review.googlesource.com/382411 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'firmware/lib/cgptlib/cgptlib_internal.c')
-rw-r--r--firmware/lib/cgptlib/cgptlib_internal.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/firmware/lib/cgptlib/cgptlib_internal.c b/firmware/lib/cgptlib/cgptlib_internal.c
index 7d402dfb..24b7ba15 100644
--- a/firmware/lib/cgptlib/cgptlib_internal.c
+++ b/firmware/lib/cgptlib/cgptlib_internal.c
@@ -378,6 +378,11 @@ void GptRepair(GptData *gpt)
gpt->valid_entries = MASK_BOTH;
}
+int GetEntryLegacyBoot(const GptEntry *e)
+{
+ return e->attrs.fields.legacy_boot;
+}
+
int GetEntrySuccessful(const GptEntry *e)
{
return (e->attrs.fields.gpt_att & CGPT_ATTRIBUTE_SUCCESSFUL_MASK) >>
@@ -402,6 +407,11 @@ int GetEntryTries(const GptEntry *e)
CGPT_ATTRIBUTE_TRIES_OFFSET;
}
+void SetEntryLegacyBoot(GptEntry *e, int legacy_boot)
+{
+ e->attrs.fields.legacy_boot = legacy_boot;
+}
+
void SetEntrySuccessful(GptEntry *e, int successful)
{
if (successful)