diff mbox series

[Linaro-uefi,v7,2/3] * util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64

Message ID 20170502070627.11389-3-fu.wei@linaro.org
State Superseded
Headers show
Series arm64, xen: add xen_boot support into grup-mkconfig | expand

Commit Message

Fu Wei Fu May 2, 2017, 7:06 a.m. UTC
From: Fu Wei <fu.wei@linaro.org>

This patch adds the support of xen_boot command for aarch64:
    xen_hypervisor
    xen_module
These two commands are only for aarch64, since it has its own protocol and
commands to boot xen hypervisor and Dom0, but not multiboot.

For other architectures, they are still using multiboot and module
commands.

Signed-off-by: Fu Wei <fu.wei@linaro.org>
---
 util/grub.d/20_linux_xen.in | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

Stefano Stabellini May 3, 2017, 8:53 p.m. UTC | #1
On Wed, 3 May 2017, Andrew Cooper wrote:
> On 02/05/17 08:06, fu.wei@linaro.org wrote:
> > From: Fu Wei <fu.wei@linaro.org>
> >
> > This patch adds the support of xen_boot command for aarch64:
> >     xen_hypervisor
> >     xen_module
> > These two commands are only for aarch64, since it has its own protocol and
> > commands to boot xen hypervisor and Dom0, but not multiboot.
> >
> > For other architectures, they are still using multiboot and module
> > commands.
> >
> > Signed-off-by: Fu Wei <fu.wei@linaro.org>
> 
> Sorry if I am jumping in late and asking awkward questions, but what is
> special about Xen/aarch64 here?  Why is it using a non-standard entry
> mechanism?

Multiboot is not available on ARM. The boot protocol we have on ARM is
FDT based:

http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=docs/misc/arm/device-tree/booting.txt

We often refer to it as "multiboot for arm" but in fact it is not
related to the x86 multiboot in any way.

In Grub, the two protocols (multiboot and
docs/misc/arm/device-tree/booting.txt) are kept clearly distinct
(55A687E5.4070106@gmail.com). Hence, the need for this patch.
Fu Wei Fu May 5, 2017, 8:57 a.m. UTC | #2
Hi Stefano,

On 4 May 2017 at 04:53, Stefano Stabellini <sstabellini@kernel.org> wrote:
> On Wed, 3 May 2017, Andrew Cooper wrote:
>> On 02/05/17 08:06, fu.wei@linaro.org wrote:
>> > From: Fu Wei <fu.wei@linaro.org>
>> >
>> > This patch adds the support of xen_boot command for aarch64:
>> >     xen_hypervisor
>> >     xen_module
>> > These two commands are only for aarch64, since it has its own protocol and
>> > commands to boot xen hypervisor and Dom0, but not multiboot.
>> >
>> > For other architectures, they are still using multiboot and module
>> > commands.
>> >
>> > Signed-off-by: Fu Wei <fu.wei@linaro.org>
>>
>> Sorry if I am jumping in late and asking awkward questions, but what is
>> special about Xen/aarch64 here?  Why is it using a non-standard entry
>> mechanism?
>
> Multiboot is not available on ARM. The boot protocol we have on ARM is
> FDT based:
>
> http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=docs/misc/arm/device-tree/booting.txt
>
> We often refer to it as "multiboot for arm" but in fact it is not
> related to the x86 multiboot in any way.
>
> In Grub, the two protocols (multiboot and
> docs/misc/arm/device-tree/booting.txt) are kept clearly distinct
> (55A687E5.4070106@gmail.com). Hence, the need for this patch.

