aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpt.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpt.h')
-rw-r--r--src/gpt.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/gpt.h b/src/gpt.h
index 5f1857c..2d1f263 100644
--- a/src/gpt.h
+++ b/src/gpt.h
@@ -4,6 +4,7 @@
#define GUID_TYPE_LINUX_EXT3 MAKE_GUID(EBD0A0A2,B9E5,4433,87C0,68B6B72699C7)
#define GUID_TYPE_LINUX_SWAP MAKE_GUID(0657FD6D,A4AB,43C4,84E5,0933C84B4F4F)
#define GUID_TYPE_APPLE_HFS MAKE_GUID(48465300,0000,11AA,AA11,00306543ECAC)
+#define GUID_TYPE_APPLE_TV MAKE_GUID(5265636F,7665,11AA,AA11,00306543ECAC)
#define GPT_ENTRY_FLAG_SYSTEM 1
typedef struct
@@ -18,6 +19,13 @@ typedef struct
#define GPT_HEADER_SIGNATURE "EFI PART"
#define GPT_HEADER_REVISION_EFI10 0x00010000
+#define GPT_PARITION_ENTRIES 128
+#define SECTOR_SIZE 512
+
+#define GPT_ENTRIES_PER_SECTOR(h) (SECTOR_SIZE/((h)->partition_entry_size))
+
+#define GPT_ENTRY_LBA(h,n) (((h)->partition_entry_lba)+(uint64_t) ((n)/GPT_ENTRIES_PER_SECTOR(h)))
+#define GPT_ENTRY_OFFSET(h,n) (((n)%GPT_ENTRIES_PER_SECTOR(h))*((h)->partition_entry_size))
typedef struct
{
@@ -25,7 +33,7 @@ typedef struct
uint32_t revision;
uint32_t header_size;
uint32_t header_crc;
- uint8_t reserved[20];
+ uint8_t reserved[4];
uint64_t my_lba;
uint64_t alternate_lba;
uint64_t first_usable_lba;
@@ -43,11 +51,14 @@ typedef struct
#define MBR_PARTITION_TYPE_EFI 0xee
#define MBR_PARTITION_BOOTABLE 0x80
+#define MBR_SECTOR(a) ((a) & 0x3f)
+#define MBR_CYLINDER(a) (((a) & 0xc0 ) << 2 | (((a)>>8) & 0xff ))
+#define MBR_CS(c,s) (((s) & 0x3f) | (((c) & 0xff) <<8 ) | (((c) & 0x300) >> 2))
+
typedef struct
{
uint8_t head;
- uint8_t sector;
- uint8_t track;
+ uint16_t cs;
} PACKED CHS;
typedef struct
@@ -60,6 +71,8 @@ typedef struct
uint32_t size;
} PACKED MBR_entry;
+#define MBR_SIGNATURE "\125\252"
+
typedef struct
{
uint8_t boot_code[440];