From a4a8c02ad5988bd4b6fd85f6e09e9e0e79d18feb Mon Sep 17 00:00:00 2001 From: Ben Chan Date: Wed, 31 Jan 2018 11:39:14 -0800 Subject: cgpt: add support for managing GPT platform required partition bit Bit 0 in the GPT partition attributes is defined to indicate whether a partition is required by the platform. This CL adds the support for managing this bit to cgpt. BUG=b:70807006 BRANCH=None TEST=Run unit tests. Change-Id: Iaf87c828438b3df6730de502ae420fcf4c61277b Reviewed-on: https://chromium-review.googlesource.com/902196 Commit-Ready: Ben Chan Tested-by: Ben Chan Reviewed-by: Mike Frysinger --- firmware/lib/cgptlib/cgptlib_internal.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'firmware/lib/cgptlib/cgptlib_internal.c') diff --git a/firmware/lib/cgptlib/cgptlib_internal.c b/firmware/lib/cgptlib/cgptlib_internal.c index 9f37def6..9d7bd0c9 100644 --- a/firmware/lib/cgptlib/cgptlib_internal.c +++ b/firmware/lib/cgptlib/cgptlib_internal.c @@ -379,6 +379,11 @@ void GptRepair(GptData *gpt) gpt->valid_entries = MASK_BOTH; } +int GetEntryRequired(const GptEntry *e) +{ + return e->attrs.fields.required; +} + int GetEntryLegacyBoot(const GptEntry *e) { return e->attrs.fields.legacy_boot; @@ -408,6 +413,11 @@ int GetEntryTries(const GptEntry *e) CGPT_ATTRIBUTE_TRIES_OFFSET; } +void SetEntryRequired(GptEntry *e, int required) +{ + e->attrs.fields.required = required; +} + void SetEntryLegacyBoot(GptEntry *e, int legacy_boot) { e->attrs.fields.legacy_boot = legacy_boot; -- cgit v1.2.1