grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] arm64,xen: add xen_boot support into grup-mkconfig
@ 2016-02-24 18:01 fu.wei
  2016-02-24 18:01 ` [PATCH 1/3] arm64: add grub_xen_boot env to indicate that we have xen_* commands fu.wei
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: fu.wei @ 2016-02-24 18:01 UTC (permalink / raw)
  To: grub-devel, arvidjaar, phcoder
  Cc: xen-devel, Ian.Campbell, jcm, julien.grall, leif.lindholm,
	linaro-uefi, Fu Wei

From: Fu Wei <fu.wei@linaro.org>

This patchset add xen_boot support into grup-mkconfig for
generating xen boot entrances automatically

ChangeLog:
v1 :first upstream patchset.

Fu Wei (3):
  arm64: add grub_xen_boot env to indicate that we have xen_* commands
  * util/grub.d/20_linux_xen.in: Add support of the xen_boot command
  i386,xen: Add xen_hypervisor and xen_module aliases for i386

 grub-core/loader/arm64/xen_boot.c |  8 ++++++++
 grub-core/loader/i386/xen.c       |  7 +++++++
 util/grub.d/20_linux_xen.in       | 18 +++++++++++++++---
 3 files changed, 30 insertions(+), 3 deletions(-)

-- 
2.5.0



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] arm64: add grub_xen_boot env to indicate that we have xen_* commands
  2016-02-24 18:01 [PATCH 0/3] arm64,xen: add xen_boot support into grup-mkconfig fu.wei
@ 2016-02-24 18:01 ` fu.wei
  2016-02-24 18:12   ` Andrei Borzenkov
  2016-02-24 18:01 ` [PATCH 2/3] * util/grub.d/20_linux_xen.in: Add support of the xen_boot command fu.wei
  2016-02-24 18:01 ` [PATCH 3/3] i386, xen: Add xen_hypervisor and xen_module aliases for i386 fu.wei
  2 siblings, 1 reply; 7+ messages in thread
From: fu.wei @ 2016-02-24 18:01 UTC (permalink / raw)
  To: grub-devel, arvidjaar, phcoder
  Cc: xen-devel, Ian.Campbell, jcm, julien.grall, leif.lindholm,
	linaro-uefi, Fu Wei

From: Fu Wei <fu.wei@linaro.org>

Signed-off-by: Fu Wei <fu.wei@linaro.org>
---
 grub-core/loader/arm64/xen_boot.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c
index 8ae43d7..ef03111 100644
--- a/grub-core/loader/arm64/xen_boot.c
+++ b/grub-core/loader/arm64/xen_boot.c
@@ -20,6 +20,7 @@
 #include <grub/charset.h>
 #include <grub/command.h>
 #include <grub/err.h>
+#include <grub/env.h>
 #include <grub/file.h>
 #include <grub/fdt.h>
 #include <grub/list.h>
@@ -490,10 +491,17 @@ GRUB_MOD_INIT (xen_boot)
     grub_register_command ("xen_module", grub_cmd_xen_module, 0,
 			   N_("Load a xen module."));
   my_mod = mod;
+
+/* setup a env to indicate that
+ * we have xen_* commands.
+ */
+  grub_env_set ("grub_xen_boot", "y");
+  grub_env_export ("grub_xen_boot");
 }
 
 GRUB_MOD_FINI (xen_boot)
 {
   grub_unregister_command (cmd_xen_hypervisor);
   grub_unregister_command (cmd_xen_module);
+  grub_env_unset ("grub_xen_boot");
 }
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] * util/grub.d/20_linux_xen.in: Add support of the xen_boot command
  2016-02-24 18:01 [PATCH 0/3] arm64,xen: add xen_boot support into grup-mkconfig fu.wei
  2016-02-24 18:01 ` [PATCH 1/3] arm64: add grub_xen_boot env to indicate that we have xen_* commands fu.wei
