diff options
author | Nam T. Nguyen <namnguyen@chromium.org> | 2014-12-12 09:38:35 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-12-12 23:15:08 +0000 |
commit | 3200401242aec1521e7c4a8b1906366fcabfb1a2 (patch) | |
tree | 9e26df71f99eb92a09871ad64d66236d133cbe4d /cgpt/cgpt_show.c | |
parent | 32a999d2c0e5bf8a1c0f6141d3db77a1dcc6f5af (diff) | |
download | vboot-3200401242aec1521e7c4a8b1906366fcabfb1a2.tar.gz |
cgpt: Support non-standard (smaller) entries table
The standard says that entries table must be at least 16384 bytes. On
some of our devices, the NOR section is only 8 KiB and used to store
both primary and secondary tables. On this device, we can only store 24
entries.
Therefore, this CL adds support for non-standard entry table. It adjusts
the MIN_NUMBER_OF_ENTRIES to 16, and replaces GPT_ENTRIES_SECTORS with
CalculateEntriesSectors.
BUG=chromium:441812
BRANCH=none
TEST=unittest
Change-Id: I6b85b35ce5612c7abb22142f8252bd0d45b676c5
Reviewed-on: https://chromium-review.googlesource.com/234996
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Nam Nguyen <namnguyen@chromium.org>
Tested-by: Nam Nguyen <namnguyen@chromium.org>
Diffstat (limited to 'cgpt/cgpt_show.c')
-rw-r--r-- | cgpt/cgpt_show.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cgpt/cgpt_show.c b/cgpt/cgpt_show.c index 68a185cb..143b5fa1 100644 --- a/cgpt/cgpt_show.c +++ b/cgpt/cgpt_show.c @@ -271,7 +271,7 @@ static int GptShow(struct drive *drive, CgptShowParams *params) { GptHeader* primary_header = (GptHeader*)drive->gpt.primary_header; printf(GPT_FMT, (int)primary_header->entries_lba, - (int)GPT_ENTRIES_SECTORS, + (int)CalculateEntriesSectors(primary_header), drive->gpt.valid_entries & MASK_PRIMARY ? "" : "INVALID", "Pri GPT table"); @@ -282,7 +282,7 @@ static int GptShow(struct drive *drive, CgptShowParams *params) { /****************************** Secondary *************************/ GptHeader* secondary_header = (GptHeader*)drive->gpt.secondary_header; printf(GPT_FMT, (int)secondary_header->entries_lba, - (int)GPT_ENTRIES_SECTORS, + (int)CalculateEntriesSectors(secondary_header), drive->gpt.valid_entries & MASK_SECONDARY ? "" : "INVALID", "Sec GPT table"); /* We show secondary table details if any of following is true. @@ -294,7 +294,8 @@ static int GptShow(struct drive *drive, CgptShowParams *params) { ((drive->gpt.valid_entries & MASK_SECONDARY) && (!(drive->gpt.valid_entries & MASK_PRIMARY) || memcmp(drive->gpt.primary_entries, drive->gpt.secondary_entries, - TOTAL_ENTRIES_SIZE)))) { + secondary_header->number_of_entries * + secondary_header->size_of_entry)))) { EntriesDetails(drive, SECONDARY, params->numeric); } |