Skip to contentSkip to conversation

Fix ARM multiboot2 breaking Fedora.

PATCH New Konrad Rzeszutek Wilk 3 participants 15 messages Aug 28, 2017 – Aug 29, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix ARM multiboot2 breaking Fedora.

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. See https://bugzilla.redhat.com/show_bug.cgi?id=1486002 for details.

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 | 13 ++++++++-----
 1 file changed, 8 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 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 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.

---
 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 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 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.

---
 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

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

Quoted 11 lines · 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

Quoted 4 lines

will result in 20_linux_xen exciting without continuing and also causing grub2-mkconfig to stop processing.

As in:

git format-patch decided to eat this relevant part:

[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]#

Quoted 41 lines

[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.

---
 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

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

#4 lore raw

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

In reply to Konrad Rzeszutek Wilk
Quoted 11 lines · 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

Quoted 4 lines

will result in 20_linux_xen exciting without continuing and also causing grub2-mkconfig to stop processing.

As in:

git format-patch decided to eat this relevant part:

[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]#

Quoted 41 lines

[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.

---
 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
#5 lore raw

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

Quoted 5 lines · Konrad Rzeszutek Wilk
Quoted 4 lines · 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).

Quoted 8 lines
Quoted 8 lines

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

s/exciting/exiting/?

Quoted 19 lines
Quoted 3 lines

and also causing grub2-mkconfig to stop processing.

As in:

git format-patch decided to eat this relevant part:

[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
	}
}
Quoted 5 lines

### END /usr/local/etc/grub.d/10_linux ###

### BEGIN /usr/local/etc/grub.d/20_linux_xen ###

root@tst063 grub]#

In general LGTM. Though please repost this patch with full commit message?

Daniel

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

#6 lore raw

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

In reply to Konrad Rzeszutek Wilk
Quoted 5 lines · Konrad Rzeszutek Wilk
Quoted 4 lines · 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).

Quoted 8 lines
Quoted 8 lines

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

s/exciting/exiting/?

Quoted 19 lines
Quoted 3 lines

and also causing grub2-mkconfig to stop processing.

As in:

git format-patch decided to eat this relevant part:

[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
	}
}
Quoted 5 lines

### END /usr/local/etc/grub.d/10_linux ###

### BEGIN /usr/local/etc/grub.d/20_linux_xen ###

root@tst063 grub]#

In general LGTM. Though please repost this patch with full commit message?

Daniel

#7 lore raw

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

In reply to Konrad Rzeszutek Wilk

Hi Konrad,

Thanks for your feedback.

Quoted 6 lines · 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 your example

Quoted 4 lines

(For example on x86):
+ /usr/bin/grub2-file --is-arm64-efi /boot/xen-4.9.0.gz [root@tst063 grub]# echo $?
1

I guess that is right behavior, then
xen_loader="multiboot"
module_loader="module"

/boot/xen-4.9.0.gz is a xen binary for x86, right?

Quoted 3 lines

will result in 20_linux_xen exciting without continuing and also causing grub2-mkconfig to stop processing.

maybe we are using different shell? are you using ash?

Quoted 43 lines

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.

---
 util/grub.d/20_linux_xen.in | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
util/grub.d/20_linux_xen.in +4 -6
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`
--

2.1.4

Signature · 10 lines
Best regards,

Fu Wei
Software Engineer
Red Hat

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

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

In reply to Konrad Rzeszutek Wilk

Hi Konrad,

Thanks for your feedback.

Quoted 6 lines · 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 your example

Quoted 4 lines

(For example on x86):
+ /usr/bin/grub2-file --is-arm64-efi /boot/xen-4.9.0.gz [root@tst063 grub]# echo $?
1

I guess that is right behavior, then
xen_loader="multiboot"
module_loader="module"

/boot/xen-4.9.0.gz is a xen binary for x86, right?

Quoted 3 lines

will result in 20_linux_xen exciting without continuing and also causing grub2-mkconfig to stop processing.

maybe we are using different shell? are you using ash?

Quoted 43 lines

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.

---
 util/grub.d/20_linux_xen.in | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
util/grub.d/20_linux_xen.in +4 -6
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`
--

