cgpt: Add a callback to allow override of GPT entry priority

This can be used by implementations that want to request vboot to
favor a particular kernel entry for booting without affecting the
checks for rollback protection and image verification.

CQ-DEPEND=CL:274716, CL:274932, CL:275171
BUG=None
BRANCH=None
TEST=Compiles successfully. make -j runtests successful.

Change-Id: I6a4600020354f5d4118c17f083c353c2585c4181
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/274558
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Commit-Queue: Nicolas Boichat <drinkcat@chromium.org>
Trybot-Ready: Nicolas Boichat <drinkcat@chromium.org>
This commit is contained in:
Furquan Shaikh
2015-06-02 10:32:52 -07:00
committed by ChromeOS Commit Bot
parent 04e2338857
commit 7a1c0d1ec8
5 changed files with 105 additions and 0 deletions

View File

@@ -370,6 +370,12 @@ int GetEntrySuccessful(const GptEntry *e)
int GetEntryPriority(const GptEntry *e)
{
int ret = VbExOverrideGptEntryPriority(e);
/* Ensure that the override priority is valid. */
if ((ret > 0) && (ret < 16))
return ret;
return (e->attrs.fields.gpt_att & CGPT_ATTRIBUTE_PRIORITY_MASK) >>
CGPT_ATTRIBUTE_PRIORITY_OFFSET;
}