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(-)
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"); }
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");
}
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");
}
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
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
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); }