diff options
author | William Johansson <radar@radhuset.org> | 2020-01-11 13:24:43 +0100 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2020-01-14 15:13:34 +0100 |
commit | b7caea4ed901b29d13b4b4b51f475bc08db4f821 (patch) | |
tree | 4e970357540e584d1590cc79aa9756e02a3ed28d | |
parent | 1e2c55d2816f515098c333d4346a6321f5bffcdb (diff) | |
download | alpine_aports-b7caea4ed901b29d13b4b4b51f475bc08db4f821.tar.bz2 alpine_aports-b7caea4ed901b29d13b4b4b51f475bc08db4f821.tar.xz alpine_aports-b7caea4ed901b29d13b4b4b51f475bc08db4f821.zip |
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)
4 files changed, 195 insertions, 2 deletions
diff --git a/main/grub/0001-util-grub.d-20_linux_xen.in-Add-xen_boot-command-sup.patch b/main/grub/0001-util-grub.d-20_linux_xen.in-Add-xen_boot-command-sup.patch new file mode 100644 index 0000000000..350180b49a --- /dev/null +++ b/main/grub/0001-util-grub.d-20_linux_xen.in-Add-xen_boot-command-sup.patch | |||
@@ -0,0 +1,64 @@ | |||
1 | From cb8fc4eee92e19fe2977026ba45bad6ecf68f55f Mon Sep 17 00:00:00 2001 | ||
2 | From: Fu Wei <fu.wei@linaro.org> | ||
3 | Date: Sun, 14 May 2017 15:43:46 +0800 | ||
4 | Subject: [PATCH 1/3] util/grub.d/20_linux_xen.in: Add xen_boot command support | ||
5 | for aarch64 | ||
6 | |||
7 | This patch adds the support of xen_boot command for aarch64: | ||
8 | xen_hypervisor | ||
9 | xen_module | ||
10 | These two commands are only for aarch64, since it has its own protocol and | ||
11 | commands to boot xen hypervisor and Dom0, but not multiboot. | ||
12 | |||
13 | For other architectures, they are still using multiboot and module | ||
14 | commands. | ||
15 | |||
16 | Signed-off-by: Fu Wei <fu.wei@linaro.org> | ||
17 | Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> | ||
18 | (cherry picked from commit d33045ce7ffcb7c1e4a60c14d5ca64b36e3c5abe) | ||
19 | --- | ||
20 | util/grub.d/20_linux_xen.in | 14 +++++++++++--- | ||
21 | 1 file changed, 11 insertions(+), 3 deletions(-) | ||
22 | |||
23 | diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in | ||
24 | index c48af948d..c002fc9f9 100644 | ||
25 | --- a/util/grub.d/20_linux_xen.in | ||
26 | +++ b/util/grub.d/20_linux_xen.in | ||
27 | @@ -122,16 +122,16 @@ linux_entry () | ||
28 | else | ||
29 | xen_rm_opts="no-real-mode edd=off" | ||
30 | fi | ||
31 | - multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} | ||
32 | + ${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} | ||
33 | echo '$(echo "$lmessage" | grub_quote)' | ||
34 | - module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} | ||
35 | + ${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} | ||
36 | EOF | ||
37 | if test -n "${initrd}" ; then | ||
38 | # TRANSLATORS: ramdisk isn't identifier. Should be translated. | ||
39 | message="$(gettext_printf "Loading initial ramdisk ...")" | ||
40 | sed "s/^/$submenu_indentation/" << EOF | ||
41 | echo '$(echo "$message" | grub_quote)' | ||
42 | - module --nounzip ${rel_dirname}/${initrd} | ||
43 | + ${module_loader} --nounzip ${rel_dirname}/${initrd} | ||
44 | EOF | ||
45 | fi | ||
46 | sed "s/^/$submenu_indentation/" << EOF | ||
47 | @@ -206,6 +206,14 @@ while [ "x${xen_list}" != "x" ] ; do | ||
48 | if [ "x$is_top_level" != xtrue ]; then | ||
49 | echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {" | ||
50 | fi | ||
51 | + $grub_file --is-arm64-efi $current_xen | ||
52 | + if [ $? -ne 0 ]; then | ||
53 | + xen_loader="multiboot" | ||
54 | + module_loader="module" | ||
55 | + else | ||
56 | + xen_loader="xen_hypervisor" | ||
57 | + module_loader="xen_module" | ||
58 | + fi | ||
59 | while [ "x$list" != "x" ] ; do | ||
60 | linux=`version_find_latest $list` | ||
61 | gettext_printf "Found linux image: %s\n" "$linux" >&2 | ||
62 | -- | ||
63 | 2.24.1 | ||
64 | |||
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 @@ | |||
1 | From 0edfe09c35ed63630e2ccba60b9965e3d7f7f518 Mon Sep 17 00:00:00 2001 | ||
2 | From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | ||
3 | Date: Tue, 29 Aug 2017 16:40:52 -0400 | ||
4 | Subject: [PATCH 2/3] Fix util/grub.d/20_linux_xen.in: Add xen_boot command | ||
5 | support for aarch64 | ||
6 | |||
7 | Commit d33045ce7ffcb7c1e4a60c14d5ca64b36e3c5abe introduced | ||
8 | the support for this, but it does not work under x86 (as it stops | ||
9 | 20_linux_xen from running). | ||
10 | |||
11 | The 20_linux_xen is run under a shell and any exits from within it: | ||
12 | |||
13 | (For example on x86): | ||
14 | + /usr/bin/grub2-file --is-arm64-efi /boot/xen-4.9.0.gz | ||
15 | [root@tst063 grub]# echo $? | ||
16 | 1 | ||
17 | |||
18 | will result in 20_linux_xen exiting without continuing | ||
19 | and also causing grub2-mkconfig to stop processing. | ||
20 | |||
21 | As in: | ||
22 | |||
23 | [root@tst063 grub]# ./grub-mkconfig | tail | ||
24 | Generating grub configuration file ... | ||
25 | Found linux image: /boot/vmlinuz-4.13.0-0.rc5.git1.1.fc27.x86_64 | ||
26 | Found initrd image: /boot/initramfs-4.13.0-0.rc5.git1.1.fc27.x86_64.img | ||
27 | Found linux image: /boot/vmlinuz-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2 | ||
28 | Found initrd image: /boot/initramfs-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2.img | ||
29 | echo 'Loading Linux 0-rescue-ec082ee24aea41b9b16aca52a6d10cc2 ...' | ||
30 | linux /vmlinuz-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2 root=/dev/mapper/fedora_tst063-root ro single | ||
31 | echo 'Loading initial ramdisk ...' | ||
32 | initrd /initramfs-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2.img | ||
33 | } | ||
34 | } | ||
35 | |||
36 | ### END /usr/local/etc/grub.d/10_linux ### | ||
37 | |||
38 | ### BEGIN /usr/local/etc/grub.d/20_linux_xen ### | ||
39 | |||
40 | root@tst063 grub]# | ||
41 | |||
42 | And no more. | ||
43 | |||
44 | This patch wraps the invocation of grub-file to be a in subshell | ||
45 | and to process the return value in a conditional. That fixes | ||
46 | the issue. | ||
47 | |||
48 | RH-BZ 1486002: grub2-mkconfig does not work if xen.gz is installed. | ||
49 | |||
50 | CC: Fu Wei <fu.wei@linaro.org> | ||
51 | Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | ||
52 | Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> | ||
53 | (cherry picked from commit a8e0f1adf7019238fff263111794c86f4eea79ac) | ||
54 | --- | ||
55 | util/grub.d/20_linux_xen.in | 9 ++++----- | ||
56 | 1 file changed, 4 insertions(+), 5 deletions(-) | ||
57 | |||
58 | diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in | ||
59 | index c002fc9f9..083bcef5d 100644 | ||
60 | --- a/util/grub.d/20_linux_xen.in | ||
61 | +++ b/util/grub.d/20_linux_xen.in | ||
62 | @@ -206,13 +206,12 @@ while [ "x${xen_list}" != "x" ] ; do | ||
63 | if [ "x$is_top_level" != xtrue ]; then | ||
64 | echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {" | ||
65 | fi | ||
66 | - $grub_file --is-arm64-efi $current_xen | ||
67 | - if [ $? -ne 0 ]; then | ||
68 | - xen_loader="multiboot" | ||
69 | - module_loader="module" | ||
70 | - else | ||
71 | + if ($grub_file --is-arm64-efi $current_xen); then | ||
72 | xen_loader="xen_hypervisor" | ||
73 | module_loader="xen_module" | ||
74 | + else | ||
75 | + xen_loader="multiboot" | ||
76 | + module_loader="module" | ||
77 | fi | ||
78 | while [ "x$list" != "x" ] ; do | ||
79 | linux=`version_find_latest $list` | ||
80 | -- | ||
81 | 2.24.1 | ||
82 | |||
diff --git a/main/grub/0003-Use-grub-file-to-figure-out-whether-multiboot2-shoul.patch b/main/grub/0003-Use-grub-file-to-figure-out-whether-multiboot2-shoul.patch new file mode 100644 index 0000000000..63ade92a27 --- /dev/null +++ b/main/grub/0003-Use-grub-file-to-figure-out-whether-multiboot2-shoul.patch | |||
@@ -0,0 +1,40 @@ | |||
1 | From b4148dbeceee4a2fe4e99acdeeb86edc5e4eed01 Mon Sep 17 00:00:00 2001 | ||
2 | From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | ||
3 | Date: Tue, 29 Aug 2017 16:40:53 -0400 | ||
4 | Subject: [PATCH 3/3] Use grub-file to figure out whether multiboot2 should be | ||
5 | used for Xen.gz | ||
6 | |||
7 | The multiboot2 is much more preferable than multiboot. Especiall | ||
8 | if booting under EFI where multiboot does not have the functionality | ||
9 | to pass ImageHandler. | ||
10 | |||
11 | Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | ||
12 | Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> | ||
13 | (cherry picked from commit b4d709b6ee789cdaf3fa7a80fd90c721a16f48c2) | ||
14 | --- | ||
15 | util/grub.d/20_linux_xen.in | 9 +++++++-- | ||
16 | 1 file changed, 7 insertions(+), 2 deletions(-) | ||
17 | |||
18 | diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in | ||
19 | index 083bcef5d..0cb0f4e49 100644 | ||
20 | --- a/util/grub.d/20_linux_xen.in | ||
21 | +++ b/util/grub.d/20_linux_xen.in | ||
22 | @@ -210,8 +210,13 @@ while [ "x${xen_list}" != "x" ] ; do | ||
23 | xen_loader="xen_hypervisor" | ||
24 | module_loader="xen_module" | ||
25 | else | ||
26 | - xen_loader="multiboot" | ||
27 | - module_loader="module" | ||
28 | + if ($grub_file --is-x86-multiboot2 $current_xen); then | ||
29 | + xen_loader="multiboot2" | ||
30 | + module_loader="module2" | ||
31 | + else | ||
32 | + xen_loader="multiboot" | ||
33 | + module_loader="module" | ||
34 | + fi | ||
35 | fi | ||
36 | while [ "x$list" != "x" ] ; do | ||
37 | linux=`version_find_latest $list` | ||
38 | -- | ||
39 | 2.24.1 | ||
40 | |||
diff --git a/main/grub/APKBUILD b/main/grub/APKBUILD index fa5ee2a54d..032cd12d17 100644 --- a/main/grub/APKBUILD +++ b/main/grub/APKBUILD | |||
@@ -2,7 +2,7 @@ | |||
2 | # Maintainer: Timo Teräs <timo.teras@iki.fi> | 2 | # Maintainer: Timo Teräs <timo.teras@iki.fi> |
3 | pkgname=grub | 3 | pkgname=grub |
4 | pkgver=2.02 | 4 | pkgver=2.02 |
5 | pkgrel=19 | 5 | pkgrel=20 |
6 | pkgdesc="Bootloader with support for Linux, Multiboot and more" | 6 | pkgdesc="Bootloader with support for Linux, Multiboot and more" |
7 | url="https://www.gnu.org/software/grub/" | 7 | url="https://www.gnu.org/software/grub/" |
8 | arch="all !s390x" | 8 | arch="all !s390x" |
@@ -66,6 +66,10 @@ source="https://ftp.gnu.org/gnu/grub/grub-$pkgver.tar.xz | |||
66 | 0018-xen_pvh-Support-building-a-standalone-image.patch | 66 | 0018-xen_pvh-Support-building-a-standalone-image.patch |
67 | 0019-xen_pvh-Support-grub-install-for-xen_pvh.patch | 67 | 0019-xen_pvh-Support-grub-install-for-xen_pvh.patch |
68 | 0020-xen_pvh-Add-support-to-configure.patch | 68 | 0020-xen_pvh-Add-support-to-configure.patch |
69 | |||
70 | 0001-util-grub.d-20_linux_xen.in-Add-xen_boot-command-sup.patch | ||
71 | 0002-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch | ||
72 | 0003-Use-grub-file-to-figure-out-whether-multiboot2-shoul.patch | ||
69 | " | 73 | " |
70 | builddir="$srcdir/grub-$pkgver" | 74 | builddir="$srcdir/grub-$pkgver" |
71 | 75 | ||
@@ -264,4 +268,7 @@ fe7ea6eeab330c0fdfd0b2a858acdff88c68f69d80b9abb21b4c3cd1d18f8717ab7c47729e28857c | |||
264 | 3e78cd3cd1c70236d8e9e3a536eb2f887283b5d257f60533d22d093df76c1c3c60e490acae4b738301c87edbac2e27398fce6ddbbeb9b2f193191c76afb9bd8b 0017-xen-Use-elfnote-defines-instead-of-plain-numbers.patch | 268 | 3e78cd3cd1c70236d8e9e3a536eb2f887283b5d257f60533d22d093df76c1c3c60e490acae4b738301c87edbac2e27398fce6ddbbeb9b2f193191c76afb9bd8b 0017-xen-Use-elfnote-defines-instead-of-plain-numbers.patch |
265 | c8a16db1224c9fb4a26ef39fbd8c36bf26ff68d45d88fb4e2530369c5bccadf0208551c34c0d16e9ee4a3102d67edad26a46e7b8388222f530310762246df8ef 0018-xen_pvh-Support-building-a-standalone-image.patch | 269 | c8a16db1224c9fb4a26ef39fbd8c36bf26ff68d45d88fb4e2530369c5bccadf0208551c34c0d16e9ee4a3102d67edad26a46e7b8388222f530310762246df8ef 0018-xen_pvh-Support-building-a-standalone-image.patch |
266 | b00cb9146cadc1f48586dcab31ac4605d9591d860283000accf709a489f136bf5c8fe3351dbefe51f9e27407ca3f1ce5dd7bc2ac64ac826f593183ef5d3a9759 0019-xen_pvh-Support-grub-install-for-xen_pvh.patch | 270 | b00cb9146cadc1f48586dcab31ac4605d9591d860283000accf709a489f136bf5c8fe3351dbefe51f9e27407ca3f1ce5dd7bc2ac64ac826f593183ef5d3a9759 0019-xen_pvh-Support-grub-install-for-xen_pvh.patch |
267 | 78bc31b69cde95a29b365b43898caf69238c036683a26e5448d66cd48c7a4906d2a9eff065f082c5300b72616d6e63033891fd75d59ce724759dc998d9942a37 0020-xen_pvh-Add-support-to-configure.patch" | 271 | 78bc31b69cde95a29b365b43898caf69238c036683a26e5448d66cd48c7a4906d2a9eff065f082c5300b72616d6e63033891fd75d59ce724759dc998d9942a37 0020-xen_pvh-Add-support-to-configure.patch |
272 | 9eb4d168824d863791040e7d288dfa2bd5314c34389adb92683b6335c5bd5426f74ec98257bcfde6ab89836ae33954ac1ad2e1caf451c2d6ab4540a4f394c985 0001-util-grub.d-20_linux_xen.in-Add-xen_boot-command-sup.patch | ||
273 | b0ab04fff0d998a78d5de7610544de14912dc5ac27f99d74e86df7ef59db02ad4a45620030d1ff640d7c09d1f3aecaf7506dfb21dc01377f6a1f3d5a95c2978b 0002-Fix-util-grub.d-20_linux_xen.in-Add-xen_boot-command.patch | ||
274 | 34518e3917bd3fd8e5944fcb6d208515ff4f2ae2e74736eb451a532bc116a63232b8fed28ca91c2417e815d179d438795ccbf6735edcaed2c0760555635d595e 0003-Use-grub-file-to-figure-out-whether-multiboot2-shoul.patch" | ||