On Thu, May 11, 2017, 02:37 Vladimir 'phcoder' Serbinenko <
address@hidden> wrote:
> On May 10, 2017, at 4:42 PM, Vladimir 'phcoder' Serbinenko <address@hidden> wrote:
>
>
>
> On Wed, Jun 29, 2016, 23:47 Eric Snowberg <address@hidden> 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 <address@hidden>
> ---
> 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