Accepting request 597264 from Base:System
OBS-URL: https://build.opensuse.org/request/show/597264 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=181
This commit is contained in:
parent
b859f8d898
commit
5d4d9a9ad3
113
grub2-efi-xen-removable.patch
Normal file
113
grub2-efi-xen-removable.patch
Normal 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`
|
@ -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 = "";
|
||||
}
|
||||
|
@ -1,3 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
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
|
||||
|
||||
- Fix corruption of "grub2-install --help" and grub2-install manual
|
||||
page (bsc#1086670)
|
||||
* unix-exec-avoid-atexit-handlers-when-child-exits.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Apr 2 08:30:05 UTC 2018 - mchang@suse.com
|
||||
|
||||
|
@ -216,6 +216,7 @@ Patch84: grub2-s390x-09-improve-zipl-setup.patch
|
||||
Patch85: grub2-getroot-scan-disk-pv.patch
|
||||
Patch86: 0001-Fix-packed-not-aligned-error-on-GCC-8.patch
|
||||
Patch87: 0001-Fix-PCIe-LER-when-GRUB2-accesses-non-enabled-MMIO-da.patch
|
||||
Patch88: unix-exec-avoid-atexit-handlers-when-child-exits.patch
|
||||
# Btrfs snapshot booting related patches
|
||||
Patch101: grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch
|
||||
Patch102: grub2-btrfs-02-export-subvolume-envvars.patch
|
||||
@ -231,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
|
||||
@ -497,6 +499,7 @@ swap partition while in resuming
|
||||
%patch85 -p1
|
||||
%patch86 -p1
|
||||
%patch87 -p1
|
||||
%patch88 -p1
|
||||
%patch101 -p1
|
||||
%patch102 -p1
|
||||
%patch103 -p1
|
||||
@ -510,6 +513,7 @@ swap partition while in resuming
|
||||
%patch121 -p1
|
||||
%patch122 -p1
|
||||
%patch123 -p1
|
||||
%patch124 -p1
|
||||
%patch140 -p1
|
||||
%patch141 -p1
|
||||
%patch150 -p1
|
||||
|
70
unix-exec-avoid-atexit-handlers-when-child-exits.patch
Normal file
70
unix-exec-avoid-atexit-handlers-when-child-exits.patch
Normal file
@ -0,0 +1,70 @@
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Mon, 28 Aug 2017 20:57:19 +0200
|
||||
Subject: unix exec: avoid atexit handlers when child exits
|
||||
Git-commit: e75cf4a58b5eaf482804e5e1b2cc7d4399df350e
|
||||
Patch-mainline: Yes, but not released yet
|
||||
References: bsc#1086670
|
||||
|
||||
The `grub_util_exec_redirect_all` helper function can be used to
|
||||
spawn an executable and redirect its output to some files. After calling
|
||||
`fork()`, the parent will wait for the child to terminate with
|
||||
`waitpid()` while the child prepares its file descriptors, environment
|
||||
and finally calls `execvp()`. If something in the children's setup
|
||||
fails, it will stop by calling `exit(127)`.
|
||||
|
||||
Calling `exit()` will cause any function registered via `atexit()` to be
|
||||
executed, which is usually the wrong thing to do in a child. And
|
||||
actually, one can easily observe faulty behaviour on musl-based systems
|
||||
without modprobe(8) installed: executing `grub-install --help` will call
|
||||
`grub_util_exec_redirect_all` with "modprobe", which obviously fails if
|
||||
modprobe(8) is not installed. Due to the child now exiting and invoking
|
||||
the `atexit()` handlers, it will clean up some data structures of the
|
||||
parent and cause it to be deadlocked in the `waitpid()` syscall.
|
||||
|
||||
The issue can easily be fixed by calling `_exit(127)` instead, which is
|
||||
especially designed to be called when the atexit-handlers should not be
|
||||
executed.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
---
|
||||
grub-core/osdep/unix/exec.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/grub-core/osdep/unix/exec.c
|
||||
+++ b/grub-core/osdep/unix/exec.c
|
||||
@@ -99,7 +99,7 @@ grub_util_exec_redirect_all (const char
|
||||
{
|
||||
fd = open (stdin_file, O_RDONLY);
|
||||
if (fd < 0)
|
||||
- exit (127);
|
||||
+ _exit (127);
|
||||
dup2 (fd, STDIN_FILENO);
|
||||
close (fd);
|
||||
}
|
||||
@@ -108,7 +108,7 @@ grub_util_exec_redirect_all (const char
|
||||
{
|
||||
fd = open (stdout_file, O_WRONLY | O_CREAT, 0700);
|
||||
if (fd < 0)
|
||||
- exit (127);
|
||||
+ _exit (127);
|
||||
dup2 (fd, STDOUT_FILENO);
|
||||
close (fd);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ grub_util_exec_redirect_all (const char
|
||||
{
|
||||
fd = open (stderr_file, O_WRONLY | O_CREAT, 0700);
|
||||
if (fd < 0)
|
||||
- exit (127);
|
||||
+ _exit (127);
|
||||
dup2 (fd, STDERR_FILENO);
|
||||
close (fd);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ grub_util_exec_redirect_all (const char
|
||||
setenv ("LC_ALL", "C", 1);
|
||||
|
||||
execvp ((char *) argv[0], (char **) argv);
|
||||
- exit (127);
|
||||
+ _exit (127);
|
||||
}
|
||||
waitpid (pid, &status, 0);
|
||||
if (!WIFEXITED (status))
|
Loading…
Reference in New Issue
Block a user