summaryrefslogtreecommitdiff
path: root/cgpt/cmd_boot.c
diff options
context:
space:
mode:
Diffstat (limited to 'cgpt/cmd_boot.c')
-rw-r--r--cgpt/cmd_boot.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/cgpt/cmd_boot.c b/cgpt/cmd_boot.c
index 2a65f202..2f815663 100644
--- a/cgpt/cmd_boot.c
+++ b/cgpt/cmd_boot.c
@@ -15,6 +15,9 @@ static void Usage(void)
printf("\nUsage: %s boot [OPTIONS] DRIVE\n\n"
"Edit the PMBR sector for legacy BIOSes\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"
" -i NUM Set bootable partition\n"
" -b FILE Install bootloader code in the PMBR\n"
" -p Create legacy PMBR partition table\n"
@@ -34,10 +37,18 @@ int cmd_boot(int argc, char *argv[]) {
char *e = 0;
opterr = 0; // quiet, you
- while ((c=getopt(argc, argv, ":hi:b:p")) != -1)
+ while ((c=getopt(argc, argv, ":hi:b:pD:")) != -1)
{
switch (c)
{
+ case 'D':
+ params.drive_size = strtoull(optarg, &e, 0);
+ if (!*optarg || (e && *e))
+ {
+ Error("invalid argument to -%c: \"%s\"\n", c, optarg);
+ errorcnt++;
+ }
+ break;
case 'i':
params.partition = (uint32_t)strtoul(optarg, &e, 0);
if (!*optarg || (e && *e))