Exactly, great thanks for your explanation! :-)
Andrew Cooper May 5, 2017, 9:01 a.m. UTC | #3
On 05/05/17 09:57, Fu Wei wrote:
> Hi Stefano,
>
> On 4 May 2017 at 04:53, Stefano Stabellini <sstabellini@kernel.org> wrote:
>> On Wed, 3 May 2017, Andrew Cooper wrote:
>>> On 02/05/17 08:06, fu.wei@linaro.org wrote:
>>>> From: Fu Wei <fu.wei@linaro.org>
>>>>
>>>> This patch adds the support of xen_boot command for aarch64:
>>>>     xen_hypervisor
>>>>     xen_module
>>>> These two commands are only for aarch64, since it has its own protocol and
>>>> commands to boot xen hypervisor and Dom0, but not multiboot.
>>>>
>>>> For other architectures, they are still using multiboot and module
>>>> commands.
>>>>
>>>> Signed-off-by: Fu Wei <fu.wei@linaro.org>
>>> Sorry if I am jumping in late and asking awkward questions, but what is
>>> special about Xen/aarch64 here?  Why is it using a non-standard entry
>>> mechanism?
>> Multiboot is not available on ARM. The boot protocol we have on ARM is
>> FDT based:
>>
>> http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=docs/misc/arm/device-tree/booting.txt
>>
>> We often refer to it as "multiboot for arm" but in fact it is not
>> related to the x86 multiboot in any way.
>>
>> In Grub, the two protocols (multiboot and
>> docs/misc/arm/device-tree/booting.txt) are kept clearly distinct
>> (55A687E5.4070106@gmail.com). Hence, the need for this patch.
> Exactly, great thanks for your explanation! :-)

So it really is an entirely custom Xen booting protocol.

It is unfortunate that this wasn't reviewed sensibly at the time (and
implemented in a project-neutral way), but it looks like the time to fix
that properly has long since passed.

~Andrew
Fu Wei Fu May 5, 2017, 9:25 a.m. UTC | #4
Hi Andrew,

On 5 May 2017 at 17:01, Andrew Cooper <andrew.cooper3@citrix.com> wrote:
> On 05/05/17 09:57, Fu Wei wrote:
>> Hi Stefano,
>>
>> On 4 May 2017 at 04:53, Stefano Stabellini <sstabellini@kernel.org> wrote:
>>> On Wed, 3 May 2017, Andrew Cooper wrote:
>>>> On 02/05/17 08:06, fu.wei@linaro.org wrote:
>>>>> From: Fu Wei <fu.wei@linaro.org>
>>>>>
>>>>> This patch adds the support of xen_boot command for aarch64:
>>>>>     xen_hypervisor
>>>>>     xen_module
>>>>> These two commands are only for aarch64, since it has its own protocol and
>>>>> commands to boot xen hypervisor and Dom0, but not multiboot.
>>>>>
>>>>> For other architectures, they are still using multiboot and module
>>>>> commands.
>>>>>
>>>>> Signed-off-by: Fu Wei <fu.wei@linaro.org>
>>>> Sorry if I am jumping in late and asking awkward questions, but what is
>>>> special about Xen/aarch64 here?  Why is it using a non-standard entry
>>>> mechanism?
>>> Multiboot is not available on ARM. The boot protocol we have on ARM is
>>> FDT based:
>>>
>>> http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=docs/misc/arm/device-tree/booting.txt
>>>
>>> We often refer to it as "multiboot for arm" but in fact it is not
>>> related to the x86 multiboot in any way.
>>>
>>> In Grub, the two protocols (multiboot and
>>> docs/misc/arm/device-tree/booting.txt) are kept clearly distinct
>>> (55A687E5.4070106@gmail.com). Hence, the need for this patch.
>> Exactly, great thanks for your explanation! :-)
>
> So it really is an entirely custom Xen booting protocol.

Yes, it is.

>
> It is unfortunate that this wasn't reviewed sensibly at the time (and
> implemented in a project-neutral way), but it looks like the time to fix
> that properly has long since passed.

I guess the reason Xen use an entirely custom(lightweight) booting
protocol on aarch64 is that the multiboot maybe a little "heavy" for
aarch64.

>
> ~Andrew
Fu Wei Fu May 5, 2017, 10:41 a.m. UTC | #5
Hi Julien,

