Date: Sun, 10 Oct 2010 04:22:31 -0700 From: Rick <rick@lgarchitecture.com> To: sem@FreeBSD.org Cc: ports@FreeBSD.org Subject: FreeBSD Port: grub2-1.98 Message-ID: <4CB1A1F7.6060404@lgarchitecture.com>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------050701050504090900030701 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hello, I have a couple FreeBSD patches for grub2 to contribute. These allow grub to install to FreeBSD gpt partitions. The gpt partition scheme allows for a small boot partition of type bios-boot to hold bootloader code. gpart, however, does not make this parition. Instead it makes the same kind of partition with a different GUID (freebsd-boot). These patches allow grub2 to recognize and install to a freebsd-boot partition. They also add support for solaris-boot partitions. I hope somebody will kindly add these to the port and publish. ALSO: I believe the patch-util-getroot.c patch currently in the port is a mistake and should be removed. I had to undo this change to get grub-probe to work. Upon further inspection, this does not seem like the right way to solve whatever problem the patch author was having and it will likely break grub for most people. The purpose of the patched routine is to map a directory to the character device that provides it (given /boot/grub/, return /dev/ad4p2, for example). It stat()'s the directory to get its parent device ID (st_dev) and then recursively searches the devices in /dev to match on their device ID (st_rdev). The patch changes this so that the function searches /dev for the ID of the folder, instead of the folder's parent. This is not right and breaks grub-install. I think the author of the patch was passing the wrong argument on the command line and that's why this patch was necessary. Thanks, Rick Richard --------------050701050504090900030701 Content-Type: text/plain; name="patch-include-grub-gpt_partition.h" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch-include-grub-gpt_partition.h" --- 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]; --------------050701050504090900030701 Content-Type: text/plain; name="patch-util-i386-pc-grub-setup.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch-util-i386-pc-grub-setup.c" --- 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; --------------050701050504090900030701--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4CB1A1F7.6060404>