From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bINIG-0001tP-9E for mharc-grub-devel@gnu.org; Wed, 29 Jun 2016 17:45:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bINIB-0001pK-Rl for grub-devel@gnu.org; Wed, 29 Jun 2016 17:45:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bINI9-00066V-Ie for grub-devel@gnu.org; Wed, 29 Jun 2016 17:45:07 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:39661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bINI9-00066R-9x for grub-devel@gnu.org; Wed, 29 Jun 2016 17:45:05 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u5TLj4fv003305 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 29 Jun 2016 21:45:04 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u5TLj4iE006475 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 29 Jun 2016 21:45:04 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 u5TLj39c032764 for ; Wed, 29 Jun 2016 21:45:03 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:45:03 -0700 From: Eric Snowberg To: grub-devel@gnu.org Cc: Eric Snowberg Subject: [PATCH 04/15] sparc64: Use the correct disk name in core.img Date: Wed, 29 Jun 2016 14:43:17 -0700 Message-Id: <5c06f858d2411b51e60427f55ed585f6012e5279.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: aserv0021.oracle.com [141.146.126.233] 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:11 -0000 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 --- 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