From 44341d32524c1621357bac52ffca7d8e9270c3e4 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 8 Sep 2007 16:49:37 +0000 Subject: *** empty log message *** --- src/gpt.h | 102 ++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 66 insertions(+), 36 deletions(-) (limited to 'src/gpt.h') diff --git a/src/gpt.h b/src/gpt.h index 6ae7866..80742ea 100644 --- a/src/gpt.h +++ b/src/gpt.h @@ -1,43 +1,73 @@ - -#define PACKED __attribute__ ( packed ) - -#define GUID(a) +#define PACKED __attribute__((packed)) #define TYPE_EMPTY "00000000-0000-0000-0000-000000000000" #define TYPE_SYSTEM "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" -typedef PACKED struct { - uint8_t d[16]; -} guid; - -typedef PACKED struct { - guid type; - guid label; - uint64_t start; - uint64_t end; - uint64_t flags; -#define FLAG_SYSTEM 1 - uint8_t name[72]; +typedef PACKED struct +{ + uint8_t d[16]; +} GUID; + +#define GPT_ENTRY_FLAG_SYSTEM 1 +typedef PACKED struct +{ + GUID type; + GUID label; + uint64_t start; + uint64_t end; + uint64_t flags; + uint8_t name[72]; } GPT_entry; - -typedef PACKED struct { - - - -typedef PACKED struct { -uint8_t boot_code[440]; -uint8_t uid[4]; -uint8_t reserved[2]; -MBR_entry entry[4]; -uint8_t signature[2]; -} - - - - - - +#define GPT_HEADER_SIGNATURE "EFI PART" +#define GPT_HEADER_REVISION_EFI10 0x00010000 + +typedef PACKED struct +{ + uint8_t signature[8]; + uint32_t revision; + uint32_t header_size; + uint32_t header_crc; + uint8_t reserved[20]; + uint64_t my_lba; + uint64_t alternate_lba; + uint64_t first_usable_lba; + uint64_t last_usable_lba; + GUID disk_guid; + uint64_t partition_entry_lba; + uint32_t n_partition_entries; + uint32_t partition_entry_size; + uint32_t partition_entry_crc; +} GPT_header; + + + + +#define MBR_PARTITION_TYPE_EFI 0xee +#define MBR_PARTITION_BOOTABLE 0x80 + +typedef PACKED struct +{ + uint8_t head; + uint8_t sector; + uint8_t track; +} CHS; + +typedef PACKED struct +{ + uint8_t bootable; + CHS chs_start; + uint8_t system; + CHS chs_end; + uint32_t start; + uint32_t size; +} MBR_entry; + +typedef PACKED struct +{ + uint8_t boot_code[440]; + uint8_t uid[4]; + uint8_t reserved[2]; + MBR_entry entry[4]; + uint8_t signature[2]; } MBR; - - -- cgit v1.2.3