2ae5c1e
From ce8210df5c25af8ce319f6cd5b7578beaf3e9a22 Mon Sep 17 00:00:00 2001
f4c76c0
From: Peter Jones <pjones@redhat.com>
f4c76c0
Date: Mon, 27 Oct 2014 09:22:55 -0400
2ae5c1e
Subject: [PATCH 65/85] Try to emit linux16/initrd16 and linuxefi/initrdefi in
f4c76c0
 30-os_prober.
f4c76c0
f4c76c0
Resolves: rhbz#1108296
f4c76c0
f4c76c0
Signed-off-by: Peter Jones <pjones@redhat.com>
f4c76c0
---
f4c76c0
 util/grub.d/30_os-prober.in | 30 ++++++++++++++++++++++++++----
f4c76c0
 1 file changed, 26 insertions(+), 4 deletions(-)
f4c76c0
f4c76c0
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
b9efc54
index 9b8f596..dc98eac 100644
f4c76c0
--- a/util/grub.d/30_os-prober.in
f4c76c0
+++ b/util/grub.d/30_os-prober.in
b9efc54
@@ -141,6 +141,28 @@ for OS in ${OSPROBED} ; do
b9efc54
   # os-prober returns text string followed by optional counter
b9efc54
   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')"
f4c76c0
 
f4c76c0
+  sixteenbit=""
f4c76c0
+  linuxefi="linux"
f4c76c0
+  initrdefi="initrd"
f4c76c0
+  case "$machine" in
f4c76c0
+    i?86|x86_64)
f4c76c0
+      sixteenbit="16"
f4c76c0
+      linuxefi="linuxefi"
f4c76c0
+      initrdefi="initrdefi"
f4c76c0
+      ;;
f4c76c0
+    aarch64)
f4c76c0
+      linuxefi="linux"
f4c76c0
+      initrdefi="initrd"
f4c76c0
+  esac
f4c76c0
+  linux="linux${sixteenbit}"
f4c76c0
+  initrd="initrd${sixteenbit}"
f4c76c0
+  # there's no way to tell that the /other/ os is booting through UEFI,
f4c76c0
+  # but if we are it's an okay bet...
f4c76c0
+  if [ -d /sys/firmware/efi ]; then
f4c76c0
+    linux=$linuxefi
f4c76c0
+    initrd=$initrdefi
f4c76c0
+  fi
f4c76c0
+
f4c76c0
   gettext_printf "Found %s on %s\n" "${LONGNAME}" "${DEVICE}" >&2
f4c76c0
 
f4c76c0
   case ${BOOT} in
b9efc54
@@ -241,11 +263,11 @@ EOF
f4c76c0
 	    save_default_entry | grub_add_tab
f4c76c0
 	    printf '%s\n' "${prepare_boot_cache}"
f4c76c0
 	    cat <<  EOF
f4c76c0
-	linux ${LKERNEL} ${LPARAMS}
f4c76c0
+	${linux} ${LKERNEL} ${LPARAMS}
f4c76c0
 EOF
f4c76c0
             if [ -n "${LINITRD}" ] ; then
f4c76c0
           cat << EOF
f4c76c0
-	initrd ${LINITRD}
f4c76c0
+	${initrd} ${LINITRD}
f4c76c0
 EOF
f4c76c0
             fi
f4c76c0
         cat << EOF
b9efc54
@@ -261,11 +283,11 @@ EOF
f4c76c0
 	save_default_entry | sed -e "s/^/$grub_tab$grub_tab/"
f4c76c0
 	printf '%s\n' "${prepare_boot_cache}" | grub_add_tab
f4c76c0
 	cat <<  EOF
f4c76c0
-		linux ${LKERNEL} ${LPARAMS}
f4c76c0
+		${linux} ${LKERNEL} ${LPARAMS}
f4c76c0
 EOF
f4c76c0
         if [ -n "${LINITRD}" ] ; then
f4c76c0
             cat << EOF
f4c76c0
-		initrd ${LINITRD}
f4c76c0
+		${initrd} ${LINITRD}
f4c76c0
 EOF
f4c76c0
         fi
f4c76c0
         cat << EOF
f4c76c0
-- 
b9efc54
2.5.0
f4c76c0