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

Robert Millan rmh at aybabtu.com
Mon Jun 16 23:33:37 UTC 2008


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?

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




-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)



More information about the Pkg-grub-devel mailing list