grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: "Vladimir 'phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH 02/15] sparc64: Add blocklist GPT support for SPARC
Date: Thu, 11 May 2017 00:40:12 +0000	[thread overview]
Message-ID: <CAEaD8JM+J79SLoRELhxyPgbcG_5Dcub04h+J46APMkk2UPQtpw@mail.gmail.com> (raw)
In-Reply-To: <CAEaD8JOdtOo2KaA-851cFWGFPm0vrMs4+1F6HtB3aNkQLeG7AA@mail.gmail.com>

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

On Thu, May 11, 2017, 02:37 Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
wrote:

>
>
> On Thu, May 11, 2017, 01:21 Eric Snowberg <eric.snowberg@oracle.com>
> wrote:
>
>>
>> > On May 10, 2017, at 4:42 PM, Vladimir 'phcoder' Serbinenko <
>> phcoder@gmail.com> wrote:
>> >
>> >
>> >
>> > On Wed, Jun 29, 2016, 23:47 Eric Snowberg <eric.snowberg@oracle.com>
>> 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 <eric.snowberg@oracle.com>
>> > ---
>> >  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
>> > +
>> > This makes ifdef conditional on platform of the tool, not of the
>> binaries and they can be different.
>>
>> Exactly, they are different, that is why the ifdef was added for SPARC.
>> The tool was putting the wrong value into the binary.
>>
> No. What I mean is that someone with x86 cpu fan prepare a disk for
> sparc64. He would compile tools for x86 and binaries for sparc64. With your
> code tool will end up with wrong offsets.
>
>>
>> > Also there are several implementations of blocklist retrieving for
>> different platform. This condition needs to be detected and adjusted for in
>> the caller (setup)
>>
>> How do you recommend I adjusted it in the setup when container_start is
>> obtained from grub_partition_get_start?
>>
> Just subtract partition offset in save_blocklists or its caller
>
Sorry, I meant *not* its caller

>
>>
>> >    /* 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
>> >
>> >
>> > _______________________________________________
>> > Grub-devel mailing list
>> > Grub-devel@gnu.org
>> > https://lists.gnu.org/mailman/listinfo/grub-devel
>> > _______________________________________________
>> > Grub-devel mailing list
>> > Grub-devel@gnu.org
>> > https://lists.gnu.org/mailman/listinfo/grub-devel
>>
>>
>> _______________________________________________
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> https://lists.gnu.org/mailman/listinfo/grub-devel
>>
>

[-- Attachment #2: Type: text/html, Size: 6991 bytes --]

  reply	other threads:[~2017-05-11  0:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-29 21:43 [PATCH 00/15] Add missing SPARC support Eric Snowberg
2016-06-29 21:43 ` [PATCH 01/15] sparc64: fix OF path names for sun4v systems Eric Snowberg
2016-06-29 21:43 ` [PATCH 02/15] sparc64: Add blocklist GPT support for SPARC Eric Snowberg
2017-05-10 22:42   ` Vladimir 'phcoder' Serbinenko
2017-05-10 23:20     ` Eric Snowberg
2017-05-11  0:37       ` Vladimir 'phcoder' Serbinenko
2017-05-11  0:40         ` Vladimir 'phcoder' Serbinenko [this message]
2017-05-11  2:05           ` Eric Snowberg
2016-06-29 21:43 ` [PATCH 03/15] grub-install: fix memory leak Eric Snowberg
2016-06-29 21:43 ` [PATCH 04/15] sparc64: Use the correct disk name in core.img Eric Snowberg
2016-06-29 21:43 ` [PATCH 05/15] ieee1275: fix segfault in grub-ofpathname Eric Snowberg
2016-06-29 21:43 ` [PATCH 06/15] ieee1275: add nvme support within ofpath Eric Snowberg
2016-06-29 21:43 ` [PATCH 07/15] ofdisk: memory corruption fix Eric Snowberg
2016-06-29 21:43 ` [PATCH 08/15] ofdisk: move open logic Eric Snowberg
2016-06-29 21:43 ` [PATCH 09/15] ieee1275: ofdisk - don't continue to query block-size after we have it Eric Snowberg
2016-06-29 21:43 ` [PATCH 10/15] ofdisk: refactor open logic Eric Snowberg
2016-06-29 21:43 ` [PATCH 11/15] sparc64: boot performance improvements Eric Snowberg
2016-06-29 21:43 ` [PATCH 12/15] ofdisk: only add aliases that exist Eric Snowberg
2016-06-29 21:43 ` [PATCH 13/15] sparc64: add disks that don't have a devalias to the device list Eric Snowberg
2016-06-29 21:43 ` [PATCH 14/15] parser: Remove escape from the state transitions Eric Snowberg
2016-06-29 21:43 ` [PATCH 15/15] sparc64: ignore hypervisor reboot memory block device Eric Snowberg
2016-07-01  6:52 ` [PATCH 00/15] Add missing SPARC support Daniel Kiper
2016-07-26 10:24   ` Daniel Kiper

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=CAEaD8JM+J79SLoRELhxyPgbcG_5Dcub04h+J46APMkk2UPQtpw@mail.gmail.com \
    --to=phcoder@gmail.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).