diff options
Diffstat (limited to 'firmware/lib/vboot_api_kernel.c')
-rw-r--r-- | firmware/lib/vboot_api_kernel.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c index ee8080fa..3416a6fd 100644 --- a/firmware/lib/vboot_api_kernel.c +++ b/firmware/lib/vboot_api_kernel.c @@ -227,13 +227,15 @@ static vb2_error_t vb2_kernel_setup(struct vb2_context *ctx, VbSharedDataHeader *shared, VbSelectAndLoadKernelParams *kparams) { + struct vb2_shared_data *sd = vb2_get_sd(ctx); uint32_t tpm_rv; vb2_error_t rv; - /* Translate vboot1 flags back to vboot2 */ - if (shared->recovery_reason) + /* Set selected boot mode in context object. + TODO: Confirm that this can be removed with persistent context. */ + if (sd->recovery_reason) ctx->flags |= VB2_CONTEXT_RECOVERY_MODE; - if (vb2_get_sd(ctx)->flags & VB2_SD_FLAG_DEV_MODE_ENABLED) + if (sd->flags & VB2_SD_FLAG_DEV_MODE_ENABLED) ctx->flags |= VB2_CONTEXT_DEVELOPER_MODE; /* @@ -248,10 +250,14 @@ static vb2_error_t vb2_kernel_setup(struct vb2_context *ctx, if (shared->flags & VBSD_NVDATA_V2) ctx->flags |= VB2_CONTEXT_NVDATA_V2; - vb2_nv_init(ctx); + /* Translate recovery reason-related fields into vboot1 */ + shared->recovery_reason = sd->recovery_reason; + if (sd->recovery_reason) + shared->firmware_index = 0xff; + if (sd->flags & VB2_SD_FLAG_MANUAL_RECOVERY) + shared->flags |= VBSD_BOOT_REC_SWITCH_ON; - struct vb2_shared_data *sd = vb2_get_sd(ctx); - sd->recovery_reason = shared->recovery_reason; + vb2_nv_init(ctx); /* * Save a pointer to the old vboot1 shared data, since we haven't |