@ 2016-02-24 18:01 ` fu.wei
  2016-02-24 18:09   ` Andrei Borzenkov
  2016-02-24 18:01 ` [PATCH 3/3] i386, xen: Add xen_hypervisor and xen_module aliases for i386 fu.wei
  2 siblings, 1 reply; 7+ messages in thread
From: fu.wei @ 2016-02-24 18:01 UTC (permalink / raw)
  To: grub-devel, arvidjaar, phcoder
  Cc: xen-devel, Ian.Campbell, jcm, julien.grall, leif.lindholm,
	linaro-uefi, Fu Wei

From: Fu Wei <fu.wei@linaro.org>

This patch adds the support of xen_boot command:
    xen_hypervisor
    xen_module

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

diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index 46045db..f2a7e95 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -122,16 +122,28 @@ 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 [ -f \$prefix/\$grub_cpu-\$grub_platform/xen_boot.mod ]; then
+            insmod xen_boot
+        fi
+        if [ "x\$grub_xen_boot" != xy ]; then
+            xen_loader="multiboot"
+            linux_loader="module"
+            initrd_loader="module --nounzip"
+        else
+            xen_loader="xen_hypervisor"
+            linux_loader="xen_module"
+            initrd_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}
+	\${linux_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}
+	\${initrd_loader}	${rel_dirname}/${initrd}
 EOF
   fi
   sed "s/^/$submenu_indentation/" << EOF
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] i386, xen: Add xen_hypervisor and xen_module aliases for i386
  2016-02-24 18:01 [PATCH 0/3] arm64,xen: add xen_boot support into grup-mkconfig fu.wei
  2016-02-24 18:01 ` [PATCH 1/3] arm64: add grub_xen_boot env to indicate that we have xen_* commands fu.wei
  2016-02-24 18:01 ` [PATCH 2/3] * util/grub.d/20_linux_xen.in: Add support of the xen_boot command fu.wei
@ 2016-02-24 18:01 ` fu.wei
  2 siblings, 0 replies; 7+ messages in thread
From: fu.wei @ 2016-02-24 18:01 UTC (permalink / raw)
  To: grub-devel, arvidjaar, phcoder
  Cc: xen-devel, Ian.Campbell, jcm, julien.grall, leif.lindholm,
	linaro-uefi, Fu Wei

From: Fu Wei <fu.wei@linaro.org>

Signed-off-by: Fu Wei <fu.wei@linaro.org>
---
 grub-core/loader/i386/xen.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/grub-core/loader/i386/xen.c b/grub-core/loader/i386/xen.c
index c4d9689..15b0727 100644
--- a/grub-core/loader/i386/xen.c
+++ b/grub-core/loader/i386/xen.c
@@ -689,6 +689,7 @@ fail:
 }
 
 static grub_command_t cmd_xen, cmd_initrd, cmd_module, cmd_multiboot;
+static grub_command_t cmd_xen_hypervisor, cmd_xen_module;
 
 GRUB_MOD_INIT (xen)
 {
@@ -696,10 +697,14 @@ GRUB_MOD_INIT (xen)
 				   0, N_("Load Linux."));
   cmd_multiboot = grub_register_command ("multiboot", grub_cmd_xen,
 					 0, N_("Load Linux."));
+  cmd_xen_hypervisor = grub_register_command ("xen_hypervisor", grub_cmd_xen,
+					      0, N_("Load Linux."));
   cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
 				      0, N_("Load initrd."));
   cmd_module = grub_register_command ("module", grub_cmd_module,
 				      0, N_("Load module."));
+  cmd_xen_module = grub_register_command ("xen_module", grub_cmd_module,
+				      0, N_("Load module."));
   my_mod = mod;
 }
 
@@ -709,4 +714,6 @@ GRUB_MOD_FINI (xen)
   grub_unregister_command (cmd_initrd);
   grub_unregister_command (cmd_multiboot);
   grub_unregister_command (cmd_module);
