Accepting request 597386 from home:michael-chang:branches:Base:System

- Fallback to raw mode if Open Firmware returns invalid ihandler (bsc#1071559)
  * grub2-ieee1275-open-raw-mode.patch

OBS-URL: https://build.opensuse.org/request/show/597386
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=299
This commit is contained in:
Michael Chang 2018-04-19 07:23:05 +00:00 committed by Git OBS Bridge
parent 1847661beb
commit 022e481ebd
3 changed files with 77 additions and 8 deletions

View File

@ -0,0 +1,60 @@
From: diegodo@br.ibm.com
References: bsc#1071559
Patch-Mainline: no
Because Openfirmware returns invalid ihandler when it tries to open a disk
which his first partition is not a supported one by the firmware (Prep, FAT,
ISO), the grub needs to understand when it should open the disk in "raw mode",
appending a ":0" in the end of the device path.
Openfirmware is unable to open disk that contains a unknown first partition
(i.e it is not a PreP, Fat, ISO) ; We needed to open the disk in "raw mode" and
so Grub was required to take care of partitions and contents.
Index: grub-2.02/grub-core/kern/ieee1275/ieee1275.c
===================================================================
--- grub-2.02.orig/grub-core/kern/ieee1275/ieee1275.c
+++ grub-2.02/grub-core/kern/ieee1275/ieee1275.c
@@ -19,6 +19,8 @@
#include <grub/ieee1275/ieee1275.h>
#include <grub/types.h>
+#include <grub/misc.h>
+#include <grub/mm.h>
#define IEEE1275_PHANDLE_INVALID ((grub_ieee1275_cell_t) -1)
#define IEEE1275_IHANDLE_INVALID ((grub_ieee1275_cell_t) 0)
@@ -458,8 +460,31 @@ grub_ieee1275_open (const char *path, gr
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
return -1;
*result = args.result;
- if (args.result == IEEE1275_IHANDLE_INVALID)
- return -1;
+ if (args.result == IEEE1275_IHANDLE_INVALID){
+
+ int path_len = grub_strlen(path);
+ if ((path[path_len-3] == ':') && (path[path_len-2] == '0')){
+ return -1;
+ }
+
+ char *new_path = grub_malloc(grub_strlen(path) + 3);
+ char *optr;
+ optr = grub_stpcpy (new_path, path);
+ *optr++ = ':';
+ *optr++ = '0';
+ *optr++ = '\0';
+
+ args.path = (grub_ieee1275_cell_t) new_path;
+
+ if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
+ return -1;
+
+ *result = args.result;
+ if (args.result == IEEE1275_IHANDLE_INVALID)
+ return -1;
+
+ }
+
return 0;
}

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Apr 17 07:54:15 UTC 2018 - mchang@suse.com
- Fallback to raw mode if Open Firmware returns invalid ihandler (bsc#1071559)
* grub2-ieee1275-open-raw-mode.patch
-------------------------------------------------------------------
Thu Apr 12 08:41:39 UTC 2018 - mchang@suse.com

View File

@ -245,13 +245,15 @@ Patch164: grub2-suse-remove-linux-root-param.patch
# PPC64 LE support
Patch205: grub2-ppc64le-disable-video.patch
Patch207: grub2-ppc64le-memory-map.patch
# PPC
Patch210: 0002-Add-Virtual-LAN-support.patch
Patch211: grub2-ppc64-cas-reboot-support.patch
Patch212: grub2-install-remove-useless-check-PReP-partition-is-empty.patch
Patch213: grub2-Fix-incorrect-netmask-on-ppc64.patch
Patch214: grub2-ieee1275-open-raw-mode.patch
Patch233: grub2-use-stat-instead-of-udevadm-for-partition-lookup.patch
Patch234: fix-grub2-use-stat-instead-of-udevadm-for-partition-lookup-with-new-glibc.patch
Patch235: 0002-Add-Virtual-LAN-support.patch
Patch236: grub2-efi_gop-avoid-low-resolution.patch
Patch277: grub2-ppc64-cas-reboot-support.patch
Patch278: grub2-install-remove-useless-check-PReP-partition-is-empty.patch
Patch279: grub2-Fix-incorrect-netmask-on-ppc64.patch
# Support HTTP Boot IPv4 and IPv6 (fate#320129)
Patch280: 0001-misc-fix-invalid-character-recongition-in-strto-l.patch
Patch281: 0002-net-read-bracketed-ipv6-addrs-and-port-numbers.patch
@ -522,13 +524,14 @@ swap partition while in resuming
%patch164 -p1
%patch205 -p1
%patch207 -p1
%patch210 -p1
%patch211 -p1
%patch212 -p1
%patch213 -p1
%patch214 -p1
%patch233 -p1
%patch234 -p1
%patch235 -p1
%patch236 -p1
%patch277 -p1
%patch278 -p1
%patch279 -p1
%patch280 -p1
%patch281 -p1
%patch282 -p1