Attached is now a patch which ignores Xen kernels,
by grepping for the config options which uses grub-legacy to detect
them.

It seems [0] that Xen Dom0 support will be soon in the official kernel.
I don't know anything about the config options which will be then used.

So it could be that the config options aren't that right in the future,
when there's again a Xen Dom0 kernel in Debian or if you compile your
own.

But if anyone wants to work on implementing Xen specific handling for
grub2 then please base your work on that patch now.
Don't use the filename as I first did.

[0] http://lists.debian.org/debian-devel/2008/07/msg01012.html
--- /etc/grub.d/10_linux	2008-07-28 12:51:00.000000000 +0200
+++ /etc/grub.d/10_linux	2008-07-31 14:54:34.000000000 +0200
@@ -150,7 +150,7 @@
 }
 
 list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
-        if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
+        if grub_file_is_not_garbage "$i" && ! is_xen_kernel "$i" ; then echo -n "$i " ; fi
       done`
 
 if [ "x$list" != "x" ] ; then
--- /usr/lib/grub/update-grub_lib	2008-07-31 13:05:57.000000000 +0200
+++ /usr/lib/grub/update-grub_lib	2008-07-31 14:41:32.000000000 +0200
@@ -156,3 +156,22 @@
   fi
   return 0
 }
+is_xen_kernel()
+{
+  ver=`echo $1 | sed -re 's%[-/A-Za-z]*%%'`
+  # according to grub-legacy's update-grub it applies to both.
+  if `grep -q CONFIG_XEN=y /boot/config-${ver}` ; then
+
+    # old style non-CONFIG_PARAVIRT kernels with xen0 support.
+    if `grep -q CONFIG_XEN_PRIVILEGED_GUEST=y /boot/config-${ver}` ; then
+      return 0
+    fi
+
+    # new style CONFIG_PARAVIRT kernels with xen support. There is
+    # no distinction between xen0 and xenU in these kernels.
+      if `grep -q CONFIG_PARAVIRT=y /boot/config-${ver}` ; then
+        return 0
+      fi
+  fi
+  return 1;
+}

Reply via email to