From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bINID-0001qp-EX for mharc-grub-devel@gnu.org; Wed, 29 Jun 2016 17:45:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bINI8-0001mm-HO for grub-devel@gnu.org; Wed, 29 Jun 2016 17:45:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bINI5-00065n-9W for grub-devel@gnu.org; Wed, 29 Jun 2016 17:45:04 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:39624) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bINI5-00065h-0m for grub-devel@gnu.org; Wed, 29 Jun 2016 17:45:01 -0400 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u5TLixmV002951 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 29 Jun 2016 21:45:00 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u5TLixf8003506 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 29 Jun 2016 21:44:59 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u5TLiw2d032718 for ; Wed, 29 Jun 2016 21:44:59 GMT Received: from ca-qasparc20.us.oracle.com (/10.147.24.73) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 29 Jun 2016 14:44:58 -0700 From: Eric Snowberg To: grub-devel@gnu.org Cc: Eric Snowberg Subject: [PATCH 02/15] sparc64: Add blocklist GPT support for SPARC Date: Wed, 29 Jun 2016 14:43:15 -0700 Message-Id: <96643090207a64ea6be92fe09f17db96e2a8fff9.1467232724.git.eric.snowberg@oracle.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: In-Reply-To: References: X-Source-IP: userv0022.oracle.com [156.151.31.74] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2016 21:45:07 -0000 Add block-list GPT support for SPARC. The OBP "load" and "boot" methods are partition aware and neither command can see the partition table. Also neither command can address the entire physical disk. When the install happens, grub generates the block-list entries based on the beginning of the physical disk, not the beginning of the parition. This patch fixes the block-list entries so they match what OBP expects during boot for a GPT disk. T5 and above now supports GPT as well as VTOC. This patch has been tested on T5-2 and newer SPARC systems. Signed-off-by: Eric Snowberg --- grub-core/osdep/linux/blocklist.c | 5 +++++ util/setup.c | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/grub-core/osdep/linux/blocklist.c b/grub-core/osdep/linux/blocklist.c index c77d608..caf8d4e 100644 --- a/grub-core/osdep/linux/blocklist.c +++ b/grub-core/osdep/linux/blocklist.c @@ -58,6 +58,11 @@ grub_install_get_blocklist (grub_device_t root_dev, struct fiemap fie1; int fd; +#ifdef __sparc__ + if (grub_strstr (container->partmap->name, "gpt")) + container_start = 0; +#endif + /* Write the first two sectors of the core image onto the disk. */ grub_util_info ("opening the core image `%s'", core_path); fd = open (core_path, O_RDONLY); diff --git a/util/setup.c b/util/setup.c index 8aa5a39..5908498 100644 --- a/util/setup.c +++ b/util/setup.c @@ -721,15 +721,21 @@ unable_to_embed: { char *buf, *ptr = core_img; size_t len = core_size; - grub_uint64_t blk; + grub_uint64_t blk, offset = 0; grub_partition_t container = core_dev->disk->partition; grub_err_t err; core_dev->disk->partition = 0; +#ifdef GRUB_SETUP_SPARC64 + { + if (grub_strstr (container->partmap->name, "gpt")) + offset = grub_partition_get_start (container); + } +#endif buf = xmalloc (core_size); blk = bl.first_sector; - err = grub_disk_read (core_dev->disk, blk, 0, GRUB_DISK_SECTOR_SIZE, buf); + err = grub_disk_read (core_dev->disk, blk + offset, 0, GRUB_DISK_SECTOR_SIZE, buf); if (err) grub_util_error (_("cannot read `%s': %s"), core_dev->disk->name, grub_errmsg); @@ -748,7 +754,7 @@ unable_to_embed: if (cur > len) cur = len; - err = grub_disk_read (core_dev->disk, blk, 0, cur, buf); + err = grub_disk_read (core_dev->disk, blk + offset, 0, cur, buf); if (err) grub_util_error (_("cannot read `%s': %s"), core_dev->disk->name, grub_errmsg); -- 1.7.1