On 5 May 2017 at 18:11, Julien Grall <julien.grall@arm.com> wrote:
> Hi Andrew,
>
>
> On 05/05/17 10:01, Andrew Cooper wrote:
>>
>> On 05/05/17 09:57, Fu Wei wrote:
>>>
>>> Hi Stefano,
>>>
>>> On 4 May 2017 at 04:53, Stefano Stabellini <sstabellini@kernel.org>
>>> wrote:
>>>>
>>>> On Wed, 3 May 2017, Andrew Cooper wrote:
>>>>>
>>>>> On 02/05/17 08:06, fu.wei@linaro.org wrote:
>>>>>>
>>>>>> From: Fu Wei <fu.wei@linaro.org>
>>>>>>
>>>>>> This patch adds the support of xen_boot command for aarch64:
>>>>>>     xen_hypervisor
>>>>>>     xen_module
>>>>>> These two commands are only for aarch64, since it has its own protocol
>>>>>> and
>>>>>> commands to boot xen hypervisor and Dom0, but not multiboot.
>>>>>>
>>>>>> For other architectures, they are still using multiboot and module
>>>>>> commands.
>>>>>>
>>>>>> Signed-off-by: Fu Wei <fu.wei@linaro.org>
>>>>>
>>>>> Sorry if I am jumping in late and asking awkward questions, but what is
>>>>> special about Xen/aarch64 here?  Why is it using a non-standard entry
>>>>> mechanism?
>>>>
>>>> Multiboot is not available on ARM. The boot protocol we have on ARM is
>>>> FDT based:
>>>>
>>>>
>>>> http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=docs/misc/arm/device-tree/booting.txt
>>>>
>>>> We often refer to it as "multiboot for arm" but in fact it is not
>>>> related to the x86 multiboot in any way.
>>>>
>>>> In Grub, the two protocols (multiboot and
>>>> docs/misc/arm/device-tree/booting.txt) are kept clearly distinct
>>>> (55A687E5.4070106@gmail.com). Hence, the need for this patch.
>>>
>>> Exactly, great thanks for your explanation! :-)
>>
>>
>> So it really is an entirely custom Xen booting protocol.
>
>
> Not really, Xen is using the Linux boot protocol. It does not allow to pass
> multiple modules. The multiboot used by x86 does not support ARM (see [1])
> and hence not supported by any bootloaders existing on ARM.
>
> The "multiboot for ARM" has been designed to be generic enough to be used by
> anyone (see [2]). And the original intention was to use "module" in
> grub.cfg. I don't know why we did this change.

yes, in the early patchset, I used multiboot and module command name,
But since the protocol we are using is not a real multiboot, so I
followed the suggestion (using xen_hypervisor and xen_module) to do
this change.

We don't want to confuse people. "module" is a command in the real
multiboot module.
if we don't use the real multiboot protocol, we avoid re-using its commands.

>
>>
>> It is unfortunate that this wasn't reviewed sensibly at the time (and
>> implemented in a project-neutral way), but it looks like the time to fix
>> that properly has long since passed.
>
>
> The bindings are project neutral. Only the commands in grub are not neutral,
> I cannot find why it is not.
>
> Cheers,
>
> [1] https://www.gnu.org/software/grub/manual/multiboot/multiboot.html
> [2]
> https://wiki.xen.org/wiki/Xen_ARM_with_Virtualization_Extensions/Multiboot
>
> --
> Julien Grall
Fu Wei Fu May 9, 2017, 9:02 a.m. UTC | #6
Hi Vladimir

On 9 May 2017 at 14:59, Vladimir 'phcoder' Serbinenko <phcoder@gmail.com> wrote:
>
>
> Le Tue, May 2, 2017 à 9:06 AM, <fu.wei@linaro.org> a écrit :
>>
>> From: Fu Wei <fu.wei@linaro.org>
>>
>> This patch adds the support of xen_boot command for aarch64:
>>     xen_hypervisor
>>     xen_module
>> These two commands are only for aarch64, since it has its own protocol and
>> commands to boot xen hypervisor and Dom0, but not multiboot.
>>
>> For other architectures, they are still using multiboot and module
>> commands.
>>
>> Signed-off-by: Fu Wei <fu.wei@linaro.org>
>> ---
>>  util/grub.d/20_linux_xen.in | 13 ++++++++++---
>>  1 file changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
>> index c48af94..9777719 100644
>> --- a/util/grub.d/20_linux_xen.in
>> +++ b/util/grub.d/20_linux_xen.in
>> @@ -122,16 +122,16 @@ linux_entry ()
>>          else
>>              xen_rm_opts="no-real-mode edd=off"
>>          fi
>> -       multiboot       ${rel_xen_dirname}/${xen_basename} placeholder
>> ${xen_args} \${xen_rm_opts}
>> +       ${xen_loader}   ${rel_xen_dirname}/${xen_basename} placeholder
>> ${xen_args} \${xen_rm_opts}
>>         echo    '$(echo "$lmessage" | grub_quote)'
>> -       module  ${rel_dirname}/${basename} placeholder
>> root=${linux_root_device_thisversion} ro ${args}
>> +       ${module_loader}        ${rel_dirname}/${basename} placeholder
>> root=${linux_root_device_thisversion} ro ${args}
>>  EOF
>>    if test -n "${initrd}" ; then
>>      # TRANSLATORS: ramdisk isn't identifier. Should be translated.
>>      message="$(gettext_printf "Loading initial ramdisk ...")"
>>      sed "s/^/$submenu_indentation/" << EOF
>>         echo    '$(echo "$message" | grub_quote)'
>> -       module  --nounzip   ${rel_dirname}/${initrd}
>> +       ${module_loader}        --nounzip   ${rel_dirname}/${initrd}
>>  EOF
>>    fi
>>    sed "s/^/$submenu_indentation/" << EOF
>> @@ -206,6 +206,13 @@ 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
>> +    if [ "x$machine" != xaarch64 ]; then
>
> Machine of grub-mkconfig doesn't necessarily match the kernel. Think of
> chroot or of having 32-bit userspace with 64-bit kernel. Better to do this
> on runtime. I know, it's not very nice but the whole grub-mkconfig is
> trouble that needs redesign that I'm working on.

