summaryrefslogtreecommitdiff
path: root/cgpt/cgpt_show.c
diff options
context:
space:
mode:
authorNam T. Nguyen <namnguyen@chromium.org>2014-10-24 13:20:39 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-13 18:29:09 +0000
commit6ee52d9a929d00e871e7316240b54f381146fbc6 (patch)
treeca403414469d9364d144a67e63f8f439874802e3 /cgpt/cgpt_show.c
parent43e0a9ed6c0b332631442fcf581e7456d62e4532 (diff)
downloadvboot-6ee52d9a929d00e871e7316240b54f381146fbc6.tar.gz
vboot: cgpt: Support writing GPT structs to NOR flash
This CL allows the GPT headers and partition entry arrays to be stored in a NOR flash device. Instead of treating both the NOR and NAND devices as one (in a sandwich way), this CL writes and reads the GPT structs independently of the actual device that houses the partitions. Therefore, the first usable LBA of the partitions will be at 0, and the last usable LBA is at the end of the NAND. +------------------------+ | NOR houses GPT structs | +------------------------+ | 0 | Index into v v +------------------------+ | NAND houses partitions | +------------------------+ Note that the "my_lba", "alternate_lba", "entries_lba" in the GPT headers are no longer meaningful. Consumers of cgptlib will have to set "stored_on_device" to either GPT_STORED_ON_DEVICE or GPT_STORED_OFF_DEVICE, and "gpt_drive_sectors" to the number of 512-byte sectors available to store GPT structs. The NOR read and write operations are done by "flashrom". BUG=chromium:425677 BRANCH=none TEST=unittest TEST=build with DEBUG, cgpt create/add/show on a stumpy-moblab Change-Id: I083b3c94da3b0bb3da1a7b10c6969774080a2afd Reviewed-on: https://chromium-review.googlesource.com/226800 Reviewed-by: Nam Nguyen <namnguyen@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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cgpt/cgpt_show.c b/cgpt/cgpt_show.c
index 4788bfd9..5b7974f7 100644
--- a/cgpt/cgpt_show.c
+++ b/cgpt/cgpt_show.c
@@ -445,7 +445,7 @@ static int GptShow(struct drive *drive, CgptShowParams *params) {
}
if (drive->gpt.valid_headers & MASK_SECONDARY)
- printf(GPT_FMT, (int)(drive->gpt.drive_sectors - GPT_HEADER_SECTORS),
+ printf(GPT_FMT, (int)(drive->gpt.gpt_drive_sectors - GPT_HEADER_SECTORS),
(int)GPT_HEADER_SECTORS, "", "Sec GPT header");
else
printf(GPT_FMT, (int)GPT_PMBR_SECTORS,