New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 644845 link

Starred by 0 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Feature



Sign in to add a comment

cgpt: add support for setting legacy bios bit in partition attributes

Project Member Reported by vapier@chromium.org, Sep 7 2016

Issue description

if you try to boot a USB stick on a newer generic x86 system, you're most likely to get an error like:
  Missing OS
the syslinux explains:
  http://www.syslinux.org/wiki/index.php?title=Common_Problems#Missing_OS_.28gptmbr.bin.29

tl;dr: this is because none of the GPT partitions are marked as bootable.  cgpt supports marking other partition attributes, but not the legacy bios boot one.

so let's update cgpt to support it, and then update the build scripts to set it.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Sep 8 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/vboot_reference/+/6764405c93664efcf9742bf4973225099f65b6ec

commit 6764405c93664efcf9742bf4973225099f65b6ec
Author: Mike Frysinger <vapier@chromium.org>
Date: Wed Sep 07 20:51:23 2016

cgpt: fix -A documentation to match reality

The documentation claims the -A option shows the raw 64-bit attributes
field when in reality it only shows the high reserved 16-bits.  Change
the docs to match the code.

BUG= chromium:644845 
TEST=vboot_reference unittests pass
BRANCH=None

Change-Id: If163896ddbca0dc27ac8205db313031e73a68fd7
Reviewed-on: https://chromium-review.googlesource.com/382431
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>

[modify] https://crrev.com/6764405c93664efcf9742bf4973225099f65b6ec/cgpt/cmd_add.c
[modify] https://crrev.com/6764405c93664efcf9742bf4973225099f65b6ec/cgpt/cmd_show.c

Project Member

Comment 2 by bugdroid1@chromium.org, Sep 8 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/vboot_reference/+/c60eb7e735bbd6d401d7c3c73a7950461cd86d05

commit c60eb7e735bbd6d401d7c3c73a7950461cd86d05
Author: Mike Frysinger <vapier@chromium.org>
Date: Thu Sep 08 00:23:46 2016

cgpt: unify cli int parsing error checking

Most of the cmd funcs had the same logic copied & pasted multiple times
over.  Unify them into a common header.

BUG= chromium:644845 
TEST=precq passes
TEST=passing invalid args to some funcs is caught
BRANCH=None

Change-Id: Ib7212bcbb17da1135b2508a52910aac37ee8e6cd
Reviewed-on: https://chromium-review.googlesource.com/382691
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>

[modify] https://crrev.com/c60eb7e735bbd6d401d7c3c73a7950461cd86d05/cgpt/cmd_repair.c
[modify] https://crrev.com/c60eb7e735bbd6d401d7c3c73a7950461cd86d05/cgpt/cmd_boot.c
[modify] https://crrev.com/c60eb7e735bbd6d401d7c3c73a7950461cd86d05/cgpt/cgpt_common.c
[modify] https://crrev.com/c60eb7e735bbd6d401d7c3c73a7950461cd86d05/cgpt/cmd_legacy.c
[modify] https://crrev.com/c60eb7e735bbd6d401d7c3c73a7950461cd86d05/cgpt/cmd_prioritize.c
[modify] https://crrev.com/c60eb7e735bbd6d401d7c3c73a7950461cd86d05/cgpt/cmd_show.c
[modify] https://crrev.com/c60eb7e735bbd6d401d7c3c73a7950461cd86d05/cgpt/cmd_add.c
[modify] https://crrev.com/c60eb7e735bbd6d401d7c3c73a7950461cd86d05/cgpt/cmd_create.c
[modify] https://crrev.com/c60eb7e735bbd6d401d7c3c73a7950461cd86d05/cgpt/cmd_find.c
[modify] https://crrev.com/c60eb7e735bbd6d401d7c3c73a7950461cd86d05/cgpt/cgpt.h

Project Member

Comment 3 by bugdroid1@chromium.org, Sep 8 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/portage-stable/+/2283b1e35c71f7cbeb7b32d892866c2e8cb4cb6f

commit 2283b1e35c71f7cbeb7b32d892866c2e8cb4cb6f
Author: Mike Frysinger <vapier@chromium.org>
Date: Wed Sep 07 19:04:46 2016

gptfdisk: upgraded package to upstream

Upgraded sys-apps/gptfdisk to version 1.0.1 for all.
Nothing uses this ... I just wanted `gdisk` & `sgdisk` for debugging.

