From owner-freebsd-ports@FreeBSD.ORG Sun Oct 10 11:49:45 2010 Return-Path: Delivered-To: ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B6951065674 for ; Sun, 10 Oct 2010 11:49:45 +0000 (UTC) (envelope-from rick@lgarchitecture.com) Received: from gw.lgarchitecture.com (24-176-175-194.static.snlo.ca.charter.com [24.176.175.194]) by mx1.freebsd.org (Postfix) with SMTP id C597E8FC0A for ; Sun, 10 Oct 2010 11:49:44 +0000 (UTC) Received: (qmail 98039 invoked by uid 98); 10 Oct 2010 04:23:01 -0700 Received: from 71.102.224.36 by gw.lgarchitecture.com (envelope-from , uid 89) with qmail-scanner-1.25-st-qms (clamdscan: 0.96.3/12116. spamassassin: 3.3.1. perlscan: 1.25-st-qms. Clear:RC:0(71.102.224.36):SA:0(-2.9/5.0):. Processed in 2.230634 secs); 10 Oct 2010 11:23:01 -0000 X-Spam-Status: No, hits=-2.9 required=5.0 X-Spam-Report: SA TESTS -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Level: * X-Qmail-Scanner-MOVED-X-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 X-Spam-Check-By: gw.lgarchitecture.com Received: from pool-71-102-224-36.snloca.dsl-w.verizon.net (HELO [192.168.1.196]) (71.102.224.36) (smtp-auth username rick@lgarchitecture.com, mechanism plain) by gw.lgarchitecture.com (qpsmtpd/0.84) with ESMTPA; Sun, 10 Oct 2010 04:22:56 -0700 Message-ID: <4CB1A1F7.6060404@lgarchitecture.com> Date: Sun, 10 Oct 2010 04:22:31 -0700 From: Rick User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.9) Gecko/20100915 Lightning/1.0b2 Thunderbird/3.1.4 MIME-Version: 1.0 To: sem@FreeBSD.org X-Enigmail-Version: 1.1.1 Content-Type: multipart/mixed; boundary="------------050701050504090900030701" Cc: ports@FreeBSD.org Subject: FreeBSD Port: grub2-1.98 X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Oct 2010 11:49:45 -0000 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 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 #include @@ -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--