So if we need to do this at run time(in grub shell), can I use
"grub_cpu" variable instead?

Thanks!

>>
>> +       xen_loader="multiboot"
>> +       module_loader="module"
>> +    else
>> +       xen_loader="xen_hypervisor"
>> +       module_loader="xen_module"
>> +    fi
>>      while [ "x$list" != "x" ] ; do
>>         linux=`version_find_latest $list`
>>         gettext_printf "Found linux image: %s\n" "$linux" >&2
>> --
>> 2.9.3
>>
>
Fu Wei Fu May 9, 2017, 9:39 a.m. UTC | #7
Hi Vladimir

On 9 May 2017 at 17:02, Fu Wei <fu.wei@linaro.org> wrote:
> Hi Vladimir
>
> On 9 May 2017 at 14:59, Vladimir 'phcoder' Serbinenko <phcoder@gmail.com> wrote:
>>
>>
>> Le Tue, May 2, 2017 à 9:06 AM, <fu.wei@linaro.org> a écrit :
>>>
>>> From: Fu Wei <fu.wei@linaro.org>
>>>
>>> This patch adds the support of xen_boot command for aarch64:
>>>     xen_hypervisor
>>>     xen_module
>>> These two commands are only for aarch64, since it has its own protocol and
>>> commands to boot xen hypervisor and Dom0, but not multiboot.
>>>
>>> For other architectures, they are still using multiboot and module
>>> commands.
>>>
>>> Signed-off-by: Fu Wei <fu.wei@linaro.org>
>>> ---
>>>  util/grub.d/20_linux_xen.in | 13 ++++++++++---
>>>  1 file changed, 10 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
>>> index c48af94..9777719 100644
>>> --- a/util/grub.d/20_linux_xen.in
>>> +++ b/util/grub.d/20_linux_xen.in
>>> @@ -122,16 +122,16 @@ linux_entry ()
>>>          else
>>>              xen_rm_opts="no-real-mode edd=off"
>>>          fi
>>> -       multiboot       ${rel_xen_dirname}/${xen_basename} placeholder
>>> ${xen_args} \${xen_rm_opts}
>>> +       ${xen_loader}   ${rel_xen_dirname}/${xen_basename} placeholder
>>> ${xen_args} \${xen_rm_opts}
>>>         echo    '$(echo "$lmessage" | grub_quote)'
>>> -       module  ${rel_dirname}/${basename} placeholder
>>> root=${linux_root_device_thisversion} ro ${args}
>>> +       ${module_loader}        ${rel_dirname}/${basename} placeholder
>>> root=${linux_root_device_thisversion} ro ${args}
>>>  EOF
>>>    if test -n "${initrd}" ; then
>>>      # TRANSLATORS: ramdisk isn't identifier. Should be translated.
>>>      message="$(gettext_printf "Loading initial ramdisk ...")"
>>>      sed "s/^/$submenu_indentation/" << EOF
>>>         echo    '$(echo "$message" | grub_quote)'
>>> -       module  --nounzip   ${rel_dirname}/${initrd}
>>> +       ${module_loader}        --nounzip   ${rel_dirname}/${initrd}
>>>  EOF
>>>    fi
>>>    sed "s/^/$submenu_indentation/" << EOF
>>> @@ -206,6 +206,13 @@ 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
>>> +    if [ "x$machine" != xaarch64 ]; then
>>
>> Machine of grub-mkconfig doesn't necessarily match the kernel. Think of
>> chroot or of having 32-bit userspace with 64-bit kernel. Better to do this
>> on runtime. I know, it's not very nice but the whole grub-mkconfig is
>> trouble that needs redesign that I'm working on.
>
> So if we need to do this at run time(in grub shell), can I use
> "grub_cpu" variable instead?