BUG= chromium:644845 
TEST=ran the tools in sdk and they worked

Change-Id: I326c6d9cf3f743e10fe0bfac7b41649db871d5d8
Reviewed-on: https://chromium-review.googlesource.com/382291
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>

[add] https://crrev.com/2283b1e35c71f7cbeb7b32d892866c2e8cb4cb6f/sys-apps/gptfdisk/gptfdisk-1.0.1.ebuild
[add] https://crrev.com/2283b1e35c71f7cbeb7b32d892866c2e8cb4cb6f/sys-apps/gptfdisk/metadata.xml
[add] https://crrev.com/2283b1e35c71f7cbeb7b32d892866c2e8cb4cb6f/sys-apps/gptfdisk/Manifest

Project Member

Comment 4 by bugdroid1@chromium.org, Sep 8 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/vboot_reference/+/6c18af501798c9b597839a3628c8374a2f8d7483

commit 6c18af501798c9b597839a3628c8374a2f8d7483
Author: Mike Frysinger <vapier@chromium.org>
Date: Wed Sep 07 20:45:48 2016

cgpt: add support for managing the legacy boot gpt bit

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>

[modify] https://crrev.com/6c18af501798c9b597839a3628c8374a2f8d7483/cgpt/cgpt_add.c
[modify] https://crrev.com/6c18af501798c9b597839a3628c8374a2f8d7483/tests/cgptlib_test.c
[modify] https://crrev.com/6c18af501798c9b597839a3628c8374a2f8d7483/cgpt/cgpt_common.c
[modify] https://crrev.com/6c18af501798c9b597839a3628c8374a2f8d7483/host/include/cgpt_params.h
[modify] https://crrev.com/6c18af501798c9b597839a3628c8374a2f8d7483/firmware/include/gpt.h
[modify] https://crrev.com/6c18af501798c9b597839a3628c8374a2f8d7483/cgpt/cgpt_show.c
[modify] https://crrev.com/6c18af501798c9b597839a3628c8374a2f8d7483/firmware/include/gpt_misc.h
[modify] https://crrev.com/6c18af501798c9b597839a3628c8374a2f8d7483/firmware/lib/cgptlib/cgptlib_internal.c
[modify] https://crrev.com/6c18af501798c9b597839a3628c8374a2f8d7483/cgpt/cmd_show.c
[modify] https://crrev.com/6c18af501798c9b597839a3628c8374a2f8d7483/cgpt/cmd_add.c
[modify] https://crrev.com/6c18af501798c9b597839a3628c8374a2f8d7483/firmware/lib/cgptlib/include/cgptlib_internal.h
[modify] https://crrev.com/6c18af501798c9b597839a3628c8374a2f8d7483/cgpt/cgpt.h

Status: Fo (was: Started)
the generic world generic thanks you, generically!
Status: Fixed (was: fo)
Project Member

Comment 7 by bugdroid1@chromium.org, Sep 9 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/crosutils/+/d7891ba2b98e0488ed3cbaf59c6e9d3e4dfc534d

commit d7891ba2b98e0488ed3cbaf59c6e9d3e4dfc534d
Author: Mike Frysinger <vapier@chromium.org>
Date: Wed Sep 07 20:54:58 2016

cgpt: mark EFI partition as bootable in the GPT

BUG= chromium:644845 
TEST=built an amd64-generic image and it booted via USB on a new generic x86 laptop
CQ-DEPEND=CL:382411

Change-Id: I3dce104a8f853a8fbca1c14ba5d3dd111d47df0a
Reviewed-on: https://chromium-review.googlesource.com/382472
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>

[modify] https://crrev.com/d7891ba2b98e0488ed3cbaf59c6e9d3e4dfc534d/build_library/cgpt.py

Project Member

Comment 8 by bugdroid1@chromium.org, Sep 9 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/crosutils/+/7c49fda7a8e94706c7f755e0ef1c57b955e76dbb

commit 7c49fda7a8e94706c7f755e0ef1c57b955e76dbb
Author: Mike Frysinger <vapier@chromium.org>
Date: Wed Sep 07 19:47:06 2016

cgpt: sanitize features field

Make sure we don't let people add unknown features (like typos).

BUG= chromium:644845 
TEST=precq passes

Change-Id: Iebd7ca8719d56c63b5fc301e8c7355b2fc1453c9
Reviewed-on: https://chromium-review.googlesource.com/382811
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>

