diff options
author | Matt Delco <delco@google.com> | 2019-01-25 11:34:25 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-01-30 16:51:29 -0800 |
commit | a22ce61eda75ec3a394e32f5c1eff27f1b2ff224 (patch) | |
tree | 900089cae791f54ca1f72e55fa47265ba4d10602 /cgpt | |
parent | 859682accb19893803026a28b4c8ca2cd57945a4 (diff) | |
download | vboot-a22ce61eda75ec3a394e32f5c1eff27f1b2ff224.tar.gz |
cgpt: add -D support to CgptEditstabilize-11686.B
The lack of -D support in CgptEdit introduced a test failure. This
change adds support for -D.
BRANCH=none
BUG=chromium:605348
TEST=Verified that prior to this change the tests failed:
cros_workon --host start vboot_reference
sudo FEATURES=test emerge vboot_reference
The tests fail in a different area prior to CgptEdit, so I applied the
following temporary change to Makefile to see the relevant failure:
ifeq (${MINIMAL},)
# Bitmap utility isn't compiled for minimal variant
- test_targets:: runbmptests runfutiltests
+ test_targets:: runbmptests # runfutiltests
# Scripts don't work under qemu testing
With this change the tests pass.
Change-Id: Ia2127a3537c72e4ea6daf59c5c33b8701a89b0f6
Signed-off-by: Matt Delco <delco@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1436496
Tested-by: Matt Delco <delco@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'cgpt')
-rw-r--r-- | cgpt/cgpt_edit.c | 3 | ||||
-rw-r--r-- | cgpt/cmd_edit.c | 10 |
2 files changed, 11 insertions, 2 deletions
diff --git a/cgpt/cgpt_edit.c b/cgpt/cgpt_edit.c index 622819b7..c7781ffc 100644 --- a/cgpt/cgpt_edit.c +++ b/cgpt/cgpt_edit.c @@ -15,7 +15,8 @@ int CgptEdit(CgptEditParams *params) { if (params == NULL) return CGPT_FAILED; - if (CGPT_OK != DriveOpen(params->drive_name, &drive, O_RDWR, 0)) + if (CGPT_OK != DriveOpen(params->drive_name, &drive, O_RDWR, + params->drive_size)) return CGPT_FAILED; if (GPT_SUCCESS != (gpt_retval = GptSanityCheck(&drive.gpt))) { diff --git a/cgpt/cmd_edit.c b/cgpt/cmd_edit.c index 4f4290b9..fb4d9192 100644 --- a/cgpt/cmd_edit.c +++ b/cgpt/cmd_edit.c @@ -14,6 +14,9 @@ static void Usage(void) printf("\nUsage: %s edit [OPTIONS] DRIVE\n\n" "Edit a drive's parameters.\n\n" "Options:\n" + " -D NUM Size (in bytes) of the disk where partitions reside\n" + " default 0, meaning partitions and GPT structs are\n" + " both on DRIVE\n" " -u GUID Drive Unique ID\n" "\n", progname); } @@ -25,12 +28,17 @@ int cmd_edit(int argc, char *argv[]) { int c; int errorcnt = 0; + char *e = 0; opterr = 0; // quiet, you - while ((c=getopt(argc, argv, ":hu:")) != -1) + while ((c=getopt(argc, argv, ":hu:D:")) != -1) { switch (c) { + case 'D': + params.drive_size = strtoull(optarg, &e, 0); + errorcnt += check_int_parse(c, e); + break; case 'u': params.set_unique = 1; if (CGPT_OK != StrToGuid(optarg, ¶ms.unique_guid)) { |