diff options
author | Dan Ehrenberg <dehrenberg@chromium.org> | 2014-12-02 08:21:57 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-12-15 22:44:33 +0000 |
commit | 3f4d8d05ba4e32990c8584bd47cdf082d4604232 (patch) | |
tree | a9c9b82c4ad25192f3ecbe921795c0961d0cbbfa /futility | |
parent | 3200401242aec1521e7c4a8b1906366fcabfb1a2 (diff) | |
download | vboot-3f4d8d05ba4e32990c8584bd47cdf082d4604232.tar.gz |
vboot: Plumb the two disk sizes and external GPT param through
This patch reinstates the external GPT support which was previously
committed and reverted. Improvements since last time include:
- Cleaned-up internal interface based on code review
- Function correctly on legacy bootloaders (e.g., depthcharge before
NAND-related patches are added)
- Better comments
- Treat new field values = 0 -> not use new feature
- Tests are added to ensure external GPT flag is passed down properly
The original commit had change-id
I5a77e417aea8ee9442d18c200d1b073aa5375ecf
Its commit message is reproduced below, and then an additional test.
----
To support an external GPT, disks have two new attributes:
- A binary flag indicating whether the GPT is in the same address
space as the payloads or a separate one.
- The number of sectors of the streaming portion of storage, as
opposed to the portion containing the GPT.
These have been added elsewhere to GptData (in cgptlib) and BlockDev
(in depthcharge). This patch adds the plumbing between those, including
in the DiskInfo interface between the firmware and vboot.
BUG=chromium:425677
BRANCH=none
TEST=Interactively wrote the GPT with cgpt and observed the following
boot with depthcharge to read the GPT from SPI and then read from
the proper locations in NAND flash.
TEST=make runalltests passes.
TEST=boots from USB with depthcharge from HEAD.
Change-Id: Ia7956517a7b9da0301f01fac5a10204f6d78cf4f
Signed-off-by: Dan Ehrenberg <dehrenberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/234640
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'futility')
-rw-r--r-- | futility/cmd_verify_kernel.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/futility/cmd_verify_kernel.c b/futility/cmd_verify_kernel.c index f5ee2e00..ffdf7d0f 100644 --- a/futility/cmd_verify_kernel.c +++ b/futility/cmd_verify_kernel.c @@ -30,9 +30,9 @@ VbError_t VbExDiskRead(VbExDiskHandle_t handle, uint64_t lba_start, { if (handle != (VbExDiskHandle_t)1) return VBERROR_UNKNOWN; - if (lba_start > params.ending_lba) + if (lba_start >= params.streaming_lba_count) return VBERROR_UNKNOWN; - if (lba_start + lba_count > params.ending_lba + 1) + if (lba_start + lba_count > params.streaming_lba_count) return VBERROR_UNKNOWN; memcpy(buffer, diskbuf + lba_start * 512, lba_count * 512); @@ -44,9 +44,9 @@ VbError_t VbExDiskWrite(VbExDiskHandle_t handle, uint64_t lba_start, { if (handle != (VbExDiskHandle_t)1) return VBERROR_UNKNOWN; - if (lba_start > params.ending_lba) + if (lba_start >= params.streaming_lba_count) return VBERROR_UNKNOWN; - if (lba_start + lba_count > params.ending_lba + 1) + if (lba_start + lba_count > params.streaming_lba_count) return VBERROR_UNKNOWN; memcpy(diskbuf + lba_start * 512, buffer, lba_count * 512); @@ -95,7 +95,8 @@ static int do_verify_kernel(int argc, char *argv[]) params.shared_data_size = sizeof(shared_data); params.disk_handle = (VbExDiskHandle_t)1; params.bytes_per_lba = 512; - params.ending_lba = disk_bytes / 512 - 1; + params.streaming_lba_count = disk_bytes / 512; + params.gpt_lba_count = params.streaming_lba_count; params.kernel_buffer_size = 16 * 1024 * 1024; params.kernel_buffer = malloc(params.kernel_buffer_size); @@ -108,7 +109,7 @@ static int do_verify_kernel(int argc, char *argv[]) params.gbb_data = NULL; params.gbb_size = 0; - /* TODO: optional dev-mode flag */ + /* TODO(chromium:441893): support dev-mode flag and external gpt flag */ params.boot_flags = 0; /* |