SHA256
1
0
forked from pool/grub2

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

- Fix error of essential directory not found on UEFI Xen host (bsc#1085842)
  * add grub2-efi-xen-removable.patch
  * rediff grub2-suse-remove-linux-root-param.patch

OBS-URL: https://build.opensuse.org/request/show/595923
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=298
This commit is contained in:
Michael Chang 2018-04-17 04:04:01 +00:00 committed by Git OBS Bridge
parent f3d710cae6
commit 1847661beb
4 changed files with 141 additions and 19 deletions

View File

@ -0,0 +1,113 @@
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.
Index: grub-2.02/util/grub.d/20_linux_xen.in
===================================================================
--- grub-2.02.orig/util/grub.d/20_linux_xen.in
+++ grub-2.02/util/grub.d/20_linux_xen.in
@@ -91,31 +91,6 @@ esac
title_correction_code=
-if [ -d /sys/firmware/efi ]; then
- is_efi=true
- err_msg=""
- efi_dir="/boot/efi/efi/${os}"
- grub_dir=/boot/@PACKAGE@
- xen_dir=/usr/lib64/efi
- 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 '
@@ -223,10 +198,15 @@ linux_entry ()
kernel=${basename} root=${linux_root_device_thisversion} ${args_unq}
ramdisk=${initrd}
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
for f in ${grub_dir}/$xen_cfg ${xen_dir}/${xen_basename} ${dirname}/${basename} ${dirname}/${initrd}; do
@@ -307,6 +287,7 @@ else
done
fi
prepare_boot_cache=
+prepare_efi_cache=
boot_device_id=
title_correction_code=
@@ -327,6 +308,33 @@ submenu_indentation=""
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
+ xen_dir=/usr/lib64/efi
+ 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`

View File

@ -1,8 +1,8 @@
Index: grub-2.02~beta2/util/grub-mkconfig.in
Index: grub-2.02/util/grub-mkconfig.in
===================================================================
--- grub-2.02~beta2.orig/util/grub-mkconfig.in
+++ grub-2.02~beta2/util/grub-mkconfig.in
@@ -261,7 +261,8 @@ export GRUB_DEFAULT \
--- grub-2.02.orig/util/grub-mkconfig.in
+++ grub-2.02/util/grub-mkconfig.in
@@ -268,7 +268,8 @@ export GRUB_DEFAULT \
GRUB_CMDLINE_LINUX_RECOVERY \
GRUB_USE_LINUXEFI \
SUSE_BTRFS_SNAPSHOT_BOOTING \
@ -12,11 +12,11 @@ Index: grub-2.02~beta2/util/grub-mkconfig.in
if test "x${grub_cfg}" != "x"; then
rm -f "${grub_cfg}.new"
Index: grub-2.02~beta2/util/grub.d/10_linux.in
Index: grub-2.02/util/grub.d/10_linux.in
===================================================================
--- grub-2.02~beta2.orig/util/grub.d/10_linux.in
+++ grub-2.02~beta2/util/grub.d/10_linux.in
@@ -66,7 +66,7 @@ case x"$GRUB_FS" in
--- grub-2.02.orig/util/grub.d/10_linux.in
+++ grub-2.02/util/grub.d/10_linux.in
@@ -64,7 +64,7 @@ case x"$GRUB_FS" in
else
rootsubvol="`make_system_path_relative_to_its_root /`"
rootsubvol="${rootsubvol#/}"
@ -25,7 +25,7 @@ Index: grub-2.02~beta2/util/grub.d/10_linux.in
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
fi
fi;;
@@ -77,6 +77,10 @@ case x"$GRUB_FS" in
@@ -75,6 +75,10 @@ case x"$GRUB_FS" in
;;
esac
@ -36,11 +36,11 @@ Index: grub-2.02~beta2/util/grub.d/10_linux.in
title_correction_code=
hotkey=1
Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in
Index: grub-2.02/util/grub.d/20_linux_xen.in
===================================================================
--- grub-2.02~beta2.orig/util/grub.d/20_linux_xen.in
+++ grub-2.02~beta2/util/grub.d/20_linux_xen.in
@@ -80,7 +80,7 @@ case x"$GRUB_FS" in
--- grub-2.02.orig/util/grub.d/20_linux_xen.in
+++ grub-2.02/util/grub.d/20_linux_xen.in
@@ -78,7 +78,7 @@ case x"$GRUB_FS" in
else
rootsubvol="`make_system_path_relative_to_its_root /`"
rootsubvol="${rootsubvol#/}"
@ -49,7 +49,7 @@ Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
fi
fi;;
@@ -91,6 +91,10 @@ case x"$GRUB_FS" in
@@ -89,6 +89,10 @@ case x"$GRUB_FS" in
;;
esac
@ -59,12 +59,12 @@ Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in
+
title_correction_code=
if [ -d /sys/firmware/efi ]; then
Index: grub-2.02~beta2/util/s390x/zipl2grub.pl.in
grub2_unquote ()
Index: grub-2.02/util/s390x/zipl2grub.pl.in
===================================================================
--- grub-2.02~beta2.orig/util/s390x/zipl2grub.pl.in
+++ grub-2.02~beta2/util/s390x/zipl2grub.pl.in
@@ -361,9 +361,13 @@ while ( <IN> ) {
--- grub-2.02.orig/util/s390x/zipl2grub.pl.in
+++ grub-2.02/util/s390x/zipl2grub.pl.in
@@ -367,9 +367,13 @@ while ( <IN> ) {
} else {
$v = "";
}

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Apr 12 08:41:39 UTC 2018 - mchang@suse.com
- Fix error of essential directory not found on UEFI Xen host (bsc#1085842)
* add grub2-efi-xen-removable.patch
* rediff grub2-suse-remove-linux-root-param.patch
-------------------------------------------------------------------
Tue Apr 10 15:12:28 CEST 2018 - jdelvare@suse.de

View File

@ -232,6 +232,7 @@ Patch120: grub2-efi-xen-chainload.patch
Patch121: grub2-efi-chainloader-root.patch
Patch122: grub2-efi-xen-cmdline.patch
Patch123: grub2-efi-xen-cfg-unquote.patch
Patch124: grub2-efi-xen-removable.patch
# Hidden menu entry and hotkey "t" for text console
Patch140: grub2-Add-hidden-menu-entries.patch
Patch141: grub2-SUSE-Add-the-t-hotkey.patch
@ -512,6 +513,7 @@ swap partition while in resuming
%patch121 -p1
%patch122 -p1
%patch123 -p1
%patch124 -p1
%patch140 -p1
%patch141 -p1
%patch150 -p1