c78952
From 5f89c77c7cff17c931f1ea52af0c39df8ab28ac9 Mon Sep 17 00:00:00 2001
f4c76c
From: Peter Jones <pjones@redhat.com>
f4c76c
Date: Mon, 27 Oct 2014 09:22:55 -0400
c78952
Subject: [PATCH 127/229] Try to emit linux16/initrd16 and linuxefi/initrdefi
bc092b
 in 30-os_prober.
f4c76c
f4c76c
Resolves: rhbz#1108296
f4c76c
f4c76c
Signed-off-by: Peter Jones <pjones@redhat.com>
f4c76c
---
f4c76c
 util/grub.d/30_os-prober.in | 30 ++++++++++++++++++++++++++----
f4c76c
 1 file changed, 26 insertions(+), 4 deletions(-)
f4c76c
f4c76c
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
ec4acb
index 9b8f5968e2d..dc98eace934 100644
f4c76c
--- a/util/grub.d/30_os-prober.in
f4c76c
+++ b/util/grub.d/30_os-prober.in
b9efc5
@@ -141,6 +141,28 @@ for OS in ${OSPROBED} ; do
b9efc5
   # os-prober returns text string followed by optional counter
b9efc5
   CLASS="--class $(echo "${LABEL}" | LC_ALL=C sed 's,[[:digit:]]*$,,' | cut -d' ' -f1 | tr 'A-Z' 'a-z' | LC_ALL=C sed 's,[^[:alnum:]_],_,g')"
f4c76c
 
f4c76c
+  sixteenbit=""
f4c76c
+  linuxefi="linux"
f4c76c
+  initrdefi="initrd"
f4c76c
+  case "$machine" in
f4c76c
+    i?86|x86_64)
f4c76c
+      sixteenbit="16"
f4c76c
+      linuxefi="linuxefi"
f4c76c
+      initrdefi="initrdefi"
f4c76c
+      ;;
f4c76c
+    aarch64)
f4c76c
+      linuxefi="linux"
f4c76c
+      initrdefi="initrd"
f4c76c
+  esac
f4c76c
+  linux="linux${sixteenbit}"
f4c76c
+  initrd="initrd${sixteenbit}"
f4c76c
+  # there's no way to tell that the /other/ os is booting through UEFI,
f4c76c
+  # but if we are it's an okay bet...
f4c76c
+  if [ -d /sys/firmware/efi ]; then
f4c76c
+    linux=$linuxefi
f4c76c
+    initrd=$initrdefi
f4c76c
+  fi
f4c76c
+
f4c76c
   gettext_printf "Found %s on %s\n" "${LONGNAME}" "${DEVICE}" >&2
f4c76c
 
f4c76c
   case ${BOOT} in
b9efc5
@@ -241,11 +263,11 @@ EOF
f4c76c
 	    save_default_entry | grub_add_tab
f4c76c
 	    printf '%s\n' "${prepare_boot_cache}"
f4c76c
 	    cat <<  EOF
f4c76c
-	linux ${LKERNEL} ${LPARAMS}
f4c76c
+	${linux} ${LKERNEL} ${LPARAMS}
f4c76c
 EOF
f4c76c
             if [ -n "${LINITRD}" ] ; then
f4c76c
           cat << EOF
f4c76c
-	initrd ${LINITRD}
f4c76c
+	${initrd} ${LINITRD}
f4c76c
 EOF
f4c76c
             fi
f4c76c
         cat << EOF
b9efc5
@@ -261,11 +283,11 @@ EOF
f4c76c
 	save_default_entry | sed -e "s/^/$grub_tab$grub_tab/"
f4c76c
 	printf '%s\n' "${prepare_boot_cache}" | grub_add_tab
f4c76c
 	cat <<  EOF
f4c76c
-		linux ${LKERNEL} ${LPARAMS}
f4c76c
+		${linux} ${LKERNEL} ${LPARAMS}
f4c76c
 EOF
f4c76c
         if [ -n "${LINITRD}" ] ; then
f4c76c
             cat << EOF
f4c76c
-		initrd ${LINITRD}
f4c76c
+		${initrd} ${LINITRD}
f4c76c
 EOF
f4c76c
         fi
f4c76c
         cat << EOF
f4c76c
-- 
ec4acb
2.15.0
f4c76c