Handle xen module loading (somewhat) better

You'll still need to actually install grub2-${efiarch}-modules and then
use grub2-install to install the xen modules in /boot/grub2/,
but this should handle actually loading them from the grub config file.

Resolves: rhbz#1486002

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2017-10-24 12:49:30 -04:00
parent e1f4c0ec1e
commit 307d019554
5 changed files with 138 additions and 1 deletions

View File

@ -0,0 +1,62 @@
From f107e84be87038bf5bf8795c0f2005e11f35c145 Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date: Mon, 28 Aug 2017 13:51:14 -0400
Subject: [PATCH 195/197] Fix util/grub.d/20_linux_xen.in: Add xen_boot command
support for aarch64
Commit d33045ce7ffcb7c1e4a60c14d5ca64b36e3c5abe introduced
the support for this, but it does not work under x86 (as it stops
20_linux_xen from running).
The 20_linux_xen is run under a shell and any exits from within it:
(For example on x86):
+ /usr/bin/grub2-file --is-arm64-efi /boot/xen-4.9.0.gz
[root@tst063 grub]# echo $?
1
will result in 20_linux_xen exciting without continuing
and also causing grub2-mkconfig to stop processing.
As in:
[root@tst063 ~]#
And no more.
This patch wraps the invocation of grub-file to be a in subshell
and to process the return value in a conditional. That fixes
the issue.
RH-BZ 1486002: grub2-mkconfig does not work if xen.gz is installed.
CC: Fu Wei <fu.wei@linaro.org>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
util/grub.d/20_linux_xen.in | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index 462f8e1f8..9b1bd7169 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -210,13 +210,12 @@ while [ "x${xen_list}" != "x" ] ; do
if [ "x$is_top_level" != xtrue ]; then
echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
fi
- $grub_file --is-arm64-efi $current_xen
- if [ $? -ne 0 ]; then
- xen_loader="multiboot"
- module_loader="module"
- else
+ if ($grub_file --is-arm64-efi $current_xen); then
xen_loader="xen_hypervisor"
module_loader="xen_module"
+ else
+ xen_loader="multiboot"
+ module_loader="module"
fi
while [ "x$list" != "x" ] ; do
linux=`version_find_latest $list`
--
2.14.2

View File

@ -0,0 +1,33 @@
From 51950b35f078393fd60e0940d1764876da0def7f Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date: Mon, 28 Aug 2017 13:59:12 -0400
Subject: [PATCH 196/197] Use grub-file to figure out whether multiboot2 should
be used for Xen.gz
The multiboot2 is much more preferable than multiboot. Especiall
if booting under EFI where multiboot does not have the functionality
to pass ImageHandler.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
util/grub.d/20_linux_xen.in | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index 9b1bd7169..fae1ffe94 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -216,6 +216,10 @@ while [ "x${xen_list}" != "x" ] ; do
else
xen_loader="multiboot"
module_loader="module"
+ if ($grub_file --is-x86-multiboot2 $current_xen); then
+ xen_loader="multiboot2"
+ module_loader="module2"
+ fi
fi
while [ "x$list" != "x" ] ; do
linux=`version_find_latest $list`
--
2.14.2

View File

@ -0,0 +1,35 @@
From 5eb993630ba5349eef2bcd22680219cdb851cc73 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 19 Oct 2017 11:29:11 -0400
Subject: [PATCH 197/197] 20_linux_xen: load xen or multiboot{,2} modules as
needed.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
util/grub.d/20_linux_xen.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index fae1ffe94..fc53bd542 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -126,6 +126,8 @@ linux_entry ()
else
xen_rm_opts="no-real-mode edd=off"
fi
+ insmod ${module_loader}
+ insmod ${xen_loader}
${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts}
echo '$(echo "$lmessage" | grub_quote)'
${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
@@ -135,6 +137,7 @@ EOF
message="$(gettext_printf "Loading initial ramdisk ...")"
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
+ insmod ${module_loader}
${module_loader} --nounzip ${rel_dirname}/${initrd}
EOF
fi
--
2.14.2

View File

@ -192,3 +192,6 @@ Patch0191: 0191-Clean-up-some-errors-in-the-linuxefi-loader.patch
Patch0192: 0192-editenv-handle-relative-symlinks.patch
Patch0193: 0193-Make-libgrub.pp-depend-on-config-util.h.patch
Patch0194: 0194-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch
Patch0195: 0195-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch
Patch0196: 0196-Use-grub-file-to-figure-out-whether-multiboot2-shoul.patch
Patch0197: 0197-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch

View File

@ -7,7 +7,7 @@
Name: grub2
Epoch: 1
Version: 2.02
Release: 18%{?dist}
Release: 19%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more
Group: System Environment/Base
License: GPLv3+
@ -454,6 +454,10 @@ fi
%endif
%changelog
* Tue Oct 24 2017 Peter Jones <pjones@redhat.com> - 2.02-19
- Handle xen module loading (somewhat) better
Resolves: rhbz#1486002
* Wed Sep 20 2017 Peter Jones <pjones@redhat.com> - 2.02-18
- Make grub2-efi-aa64 provide grub2
Resolves: rhbz#1491045