diff options
author | Furquan Shaikh <furquan@google.com> | 2015-02-03 16:28:31 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-02-12 04:40:39 +0000 |
commit | b7d1f03e368b146d11eab511cd6a573a528bc728 (patch) | |
tree | 8ffe7b194a3b48be90dd39c32776fba0f0e3e7f7 | |
parent | 80e779d50b52cd97c9d5896a3b75fa8118ee488f (diff) | |
download | vboot-b7d1f03e368b146d11eab511cd6a573a528bc728.tar.gz |
kernel flags: Pass back kernel premable flags in kparams
Kernel preamble flags are set by the signer for passing hints about
the image. Read these flags from the preamble and pass it back to the
caller in kparams structure.
BUG=chrome-os-partner:35861
BRANCH=None
TEST=Compiles and boots to kernel prompt for both CrOS image and bootimg.
Change-Id: I07a8b974dcf3ab5cd93d26a752c989d268c8da99
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/245951
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Furquan Shaikh <furquan@chromium.org>
-rw-r--r-- | firmware/include/vboot_api.h | 2 | ||||
-rw-r--r-- | firmware/lib/include/load_kernel_fw.h | 2 | ||||
-rw-r--r-- | firmware/lib/vboot_api_kernel.c | 2 | ||||
-rw-r--r-- | firmware/lib/vboot_kernel.c | 3 |
4 files changed, 9 insertions, 0 deletions
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h index af61eedd..9c040c06 100644 --- a/firmware/include/vboot_api.h +++ b/firmware/include/vboot_api.h @@ -335,6 +335,8 @@ typedef struct VbSelectAndLoadKernelParams { uint32_t bootloader_size; /* UniquePartitionGuid for boot partition */ uint8_t partition_guid[16]; + /* Flags passed in by signer */ + uint32_t flags; /* * TODO: in H2C, all that pretty much just gets passed to the * bootloader as KernelBootloaderOptions, though the disk handle is diff --git a/firmware/lib/include/load_kernel_fw.h b/firmware/lib/include/load_kernel_fw.h index 46081912..da418a33 100644 --- a/firmware/lib/include/load_kernel_fw.h +++ b/firmware/lib/include/load_kernel_fw.h @@ -70,6 +70,8 @@ typedef struct LoadKernelParams { uint64_t bootloader_size; /* UniquePartitionGuid for boot partition */ uint8_t partition_guid[16]; + /* Flags passed in by signer */ + uint32_t flags; } LoadKernelParams; /** diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c index d394d5cc..4769089e 100644 --- a/firmware/lib/vboot_api_kernel.c +++ b/firmware/lib/vboot_api_kernel.c @@ -984,6 +984,7 @@ VbError_t VbSelectAndLoadKernel(VbCommonParams *cparams, kparams->partition_number = 0; kparams->bootloader_address = 0; kparams->bootloader_size = 0; + kparams->flags = 0; Memset(kparams->partition_guid, 0, sizeof(kparams->partition_guid)); cparams->bmp = NULL; @@ -1152,6 +1153,7 @@ VbError_t VbSelectAndLoadKernel(VbCommonParams *cparams, kparams->partition_number = (uint32_t)p.partition_number; kparams->bootloader_address = p.bootloader_address; kparams->bootloader_size = (uint32_t)p.bootloader_size; + kparams->flags = p.flags; Memcpy(kparams->partition_guid, p.partition_guid, sizeof(kparams->partition_guid)); diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c index 08b8a23b..9ea054c3 100644 --- a/firmware/lib/vboot_kernel.c +++ b/firmware/lib/vboot_kernel.c @@ -67,6 +67,7 @@ VbError_t LoadKernel(LoadKernelParams *params, VbCommonParams *cparams) params->partition_number = 0; params->bootloader_address = 0; params->bootloader_size = 0; + params->flags = 0; /* Calculate switch positions and boot mode */ rec_switch = (BOOT_FLAG_RECOVERY & params->boot_flags ? 1 : 0); @@ -437,6 +438,8 @@ VbError_t LoadKernel(LoadKernelParams *params, VbCommonParams *cparams) */ params->bootloader_address = preamble->bootloader_address; params->bootloader_size = preamble->bootloader_size; + if (VbKernelHasFlags(preamble) == VBOOT_SUCCESS) + params->flags = preamble->flags; /* Update GPT to note this is the kernel we're trying */ GptUpdateKernelEntry(&gpt, GPT_UPDATE_ENTRY_TRY); |