summaryrefslogtreecommitdiff
path: root/cgpt/cmd_create.c
diff options
context:
space:
mode:
authorNam T. Nguyen <namnguyen@chromium.org>2014-08-22 15:01:38 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-08-28 01:17:48 +0000
commita2d72f70c18905aba25eb0971f6f601dd1fa5a60 (patch)
tree42f9be2f6fb2d9bd5fd54a7d4b31d5c0c378e381 /cgpt/cmd_create.c
parentf510973497a430c1bb41d9b7e996d02fb7f7179e (diff)
downloadvboot-a2d72f70c18905aba25eb0971f6f601dd1fa5a60.tar.gz
vboot: cgpt: Refer to partition entries by entries_lba.
This CL accesses the partition entry array through its header's entries_lba value. Previously, we assume the primary entry array lies on third sector, and the secondary array lies (1 + 32) sectors from disk end. This assumption was fine, even Wikipedia assumed the same. But in order for us to support writing boot code to the third sector (as required by some Freescale board), the primary entry array must be moved to another location. Therefore, we must use "entries_lba" to locate the arrays from now on. BRANCH=none BUG=chromium:406432 TEST=unittest TEST=`cgpt create -p` and then `cgpt show`. Make sure the table header and entries are properly moved. Change-Id: Ia9008b0bb204f290b1f6240df562ce7d3a9bbff2 Reviewed-on: https://chromium-review.googlesource.com/213861 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Nam Nguyen <namnguyen@chromium.org> Tested-by: Nam Nguyen <namnguyen@chromium.org>
Diffstat (limited to 'cgpt/cmd_create.c')
-rw-r--r--cgpt/cmd_create.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cgpt/cmd_create.c b/cgpt/cmd_create.c
index c751b24d..ca1b815d 100644
--- a/cgpt/cmd_create.c
+++ b/cgpt/cmd_create.c
@@ -17,6 +17,8 @@ static void Usage(void)
"Options:\n"
" -z Zero the sectors of the GPT table and entries\n"
" -s Size (in byes) of the disk (MTD only)\n"
+ " -p Size (in blocks) of the disk to pad between the\n"
+ " primary GPT header and its entries, default 0\n"
"\n", progname);
}
@@ -29,7 +31,7 @@ int cmd_create(int argc, char *argv[]) {
char *e = 0;
opterr = 0; // quiet, you
- while ((c=getopt(argc, argv, ":hzs:")) != -1)
+ while ((c=getopt(argc, argv, ":hzsp:")) != -1)
{
switch (c)
{
@@ -39,6 +41,9 @@ int cmd_create(int argc, char *argv[]) {
case 's':
params.size = strtoull(optarg, &e, 0);
break;
+ case 'p':
+ params.padding = strtoull(optarg, &e, 0);
+ break;
case 'h':
Usage();