vboot: cgpt: Treat drive_path as the GPT storage

Previously, "cgpt" called out to "flashrom" directly to read and write
NOR area. This CL removes that dependency and always treats "drive_path"
as the storage of GPT structs. This makes it consistent that whatever
device that cgpt reads from or writes to is always the device that
stores GPT structs. We only need to pass in the size of the drive that
contains the partitions, but we do not need to access to that drive.

More information is in the bug.

BUG=chromium:432611
BRANCH=none
TEST=unittest
CQ-DEPEND=CL:228942

Change-Id: Id0139adf70463cec4f2924de8b9a4725dbec822b
Reviewed-on: https://chromium-review.googlesource.com/229736
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Nam Nguyen <namnguyen@chromium.org>
Tested-by: Nam Nguyen <namnguyen@chromium.org>
This commit is contained in:
Nam T. Nguyen
2014-11-13 19:30:46 -08:00
committed by chrome-internal-fetch
parent a524a3a515
commit ab89959180
24 changed files with 308 additions and 551 deletions

View File

@@ -34,7 +34,7 @@ int CheckParameters(GptData *gpt)
* too small to contain basic GPT structure (PMBR + Headers + Entries),
* the value is wrong.
*/
if (gpt->drive_sectors < (1 + 2 * (1 + GPT_ENTRIES_SECTORS)))
if (gpt->gpt_drive_sectors < (1 + 2 * (1 + GPT_ENTRIES_SECTORS)))
return GPT_ERROR_INVALID_SECTOR_NUMBER;
return GPT_SUCCESS;