* [PATCH] Fix ARM multiboot2 breaking Fedora.
@ 2017-08-28 18:40 Konrad Rzeszutek Wilk
2017-08-28 18:40 ` [PATCH 1/2] Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 Konrad Rzeszutek Wilk
2017-08-28 18:40 ` [PATCH 2/2] Use grub-file to figure out whether multiboot2 should be used for Xen.gz Konrad Rzeszutek Wilk
0 siblings, 2 replies; 8+ messages in thread
From: Konrad Rzeszutek Wilk @ 2017-08-28 18:40 UTC (permalink / raw)
To: daniel.kiper, xen-devel, grub-devel
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
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/2] Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 2017-08-28 18:40 [PATCH] Fix ARM multiboot2 breaking Fedora Konrad Rzeszutek Wilk @ 2017-08-28 18:40 ` Konrad Rzeszutek Wilk 2017-08-28 18:42 ` Konrad Rzeszutek Wilk 2017-08-29 7:12 ` Fu Wei Fu 2017-08-28 18:40 ` [PATCH 2/2] Use grub-file to figure out whether multiboot2 should be used for Xen.gz Konrad Rzeszutek Wilk 1 sibling, 2 replies; 8+ messages in thread From: Konrad Rzeszutek Wilk @ 2017-08-28 18:40 UTC (permalink / raw) To: daniel.kiper, xen-devel, grub-devel; +Cc: Konrad Rzeszutek Wilk, Fu Wei 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 <fu.wei@linaro.org> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- 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 c002fc9..083bcef 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.1.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 2017-08-28 18:40 ` [PATCH 1/2] Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 Konrad Rzeszutek Wilk @ 2017-08-28 18:42 ` Konrad Rzeszutek Wilk 2017-08-29 18:58 ` Daniel Kiper 2017-08-29 7:12 ` Fu Wei Fu 1 sibling, 1 reply; 8+ messages in thread From: Konrad Rzeszutek Wilk @ 2017-08-28 18:42 UTC (permalink / raw) To: daniel.kiper, xen-devel, grub-devel; +Cc: Fu Wei On Mon, Aug 28, 2017 at 02:40:14PM -0400, Konrad Rzeszutek Wilk wrote: > 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: 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]# > > [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 <fu.wei@linaro.org> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > --- > 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 c002fc9..083bcef 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.1.4 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 2017-08-28 18:42 ` Konrad Rzeszutek Wilk @ 2017-08-29 18:58 ` Daniel Kiper 0 siblings, 0 replies; 8+ messages in thread From: Daniel Kiper @ 2017-08-29 18:58 UTC (permalink / raw) To: Konrad Rzeszutek Wilk; +Cc: xen-devel, grub-devel, Fu Wei On Mon, Aug 28, 2017 at 02:42:18PM -0400, Konrad Rzeszutek Wilk wrote: > On Mon, Aug 28, 2017 at 02:40:14PM -0400, Konrad Rzeszutek Wilk wrote: > > 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 s/exciting/exiting/? > > 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]# In general LGTM. Though please repost this patch with full commit message? Daniel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 2017-08-28 18:40 ` [PATCH 1/2] Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 Konrad Rzeszutek Wilk 2017-08-28 18:42 ` Konrad Rzeszutek Wilk @ 2017-08-29 7:12 ` Fu Wei Fu 2017-08-29 13:29 ` Konrad Rzeszutek Wilk 1 sibling, 1 reply; 8+ messages in thread From: Fu Wei Fu @ 2017-08-29 7:12 UTC (permalink / raw) To: Konrad Rzeszutek Wilk Cc: daniel.kiper, xen-devel, The development of GNU GRUB Hi Konrad, Thanks for your feedback. On 29 August 2017 at 02:40, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote: > 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 > (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? > > 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? > > 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 <fu.wei@linaro.org> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > --- > 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 c002fc9..083bcef 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.1.4 > -- Best regards, Fu Wei Software Engineer Red Hat ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 2017-08-29 7:12 ` Fu Wei Fu @ 2017-08-29 13:29 ` Konrad Rzeszutek Wilk 0 siblings, 0 replies; 8+ messages in thread From: Konrad Rzeszutek Wilk @ 2017-08-29 13:29 UTC (permalink / raw) To: Fu Wei Fu; +Cc: daniel.kiper, xen-devel, The development of GNU GRUB On Tue, Aug 29, 2017 at 03:12:59PM +0800, Fu Wei Fu wrote: > Hi Konrad, > > Thanks for your feedback. Thank you for speedy response! > > On 29 August 2017 at 02:40, Konrad Rzeszutek Wilk > <konrad.wilk@oracle.com> wrote: > > 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 > > > (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? 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. > > > > > 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. > > > > > 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 <fu.wei@linaro.org> > > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > > --- > > 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 c002fc9..083bcef 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.1.4 > > > > > > -- > Best regards, > > Fu Wei > Software Engineer > Red Hat ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] Use grub-file to figure out whether multiboot2 should be used for Xen.gz 2017-08-28 18:40 [PATCH] Fix ARM multiboot2 breaking Fedora Konrad Rzeszutek Wilk 2017-08-28 18:40 ` [PATCH 1/2] Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 Konrad Rzeszutek Wilk @ 2017-08-28 18:40 ` Konrad Rzeszutek Wilk 2017-08-29 19:04 ` Daniel Kiper 1 sibling, 1 reply; 8+ messages in thread From: Konrad Rzeszutek Wilk @ 2017-08-28 18:40 UTC (permalink / raw) To: daniel.kiper, xen-devel, grub-devel; +Cc: 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. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- v2: Rebase on top of d33045ce7ffcb7c1e4a60c14d5ca64b36e3c5abe --- 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 083bcef..29e015b 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -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` -- 2.1.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] Use grub-file to figure out whether multiboot2 should be used for Xen.gz 2017-08-28 18:40 ` [PATCH 2/2] Use grub-file to figure out whether multiboot2 should be used for Xen.gz Konrad Rzeszutek Wilk @ 2017-08-29 19:04 ` Daniel Kiper 0 siblings, 0 replies; 8+ messages in thread From: Daniel Kiper @ 2017-08-29 19:04 UTC (permalink / raw) To: Konrad Rzeszutek Wilk; +Cc: xen-devel, grub-devel On Mon, Aug 28, 2017 at 02:40:15PM -0400, Konrad Rzeszutek Wilk wrote: > 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 <konrad.wilk@oracle.com> > --- > v2: Rebase on top of d33045ce7ffcb7c1e4a60c14d5ca64b36e3c5abe > --- > 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 083bcef..29e015b 100644 > --- a/util/grub.d/20_linux_xen.in > +++ b/util/grub.d/20_linux_xen.in > @@ -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? > + 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-08-29 19:05 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-08-28 18:40 [PATCH] Fix ARM multiboot2 breaking Fedora Konrad Rzeszutek Wilk 2017-08-28 18:40 ` [PATCH 1/2] Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 Konrad Rzeszutek Wilk 2017-08-28 18:42 ` Konrad Rzeszutek Wilk 2017-08-29 18:58 ` Daniel Kiper 2017-08-29 7:12 ` Fu Wei Fu 2017-08-29 13:29 ` Konrad Rzeszutek Wilk 2017-08-28 18:40 ` [PATCH 2/2] Use grub-file to figure out whether multiboot2 should be used for Xen.gz Konrad Rzeszutek Wilk 2017-08-29 19:04 ` Daniel Kiper
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).