2.1.4

Signature · 5 lines
Best regards,

Fu Wei
Software Engineer
Red Hat
#9 lore raw

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

Quoted 3 lines · Fu Wei Fu

Hi Konrad,

Thanks for your feedback.

Thank you for speedy response!

Quoted 17 lines
Quoted 6 lines · 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 your example

Quoted 4 lines

(For example on x86):
+ /usr/bin/grub2-file --is-arm64-efi /boot/xen-4.9.0.gz [root@tst063 grub]# echo $?
1

Quoted 5 lines

I guess that is right behavior, then
xen_loader="multiboot"
module_loader="module"

/boot/xen-4.9.0.gz is a xen binary for x86, right?

Correct. I also tested it with an xen.efi which was built for ARM (I copied it in /boot/ directroy), and it created an proper entry for it:

xen_hypervisor /xen.efi placeholder dom0_max_vcpus=2 dom0_mem=max:2G loglvl=all guest_loglvl=all console=com1 com1=115200,8n1 iommu=verbose,debug scan=ucode conring_size=2097152 ${xen_rm_opts}

en_module /vmlinuz-4.13.0-0.rc5.git1.1.fc27.x86_64 placeholder root=/dev/mapper/fedora_tst063-root ro rd.lvm.lv=fedora_tst063/root rd.lvm.lv=fedora_tst063/swap loglevel=8 console=hvc0

...

Naturally I didn't try to boot it as it would most surely not work.

Quoted 6 lines
Quoted 4 lines

will result in 20_linux_xen exciting without continuing and also causing grub2-mkconfig to stop processing.

maybe we are using different shell? are you using ash?

[root@tst063 fedora]# head -2 which grub2-mkconfig #! /bin/sh
set -e

And the upstream grub shows:

[root@tst063 grub]# head -2 ./util/grub-mkconfig.in #! /bin/sh
set -e

I am assuming you are using ARM, in which case I would recommend you just copy xen.gz (compiled for x86) in your /boot directory. You should get a similar failure condition as I got.

Quoted 36 lines
Quoted 36 lines

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.

---
 util/grub.d/20_linux_xen.in | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
util/grub.d/20_linux_xen.in +2 -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
Quoted 17 lines
Quoted 8 lines
util/grub.d/20_linux_xen.in +2 -1
+       xen_loader="multiboot"
+       module_loader="module"
     fi
     while [ "x$list" != "x" ] ; do
        linux=`version_find_latest $list`
--

2.1.4

Signature · 5 lines
Best regards,

Fu Wei
Software Engineer
Red Hat

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

#10 lore raw

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

In reply to Fu Wei Fu
Quoted 3 lines · Fu Wei Fu

Hi Konrad,

Thanks for your feedback.

Thank you for speedy response!

Quoted 17 lines
Quoted 6 lines · 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 your example

Quoted 4 lines

(For example on x86):
+ /usr/bin/grub2-file --is-arm64-efi /boot/xen-4.9.0.gz [root@tst063 grub]# echo $?
1

Quoted 5 lines

I guess that is right behavior, then
xen_loader="multiboot"
module_loader="module"

/boot/xen-4.9.0.gz is a xen binary for x86, right?

Correct. I also tested it with an xen.efi which was built for ARM (I copied it in /boot/ directroy), and it created an proper entry for it:

xen_hypervisor /xen.efi placeholder dom0_max_vcpus=2 dom0_mem=max:2G loglvl=all guest_loglvl=all console=com1 com1=115200,8n1 iommu=verbose,debug scan=ucode conring_size=2097152 ${xen_rm_opts}

en_module /vmlinuz-4.13.0-0.rc5.git1.1.fc27.x86_64 placeholder root=/dev/mapper/fedora_tst063-root ro rd.lvm.lv=fedora_tst063/root rd.lvm.lv=fedora_tst063/swap loglevel=8 console=hvc0