[modify] https://crrev.com/7c49fda7a8e94706c7f755e0ef1c57b955e76dbb/build_library/cgpt.py

Project Member

Comment 9 by bugdroid1@chromium.org, Sep 27 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/crosutils/+/0c61cd556f191919554657f39f785259925644c0

commit 0c61cd556f191919554657f39f785259925644c0
Author: Mike Frysinger <vapier@chromium.org>
Date: Mon Sep 12 18:09:55 2016

add missing local markings & quotes

Some of these functions corrupt variables because they don't declare
them as local (so they break the parent).  Add missing local markings
and a few quotes while I'm here.

BUG= chromium:644845 
TEST=precq passes
TEST=installing from USB stick still works

Change-Id: I1d0070f54beb4088c892b36cfabcfaec1ec322ac
Reviewed-on: https://chromium-review.googlesource.com/387346
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>

[modify] https://crrev.com/0c61cd556f191919554657f39f785259925644c0/build_library/cgpt.py
[modify] https://crrev.com/0c61cd556f191919554657f39f785259925644c0/build_library/cgpt_shell.sh
[modify] https://crrev.com/0c61cd556f191919554657f39f785259925644c0/build_library/disk_layout_util.sh

Labels: VerifyIn-55

Comment 11 by dchan@google.com, Nov 19 2016

Labels: VerifyIn-56

Comment 12 by dchan@google.com, Jan 21 2017

Labels: VerifyIn-57
Project Member

Comment 13 by bugdroid1@chromium.org, Feb 15 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/crosutils/+/9744757a9ce62e074b8acf117f91ba3a92727b03

commit 9744757a9ce62e074b8acf117f91ba3a92727b03
Author: Mike Frysinger <vapier@chromium.org>
Date: Wed Feb 15 18:47:35 2017

cgpt: fix unittest failures

The change to sanitize this field broke the unittests slightly.

Also tweak the shebang to pass updated linter checks.

BUG= chromium:644845 
TEST=unittest passes

Change-Id: I382fe01f4b7b2dfbc80cc1e922dc1f1cc0d86892
Reviewed-on: https://chromium-review.googlesource.com/442844
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>

[modify] https://crrev.com/9744757a9ce62e074b8acf117f91ba3a92727b03/build_library/cgpt_unittest.py

Comment 14 by dchan@google.com, Mar 4 2017

Labels: VerifyIn-58

Comment 15 by dchan@google.com, Apr 17 2017

Labels: VerifyIn-59

Comment 16 by dchan@google.com, May 30 2017

Labels: VerifyIn-60
Labels: VerifyIn-61

Comment 18 by dchan@chromium.org, Oct 14 2017

Status: Archived (was: Fixed)
Project Member

Comment 19 by bugdroid1@chromium.org, Feb 2 2018

Labels: merge-merged-factory-gale-8743.19.B
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/vboot_reference/+/b9fc93d59dd9fe7cc09bb20fd54756a54db3efbc

commit b9fc93d59dd9fe7cc09bb20fd54756a54db3efbc
Author: Mike Frysinger <vapier@chromium.org>
Date: Fri Feb 02 04:09:50 2018

cgpt: unify cli int parsing error checking

Most of the cmd funcs had the same logic copied & pasted multiple times
over.  Unify them into a common header.

BUG= chromium:644845 
TEST=precq passes
TEST=passing invalid args to some funcs is caught
BRANCH=None

Change-Id: Ib7212bcbb17da1135b2508a52910aac37ee8e6cd
Reviewed-on: https://chromium-review.googlesource.com/382691
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/897388
Reviewed-by: Wei-Han Chen <stimim@chromium.org>
Commit-Queue: Wei-Han Chen <stimim@chromium.org>
Tested-by: Wei-Han Chen <stimim@chromium.org>

