2018-04-17 06:04:01 +02:00
|
|
|
From: Michael Chang <mchang@suse.com>
|
|
|
|
References: bsc#1085842
|
|
|
|
Patch-Mainline: no
|
|
|
|
|
|
|
|
The grub can be installed with removable option to support booting from
|
|
|
|
removable media with standard UEFI default file path of the form:
|
|
|
|
\EFI\BOOT\BOOT{machine type short-name}.EFI
|
|
|
|
|
|
|
|
It does not make use of distributor directory, which becomes a problem for UEFI
|
|
|
|
Xen installation as it requires that directory to be present for storing xen
|
|
|
|
stuff like chainloaded hypervisor, xen kernel and so on. Moreover it makes bad
|
|
|
|
assumption that hypervisor will be chainloaded by grub under the same
|
|
|
|
directory, which is also not always true.
|
|
|
|
|
|
|
|
This patch fixes the problem by ensuring the directory available to Xen
|
|
|
|
installation if any Xen hypervisor found and independent to grub boot path
|
|
|
|
$cmdpath to work.
|
|
|
|
|
2019-01-23 12:53:47 +01:00
|
|
|
---
|
|
|
|
util/grub.d/20_linux_xen.in | 62 ++++++++++++++++++++++++--------------------
|
|
|
|
1 file changed, 35 insertions(+), 27 deletions(-)
|
|
|
|
|
|
|
|
--- a/util/grub.d/20_linux_xen.in
|
|
|
|
+++ b/util/grub.d/20_linux_xen.in
|
|
|
|
@@ -101,32 +101,6 @@ esac
|
2018-04-17 06:04:01 +02:00
|
|
|
|
|
|
|
title_correction_code=
|
|
|
|
|
|
|
|
-if [ -d /sys/firmware/efi ]; then
|
|
|
|
- is_efi=true
|
|
|
|
- err_msg=""
|
|
|
|
- efi_dir="/boot/efi/efi/${os}"
|
|
|
|
- grub_dir=/boot/@PACKAGE@
|
2019-01-23 12:53:47 +01:00
|
|
|
- xen_dir=/usr/share/efi/$machine
|
|
|
|
- [ -d $xen_dir ] || xen_dir=/usr/lib64/efi
|
2018-04-17 06:04:01 +02:00
|
|
|
- for d in $grub_dir $efi_dir $xen_dir; do
|
|
|
|
- [ ! -d "$d" ] || continue
|
|
|
|
- err_msg="${err_msg}$ME: Essential directory '$d' not found!\n"
|
|
|
|
- done
|
|
|
|
- if ! [ -d "$efi_dir" -a -d "$grub_dir" -a -d "$xen_dir" ]; then
|
|
|
|
- err_msg="${err_msg}$ME: XEN configuration skipped!\n"
|
|
|
|
- else
|
|
|
|
- rm -f $grub_dir/xen*.cfg
|
|
|
|
- if [ -s $efi_dir/grub.xen-files ]; then
|
|
|
|
- for f in $(sort $efi_dir/grub.xen-files| uniq); do
|
|
|
|
- rm -f $efi_dir/$f
|
|
|
|
- done
|
|
|
|
- : > $efi_dir/grub.xen-files
|
|
|
|
- fi
|
|
|
|
- fi
|
|
|
|
-else
|
|
|
|
- is_efi=false
|
|
|
|
-fi
|
|
|
|
-
|
|
|
|
grub2_unquote ()
|
|
|
|
{
|
|
|
|
awk '
|
2019-01-23 12:53:47 +01:00
|
|
|
@@ -234,10 +208,15 @@ linux_entry ()
|
2018-04-17 06:04:01 +02:00
|
|
|
kernel=${basename} root=${linux_root_device_thisversion} ${args_unq}
|
2019-12-10 07:30:43 +01:00
|
|
|
ramdisk=${initrd_real}
|
2018-04-17 06:04:01 +02:00
|
|
|
EOF
|
|
|
|
+ if [ -z "${prepare_efi_cache}" ]; then
|
|
|
|
+ grub_device_efi="`${grub_probe} --target=device /boot/efi`"
|
|
|
|
+ prepare_efi_cache="$(prepare_grub_to_access_device ${grub_device_efi} | grub_add_tab)"
|
|
|
|
+ fi
|
|
|
|
+ printf '%s\n' "${prepare_efi_cache}" | sed "s/^/$submenu_indentation/"
|
|
|
|
message="$(gettext_printf "Loading Xen %s with Linux %s ..." ${xen_version} ${version})"
|
|
|
|
sed "s/^/$submenu_indentation/" <<-EOF
|
|
|
|
echo '$(echo "$message" | grub_quote)'
|
|
|
|
- chainloader \$cmdpath/${xen_basename} ${xen_basename} ${SUSE_CMDLINE_XENEFI} $section
|
|
|
|
+ chainloader ${rel_efi_dir}/${xen_basename} ${xen_basename} ${SUSE_CMDLINE_XENEFI} $section
|
|
|
|
}
|
|
|
|
EOF
|
2019-12-10 07:30:43 +01:00
|
|
|
for f in ${grub_dir}/$xen_cfg ${xen_dir}/${xen_basename} ${dirname}/${basename} ${dirname}/${initrd_real}; do
|
2019-01-23 12:53:47 +01:00
|
|
|
@@ -318,6 +297,7 @@ else
|
2018-04-17 06:04:01 +02:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
prepare_boot_cache=
|
|
|
|
+prepare_efi_cache=
|
|
|
|
boot_device_id=
|
|
|
|
|
|
|
|
title_correction_code=
|
2019-01-23 12:53:47 +01:00
|
|
|
@@ -328,6 +308,34 @@ submenu_indentation=""
|
2018-04-17 06:04:01 +02:00
|
|
|
|
|
|
|
is_top_level=true
|
|
|
|
|
|
|
|
+if [ -d /sys/firmware/efi ] && [ "x${xen_list}" != "x" ]; then
|
|
|
|
+ is_efi=true
|
|
|
|
+ err_msg=""
|
|
|
|
+ efi_dir="/boot/efi/efi/${os}"
|
|
|
|
+ grub_dir=/boot/grub2
|
2019-01-23 12:53:47 +01:00
|
|
|
+ xen_dir=/usr/share/efi/$machine
|
|
|
|
+ [ -d $xen_dir ] || xen_dir=/usr/lib64/efi
|
2018-04-17 06:04:01 +02:00
|
|
|
+ for d in $grub_dir $xen_dir; do
|
|
|
|
+ [ ! -d "$d" ] || continue
|
|
|
|
+ err_msg="${err_msg}$ME: Essential directory '$d' not found!\n"
|
|
|
|
+ done
|
|
|
|
+ if ! [ -d "$grub_dir" -a -d "$xen_dir" ]; then
|
|
|
|
+ err_msg="${err_msg}$ME: XEN configuration skipped!\n"
|
|
|
|
+ else
|
|
|
|
+ mkdir -p $efi_dir
|
|
|
|
+ rel_efi_dir=`make_system_path_relative_to_its_root $efi_dir`
|
|
|
|
+ rm -f $grub_dir/xen*.cfg
|
|
|
|
+ if [ -s $efi_dir/grub.xen-files ]; then
|
|
|
|
+ for f in $(sort $efi_dir/grub.xen-files| uniq); do
|
|
|
|
+ rm -f $efi_dir/$f
|
|
|
|
+ done
|
|
|
|
+ : > $efi_dir/grub.xen-files
|
|
|
|
+ fi
|
|
|
|
+ fi
|
|
|
|
+else
|
|
|
|
+ is_efi=false
|
|
|
|
+fi
|
|
|
|
+
|
|
|
|
while [ "x${xen_list}" != "x" ] ; do
|
|
|
|
list="${linux_list}"
|
|
|
|
current_xen=`version_find_latest $xen_list`
|