+  grub_unregister_command (cmd_xen_module);
+  grub_unregister_command (cmd_xen_hypervisor);
 }
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] * util/grub.d/20_linux_xen.in: Add support of the xen_boot command
  2016-02-24 18:01 ` [PATCH 2/3] * util/grub.d/20_linux_xen.in: Add support of the xen_boot command fu.wei
@ 2016-02-24 18:09   ` Andrei Borzenkov
  0 siblings, 0 replies; 7+ messages in thread
From: Andrei Borzenkov @ 2016-02-24 18:09 UTC (permalink / raw)
  To: fu.wei, grub-devel, phcoder
  Cc: xen-devel, Ian.Campbell, jcm, julien.grall, leif.lindholm,
	linaro-uefi

24.02.2016 21:01, fu.wei@linaro.org пишет:
> From: Fu Wei <fu.wei@linaro.org>
> 
> This patch adds the support of xen_boot command:
>     xen_hypervisor
>     xen_module
> 
> Signed-off-by: Fu Wei <fu.wei@linaro.org>
> ---
>  util/grub.d/20_linux_xen.in | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
> index 46045db..f2a7e95 100644
> --- a/util/grub.d/20_linux_xen.in
> +++ b/util/grub.d/20_linux_xen.in
> @@ -122,16 +122,28 @@ 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 [ -f \$prefix/\$grub_cpu-\$grub_platform/xen_boot.mod ]; then
> +            insmod xen_boot
> +        fi
> +        if [ "x\$grub_xen_boot" != xy ]; then

This should be feature test, see other mail.

> +            xen_loader="multiboot"
> +            linux_loader="module"
> +            initrd_loader="module --nounzip"
> +        else
> +            xen_loader="xen_hypervisor"
> +            linux_loader="xen_module"
> +            initrd_loader="xen_module"
> +        fi

xen_module will uncompress initrd (at least, as long as corresponding
filters are loaded). This makes two commands incompatible. xen_module
likely needs to support the same option.

> +	\${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}
> +	\${linux_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}
> +	\${initrd_loader}	${rel_dirname}/${initrd}
>  EOF
>    fi
>    sed "s/^/$submenu_indentation/" << EOF
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] arm64: add grub_xen_boot env to indicate that we have xen_* commands
  2016-02-24 18:01 ` [PATCH 1/3] arm64: add grub_xen_boot env to indicate that we have xen_* commands fu.wei
@ 2016-02-24 18:12   ` Andrei Borzenkov
  2016-02-25  6:55     ` Fu Wei
  0 siblings, 1 reply; 7+ messages in thread
From: Andrei Borzenkov @ 2016-02-24 18:12 UTC (permalink / raw)
  To: fu.wei, grub-devel, phcoder
  Cc: xen-devel, Ian.Campbell, jcm, julien.grall, leif.lindholm,
	linaro-uefi

24.02.2016 21:01, fu.wei@linaro.org пишет:
> From: Fu Wei <fu.wei@linaro.org>
> 
> Signed-off-by: Fu Wei <fu.wei@linaro.org>
> ---
>  grub-core/loader/arm64/xen_boot.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c
> index 8ae43d7..ef03111 100644
> --- a/grub-core/loader/arm64/xen_boot.c
> +++ b/grub-core/loader/arm64/xen_boot.c
> @@ -20,6 +20,7 @@
>  #include <grub/charset.h>
>  #include <grub/command.h>
>  #include <grub/err.h>
> +#include <grub/env.h>
>  #include <grub/file.h>
>  #include <grub/fdt.h>
>  #include <grub/list.h>
> @@ -490,10 +491,17 @@ GRUB_MOD_INIT (xen_boot)
>      grub_register_command ("xen_module", grub_cmd_xen_module, 0,
>  			   N_("Load a xen module."));
>    my_mod = mod;
> +
> +/* setup a env to indicate that
> + * we have xen_* commands.
> + */
> +  grub_env_set ("grub_xen_boot", "y");
> +  grub_env_export ("grub_xen_boot");
>  }

Please define feature for it, see grub-core/normal/main.c.

>  
>  GRUB_MOD_FINI (xen_boot)
>  {
>    grub_unregister_command (cmd_xen_hypervisor);
>    grub_unregister_command (cmd_xen_module);
> +  grub_env_unset ("grub_xen_boot");
>  }
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] arm64: add grub_xen_boot env to indicate that we have xen_* commands
  2016-02-24 18:12   ` Andrei Borzenkov
