diff mbox

[Linaro-uefi,v5,3/4] * util/grub.d/20_linux_xen.in: Add xen_boot command support

Message ID 1467827637-14508-4-git-send-email-fu.wei@linaro.org
State Superseded
Headers show

Commit Message

Fu Wei Fu July 6, 2016, 5:53 p.m. UTC
From: Fu Wei <fu.wei@linaro.org>

This patch adds the support of xen_boot command:
    xen_hypervisor
    xen_module

Also add a new "feature_xen_boot" to indicate this grub support
xen_boot command.

Signed-off-by: Fu Wei <fu.wei@linaro.org>
---
 grub-core/normal/main.c     |  2 +-
 util/grub.d/20_linux_xen.in | 13 ++++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

Comments

Julien Grall July 12, 2016, 10:21 a.m. UTC | #1
Hi Fu Wei,

On 06/07/16 18:53, fu.wei@linaro.org wrote:
> From: Fu Wei <fu.wei@linaro.org>
>
> This patch adds the support of xen_boot command:
>      xen_hypervisor
>      xen_module
>
> Also add a new "feature_xen_boot" to indicate this grub support
> xen_boot command.
>
> Signed-off-by: Fu Wei <fu.wei@linaro.org>
> ---
>   grub-core/normal/main.c     |  2 +-
>   util/grub.d/20_linux_xen.in | 13 ++++++++++---
>   2 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
> index 78a70a8..3402a05 100644
> --- a/grub-core/normal/main.c
> +++ b/grub-core/normal/main.c
> @@ -488,7 +488,7 @@ static const char *features[] = {
>     "feature_chainloader_bpb", "feature_ntldr", "feature_platform_search_hint",
>     "feature_default_font_path", "feature_all_video_module",
>     "feature_menuentry_id", "feature_menuentry_options", "feature_200_final",
> -  "feature_nativedisk_cmd", "feature_timeout_style"
> +  "feature_nativedisk_cmd", "feature_timeout_style", "feature_xen_boot"
>   };
>
>   GRUB_MOD_INIT(normal)
> diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
> index c48af94..6a88a39 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\$feature_xen_boot" != xy ]; 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}

What is the coding style for grub? This line is using hard tabs, but the 
previous one are using soft tab.

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

Regards,
Fu Wei Fu July 26, 2016, 8:13 a.m. UTC | #2
Hi Julien,

On 12 July 2016 at 18:21, Julien Grall <julien.grall@arm.com> wrote:
> Hi Fu Wei,
>
>
> On 06/07/16 18:53, fu.wei@linaro.org wrote:
>>
>> From: Fu Wei <fu.wei@linaro.org>
>>
>> This patch adds the support of xen_boot command:
>>      xen_hypervisor
>>      xen_module
>>
>> Also add a new "feature_xen_boot" to indicate this grub support
>> xen_boot command.
>>
>> Signed-off-by: Fu Wei <fu.wei@linaro.org>
>> ---
>>   grub-core/normal/main.c     |  2 +-
>>   util/grub.d/20_linux_xen.in | 13 ++++++++++---
>>   2 files changed, 11 insertions(+), 4 deletions(-)
>>
>> diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
>> index 78a70a8..3402a05 100644
>> --- a/grub-core/normal/main.c
>> +++ b/grub-core/normal/main.c
>> @@ -488,7 +488,7 @@ static const char *features[] = {
>>     "feature_chainloader_bpb", "feature_ntldr",
>> "feature_platform_search_hint",
>>     "feature_default_font_path", "feature_all_video_module",
>>     "feature_menuentry_id", "feature_menuentry_options",
>> "feature_200_final",
>> -  "feature_nativedisk_cmd", "feature_timeout_style"
>> +  "feature_nativedisk_cmd", "feature_timeout_style", "feature_xen_boot"
>>   };
>>
>>   GRUB_MOD_INIT(normal)
>> diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
>> index c48af94..6a88a39 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\$feature_xen_boot" != xy ]; 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}
>
>
> What is the coding style for grub? This line is using hard tabs, but the
> previous one are using soft tab.

Thanks for pointing it out, I thinks it should be soft tab,
reason:
(1) GRUB follows the GNU Coding Standards
(2) according to "GNU Hello"( an example of how to follow the GNU
coding standards ),
the shell scripts are using soft tab.

So I will use  soft tab in v6, please check

Thanks

>
>>         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
>>
>
> Regards,
>
> --
> Julien Grall
diff mbox

Patch

diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 78a70a8..3402a05 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -488,7 +488,7 @@  static const char *features[] = {
   "feature_chainloader_bpb", "feature_ntldr", "feature_platform_search_hint",
   "feature_default_font_path", "feature_all_video_module",
   "feature_menuentry_id", "feature_menuentry_options", "feature_200_final",
-  "feature_nativedisk_cmd", "feature_timeout_style"
+  "feature_nativedisk_cmd", "feature_timeout_style", "feature_xen_boot"
 };
 
 GRUB_MOD_INIT(normal)
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index c48af94..6a88a39 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\$feature_xen_boot" != xy ]; 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)'
-	module	--nounzip   ${rel_dirname}/${initrd}
+	\${module_loader} --nounzip	${rel_dirname}/${initrd}
 EOF
   fi
   sed "s/^/$submenu_indentation/" << EOF