From 307d0195543a534bef98328ba37f64a86fbfb462 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 24 Oct 2017 12:49:30 -0400 Subject: [PATCH] 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 --- ...20_linux_xen.in-Add-xen_boot-command.patch | 62 +++++++++++++++++++ ...-figure-out-whether-multiboot2-shoul.patch | 33 ++++++++++ ...d-xen-or-multiboot-2-modules-as-need.patch | 35 +++++++++++ grub.patches | 3 + grub2.spec | 6 +- 5 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 0195-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch create mode 100644 0196-Use-grub-file-to-figure-out-whether-multiboot2-shoul.patch create mode 100644 0197-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch diff --git a/0195-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch b/0195-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch new file mode 100644 index 0000000..159ec4e --- /dev/null +++ b/0195-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch @@ -0,0 +1,62 @@ +From f107e84be87038bf5bf8795c0f2005e11f35c145 Mon Sep 17 00:00:00 2001 +From: Konrad Rzeszutek Wilk +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 +Signed-off-by: Konrad Rzeszutek Wilk +--- + 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 + diff --git a/0196-Use-grub-file-to-figure-out-whether-multiboot2-shoul.patch b/0196-Use-grub-file-to-figure-out-whether-multiboot2-shoul.patch new file mode 100644 index 0000000..4716cb9 --- /dev/null +++ b/0196-Use-grub-file-to-figure-out-whether-multiboot2-shoul.patch @@ -0,0 +1,33 @@ +From 51950b35f078393fd60e0940d1764876da0def7f Mon Sep 17 00:00:00 2001 +From: Konrad Rzeszutek Wilk +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 +--- + 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 + diff --git a/0197-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch b/0197-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch new file mode 100644 index 0000000..4d88875 --- /dev/null +++ b/0197-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch @@ -0,0 +1,35 @@ +From 5eb993630ba5349eef2bcd22680219cdb851cc73 Mon Sep 17 00:00:00 2001 +From: Peter Jones +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 +--- + 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 + diff --git a/grub.patches b/grub.patches index aac5386..1bba569 100644 --- a/grub.patches +++ b/grub.patches @@ -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 diff --git a/grub2.spec b/grub2.spec index 23ac5a9..8d907ea 100644 --- a/grub2.spec +++ b/grub2.spec @@ -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 - 2.02-19 +- Handle xen module loading (somewhat) better + Resolves: rhbz#1486002 + * Wed Sep 20 2017 Peter Jones - 2.02-18 - Make grub2-efi-aa64 provide grub2 Resolves: rhbz#1491045