@ 2016-02-25  6:55     ` Fu Wei
  0 siblings, 0 replies; 7+ messages in thread
From: Fu Wei @ 2016-02-25  6:55 UTC (permalink / raw)
  To: Andrei Borzenkov
  Cc: The development of GNU GRUB, xen-devel, Ian Campbell,
	Vladimir Serbinenko, Julien Grall, Leif Lindholm,
	Linaro UEFI Mailman List, Jon Masters

Hi Andrei.

On 25 February 2016 at 02:12, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
> 24.02.2016 21:01, fu.wei@linaro.org пишет:
>> From: Fu Wei <fu.wei@linaro.org>
>>
>> Signed-off-by: Fu Wei <fu.wei@linaro.org>
>> ---
>>  grub-core/loader/arm64/xen_boot.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c
>> index 8ae43d7..ef03111 100644
>> --- a/grub-core/loader/arm64/xen_boot.c
>> +++ b/grub-core/loader/arm64/xen_boot.c
>> @@ -20,6 +20,7 @@
>>  #include <grub/charset.h>
>>  #include <grub/command.h>
>>  #include <grub/err.h>
>> +#include <grub/env.h>
>>  #include <grub/file.h>
>>  #include <grub/fdt.h>
>>  #include <grub/list.h>
>> @@ -490,10 +491,17 @@ GRUB_MOD_INIT (xen_boot)
>>      grub_register_command ("xen_module", grub_cmd_xen_module, 0,
>>                          N_("Load a xen module."));
>>    my_mod = mod;
>> +
>> +/* setup a env to indicate that
>> + * we have xen_* commands.
>> + */
>> +  grub_env_set ("grub_xen_boot", "y");
>> +  grub_env_export ("grub_xen_boot");
>>  }
>
> Please define feature for it, see grub-core/normal/main.c.

Thanks for your suggestion

>
>>
>>  GRUB_MOD_FINI (xen_boot)
>>  {
>>    grub_unregister_command (cmd_xen_hypervisor);
>>    grub_unregister_command (cmd_xen_module);
>> +  grub_env_unset ("grub_xen_boot");
>>  }
>>
>



-- 
Best regards,

Fu Wei
Software Engineer
Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
Ph: +86 21 61221326(direct)
Ph: +86 186 2020 4684 (mobile)
Room 1512, Regus One Corporate Avenue,Level 15,
One Corporate Avenue,222 Hubin Road,Huangpu District,
Shanghai,China 200021


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-02-25  6:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-24 18:01 [PATCH 0/3] arm64,xen: add xen_boot support into grup-mkconfig fu.wei
2016-02-24 18:01 ` [PATCH 1/3] arm64: add grub_xen_boot env to indicate that we have xen_* commands fu.wei
2016-02-24 18:12   ` Andrei Borzenkov
2016-02-25  6:55     ` Fu Wei
2016-02-24 18:01 ` [PATCH 2/3] * util/grub.d/20_linux_xen.in: Add support of the xen_boot command fu.wei
2016-02-24 18:09   ` Andrei Borzenkov
2016-02-24 18:01 ` [PATCH 3/3] i386, xen: Add xen_hypervisor and xen_module aliases for i386 fu.wei

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