| // Copyright 2017 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef SYSROOT_ZIRCON_HW_GPT_H_ |
| #define SYSROOT_ZIRCON_HW_GPT_H_ |
| |
| #include <assert.h> |
| #include <stdbool.h> |
| #include <stdint.h> |
| #include <zircon/compiler.h> |
| |
| #define GPT_MAGIC (0x5452415020494645ull) // 'EFI PART' |
| #define GPT_HEADER_SIZE 0x5c |
| #define GPT_ENTRY_SIZE 0x80 |
| #define GPT_GUID_LEN 16 |
| #define GPT_GUID_STRLEN 37 |
| #define GPT_NAME_LEN 72 |
| |
| typedef struct gpt_header { |
| uint64_t magic; // Magic number. |
| uint32_t revision; // Revision. |
| uint32_t size; // Size of the header. |
| uint32_t crc32; // Checksum of this header. |
| uint32_t reserved0; // Reserved field. |
| uint64_t current; // Block where this table is stored. |
| uint64_t backup; // Block where other copy of partition table is stored. |
| uint64_t first; // First usable block. Block after primary partition table ends. |
| uint64_t last; // Last usable block. Block before backup partition table starts. |
| uint8_t guid[GPT_GUID_LEN]; // Disk GUID. |
| uint64_t entries; // Starting block where entries for this partition tables are found. |
| // Value equals 2 for primary copy. |
| uint32_t entries_count; // Total number of entries. |
| uint32_t entries_size; // Size of each entry. |
| uint32_t entries_crc; // Checksum of the entire entries array. |
| } __PACKED gpt_header_t; |
| |
| static_assert(GPT_HEADER_SIZE == sizeof(gpt_header_t), "Gpt header size invalid"); |
| |
| typedef struct gpt_entry { |
| uint8_t type[GPT_GUID_LEN]; |
| uint8_t guid[GPT_GUID_LEN]; |
| uint64_t first; |
| uint64_t last; |
| uint64_t flags; |
| uint8_t name[GPT_NAME_LEN]; // UTF-16 on disk |
| } gpt_entry_t; |
| |
| static_assert(GPT_ENTRY_SIZE == sizeof(gpt_entry_t), "Gpt entry size invalid"); |
| |
| // clang-format off |
| #define GUID_EMPTY_STRING "00000000-0000-0000-0000-000000000000" |
| #define GUID_EMPTY_VALUE { \ |
| 0x00, 0x00, 0x00, 0x00, \ |
| 0x00, 0x00, \ |
| 0x00, 0x00, \ |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 \ |
| } |
| #define GUID_EMPTY_NAME "empty" |
| |
| #define GUID_EFI_STRING "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" |
| #define GUID_EFI_VALUE { \ |
| 0x28, 0x73, 0x2a, 0xc1, \ |
| 0x1f, 0xf8, \ |
| 0xd2, 0x11, \ |
| 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b \ |
| } |
| #define GUID_EFI_NAME "efi-system" |
| |
| // GUID for a system partition |
| #define GUID_SYSTEM_STRING "606B000B-B7C7-4653-A7D5-B737332C899D" |
| #define GUID_SYSTEM_VALUE { \ |
| 0x0b, 0x00, 0x6b, 0x60, \ |
| 0xc7, 0xb7, \ |
| 0x53, 0x46, \ |
| 0xa7, 0xd5, 0xb7, 0x37, 0x33, 0x2c, 0x89, 0x9d \ |
| } |
| #define GUID_SYSTEM_NAME "fuchsia-system" |
| |
| // GUID for a data partition |
| #define GUID_DATA_STRING "08185F0C-892D-428A-A789-DBEEC8F55E6A" |
| #define GUID_DATA_VALUE { \ |
| 0x0c, 0x5f, 0x18, 0x08, \ |
| 0x2d, 0x89, \ |
| 0x8a, 0x42, \ |
| 0xa7, 0x89, 0xdb, 0xee, 0xc8, 0xf5, 0x5e, 0x6a \ |
| } |
| #define GUID_DATA_NAME "fuchsia-data" |
| |
| // GUID for a installer partition |
| #define GUID_INSTALL_STRING "48435546-4953-2041-494E-5354414C4C52" |
| #define GUID_INSTALL_VALUE { \ |
| 0x46, 0x55, 0x43, 0x48, \ |
| 0x53, 0x49, \ |
| 0x41, 0x20, \ |
| 0x49, 0x4E, 0x53, 0x54, 0x41, 0x4C, 0x4C, 0x52 \ |
| } |
| #define GUID_INSTALL_NAME "fuchsia-install" |
| |
| #define GUID_BLOB_STRING "2967380E-134C-4CBB-B6DA-17E7CE1CA45D" |
| #define GUID_BLOB_VALUE { \ |
| 0x0e, 0x38, 0x67, 0x29, \ |
| 0x4c, 0x13, \ |
| 0xbb, 0x4c, \ |
| 0xb6, 0xda, 0x17, 0xe7, 0xce, 0x1c, 0xa4, 0x5d \ |
| } |
| #define GUID_BLOB_NAME "fuchsia-blob" |
| |
| #define GUID_FVM_STRING "41D0E340-57E3-954E-8C1E-17ECAC44CFF5" |
| #define GUID_FVM_VALUE { \ |
| 0x40, 0xe3, 0xd0, 0x41, \ |
| 0xe3, 0x57, \ |
| 0x4e, 0x95, \ |
| 0x8c, 0x1e, 0x17, 0xec, 0xac, 0x44, 0xcf, 0xf5 \ |
| } |
| #define GUID_FVM_NAME "fuchsia-fvm" |
| |
| #define GUID_ZIRCON_A_STRING "DE30CC86-1F4A-4A31-93C4-66F147D33E05" |
| #define GUID_ZIRCON_A_VALUE { \ |
| 0x86, 0xcc, 0x30, 0xde, \ |
| 0x4a, 0x1f, \ |
| 0x31, 0x4a, \ |
| 0x93, 0xc4, 0x66, 0xf1, 0x47, 0xd3, 0x3e, 0x05, \ |
| } |
| #define GUID_ZIRCON_A_NAME "zircon-a" |
| |
| #define GUID_ZIRCON_B_STRING "23CC04DF-C278-4CE7-8471-897D1A4BCDF7" |
| #define GUID_ZIRCON_B_VALUE { \ |
| 0xdf, 0x04, 0xcc, 0x23, \ |
| 0x78, 0xc2, \ |
| 0xe7, 0x4c, \ |
| 0x84, 0x71, 0x89, 0x7d, 0x1a, 0x4b, 0xcd, 0xf7 \ |
| } |
| #define GUID_ZIRCON_B_NAME "zircon-b" |
| |
| #define GUID_ZIRCON_R_STRING "A0E5CF57-2DEF-46BE-A80C-A2067C37CD49" |
| #define GUID_ZIRCON_R_VALUE { \ |
| 0x57, 0xcf, 0xe5, 0xa0, \ |
| 0xef, 0x2d, \ |
| 0xbe, 0x46, \ |
| 0xa8, 0x0c, 0xa2, 0x06, 0x7c, 0x37, 0xcd, 0x49 \ |
| } |
| #define GUID_ZIRCON_R_NAME "zircon-r" |
| |
| #define GUID_SYS_CONFIG_STRING "4E5E989E-4C86-11E8-A15B-480FCF35F8E6" |
| #define GUID_SYS_CONFIG_VALUE { \ |
| 0x9e, 0x98, 0x5e, 0x4e, \ |
| 0x86, 0x4c, \ |
| 0xe8, 0x11, \ |
| 0xa1, 0x5b, 0x48, 0x0f, 0xcf, 0x35, 0xf8, 0xe6 \ |
| } |
| #define GUID_SYS_CONFIG_NAME "sys-config" |
| |
| #define GUID_FACTORY_CONFIG_STRING "5A3A90BE-4C86-11E8-A15B-480FCF35F8E6" |
| #define GUID_FACTORY_CONFIG_VALUE { \ |
| 0xbe, 0x90, 0x3a, 0x5a, \ |
| 0x86, 0x4c, \ |
| 0xe8, 0x11, \ |
| 0xa1, 0x5b, 0x48, 0x0f, 0xcf, 0x35, 0xf8, 0xe6 \ |
| } |
| #define GUID_FACTORY_CONFIG_NAME "factory" |
| |
| #define GUID_BOOTLOADER_STRING "5ECE94FE-4C86-11E8-A15B-480FCF35F8E6" |
| #define GUID_BOOTLOADER_VALUE { \ |
| 0xfe, 0x94, 0xce, 0x5e, \ |
| 0x86, 0x4c, \ |
| 0xe8, 0x11, \ |
| 0xa1, 0x5b, 0x48, 0x0f, 0xcf, 0x35, 0xf8, 0xe6 \ |
| } |
| #define GUID_BOOTLOADER_NAME "bootloader" |
| |
| #define GUID_TEST_STRING "8B94D043-30BE-4871-9DFA-D69556E8C1F3" |
| #define GUID_TEST_VALUE { \ |
| 0x43, 0xD0, 0x94, 0x8b, \ |
| 0xbe, 0x30, \ |
| 0x71, 0x48, \ |
| 0x9d, 0xfa, 0xd6, 0x95, 0x56, 0xe8, 0xc1, 0xf3 \ |
| } |
| #define GUID_TEST_NAME "guid-test" |
| |
| #define GUID_VBMETA_A_STRING "A13B4D9A-EC5F-11E8-97D8-6C3BE52705BF" |
| #define GUID_VBMETA_A_VALUE { \ |
| 0x9a, 0x4d, 0x3b, 0xa1, \ |
| 0x5f, 0xec, \ |
| 0xe8, 0x11, \ |
| 0x97, 0xd8, 0x6c, 0x3b, 0xe5, 0x27, 0x05, 0xbf \ |
| } |
| #define GUID_VBMETA_A_NAME "vbmeta_a" |
| |
| #define GUID_VBMETA_B_STRING "A288ABF2-EC5F-11E8-97D8-6C3BE52705BF" |
| #define GUID_VBMETA_B_VALUE { \ |
| 0xf2, 0xab, 0x88, 0xa2, \ |
| 0x5f, 0xec, \ |
| 0xe8, 0x11, \ |
| 0x97, 0xd8, 0x6c, 0x3b, 0xe5, 0x27, 0x05, 0xbf \ |
| } |
| #define GUID_VBMETA_B_NAME "vbmeta_b" |
| |
| #define GUID_VBMETA_R_STRING "6A2460C3-CD11-4E8B-80A8-12CCE268ED0A" |
| #define GUID_VBMETA_R_VALUE { \ |
| 0xc3, 0x60, 0x24, 0x6a, \ |
| 0x11, 0xcd, \ |
| 0x8b, 0x4e, \ |
| 0x80, 0xa8, 0x12, 0xcc, 0xe2, 0x68, 0xed, 0x0a \ |
| } |
| #define GUID_VBMETA_R_NAME "vbmeta_r" |
| |
| #define GUID_ABR_META_STRING "1D75395D-F2C6-476B-A8B7-45CC1C97B476" |
| #define GUID_ABR_META_VALUE { \ |
| 0x5d, 0x39, 0x75, 0x1d, \ |
| 0xc6, 0xf2, \ |
| 0x6b, 0x47, \ |
| 0xa8, 0xb7, 0x45, 0xcc, 0x1c, 0x97, 0xb4, 0x76 \ |
| } |
| #define GUID_ABR_META_NAME "misc" |
| |
| #define GUID_CROS_KERNEL_STRING "FE3A2A5D-4F32-41A7-B725-ACCC3285A309" |
| #define GUID_CROS_KERNEL_VALUE { \ |
| 0x5d, 0x2a, 0x3a, 0xfe, \ |
| 0x32, 0x4f, \ |
| 0xa7, 0x41, \ |
| 0xb7, 0x25, 0xac, 0xcc, 0x32, 0x85, 0xa3, 0x09 \ |
| } |
| #define GUID_CROS_KERNEL_NAME "cros-kernel" |
| |
| #define GUID_CROS_ROOTFS_STRING "3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC" |
| #define GUID_CROS_ROOTFS_VALUE { \ |
| 0x02, 0xe2, 0xb8, 0x3C, \ |
| 0x7e, 0x3b, \ |
| 0xdd, 0x47, \ |
| 0x8a, 0x3c, 0x7f, 0xf2, 0xa1, 0x3c, 0xfc, 0xec \ |
| } |
| #define GUID_CROS_ROOTFS_NAME "cros-rootfs" |
| |
| #define GUID_CROS_RESERVED_STRING "2E0A753D-9E48-43B0-8337-B15192CB1B5E" |
| #define GUID_CROS_RESERVED_VALUE { \ |
| 0x3d, 0x75, 0x0a, 0x2e, \ |
| 0x48, 0x9e, \ |
| 0xb0, 0x43, \ |
| 0x83, 0x37, 0xb1, 0x51, 0x92, 0xcb, 0x1b, 0x5e \ |
| } |
| #define GUID_CROS_RESERVED_NAME "cros-reserved" |
| |
| #define GUID_CROS_FIRMWARE_STRING "CAB6E88E-ABF3-4102-A07A-D4BB9BE3C1D3" |
| #define GUID_CROS_FIRMWARE_VALUE { \ |
| 0x8e, 0xe8, 0xb6, 0xca, \ |
| 0xf3, 0xab, \ |
| 0x02, 0x41, \ |
| 0xa0, 0x7a, 0xd4, 0xbb, 0x9b, 0xe3, 0xc1, 0xd3 \ |
| } |
| #define GUID_CROS_FIRMWARE_NAME "cros-firmware" |
| |
| #define GUID_CROS_DATA_STRING "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7" |
| #define GUID_CROS_DATA_VALUE { \ |
| 0xa2, 0xa0, 0xd0, 0xeb, \ |
| 0xe5, 0xb9, \ |
| 0x33, 0x44, \ |
| 0x87, 0xc0, 0x68, 0xb6, 0xb7, 0x26, 0x99, 0xc7 \ |
| } |
| #define GUID_CROS_DATA_NAME "cros-data" |
| |
| #define GUID_BIOS_STRING "21686148-6449-6E6F-744E-656564454649" |
| #define GUID_BIOS_VALUE { \ |
| 0x48, 0x61, 0x68, 0x21, \ |
| 0x49, 0x64, \ |
| 0x6f, 0x6e, \ |
| 0x74, 0x4e, 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 \ |
| } |
| #define GUID_BIOS_NAME "bios" |
| |
| #define GUID_EMMC_BOOT1_STRING "900B0FC5-90CD-4D4F-84F9-9F8ED579DB88" |
| #define GUID_EMMC_BOOT1_VALUE { \ |
| 0xc5, 0x0f, 0x0b, 0x90, \ |
| 0xcd, 0x90, \ |
| 0x4f, 0x4d, \ |
| 0x84, 0xf9, 0x9f, 0x8e, 0xd5, 0x79, 0xdb, 0x88 \ |
| } |
| #define GUID_EMMC_BOOT1_NAME "emmc-boot1" |
| |
| #define GUID_EMMC_BOOT2_STRING "B2B2E8D1-7C10-4EBC-A2D0-4614568260AD" |
| #define GUID_EMMC_BOOT2_VALUE { \ |
| 0xd1, 0xe8, 0xb2, 0xb2, \ |
| 0x10, 0x7c, \ |
| 0xbc, 0x4e, \ |
| 0xa2, 0xd0, 0x46, 0x14, 0x56, 0x82, 0x60, 0xad \ |
| } |
| #define GUID_EMMC_BOOT2_NAME "emmc-boot2" |
| |
| #define GUID_LINUX_FILESYSTEM_DATA_STRING "0FC63DAF-8483-4772-8E79-3D69D8477DE4" |
| #define GUID_LINUX_FILESYSTEM_DATA_VALUE { \ |
| 0xaf, 0x3d, 0xc6, 0x0f, \ |
| 0x83, 0x84, \ |
| 0x72, 0x47, \ |
| 0x8e, 0x79, 0x3d, 0x69, 0xd8, 0x47, 0x7d, 0xe4 \ |
| } |
| #define GUID_LINUX_FILESYSTEM_DATA_NAME "linux-filesystem" |
| |
| // clang-format on |
| |
| #endif // SYSROOT_ZIRCON_HW_GPT_H_ |