Skip to contentSkip to conversation

Fix ARM multiboot2 breaking Fedora.

PATCH Applied Konrad Rzeszutek Wilk 2 participants 9 messages Aug 29, 2017 – Sep 7, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Fix ARM multiboot2 breaking Fedora.

Since v1 [http://lists.gnu.org/archive/html/grub-devel/2017-08/msg00073.html]
- Fixed up patch with failing invocation,
- Redid patch #2 per Daniel's instructions.

Hey,

The first patch:
[PATCH 1/2] Fix util/grub.d/20_linux_xen.in: Add xen_boot command

is a fix discovered on Fedora rawhide where I was surprised to see that grub2-mkconfig would not create a configuration file anymore.

The second patch has been posted in the past
(https://lists.xen.org/archives/html/xen-devel/2017-03/txtCeHTNmz1hZ.txt)

[PATCH 2/2] Use grub-file to figure out whether multiboot2 should be

and just allows us to multiboot2 instead of multiboot if the binary supports it.

 util/grub.d/20_linux_xen.in | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Konrad Rzeszutek Wilk (2):
Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 Use grub-file to figure out whether multiboot2 should be used for Xen.gz

#1 lore raw

PATCH v2 1/2 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.

---
v1: Initial patch
v2: Add the failing output.

---
 util/grub.d/20_linux_xen.in | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
util/grub.d/20_linux_xen.in +4 -5
index c002fc9..083bcef 100644
@@ -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`
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw

PATCH v2 1/2 Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64

In reply to Konrad Rzeszutek Wilk

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.

---
v1: Initial patch
v2: Add the failing output.

---
 util/grub.d/20_linux_xen.in | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
util/grub.d/20_linux_xen.in +4 -5
index c002fc9..083bcef 100644
@@ -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`
Signature · 1 line
2.1.4
#3 lore raw

PATCH v2 2/2 Use grub-file to figure out whether multiboot2 should be used for Xen.gz

In reply to Konrad Rzeszutek Wilk

The multiboot2 is much more preferable than multiboot. Especiall if booting under EFI where multiboot does not have the functionality to pass ImageHandler.

---
v2: Rebase on top of d33045ce7ffcb7c1e4a60c14d5ca64b36e3c5abe
v3: Add 'else' in the conditional.
Use a tab and four spaces instead of two tabs.

---
 util/grub.d/20_linux_xen.in | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
util/grub.d/20_linux_xen.in +7 -2
index 083bcef..0cb0f4e 100644
@@ -210,8 +210,13 @@ while [ "x${xen_list}" != "x" ] ; do
 	xen_loader="xen_hypervisor"
 	module_loader="xen_module"
     else
-	xen_loader="multiboot"
-	module_loader="module"
+	if ($grub_file --is-x86-multiboot2 $current_xen); then
+	    xen_loader="multiboot2"
+	    module_loader="module2"
+	else
+	    xen_loader="multiboot"
+	    module_loader="module"
+        fi
     fi
     while [ "x$list" != "x" ] ; do
 	linux=`version_find_latest $list`
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#4 lore raw

PATCH v2 2/2 Use grub-file to figure out whether multiboot2 should be used for Xen.gz

In reply to Konrad Rzeszutek Wilk

The multiboot2 is much more preferable than multiboot. Especiall if booting under EFI where multiboot does not have the functionality to pass ImageHandler.

---
v2: Rebase on top of d33045ce7ffcb7c1e4a60c14d5ca64b36e3c5abe
v3: Add 'else' in the conditional.
Use a tab and four spaces instead of two tabs.

---
 util/grub.d/20_linux_xen.in | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
util/grub.d/20_linux_xen.in +7 -2
index 083bcef..0cb0f4e 100644
@@ -210,8 +210,13 @@ while [ "x${xen_list}" != "x" ] ; do
 	xen_loader="xen_hypervisor"
 	module_loader="xen_module"
     else
-	xen_loader="multiboot"
-	module_loader="module"
+	if ($grub_file --is-x86-multiboot2 $current_xen); then
+	    xen_loader="multiboot2"
+	    module_loader="module2"
+	else
+	    xen_loader="multiboot"
+	    module_loader="module"
+        fi
     fi
     while [ "x$list" != "x" ] ; do
 	linux=`version_find_latest $list`
Signature · 1 line
2.1.4
#5 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 13 lines · Konrad Rzeszutek Wilk

Since v1 [http://lists.gnu.org/archive/html/grub-devel/2017-08/msg00073.html]
- Fixed up patch with failing invocation,
- Redid patch #2 per Daniel's instructions.

Hey,

The first patch:
[PATCH 1/2] Fix util/grub.d/20_linux_xen.in: Add xen_boot command

is a fix discovered on Fedora rawhide where I was surprised to see that grub2-mkconfig would not create a configuration file anymore.

Quoted 7 lines

The second patch has been posted in the past
(https://lists.xen.org/archives/html/xen-devel/2017-03/txtCeHTNmz1hZ.txt)

[PATCH 2/2] Use grub-file to figure out whether multiboot2 should be

and just allows us to multiboot2 instead of multiboot if the binary supports it.

LGMT. If there are no objections in a week or so I will apply both of them.

Daniel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 13 lines · Konrad Rzeszutek Wilk

Since v1 [http://lists.gnu.org/archive/html/grub-devel/2017-08/msg00073.html]
- Fixed up patch with failing invocation,
- Redid patch #2 per Daniel's instructions.

Hey,

The first patch:
[PATCH 1/2] Fix util/grub.d/20_linux_xen.in: Add xen_boot command

is a fix discovered on Fedora rawhide where I was surprised to see that grub2-mkconfig would not create a configuration file anymore.

Quoted 7 lines

The second patch has been posted in the past
(https://lists.xen.org/archives/html/xen-devel/2017-03/txtCeHTNmz1hZ.txt)

[PATCH 2/2] Use grub-file to figure out whether multiboot2 should be

and just allows us to multiboot2 instead of multiboot if the binary supports it.

LGMT. If there are no objections in a week or so I will apply both of them.

Daniel

Applied
#7 lore raw
Quoted 17 lines · Daniel Kiper
Quoted 16 lines · Konrad Rzeszutek Wilk

Since v1 [http://lists.gnu.org/archive/html/grub-devel/2017-08/msg00073.html]
- Fixed up patch with failing invocation,
- Redid patch #2 per Daniel's instructions.

Hey,

The first patch:
[PATCH 1/2] Fix util/grub.d/20_linux_xen.in: Add xen_boot command

is a fix discovered on Fedora rawhide where I was surprised to see that grub2-mkconfig would not create a configuration file anymore.

The second patch has been posted in the past
(https://lists.xen.org/archives/html/xen-devel/2017-03/txtCeHTNmz1hZ.txt)

Quoted 6 lines
Quoted 4 lines

[PATCH 2/2] Use grub-file to figure out whether multiboot2 should be

and just allows us to multiboot2 instead of multiboot if the binary supports it.

LGMT. If there are no objections in a week or so I will apply both of them.

Applied!

Thanks,

Daniel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Applied
#8 lore raw
In reply to Daniel Kiper
Quoted 17 lines · Daniel Kiper
Quoted 16 lines · Konrad Rzeszutek Wilk

Since v1 [http://lists.gnu.org/archive/html/grub-devel/2017-08/msg00073.html]
- Fixed up patch with failing invocation,
- Redid patch #2 per Daniel's instructions.

Hey,

The first patch:
[PATCH 1/2] Fix util/grub.d/20_linux_xen.in: Add xen_boot command

is a fix discovered on Fedora rawhide where I was surprised to see that grub2-mkconfig would not create a configuration file anymore.

The second patch has been posted in the past
(https://lists.xen.org/archives/html/xen-devel/2017-03/txtCeHTNmz1hZ.txt)

Quoted 6 lines
Quoted 4 lines

[PATCH 2/2] Use grub-file to figure out whether multiboot2 should be

and just allows us to multiboot2 instead of multiboot if the binary supports it.

LGMT. If there are no objections in a week or so I will apply both of them.

Applied!

Thanks,

Daniel