Dose this patch make sense to you?

-       module  --nounzip   ${rel_dirname}/${initrd}
+        \${module_loader} --nounzip    ${rel_dirname}/${initrd}
 EOF
   fi
   sed "s/^/$submenu_indentation/" << EOF


>
> Thanks!
>
>>>
>>> +       xen_loader="multiboot"
>>> +       module_loader="module"
>>> +    else
>>> +       xen_loader="xen_hypervisor"
>>> +       module_loader="xen_module"
>>> +    fi
>>>      while [ "x$list" != "x" ] ; do
>>>         linux=`version_find_latest $list`
>>>         gettext_printf "Found linux image: %s\n" "$linux" >&2
>>> --
>>> 2.9.3
>>>
>>
>
>
>
> --
> Best regards,
>
> Fu Wei
> Software Engineer
> Red Hatdiff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index c48af94..0c26cbb 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -122,16 +122,23 @@ linux_entry ()
         else
             xen_rm_opts="no-real-mode edd=off"
         fi
-       multiboot       ${rel_xen_dirname}/${xen_basename} placeholder
${xen_args} \${xen_rm_opts}
+        if [ "x\$grub_cpu" != xarm64 ]; then
+            xen_loader="multiboot"
+            module_loader="module"
+        else
+            xen_loader="xen_hypervisor"
+            module_loader="xen_module"
+        fi
+        \${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder
${xen_args} \${xen_rm_opts}
        echo    '$(echo "$lmessage" | grub_quote)'
-       module  ${rel_dirname}/${basename} placeholder
root=${linux_root_device_thisversion} ro ${args}
+        \${module_loader}      ${rel_dirname}/${basename} placeholder
root=${linux_root_device_thisversion} ro ${args}
 EOF
   if test -n "${initrd}" ; then
     # TRANSLATORS: ramdisk isn't identifier. Should be translated.
     message="$(gettext_printf "Loading initial ramdisk ...")"
     sed "s/^/$submenu_indentation/" << EOF
        echo    '$(echo "$message" | grub_quote)'

Fu Wei Fu May 14, 2017, 7:53 a.m. UTC | #8
Hi Vladimir,

On 11 May 2017 at 22:25, Fu Wei <fu.wei@linaro.org> wrote:
> Hi Vladimir,
>
> On 11 May 2017 at 06:01, Vladimir 'phcoder' Serbinenko
> <phcoder@gmail.com> wrote:
>>
>>
>> On Tue, May 9, 2017, 11:02 Fu Wei <fu.wei@linaro.org> wrote:
>>>
>>> Hi Vladimir
>>>
>>> On 9 May 2017 at 14:59, Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
>>> wrote:
>>> >
>>> >
>>> > Le Tue, May 2, 2017 à 9:06 AM, <fu.wei@linaro.org> a écrit :
>>> >>
>>> >> From: Fu Wei <fu.wei@linaro.org>
>>> >>
>>> >> This patch adds the support of xen_boot command for aarch64:
>>> >>     xen_hypervisor
>>> >>     xen_module
>>> >> These two commands are only for aarch64, since it has its own protocol
>>> >> and
>>> >> commands to boot xen hypervisor and Dom0, but not multiboot.
>>> >>
>>> >> For other architectures, they are still using multiboot and module
>>> >> commands.
>>> >>
>>> >> Signed-off-by: Fu Wei <fu.wei@linaro.org>
>>> >> ---
>>> >>  util/grub.d/20_linux_xen.in | 13 ++++++++++---
>>> >>  1 file changed, 10 insertions(+), 3 deletions(-)
>>> >>
>>> >> diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
>>> >> index c48af94..9777719 100644
>>> >> --- a/util/grub.d/20_linux_xen.in
>>> >> +++ b/util/grub.d/20_linux_xen.in
>>> >> @@ -122,16 +122,16 @@ linux_entry ()
>>> >>          else
>>> >>              xen_rm_opts="no-real-mode edd=off"
>>> >>          fi
>>> >> -       multiboot       ${rel_xen_dirname}/${xen_basename} placeholder
>>> >> ${xen_args} \${xen_rm_opts}
>>> >> +       ${xen_loader}   ${rel_xen_dirname}/${xen_basename} placeholder
>>> >> ${xen_args} \${xen_rm_opts}
>>> >>         echo    '$(echo "$lmessage" | grub_quote)'
>>> >> -       module  ${rel_dirname}/${basename} placeholder
>>> >> root=${linux_root_device_thisversion} ro ${args}
>>> >> +       ${module_loader}        ${rel_dirname}/${basename} placeholder
>>> >> root=${linux_root_device_thisversion} ro ${args}
>>> >>  EOF
>>> >>    if test -n "${initrd}" ; then
>>> >>      # TRANSLATORS: ramdisk isn't identifier. Should be translated.
>>> >>      message="$(gettext_printf "Loading initial ramdisk ...")"
>>> >>      sed "s/^/$submenu_indentation/" << EOF
>>> >>         echo    '$(echo "$message" | grub_quote)'
>>> >> -       module  --nounzip   ${rel_dirname}/${initrd}
>>> >> +       ${module_loader}        --nounzip   ${rel_dirname}/${initrd}
>>> >>  EOF
>>> >>    fi
>>> >>    sed "s/^/$submenu_indentation/" << EOF
>>> >> @@ -206,6 +206,13 @@ 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
>>> >> +    if [ "x$machine" != xaarch64 ]; then
>>> >
>>> > Machine of grub-mkconfig doesn't necessarily match the kernel. Think of
>>> > chroot or of having 32-bit userspace with 64-bit kernel. Better to do
>>> > this
>>> > on runtime. I know, it's not very nice but the whole grub-mkconfig is
>>> > trouble that needs redesign that I'm working on.
>>>
>>> So if we need to do this at run time(in grub shell), can I use
>>> "grub_cpu" variable instead?
>>
>> Yes, you can. Another possibility, probably better, is to check actual file
>> type, see grub-file
>
> Very good idea, will do in my v8 patchset, will send v8 in a day.

I have posted v8 patchset which is using “$grub_file”, please help me
to review it :-)

