[U-Boot] [PATCH 5/7] disk: Allow alternate EFI partition signature

Simon Glass sjg at chromium.org
Sat Oct 13 02:26:10 CEST 2012


From: Stefan Reinauer <reinauer at chromium.org>

ChromeOS uses a GPT partition table to partition the disk.
However, Windows will refuse to install on a GPT partitioned
disk if there is no EFI available (Even if there is an MBR, too)
To hide the GPT partition table from Windows, we need to write
it with a header magic other than "EFI PART". To support old
and new systems, Check for the magic string "CHROMEOS" too.

Signed-off-by: Stefan Reinauer <reinauer at chromium.org>

Signed-off-by: Simon Glass <sjg at chromium.org>
---
 disk/part_efi.c |    3 ++-
 disk/part_efi.h |    4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/disk/part_efi.c b/disk/part_efi.c
index 22a1dad..f2a2445 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -307,7 +307,8 @@ static int is_gpt_valid(block_dev_desc_t * dev_desc, unsigned long long lba,
 	}
 
 	/* Check the GPT header signature */
-	if (le64_to_int(pgpt_head->signature) != GPT_HEADER_SIGNATURE) {
+	if ((le64_to_int(pgpt_head->signature) != GPT_HEADER_SIGNATURE) &&
+	    (le64_to_int(pgpt_head->signature) != GPT_HEADER_SIGNATURE2)) {
 		printf("GUID Partition Table Header signature is wrong:"
 			"0x%llX != 0x%llX\n",
 			(unsigned long long)le64_to_int(pgpt_head->signature),
diff --git a/disk/part_efi.h b/disk/part_efi.h
index 5903e7c..07e590d 100644
--- a/disk/part_efi.h
+++ b/disk/part_efi.h
@@ -37,7 +37,9 @@
 #define EFI_PMBR_OSTYPE_EFI_GPT 0xEE
 
 #define GPT_BLOCK_SIZE 512
-#define GPT_HEADER_SIGNATURE 0x5452415020494645ULL
+#define GPT_HEADER_SIGNATURE  0x5452415020494645ULL
+#define GPT_HEADER_SIGNATURE2 0x534f454d4f524843ULL
+
 #define GPT_HEADER_REVISION_V1 0x00010000
 #define GPT_PRIMARY_PARTITION_TABLE_LBA 1ULL
 #define GPT_ENTRY_NAME "gpt"
-- 
1.7.7.3



More information about the U-Boot mailing list