summaryrefslogtreecommitdiff
path: root/cgpt/cmd_add.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@chromium.org>2016-09-07 16:45:48 -0400
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-02-02 04:09:53 +0000
commitd6c687b0cd889261dd96a8fe4b53d07e7daaa7d9 (patch)
tree9d0f3ce35ce125f4b5ce7896d95b342930b9a195 /cgpt/cmd_add.c
parent79dcfc138e0a37e269e907e471892c6fe72fe8eb (diff)
downloadvboot-factory-gale-8743.19.B.tar.gz
cgpt: add support for managing the legacy boot gpt bitfactory-gale-8743.19.B
Bit 2 in the GPT partition attributes has been allocated as the legacy bios boot (equivalent to the "active" or "boot" flag in MBR). If we try to boot images on newer x86 systems, syslinux dies because it can't find any GPT partition marked bootable. Update the various parts of cgpt add & show to manage this bit. Now we can run: cgpt add -i 12 -B 1 chromiumos_image.bin And the EFI partition will be marked bootable. BUG=chromium:644845 TEST=vboot_reference unittests pass TEST=booted an amd64-generic disk image via USB on a generic laptop BRANCH=None Change-Id: I78e17b8df5b0c61e9e2d8a3c703e6d5ad230fe92 Reviewed-on: https://chromium-review.googlesource.com/382411 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/897390 Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org>
Diffstat (limited to 'cgpt/cmd_add.c')
-rw-r--r--cgpt/cmd_add.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/cgpt/cmd_add.c b/cgpt/cmd_add.c
index ca379a22..3c7741b8 100644
--- a/cgpt/cmd_add.c
+++ b/cgpt/cmd_add.c
@@ -27,6 +27,7 @@ static void Usage(void)
" -S NUM set Successful flag (0|1)\n"
" -T NUM set Tries flag (0-15)\n"
" -P NUM set Priority flag (0-15)\n"
+ " -B NUM set Legacy Boot flag (0|1)\n"
" -A NUM set raw 16-bit attribute value (bits 48-63)\n"
"\n"
"Use the -i option to modify an existing partition.\n"
@@ -45,7 +46,7 @@ int cmd_add(int argc, char *argv[]) {
char *e = 0;
opterr = 0; // quiet, you
- while ((c=getopt(argc, argv, ":hi:b:s:t:u:l:S:T:P:A:D:")) != -1)
+ while ((c=getopt(argc, argv, ":hi:b:s:t:u:l:S:T:P:B:A:D:")) != -1)
{
switch (c)
{
@@ -103,6 +104,12 @@ int cmd_add(int argc, char *argv[]) {
errorcnt += check_int_parse(c, e);
errorcnt += check_int_limit(c, params.priority, 0, 15);
break;
+ case 'B':
+ params.set_legacy_boot = 1;
+ params.legacy_boot = (uint32_t)strtoul(optarg, &e, 0);
+ errorcnt += check_int_parse(c, e);
+ errorcnt += check_int_limit(c, params.legacy_boot, 0, 1);
+ break;
case 'A':
params.set_raw = 1;
params.raw_value = strtoull(optarg, &e, 0);