aboutsummaryrefslogtreecommitdiffstats
path: root/main/grub/0002-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch
diff options
context:
space:
mode:
authorWilliam Johansson <radar@radhuset.org>2020-01-11 13:24:43 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2020-01-14 15:13:34 +0100
commitb7caea4ed901b29d13b4b4b51f475bc08db4f821 (patch)
tree4e970357540e584d1590cc79aa9756e02a3ed28d /main/grub/0002-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch
parent1e2c55d2816f515098c333d4346a6321f5bffcdb (diff)
downloadaports-b7caea4ed901b29d13b4b4b51f475bc08db4f821.tar.bz2
aports-b7caea4ed901b29d13b4b4b51f475bc08db4f821.tar.xz
main/grub: fix booting Xen under EFI
Need to use multiboot2 while booting Xen under EFI, and not multiboot as is used when generating grub.cfg with grub-mkconfig. Backport commits included in upstream Grub 2.04. Diskless setups are not affected, as grub.cfg is generated manually by the mkimage scipts. (cherry picked from commit 6b9be75ec9776ac0f8ced9d888106194ae61b4f0)
Diffstat (limited to 'main/grub/0002-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch')
-rw-r--r--main/grub/0002-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch82
1 files changed, 82 insertions, 0 deletions
diff --git a/main/grub/0002-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch b/main/grub/0002-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch
new file mode 100644
index 0000000000..5b2b8b1a65
--- /dev/null
+++ b/main/grub/0002-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch
@@ -0,0 +1,82 @@
+From 0edfe09c35ed63630e2ccba60b9965e3d7f7f518 Mon Sep 17 00:00:00 2001
+From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+Date: Tue, 29 Aug 2017 16:40:52 -0400
+Subject: [PATCH 2/3] 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 exiting without continuing
+and also causing grub2-mkconfig to stop processing.
+
+As in:
+
+ [root@tst063 grub]# ./grub-mkconfig | tail
+ Generating grub configuration file ...
+ Found linux image: /boot/vmlinuz-4.13.0-0.rc5.git1.1.fc27.x86_64
+ Found initrd image: /boot/initramfs-4.13.0-0.rc5.git1.1.fc27.x86_64.img
+ Found linux image: /boot/vmlinuz-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2
+ Found initrd image: /boot/initramfs-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2.img
+ echo 'Loading Linux 0-rescue-ec082ee24aea41b9b16aca52a6d10cc2 ...'
+ linux /vmlinuz-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2 root=/dev/mapper/fedora_tst063-root ro single
+ echo 'Loading initial ramdisk ...'
+ initrd /initramfs-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2.img
+ }
+ }
+
+ ### END /usr/local/etc/grub.d/10_linux ###
+
+ ### BEGIN /usr/local/etc/grub.d/20_linux_xen ###
+
+ root@tst063 grub]#
+
+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>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+(cherry picked from commit a8e0f1adf7019238fff263111794c86f4eea79ac)
+---
+ 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 c002fc9f9..083bcef5d 100644
+--- a/util/grub.d/20_linux_xen.in
++++ b/util/grub.d/20_linux_xen.in
+@@ -206,13 +206,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.24.1
+