bc092b
From d33045ce7ffcb7c1e4a60c14d5ca64b36e3c5abe Mon Sep 17 00:00:00 2001
bc092b
From: Fu Wei <fu.wei@linaro.org>
bc092b
Date: Sun, 14 May 2017 15:43:46 +0800
31cddd
Subject: [PATCH] util/grub.d/20_linux_xen.in: Add xen_boot command support for
31cddd
 aarch64
bc092b
bc092b
This patch adds the support of xen_boot command for aarch64:
bc092b
    xen_hypervisor
bc092b
    xen_module
bc092b
These two commands are only for aarch64, since it has its own protocol and
bc092b
commands to boot xen hypervisor and Dom0, but not multiboot.
bc092b
bc092b
For other architectures, they are still using multiboot and module
bc092b
commands.
bc092b
bc092b
Signed-off-by: Fu Wei <fu.wei@linaro.org>
bc092b
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
bc092b
---
bc092b
 util/grub.d/20_linux_xen.in | 14 +++++++++++---
bc092b
 1 file changed, 11 insertions(+), 3 deletions(-)
bc092b
bc092b
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
ec4acb
index c48af948d6e..c002fc9f946 100644
bc092b
--- a/util/grub.d/20_linux_xen.in
bc092b
+++ b/util/grub.d/20_linux_xen.in
bc092b
@@ -122,16 +122,16 @@ linux_entry ()
bc092b
         else
bc092b
             xen_rm_opts="no-real-mode edd=off"
bc092b
         fi
bc092b
-	multiboot	${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts}
bc092b
+	${xen_loader}	${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts}
bc092b
 	echo	'$(echo "$lmessage" | grub_quote)'
bc092b
-	module	${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
bc092b
+	${module_loader}	${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
bc092b
 EOF
bc092b
   if test -n "${initrd}" ; then
bc092b
     # TRANSLATORS: ramdisk isn't identifier. Should be translated.
bc092b
     message="$(gettext_printf "Loading initial ramdisk ...")"
bc092b
     sed "s/^/$submenu_indentation/" << EOF
bc092b
 	echo	'$(echo "$message" | grub_quote)'
bc092b
-	module	--nounzip   ${rel_dirname}/${initrd}
bc092b
+	${module_loader}	--nounzip   ${rel_dirname}/${initrd}
bc092b
 EOF
bc092b
   fi
bc092b
   sed "s/^/$submenu_indentation/" << EOF
bc092b
@@ -206,6 +206,14 @@ while [ "x${xen_list}" != "x" ] ; do
bc092b
     if [ "x$is_top_level" != xtrue ]; then
bc092b
 	echo "	submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
bc092b
     fi
bc092b
+    $grub_file --is-arm64-efi $current_xen
bc092b
+    if [ $? -ne 0 ]; then
bc092b
+	xen_loader="multiboot"
bc092b
+	module_loader="module"
bc092b
+    else
bc092b
+	xen_loader="xen_hypervisor"
bc092b
+	module_loader="xen_module"
bc092b
+    fi
bc092b
     while [ "x$list" != "x" ] ; do
bc092b
 	linux=`version_find_latest $list`
bc092b
 	gettext_printf "Found linux image: %s\n" "$linux" >&2