summaryrefslogtreecommitdiff
path: root/firmware/lib/cgptlib
diff options
context:
space:
mode:
authorStefan Reinauer <reinauer@chromium.org>2012-08-23 15:06:25 -0700
committerGerrit <chrome-bot@google.com>2012-09-19 15:33:30 -0700
commitb7b865cfee68190babd971ab9a897bdabbab075f (patch)
tree8ad900ddff6a69f9a65cd0507857a6da2677592f /firmware/lib/cgptlib
parent40d8651bb36048c9b5f07be97ff17b2cf503015e (diff)
downloadvboot-b7b865cfee68190babd971ab9a897bdabbab075f.tar.gz
Support alternative GPT header signature
In order to dual boot Windows and ChromeOS, Windows must not find a GPT partition table on the disk. So change ChromeOS to cope with an alternative signature "CHROMEOS" instead of the standard "EFI PART" BUG=chrome-os-partner:6108 TEST=rebuild chromeos, install it, run cgpt legacy /dev/sda dd if=/dev/sda of=/tmp/x bs=1k hexdump -C /tmp/X see the string CHROMEOS BRANCH=link Signed-off-by: Stefan Reinauer <reinauer@chromium.org> Change-Id: Ia88eff33b9880bd73a78c1b8e026c1f8298c4557 Reviewed-on: https://gerrit.chromium.org/gerrit/31264 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Ready: Stefan Reinauer <reinauer@chromium.org> Tested-by: Stefan Reinauer <reinauer@chromium.org>
Diffstat (limited to 'firmware/lib/cgptlib')
-rw-r--r--firmware/lib/cgptlib/cgptlib_internal.c3
-rw-r--r--firmware/lib/cgptlib/include/gpt.h3
2 files changed, 4 insertions, 2 deletions
diff --git a/firmware/lib/cgptlib/cgptlib_internal.c b/firmware/lib/cgptlib/cgptlib_internal.c
index ee3c87f1..a942b1b3 100644
--- a/firmware/lib/cgptlib/cgptlib_internal.c
+++ b/firmware/lib/cgptlib/cgptlib_internal.c
@@ -45,7 +45,8 @@ int CheckHeader(GptHeader *h, int is_secondary, uint64_t drive_sectors) {
/* Make sure we're looking at a header of reasonable size before
* attempting to calculate CRC. */
- if (Memcmp(h->signature, GPT_HEADER_SIGNATURE, GPT_HEADER_SIGNATURE_SIZE))
+ if (Memcmp(h->signature, GPT_HEADER_SIGNATURE, GPT_HEADER_SIGNATURE_SIZE) &&
+ Memcmp(h->signature, GPT_HEADER_SIGNATURE2, GPT_HEADER_SIGNATURE_SIZE))
return 1;
if (h->revision != GPT_HEADER_REVISION)
return 1;
diff --git a/firmware/lib/cgptlib/include/gpt.h b/firmware/lib/cgptlib/include/gpt.h
index 69d89d94..95b77145 100644
--- a/firmware/lib/cgptlib/include/gpt.h
+++ b/firmware/lib/cgptlib/include/gpt.h
@@ -14,7 +14,8 @@
__pragma(pack(push,1)) /* Support packing for MSVC. */
-#define GPT_HEADER_SIGNATURE "EFI PART"
+#define GPT_HEADER_SIGNATURE "EFI PART"
+#define GPT_HEADER_SIGNATURE2 "CHROMEOS"
#define GPT_HEADER_SIGNATURE_SIZE sizeof(GPT_HEADER_SIGNATURE)
#define GPT_HEADER_REVISION 0x00010000