diff mbox

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

Message ID 1456336901-25708-3-git-send-email-fu.wei@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

fu.wei@linaro.org Feb. 24, 2016, 6:01 p.m. UTC
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(-)

Comments

Andrei Borzenkov Feb. 24, 2016, 6:09 p.m. UTC | #1
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
>
diff mbox

Patch

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