grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Snowberg <eric.snowberg@oracle.com>
To: grub-devel@gnu.org
Cc: Eric Snowberg <eric.snowberg@oracle.com>
Subject: [PATCH 04/15] sparc64: Use the correct disk name in core.img
Date: Wed, 29 Jun 2016 14:43:17 -0700	[thread overview]
Message-ID: <5c06f858d2411b51e60427f55ed585f6012e5279.1467232724.git.eric.snowberg@oracle.com> (raw)
In-Reply-To: <cover.1467232724.git.eric.snowberg@oracle.com>
In-Reply-To: <cover.1467232724.git.eric.snowberg@oracle.com>

Use the correct disk name and escape it properly in core.img for SPARC.
Prior to this patch, search.fs_uuid was missing from the core.img.
On SPARC, the core.img is very small and doesn't contain everything
needed to boot. Therefore many modules contained within:
/boot/grub/sparc64-ieee1275 are needed.

This patch will prevent walking the entire device tree every time
and possibly using the wrong disk.

This has been tested on T1 thru T7 hardware

I didn't change the behavior for other IEEE1275 platforms, but they
may benefit from this patch if they were added within the switch
statement.

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
---
 include/grub/emu/getroot.h |    2 ++
 util/grub-install.c        |   13 +++++++++++++
 util/probe.c               |    2 +-
 3 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/include/grub/emu/getroot.h b/include/grub/emu/getroot.h
index 73fa2d3..4f04c7d 100644
--- a/include/grub/emu/getroot.h
+++ b/include/grub/emu/getroot.h
@@ -100,5 +100,7 @@ grub_util_guess_baremetal_drive (const char *orig_path);
 void
 grub_util_fprint_full_disk_name (FILE *f,
 				 const char *drive, grub_device_t dev);
+char *
+escape_of_path (const char *orig_path);
 
 #endif /* ! GRUB_UTIL_GETROOT_HEADER */
diff --git a/util/grub-install.c b/util/grub-install.c
index 7394739..f1ddf1c 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -1347,6 +1347,7 @@ main (int argc, char *argv[])
 	  || grub_drives[1]
 	  || (!install_drive
 	      && platform != GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275)
+	  || (platform == GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275)
 	  || (install_drive && !is_same_disk (grub_drives[0], install_drive))
 	  || !have_bootdev (platform))
 	{
@@ -1438,6 +1439,18 @@ main (int argc, char *argv[])
 		    g = grub_util_guess_efi_drive (*curdev);
 		    break;
 		  case GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275:
+		    {
+		      char *dname;
+		      const char *ofpath = grub_util_devname_to_ofpath (*curdev);
+		      g = xasprintf ("ieee1275/%s", ofpath);
+		      dname = escape_of_path (g);
+		      fprintf (load_cfg_f, "%s ", dname);
+		      free (dname);
+		      free (g);
+		      g = NULL;
+		      break;
+		    }
+
 		  case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275:
 		  case GRUB_INSTALL_PLATFORM_I386_IEEE1275:
 		    {
diff --git a/util/probe.c b/util/probe.c
index fa7ca34..880cb5c 100644
--- a/util/probe.c
+++ b/util/probe.c
@@ -44,7 +44,7 @@
 /* Since OF path names can have "," characters in them, and GRUB
    internally uses "," to indicate partitions (unlike OF which uses
    ":" for this purpose) we escape such commas.  */
-static char *
+char *
 escape_of_path (const char *orig_path)
 {
   char *new_path, *d, c;
-- 
1.7.1



  parent reply	other threads:[~2016-06-29 21:45 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
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 ` Eric Snowberg [this message]
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=5c06f858d2411b51e60427f55ed585f6012e5279.1467232724.git.eric.snowberg@oracle.com \
    --to=eric.snowberg@oracle.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).