[modify] https://crrev.com/b9fc93d59dd9fe7cc09bb20fd54756a54db3efbc/cgpt/cmd_repair.c
[modify] https://crrev.com/b9fc93d59dd9fe7cc09bb20fd54756a54db3efbc/cgpt/cmd_boot.c
[modify] https://crrev.com/b9fc93d59dd9fe7cc09bb20fd54756a54db3efbc/cgpt/cgpt_common.c
[modify] https://crrev.com/b9fc93d59dd9fe7cc09bb20fd54756a54db3efbc/cgpt/cmd_legacy.c
[modify] https://crrev.com/b9fc93d59dd9fe7cc09bb20fd54756a54db3efbc/cgpt/cmd_prioritize.c
[modify] https://crrev.com/b9fc93d59dd9fe7cc09bb20fd54756a54db3efbc/cgpt/cmd_show.c
[modify] https://crrev.com/b9fc93d59dd9fe7cc09bb20fd54756a54db3efbc/cgpt/cmd_add.c
[modify] https://crrev.com/b9fc93d59dd9fe7cc09bb20fd54756a54db3efbc/cgpt/cmd_create.c
[modify] https://crrev.com/b9fc93d59dd9fe7cc09bb20fd54756a54db3efbc/cgpt/cmd_find.c
[modify] https://crrev.com/b9fc93d59dd9fe7cc09bb20fd54756a54db3efbc/cgpt/cgpt.h

Project Member

Comment 20 by bugdroid1@chromium.org, Feb 2 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/vboot_reference/+/79dcfc138e0a37e269e907e471892c6fe72fe8eb

commit 79dcfc138e0a37e269e907e471892c6fe72fe8eb
Author: Mike Frysinger <vapier@chromium.org>
Date: Fri Feb 02 04:09:51 2018

cgpt: fix -A documentation to match reality

The documentation claims the -A option shows the raw 64-bit attributes
field when in reality it only shows the high reserved 16-bits.  Change
the docs to match the code.

BUG= chromium:644845 
TEST=vboot_reference unittests pass
BRANCH=None

Change-Id: If163896ddbca0dc27ac8205db313031e73a68fd7
Reviewed-on: https://chromium-review.googlesource.com/382431
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/897389
Reviewed-by: Wei-Han Chen <stimim@chromium.org>
Commit-Queue: Wei-Han Chen <stimim@chromium.org>
Tested-by: Wei-Han Chen <stimim@chromium.org>

[modify] https://crrev.com/79dcfc138e0a37e269e907e471892c6fe72fe8eb/cgpt/cmd_add.c
[modify] https://crrev.com/79dcfc138e0a37e269e907e471892c6fe72fe8eb/cgpt/cmd_show.c

Project Member

Comment 21 by bugdroid1@chromium.org, Feb 2 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/vboot_reference/+/d6c687b0cd889261dd96a8fe4b53d07e7daaa7d9

commit d6c687b0cd889261dd96a8fe4b53d07e7daaa7d9
Author: Mike Frysinger <vapier@chromium.org>
Date: Fri Feb 02 04:09:53 2018

cgpt: add support for managing the legacy boot gpt bit

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>

[modify] https://crrev.com/d6c687b0cd889261dd96a8fe4b53d07e7daaa7d9/cgpt/cgpt_add.c
[modify] https://crrev.com/d6c687b0cd889261dd96a8fe4b53d07e7daaa7d9/tests/cgptlib_test.c
[modify] https://crrev.com/d6c687b0cd889261dd96a8fe4b53d07e7daaa7d9/cgpt/cgpt_common.c
[modify] https://crrev.com/d6c687b0cd889261dd96a8fe4b53d07e7daaa7d9/host/include/cgpt_params.h
[modify] https://crrev.com/d6c687b0cd889261dd96a8fe4b53d07e7daaa7d9/firmware/include/gpt.h
[modify] https://crrev.com/d6c687b0cd889261dd96a8fe4b53d07e7daaa7d9/cgpt/cgpt_show.c
[modify] https://crrev.com/d6c687b0cd889261dd96a8fe4b53d07e7daaa7d9/firmware/include/gpt_misc.h
[modify] https://crrev.com/d6c687b0cd889261dd96a8fe4b53d07e7daaa7d9/firmware/lib/cgptlib/cgptlib_internal.c
[modify] https://crrev.com/d6c687b0cd889261dd96a8fe4b53d07e7daaa7d9/cgpt/cmd_show.c
[modify] https://crrev.com/d6c687b0cd889261dd96a8fe4b53d07e7daaa7d9/cgpt/cmd_add.c
[modify] https://crrev.com/d6c687b0cd889261dd96a8fe4b53d07e7daaa7d9/firmware/lib/cgptlib/include/cgptlib_internal.h
[modify] https://crrev.com/d6c687b0cd889261dd96a8fe4b53d07e7daaa7d9/cgpt/cgpt.h

Status: Fixed (was: Archived)

Sign in to add a comment