grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Rick <rick@sloservers.com>
To: grub-devel@gnu.org
Subject: Support for solaris and freebsd GPT partition types
Date: Sat, 30 Oct 2010 22:22:44 -0700	[thread overview]
Message-ID: <4CCCFD24.80401@sloservers.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

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

[-- Attachment #2: patch-include-grub-gpt_partition.h --]
[-- Type: text/plain, Size: 694 bytes --]

--- include/grub/gpt_partition.h.orig	2010-03-06 12:51:37.000000000 -0800
+++ include/grub/gpt_partition.h	2010-10-10 02:57:26.000000000 -0700
@@ -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];

[-- Attachment #3: patch-util-i386-pc-grub-setup.c --]
[-- Type: text/plain, Size: 1117 bytes --]

--- util/i386/pc/grub-setup.c.orig	2010-03-06 12:51:37.000000000 -0800
+++ util/i386/pc/grub-setup.c	2010-10-10 02:56:55.000000000 -0700
@@ -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;

             reply	other threads:[~2010-10-31  5:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-31  5:22 Rick [this message]
2010-10-31 10:23 ` Support for solaris and freebsd GPT partition types Vladimir 'φ-coder/phcoder' Serbinenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CCCFD24.80401@sloservers.com \
    --to=rick@sloservers.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).