Skip to contentSkip to conversation

Add support for CONFIG_EFI_PARTITION (GUID Partition Table)

PATCH New Richard Retanubun 1 participant 1 message Sep 23, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add support for CONFIG_EFI_PARTITION (GUID Partition Table)

---
 README          |    2 +-
 disk/Makefile   |    1 +
 disk/part.c     |   33 ++++-
 disk/part_efi.c |  425 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 disk/part_efi.h |  138 ++++++++++++++++++
 include/part.h  |    8 +
 6 files changed, 603 insertions(+), 4 deletions(-)
 create mode 100644 disk/part_efi.c
 create mode 100644 disk/part_efi.h
README +1 -1
index f9ea255..4f05907 100644
@@ -687,7 +687,7 @@ The following options need to be configured:
 
 - Partition Support:
 		CONFIG_MAC_PARTITION and/or CONFIG_DOS_PARTITION
-		and/or CONFIG_ISO_PARTITION
+		and/or CONFIG_ISO_PARTITION and/or CONFIG_EFI_PARTITION
 
 		If IDE or SCSI support is enabled (CONFIG_CMD_IDE or
 		CONFIG_CMD_SCSI) you must configure support for at
disk/Makefile +1 -0
index f19d18d..c479145 100644
@@ -32,6 +32,7 @@ COBJS-y += part_mac.o
 COBJS-y += part_dos.o
 COBJS-y += part_iso.o
 COBJS-y += part_amiga.o
+COBJS-y += part_efi.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
disk/part.c +30 -3
index 5c4bf6b..9db6a78 100644
@@ -198,7 +198,8 @@ void dev_print (block_dev_desc_t *dev_desc)
 #if defined(CONFIG_MAC_PARTITION) || \
     defined(CONFIG_DOS_PARTITION) || \
     defined(CONFIG_ISO_PARTITION) || \
-    defined(CONFIG_AMIGA_PARTITION)
+    defined(CONFIG_AMIGA_PARTITION) || \
+    defined(CONFIG_EFI_PARTITION)
 
 void init_part (block_dev_desc_t * dev_desc)
 {
@@ -216,6 +217,14 @@ void init_part (block_dev_desc_t * dev_desc)
 	}
 #endif
 
+/* must be placed before DOS partition detection */
+#ifdef CONFIG_EFI_PARTITION
+	if (test_part_efi(dev_desc) == 0) {
+		dev_desc->part_type = PART_TYPE_EFI;
+		return;
+	}
+#endif
+
 #ifdef CONFIG_DOS_PARTITION
 	if (test_part_dos(dev_desc) == 0) {
 		dev_desc->part_type = PART_TYPE_DOS;
@@ -272,6 +281,15 @@ int get_partition_info (block_dev_desc_t *dev_desc, int part
 	    }
 	    break;
 #endif
+
+#ifdef CONFIG_EFI_PARTITION
+	case PART_TYPE_EFI:
+		if (get_partition_info_efi(dev_desc,part,info) == 0) {
+			PRINTF ("## Valid EFI partition found ##\n");
+			return (0);
+		}
+		break;
+#endif
 	default:
 		break;
 	}
@@ -342,14 +360,23 @@ void print_part (block_dev_desc_t * dev_desc)
 	    print_part_amiga (dev_desc);
 	    return;
 #endif
+
+#ifdef CONFIG_EFI_PARTITION
+	case PART_TYPE_EFI:
+		PRINTF ("## Testing for valid EFI partition ##\n");
+		print_part_header ("EFI", dev_desc);
+		print_part_efi (dev_desc);
+		return;
+#endif
 	}
 	puts ("## Unknown partition table\n");
 }
 
 
-#else	/* neither MAC nor DOS nor ISO partition configured */
+#else	/* neither MAC nor DOS nor ISO nor AMIGA nor EFI partition configured */
 # error neither CONFIG_MAC_PARTITION nor CONFIG_DOS_PARTITION
-# error nor CONFIG_ISO_PARTITION configured!
+# error nor CONFIG_ISO_PARTITION nor CONFIG_AMIGA_PARTITION
+# error nor CONFIG_EFI_PARTITION configured!
 #endif
 
 #endif
disk/part_efi.c new file +425 -0

425 lines not on this page · raw message

disk/part_efi.h new file +138 -0

138 lines not on this page · raw message

include/part.h +8 -0
index b22a637..980fd04 100644
@@ -69,6 +69,7 @@ typedef struct block_dev_desc {
 #define PART_TYPE_DOS		0x02
 #define PART_TYPE_ISO		0x03
 #define PART_TYPE_AMIGA		0x04
+#define PART_TYPE_EFI		0x05
 
 /*
  * Type string for U-Boot bootable partitions
@@ -135,4 +136,11 @@ void print_part_amiga (block_dev_desc_t *dev_desc);
 int   test_part_amiga (block_dev_desc_t *dev_desc);
 #endif
 
+#ifdef CONFIG_EFI_PARTITION
+/* disk/part_efi.c */
+int get_partition_info_efi (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
+void print_part_efi (block_dev_desc_t *dev_desc);
+int   test_part_efi (block_dev_desc_t *dev_desc);
+#endif
+
 #endif /* _PART_H */
Signature · 1 line
1.5.5.GIT