Skip to contentSkip to conversation

arm64,xen: add xen_boot support into grup-mkconfig

PATCH Superseded [email protected] 2 participants 7 messages Feb 24, 2016 – Feb 25, 2016

v1 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

cover arm64,xen: add xen_boot support into grup-mkconfig

From: Fu Wei <[email protected]>

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(-)
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/3 arm64: add grub_xen_boot env to indicate that we have xen_* commands

From: Fu Wei <[email protected]>

---
 grub-core/loader/arm64/xen_boot.c | 8 ++++++++
 1 file changed, 8 insertions(+)
grub-core/loader/arm64/xen_boot.c +8 -0
index 8ae43d7..ef03111 100644
@@ -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");
 }
Signature · 1 line
2.5.0
#2 lore raw

Re: [PATCH 1/3] arm64: add grub_xen_boot env to indicate that we have xen_* commands

24.02.2016 21:01, [email protected] пишет:

Quoted 20 lines

From: Fu Wei <[email protected]>

---
 grub-core/loader/arm64/xen_boot.c | 8 ++++++++
 1 file changed, 8 insertions(+)
grub-core/loader/arm64/xen_boot.c +1 -0
index 8ae43d7..ef03111 100644
@@ -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>

grub-core/loader/arm64/xen_boot.c GRUB_MOD_INIT (xen_boot) · line 500

Quoted 10 lines
grub-core/loader/arm64/xen_boot.c +6 -0
@@ -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-core/loader/arm64/xen_boot.c GRUB_MOD_INIT (xen_boot)

Quoted 8 lines
grub-core/loader/arm64/xen_boot.c +1 -0
 GRUB_MOD_FINI (xen_boot)
 {
   grub_unregister_command (cmd_xen_hypervisor);
   grub_unregister_command (cmd_xen_module);
+  grub_env_unset ("grub_xen_boot");
 }
 

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

author
#3 lore raw

Re: [PATCH 1/3] arm64: add grub_xen_boot env to indicate that we have xen_* commands

Hi Andrei.

Quoted 25 lines · Andrei Borzenkov

24.02.2016 21:01, [email protected] пишет:

Quoted 24 lines

From: Fu Wei <[email protected]>

---
 grub-core/loader/arm64/xen_boot.c | 8 ++++++++
 1 file changed, 8 insertions(+)
grub-core/loader/arm64/xen_boot.c +2 -0
index 8ae43d7..ef03111 100644
@@ -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;
+
Quoted 8 lines

grub-core/loader/arm64/xen_boot.c GRUB_MOD_INIT (xen_boot) · line 500

Quoted 6 lines
grub-core/loader/arm64/xen_boot.c +5 -0
+/* 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

Quoted 10 lines
Quoted 9 lines
grub-core/loader/arm64/xen_boot.c +1 -0
 GRUB_MOD_FINI (xen_boot)
 {
   grub_unregister_command (cmd_xen_hypervisor);
   grub_unregister_command (cmd_xen_module);
+  grub_env_unset ("grub_xen_boot");
 }
 
Signature · 15 lines
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

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#4 lore raw

PATCH 2/3 * util/grub.d/20_linux_xen.in: Add support of the xen_boot command

In reply to [email protected]

From: Fu Wei <[email protected]>

This patch adds the support of xen_boot command:
xen_hypervisor
xen_module

---
 util/grub.d/20_linux_xen.in | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
util/grub.d/20_linux_xen.in +15 -3
index 46045db..f2a7e95 100644
@@ -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
Signature · 1 line
2.5.0
#5 lore raw

Re: [PATCH 2/3] * util/grub.d/20_linux_xen.in: Add support of the xen_boot command

24.02.2016 21:01, [email protected] пишет:

Quoted 16 lines

From: Fu Wei <[email protected]>

This patch adds the support of xen_boot command:
xen_hypervisor
xen_module

---
 util/grub.d/20_linux_xen.in | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
util/grub.d/20_linux_xen.in +0 -0
index 46045db..f2a7e95 100644

util/grub.d/20_linux_xen.in linux_entry () · line 128

Quoted 8 lines
util/grub.d/20_linux_xen.in +4 -1
@@ -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.

util/grub.d/20_linux_xen.in linux_entry () · line 136

Quoted 8 lines
util/grub.d/20_linux_xen.in +8 -0
+            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.

Quoted 6 lines
util/grub.d/20_linux_xen.in +2 -1
+	\${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

util/grub.d/20_linux_xen.in linux_entry () · line 149

Quoted 10 lines
util/grub.d/20_linux_xen.in +1 -1
   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

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#6 lore raw

PATCH 3/3 i386, xen: Add xen_hypervisor and xen_module aliases for i386

In reply to [email protected]

From: Fu Wei <[email protected]>

---
 grub-core/loader/i386/xen.c | 7 +++++++
 1 file changed, 7 insertions(+)
grub-core/loader/i386/xen.c +7 -0
index c4d9689..15b0727 100644
@@ -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);
 }
Signature · 1 line
2.5.0