10_linux grub2 script.
Index: Xen-Ubuntu-10.04/etc/grub.d/10_linux
===================================================================
diff -Naur Ubuntu-10.04/etc/grub.d/10_linux Xen-Ubuntu-10.04/etc/grub.d/10_linux
--- Ubuntu-10.04/etc/grub.d/10_linux	2010-06-24 12:53:56.000000000 -0700
+++ Xen-Ubuntu-10.04/etc/grub.d/10_linux	2010-06-25 15:09:47.000000000 -0700
@@ -66,10 +66,17 @@
   version="$2"
   recovery="$3"
   args="$4"
-  if ${recovery} ; then
-    title="$(gettext_quoted "%s, with Linux %s (recovery mode)")"
+  xen_path="$6"
+  xen_cmdline="$7"
+  if [ "x$xen_cmdline" != "x" ]; then
+    xen_title=${xen_path%.gz}
+    title="${xen_title#/boot/} $(gettext_quoted "%s, with Linux %s")"
   else
-    title="$(gettext_quoted "%s, with Linux %s")"
+    if ${recovery} ; then
+      title="$(gettext_quoted "%s, with Linux %s (recovery mode)")"
+    else
+      title="$(gettext_quoted "%s, with Linux %s")"
+    fi
   fi
   printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}"
   cat << EOF
@@ -92,9 +99,18 @@
 	echo	'$(printf "$(gettext_quoted "Loading Linux %s ...")" ${version})'
 EOF
   fi
-  cat << EOF
+  if [ "x$xen_cmdline" != "x" ]; then
+    module_or_initrd="module"
+    cat << EOF
+	multiboot ${xen_path} ${xen_cmdline}
+	module	${rel_dirname}/${basename} dummy=dummy root=${linux_root_device_thisversion} ro ${args}
+EOF
+  else
+    module_or_initrd="initrd"
+    cat << EOF
 	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
 EOF
+  fi
   if [ "x$5" != "xquiet" ]; then
     cat << EOF
 	echo	'$(gettext_quoted "Loading initial ramdisk ...")'
@@ -102,7 +118,7 @@
   fi
   if test -n "${initrd}" ; then
     cat << EOF
-	initrd	${rel_dirname}/${initrd}
+	${module_or_initrd}	${rel_dirname}/${initrd}
 EOF
   fi
   cat << EOF
@@ -115,6 +131,9 @@
       done`
 prepare_boot_cache=
 
+# Need to source this because GRUB_CMDLINE_XEN_DEFAULT is not exported in /usr/sbin/grub-mkconfig
+. /etc/default/grub
+
 while [ "x$list" != "x" ] ; do
   linux=`version_find_latest $list`
   echo "Found linux image: $linux" >&2
@@ -141,6 +160,18 @@
     linux_root_device_thisversion=${GRUB_DEVICE}
   fi
 
+  linux_config=${rel_dirname}/config-${version}
+  if grep -q 'CONFIG_XEN_DOM0=y' $linux_config ; then
+    for xen_entry in /boot/xen-*.gz ; do
+      if [ ! -L $xen_entry ]; then
+        echo "  dom0 kernel and Xen hypervisor: $xen_entry" >&2
+        linux_entry "${OS}" "${version}" false \
+            "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_EXTRA} ${GRUB_CMDLINE_LINUX_DEFAULT}" \
+            quiet "${xen_entry}" "${GRUB_CMDLINE_XEN_DEFAULT}"
+      fi
+    done
+  fi
+
   linux_entry "${OS}" "${version}" false \
       "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_EXTRA} ${GRUB_CMDLINE_LINUX_DEFAULT}" \
       quiet
