From 723b3c09debfa350f7a17e7927116c3535ac081b Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Thu, 1 Oct 2015 19:22:31 -0700 Subject: cgpt: Update behavior of GptUpdateKernelWithEntry In order to support slots, we need to update behavior of GptUpdateKernelWithEntry so that: 1. Invalid - Marks kernel entry as invalid 2. Active - Marks kernel entry as active CQ-DEPEND=CL:336906 BUG=chrome-os-partner:51807 BRANCH=None TEST=Compiles successfully "sudo emerge vboot_reference" "emerge-smaug vboot_reference". "make -j runtests" successful. Change-Id: If248b3c6bdd23d03cb1dd24f4e21cacef5cc3f26 Signed-off-by: Furquan Shaikh Reviewed-on: https://chromium-review.googlesource.com/335942 Commit-Ready: Furquan Shaikh Tested-by: Furquan Shaikh Reviewed-by: Aaron Durbin --- firmware/include/gpt_misc.h | 8 ++++---- firmware/lib/cgptlib/cgptlib.c | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/firmware/include/gpt_misc.h b/firmware/include/gpt_misc.h index 49e13518..9f442c49 100644 --- a/firmware/include/gpt_misc.h +++ b/firmware/include/gpt_misc.h @@ -51,12 +51,12 @@ enum { */ GPT_UPDATE_ENTRY_BAD = 2, /* - * Used for fastboot mode. When an image is written to kernel partition, - * its GPT entry is marked with S1,P1,T15. + * Used for fastboot mode. If kernel partition slot is marked active, + * its GPT entry is marked with S1,P2,T0. */ - GPT_UPDATE_ENTRY_RESET = 3, + GPT_UPDATE_ENTRY_ACTIVE = 3, /* - * Used for fastboot mode. When an image is written to kernel partition, + * Used for fastboot mode. If kernel partition slot is marked invalid, * its GPT entry is marked with S0,P0,T0. */ GPT_UPDATE_ENTRY_INVALID = 4, diff --git a/firmware/lib/cgptlib/cgptlib.c b/firmware/lib/cgptlib/cgptlib.c index 05ee29cb..11512a0e 100644 --- a/firmware/lib/cgptlib/cgptlib.c +++ b/firmware/lib/cgptlib/cgptlib.c @@ -157,21 +157,21 @@ int GptUpdateKernelWithEntry(GptData *gpt, GptEntry *e, uint32_t update_type) } break; } - case GPT_UPDATE_ENTRY_RESET: { + case GPT_UPDATE_ENTRY_ACTIVE: { /* - * Used for fastboot mode. If image is written to kernel - * partition, its GPT entry is marked with S1,P1,T15 + * Used for fastboot mode. If kernel partition slot is marked + * active, its GPT entry is marked with S1,P2,T0. */ modified = 1; - SetEntryTries(e, 15); - SetEntryPriority(e, 1); + SetEntryTries(e, 0); + SetEntryPriority(e, 2); SetEntrySuccessful(e, 1); break; } case GPT_UPDATE_ENTRY_INVALID: { /* - * Used for fastboot mode. If kernel partition is erased, its - * GPT entry is marked with S0,P0,T0 + * Used for fastboot mode. If kernel partition slot is marked + * invalid, its GPT entry is marked with S0,P0,T0 */ modified = 1; SetEntryTries(e, 0); -- cgit v1.2.1