Great thanks!

>
>>>
>>>
>>> Thanks!
>>>
>>> >>
>>> >> +       xen_loader="multiboot"
>>> >> +       module_loader="module"
>>> >> +    else
>>> >> +       xen_loader="xen_hypervisor"
>>> >> +       module_loader="xen_module"
>>> >> +    fi
>>> >>      while [ "x$list" != "x" ] ; do
>>> >>         linux=`version_find_latest $list`
>>> >>         gettext_printf "Found linux image: %s\n" "$linux" >&2
>>> >> --
>>> >> 2.9.3
>>> >>
>>> >
>>>
>>>
>>>
>>> --
>>> Best regards,
>>>
>>> Fu Wei
>>> Software Engineer
>>> Red Hat
>
>
>
> --
> Best regards,
>
> Fu Wei
> Software Engineer
> Red Hat
diff mbox series

Patch

diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index c48af94..9777719 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -122,16 +122,16 @@  linux_entry ()
         else
             xen_rm_opts="no-real-mode edd=off"
         fi
-	multiboot	${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts}
+	${xen_loader}	${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts}
 	echo	'$(echo "$lmessage" | grub_quote)'
-	module	${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
+	${module_loader}	${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
 EOF
   if test -n "${initrd}" ; then
     # TRANSLATORS: ramdisk isn't identifier. Should be translated.
     message="$(gettext_printf "Loading initial ramdisk ...")"
     sed "s/^/$submenu_indentation/" << EOF
 	echo	'$(echo "$message" | grub_quote)'
-	module	--nounzip   ${rel_dirname}/${initrd}
+	${module_loader}	--nounzip   ${rel_dirname}/${initrd}
 EOF
   fi
   sed "s/^/$submenu_indentation/" << EOF
@@ -206,6 +206,13 @@  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
+    if [ "x$machine" != xaarch64 ]; then
+	xen_loader="multiboot"
+	module_loader="module"
+    else
+	xen_loader="xen_hypervisor"
+	module_loader="xen_module"
+    fi
     while [ "x$list" != "x" ] ; do
 	linux=`version_find_latest $list`
 	gettext_printf "Found linux image: %s\n" "$linux" >&2