Skip to contentSkip to conversation

Support for solaris and freebsd GPT partition types

PATCH Rick 2 participants 2 messages Oct 31, 2010

lore
Share & tools
lore

Rick

author
#0 lore raw

Hello,

A while back, I tried installing GRUB on a FreeBSD GPT system. GRUB only installs to bios-boot partitions and while I could have changed the freebsd-boot partition type on my system, I wanted GRUB to recognize freebsd-boot partition types instead. I made some simple patches to allow GRUB to install to freebsd-boot and solaris-boot partition types.

I've attached the patches if somebody wants to merge them in (or tell me why this is a bad idea) :)

-Rick

grub/gpt_partition.h renamed from grub/gpt_partition.h.orig +11 -0
@@ -40,6 +40,17 @@
     { 0x74, 0x4e, 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 } \
   }
 
+#define GRUB_GPT_PARTITION_TYPE_FREEBSD_BOOT \
+  { grub_cpu_to_le32 (0x83BD6B9D), grub_cpu_to_le16 (0x7F41), grub_cpu_to_le16 (0x11DC), \
+    { 0xBE, 0x0B, 0x00, 0x15, 0x60, 0xB8, 0x4F, 0x0F } \
+  }
+  
+#define GRUB_GPT_PARTITION_TYPE_SOLARIS_BOOT \
+  { grub_cpu_to_le32 (0x6A82CB45), grub_cpu_to_le16 (0x1DD2), grub_cpu_to_le16 (0x11B2), \
+    { 0x99, 0xA6, 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } \
+  }
+
+
 struct grub_gpt_header
 {
   grub_uint8_t magic[8];
i386/pc/grub-setup.c renamed from i386/pc/grub-setup.c.orig +5 -2
@@ -38,7 +38,8 @@
 #include <grub/util/getroot.h>
 
 static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_PARTITION_TYPE_BIOS_BOOT;
-
+static const grub_gpt_part_type_t grub_gpt_partition_type_freebsd_boot = GRUB_GPT_PARTITION_TYPE_FREEBSD_BOOT;
+static const grub_gpt_part_type_t grub_gpt_partition_type_solaris_boot = GRUB_GPT_PARTITION_TYPE_SOLARIS_BOOT;
 #include <grub_setup_init.h>
 
 #include <stdio.h>
@@ -138,7 +139,9 @@
       struct grub_gpt_partentry *gptdata = p->data;
 
       /* If there's an embed region, it is in a dedicated partition.  */
-      if (! memcmp (&gptdata->type, &grub_gpt_partition_type_bios_boot, 16))
+      if (! memcmp (&gptdata->type, &grub_gpt_partition_type_bios_boot, 16) || 
+	      ! memcmp (&gptdata->type, &grub_gpt_partition_type_freebsd_boot, 16) ||
+		  ! memcmp (&gptdata->type, &grub_gpt_partition_type_solaris_boot, 16))
 	{
 	  embed_region.start = p->start;
 	  embed_region.end = p->start + p->len;
#1 lore raw
Quoted 12 lines · Rick

Hello,

A while back, I tried installing GRUB on a FreeBSD GPT system. GRUB only installs to bios-boot partitions and while I could have changed the freebsd-boot partition type on my system, I wanted GRUB to recognize freebsd-boot partition types instead. I made some simple patches to allow GRUB to install to freebsd-boot and solaris-boot partition types.

I've attached the patches if somebody wants to merge them in (or tell me why this is a bad idea) :)

These types weren't reserved by us and blindly using them without consulting the ones who reserved it is just squatting and can create any kind of conflict.

Quoted 9 lines

-Rick

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko