Received: from list by lists.gnu.org with archive (Exim 4.71) id 1e0TEv-00051A-0R for mharc-grub-devel@gnu.org; Fri, 06 Oct 2017 10:04:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0TEr-0004y9-Hp for grub-devel@gnu.org; Fri, 06 Oct 2017 10:04:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e0TEo-0002qI-Do for grub-devel@gnu.org; Fri, 06 Oct 2017 10:04:29 -0400 Received: from boksu.net-space.pl ([185.15.1.105]:33212) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.71) (envelope-from ) id 1e0TEo-0002nz-2A for grub-devel@gnu.org; Fri, 06 Oct 2017 10:04:26 -0400 Received: (from localhost user: 'dkiper' uid#4000 fake: STDIN (dkiper@boksu.net-space.pl)) by router-fw-old.local.net-space.pl id S1809899AbdJFOEV (ORCPT ); Fri, 6 Oct 2017 16:04:21 +0200 Date: Fri, 6 Oct 2017 16:04:21 +0200 From: Daniel Kiper To: The development of GNU GRUB Cc: phcoder@gmail.com, Eric Snowberg Subject: Re: [PATCH v2] sparc64: Add blocklist GPT support for SPARC Message-ID: <20171006140421.GA2075@router-fw-old.local.net-space.pl> References: <1494552324-191766-1-git-send-email-eric.snowberg@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1494552324-191766-1-git-send-email-eric.snowberg@oracle.com> User-Agent: Mutt/1.3.28i X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.15.1.105 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: Fri, 06 Oct 2017 14:04:31 -0000 On Thu, May 11, 2017 at 06:25:24PM -0700, Eric Snowberg wrote: > 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 > --- > Changes in v2: > Do all GPT offset calculations in setup > --- > util/setup.c | 26 +++++++++++++++++++++++--- > 1 files changed, 23 insertions(+), 3 deletions(-) > > diff --git a/util/setup.c b/util/setup.c > index 8aa5a39..8036307 100644 > --- a/util/setup.c > +++ b/util/setup.c > @@ -138,6 +138,9 @@ struct blocklists > #ifdef GRUB_SETUP_BIOS > grub_uint16_t current_segment; > #endif > +#ifdef GRUB_SETUP_SPARC64 > + grub_uint64_t gpt_offset; > +#endif This does not seem to be used below... Daniel > grub_uint16_t last_length; > grub_disk_addr_t first_sector; > }; > @@ -151,6 +154,10 @@ save_blocklists (grub_disk_addr_t sector, unsigned offset, unsigned length, > struct grub_boot_blocklist *prev = bl->block + 1; > grub_uint64_t seclen; > > +#ifdef GRUB_SETUP_SPARC64 > + sector -= bl->gpt_offset; > +#endif > + > grub_util_info ("saving <%" GRUB_HOST_PRIuLONG_LONG ",%u,%u>", > (unsigned long long) sector, offset, length); > > @@ -662,6 +669,16 @@ unable_to_embed: > > bl.block = bl.first_block; > > +#ifdef GRUB_SETUP_SPARC64 > + { > + grub_partition_t container = root_dev->disk->partition; > + bl.gpt_offset = 0; > + > + if (grub_strstr (container->partmap->name, "gpt")) > + bl.gpt_offset = grub_partition_get_start (container); > + } > +#endif > + > grub_install_get_blocklist (root_dev, core_path, core_img, core_size, > save_blocklists, &bl); > > @@ -721,15 +738,18 @@ 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 > + offset = bl.gpt_offset; > +#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 +768,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 > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel