Fixing update-grub to work with paravirt ops (2.6.22+) Xen kernels

Ian Campbell ijc at hellion.org.uk
Tue Jun 17 06:29:17 UTC 2008


On Tue, 2008-06-17 at 01:33 +0200, Robert Millan wrote:
> Hi Ian,
> 
> After the response from Joey, I checked the update-grub-no-xen-special-case
> patch you sent (quoted below), but it doesn't seem to completely disable
> any explicit check for Xen.
> 
> Is this only intended to preserve compatibility with pre-CONFIG_PARAVIRT
> Linux builds?

I _think_ (it was a while back!) I was trying to arrange it so that you
would get a standard entry for every kernel regardless of Xen-ness and
if a hypervisor was present (a decent sign you are dom0) then you would
also get an entry with hypervisor+kernel for every kernel which looked
like it was capable of dom0 use, which means old ones with
PRIVILEGED_GUEST and all new PARAVIRT ones.

Ian.

> 
> On Wed, May 07, 2008 at 09:42:24PM +0100, Ian Campbell wrote:
> > Index: trunk/debian/update-grub
> > ===================================================================
> > --- trunk.orig/debian/update-grub	2008-05-05 17:30:19.000000000 +0100
> > +++ trunk/debian/update-grub	2008-05-05 17:30:28.000000000 +0100
> > @@ -777,14 +777,17 @@
> >         echo "none found, skipping ..." >&2
> >  fi
> >  
> > -
> > -xenKernels=""
> > -for ver in `grep -l CONFIG_XEN_PRIVILEGED_GUEST=y /boot/config* | sed -e s%/boot/config-%%`; do
> > +xen0Kernels=""
> > +# First old style non-CONFIG_PARAVIRT kernels with xen0 support.
> > +for ver in `grep -l CONFIG_XEN=y /boot/config* | sed -e s%/boot/config-%%`; do
> > +  if ! grep -q CONFIG_XEN_PRIVILEGED_GUEST=y /boot/config-$ver ; then
> > +      continue
> > +  fi
> >    # ver is a kernel version
> >    kern="/boot/vmlinuz-$ver"
> >    if [ -r $kern ] ; then
> >         newerKernels=""
> > -       for i in $xenKernels ; do
> > +       for i in $xen0Kernels ; do
> >                  res=$(CompareVersions "$kern" "$i")
> >                  if [ "$kern" != "" ] && [ "$res" -gt 0 ] ; then
> >                          newerKernels="$newerKernels $kern $i"
> > @@ -796,30 +799,38 @@
> >          if [ "$kern" != "" ] ; then
> >                  newerKernels="$newerKernels $kern"
> >          fi
> > -        xenKernels="$newerKernels"
> > +        xen0Kernels="$newerKernels"
> >      fi
> >  done
> >  
> > -in_domU=
> > -if [ -e /proc/xen/capabilities ] && ! grep -q "control_d" /proc/xen/capabilities; then
> > -	in_domU=1
> > -fi
> > +# Second new style CONFIG_PARAVIRT kernels with xen support. There is
> > +# no distinction between xen0 and xenU in these kernels.
> > +for ver in `grep -l CONFIG_PARAVIRT=y /boot/config* | sed -e s%/boot/config-%%`; do
> > +  if ! grep -q CONFIG_XEN=y /boot/config-$ver ; then
> > +      continue
> > +  fi
> > +  # ver is a kernel version
> > +  kern="/boot/vmlinuz-$ver"
> > +  if [ -r $kern ] ; then
> > +       newerKernels=""
> > +       for i in $xen0Kernels ; do
> > +                res=$(CompareVersions "$kern" "$i")
> > +                if [ "$kern" != "" ] && [ "$res" -gt 0 ] ; then
> > +                        newerKernels="$newerKernels $kern $i"
> > +                        kern=""
> > +                else
> > +                        newerKernels="$newerKernels $i"
> > +                fi
> > +        done
> > +        if [ "$kern" != "" ] ; then
> > +                newerKernels="$newerKernels $kern"
> > +        fi
> > +        xen0Kernels="$newerKernels"
> > +    fi
> > +done
> >  
> >  sortedKernels=""
> >  for kern in $(/bin/ls -1vr /boot | grep -v "dpkg-*" | grep "^vmlinuz-") ; do
> > -	if `echo "$xenKernels" | grep -q "$kern "` || `echo "$kern" | grep -q "xen"`; then
> > -		is_xen=1
> > -	else
> > -		is_xen=
> > -	fi
> > -
> > -	if [ ! "$in_domU" ] && [ "$is_xen" ]; then
> > -	  # skip xen kernels
> > -          continue
> > -        elif [ "$in_domU" ] && ! [ "$is_xen" ]; then
> > -	  # skip non-xen kernels
> > -	  continue
> > -        fi
> >          kern="/boot/$kern"
> >  	newerKernels=""
> >  	for i in $sortedKernels ; do
> > @@ -912,7 +923,7 @@
> >      
> >  
> >  # Xen entries first.
> > -for kern in $xenKernels ; do
> > +for kern in $xen0Kernels ; do
> >  	if test ! x"$howmany" = x"all" ; then
> >  		if [ $counter -gt $howmany ] ; then
> >  			break
> 
> 
> 
> 
-- 
Ian Campbell

An expert is a person who avoids the small errors as he sweeps on to the
grand fallacy.
		-- Benjamin Stolberg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20080617/b888cccb/attachment.pgp 


More information about the Pkg-grub-devel mailing list