...

Naturally I didn't try to boot it as it would most surely not work.

Quoted 6 lines
Quoted 4 lines

will result in 20_linux_xen exciting without continuing and also causing grub2-mkconfig to stop processing.

maybe we are using different shell? are you using ash?

[root@tst063 fedora]# head -2 which grub2-mkconfig #! /bin/sh
set -e

And the upstream grub shows:

[root@tst063 grub]# head -2 ./util/grub-mkconfig.in #! /bin/sh
set -e

I am assuming you are using ARM, in which case I would recommend you just copy xen.gz (compiled for x86) in your /boot directory. You should get a similar failure condition as I got.

Quoted 53 lines
Quoted 44 lines

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.

---
 util/grub.d/20_linux_xen.in | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
util/grub.d/20_linux_xen.in +4 -6
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`
--

2.1.4

Signature · 5 lines
Best regards,

Fu Wei
Software Engineer
Red Hat
#11 lore raw

PATCH 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

---
 util/grub.d/20_linux_xen.in | 4 ++++
 1 file changed, 4 insertions(+)
util/grub.d/20_linux_xen.in +4 -0
index 083bcef..29e015b 100644
@@ -212,6 +212,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`
Signature · 7 lines
2.1.4


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

PATCH 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

---
 util/grub.d/20_linux_xen.in | 4 ++++
 1 file changed, 4 insertions(+)
util/grub.d/20_linux_xen.in +4 -0
index 083bcef..29e015b 100644
@@ -212,6 +212,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`
Signature · 1 line
2.1.4
#13 lore raw

Re: [PATCH 2/2] Use grub-file to figure out whether multiboot2 should be used for Xen.gz

Quoted 16 lines · 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

---
 util/grub.d/20_linux_xen.in | 4 ++++
 1 file changed, 4 insertions(+)
util/grub.d/20_linux_xen.in +0 -0
index 083bcef..29e015b 100644

util/grub.d/20_linux_xen.in while [ "x${xen_list}" != "x" ] ; do · line 214

Quoted 3 lines
util/grub.d/20_linux_xen.in +0 -0
@@ -212,6 +212,10 @@ while [ "x${xen_list}" != "x" ] ; do
     else
 	xen_loader="multiboot"
 	module_loader="module"

Could you put these two lines into else below?

util/grub.d/20_linux_xen.in while [ "x${xen_list}" != "x" ] ; do · line 217

Quoted 3 lines
util/grub.d/20_linux_xen.in +3 -0
+	if ($grub_file --is-x86-multiboot2 $current_xen); then
+		xen_loader="multiboot2"
+		module_loader="module2"

Too much tabs. It should be one tab and four spaces.

Daniel

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

#14 lore raw

Re: [PATCH 2/2] Use grub-file to figure out whether multiboot2 should be used for Xen.gz

In reply to Konrad Rzeszutek Wilk
Quoted 16 lines · 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

---
 util/grub.d/20_linux_xen.in | 4 ++++
 1 file changed, 4 insertions(+)
util/grub.d/20_linux_xen.in +0 -0
index 083bcef..29e015b 100644

util/grub.d/20_linux_xen.in while [ "x${xen_list}" != "x" ] ; do · line 214

Quoted 3 lines
util/grub.d/20_linux_xen.in +0 -0
@@ -212,6 +212,10 @@ while [ "x${xen_list}" != "x" ] ; do
     else
 	xen_loader="multiboot"
 	module_loader="module"

Could you put these two lines into else below?

util/grub.d/20_linux_xen.in while [ "x${xen_list}" != "x" ] ; do · line 217

Quoted 3 lines
util/grub.d/20_linux_xen.in +3 -0
+	if ($grub_file --is-x86-multiboot2 $current_xen); then
+		xen_loader="multiboot2"
+		module_loader="module2"

Too much tabs. It should be one tab and four spaces.

Daniel