summaryrefslogtreecommitdiff
path: root/tests/vboot_kernel_tests.c
diff options
context:
space:
mode:
authorNam T. Nguyen <namnguyen@chromium.org>2014-12-12 09:38:35 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-12-12 23:15:08 +0000
commit3200401242aec1521e7c4a8b1906366fcabfb1a2 (patch)
tree9e26df71f99eb92a09871ad64d66236d133cbe4d /tests/vboot_kernel_tests.c
parent32a999d2c0e5bf8a1c0f6141d3db77a1dcc6f5af (diff)
downloadvboot-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 'tests/vboot_kernel_tests.c')
-rw-r--r--tests/vboot_kernel_tests.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/vboot_kernel_tests.c b/tests/vboot_kernel_tests.c
index 6f47ae35..41ac7add 100644
--- a/tests/vboot_kernel_tests.c
+++ b/tests/vboot_kernel_tests.c
@@ -87,14 +87,14 @@ static void SetupGptHeader(GptHeader *h, int is_secondary)
/* Set LBA pointers for primary or secondary header */
if (is_secondary) {
h->my_lba = MOCK_SECTOR_COUNT - GPT_HEADER_SECTORS;
- h->entries_lba = h->my_lba - GPT_ENTRIES_SECTORS;
+ h->entries_lba = h->my_lba - CalculateEntriesSectors(h);
} else {
h->my_lba = GPT_PMBR_SECTORS;
h->entries_lba = h->my_lba + 1;
}
- h->first_usable_lba = 2 + GPT_ENTRIES_SECTORS;
- h->last_usable_lba = MOCK_SECTOR_COUNT - 2 - GPT_ENTRIES_SECTORS;
+ h->first_usable_lba = 2 + CalculateEntriesSectors(h);
+ h->last_usable_lba = MOCK_SECTOR_COUNT - 2 - CalculateEntriesSectors(h);
h->header_crc32 = HeaderCrc(h);
}