chiark / gitweb /
* Default kernel image guesser is more sophisticated - now we look
authorIan Jackson <ian@anarres>
Tue, 3 Apr 2007 16:41:20 +0000 (17:41 +0100)
committerIan Jackson <ian@anarres>
Tue, 3 Apr 2007 16:41:20 +0000 (17:41 +0100)
  for something that looks like a Xen kernel rather than guessing
  from the filename since the filenames seem unstable.

debian/changelog
xen/README
xen/readconfig.in
xen/setup

index b7b08075a5df81e482b7d22d6b816e30cb976b06..eb8aefa356f6471db98fd07abb5710853008d499 100644 (file)
@@ -8,8 +8,11 @@ autopkgtest (0.7.2~~iwj) unstable; urgency=low
   * new `timeout=' option on `execute' virt server command.
   * set some default timeouts (these should be settable with options,
     really).
   * new `timeout=' option on `execute' virt server command.
   * set some default timeouts (these should be settable with options,
     really).
+  * Default kernel image guesser is more sophisticated - now we look
+    for something that looks like a Xen kernel rather than guessing
+    from the filename since the filenames seem unstable.
 
 
-  -- Ian Jackson <iwj@ubuntu.com>  Fri, 23 Mar 2007 16:58:42 +0000
+ --
 
 autopkgtest (0.7.2) feisty; urgency=low
 
 
 autopkgtest (0.7.2) feisty; urgency=low
 
index ed137120197a95b76778203b46474a8c4c8ba860..cd11f063d45f844328d516c9dd2ae172298a638e 100644 (file)
@@ -121,10 +121,10 @@ adt_fw_hook               <config> with _config replaced with _fwhook
 
 ---------- Items that are likely to need attention ----------
 
 
 ---------- Items that are likely to need attention ----------
 
-adt_kernel             the booted kernel file /boot/xen*`uname -r`
+adt_kernel             Xen kernel matching /boot/xen*`uname -r`
        Kernel to boot in the testbed image
 
        Kernel to boot in the testbed image
 
-adt_ramdisk            <kernel>.initrd.img
+adt_ramdisk            initrd.img-* where <kernel> is vmlinuz-*
        Initial ramdisk to provide to the testbid image.
        "none" means do not provide an initial ramdisk.
 
        Initial ramdisk to provide to the testbid image.
        "none" means do not provide an initial ramdisk.
 
index 15c58b98457c935b0563985b44ec39c3b26e25ba..b9582935d7b86474093cf197d7373a8853b0eb05 100644 (file)
@@ -103,26 +103,53 @@ case "$adt_lvm_vg" in
        ;;
 esac
 
        ;;
 esac
 
-case "$adt_kernel" in
-'')
+if [ "$adt_readconfig_needkernel" ]; then
+ case "$adt_kernel" in
+ '')
        printf "searching for kernel ... "
        printf "searching for kernel ... "
-       for f in /boot/xen*"`uname -r`"; do
+       for f in /boot/*"`uname -r`"*; do
                test -e "$f" || continue
                test -e "$f" || continue
+               printf "(%s:" "$f"
+               output="$(file -- "$f")"
+               case "$output" in
+               *"gzip compressed data"*) ;;
+               *) printf "!gzip) "; continue ;;
+               esac
+               trap 'rm -f -- "$tf"; exit 127' 0
+               tf=`mktemp -t`
+               zcat -- "$f" >"$tf"
+               output="$(file -- "$tf")"
+               case "$output" in
+               *"ELF "*" executable,"*) ;;
+               *) printf "!ELF) "; continue;;
+               esac
+               output="$(objdump -j __xen_guest -s -- "$tf")"
+               rm -f "$tf"; trap '' 0
+               case "$output" in
+               *" __xen_guest:"*) ;;
+               *) printf "!Xen) "; continue
+               esac
+               printf "y) "
                test "x$adt_kernel" = x || \
                        fail 'several kernels, config must specify which'
                adt_kernel="$f"
        done
                test "x$adt_kernel" = x || \
                        fail 'several kernels, config must specify which'
                adt_kernel="$f"
        done
+       [ "x$adt_kernel" != x ] || \
+               fail 'could not find currently booted Xen kernel'
        echo "using currently booted kernel: $adt_kernel"
        ;;
        echo "using currently booted kernel: $adt_kernel"
        ;;
-esac
+ esac
 
 
-case "$adt_ramdisk" in
-none)  echo "ramdisk \`none' specified, using static kernel"
+ case "$adt_ramdisk" in
+ none) echo "ramdisk \`none' specified, using static kernel"
        adt_ramdisk='' ;;
        adt_ramdisk='' ;;
-'')    adt_ramdisk="$adt_kernel.initrd.img"
-       echo "using default ramdisk <kernel>.initrd.img: $adt_ramdisk" ;;
-*)     ;;
-esac
+ '')   adt_ramdisk="${adt_kernel/\/vmlinuz-//initrd.img-}"
+       test -e "$adt_ramdisk" || \
+ fail "calculated default ramdisk initrd.img \`$adt_ramdisk' does not exist"
+       echo "using calculated default ramdisk initrd.img: $adt_ramdisk" ;;
+ *)    ;;
+ esac
+fi
 
 case "$adt_modules" in
 '')    adt_modules="/lib/modules/`uname -r`" ;;
 
 case "$adt_modules" in
 '')    adt_modules="/lib/modules/`uname -r`" ;;
index d617a88f04fd628bb9c0118cf4947b0485e8abe3..6a69b64ff0533fa4c86ae91d975d4c0a540d99a9 100755 (executable)
--- a/xen/setup
+++ b/xen/setup
@@ -1,5 +1,6 @@
 #!/bin/bash
 set -e
 #!/bin/bash
 set -e
+adt_readconfig_needkernel=y
 . ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/readconfig
 test $nonoptargs = 0 || fail "non-option arguments not allowed"
 
 . ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/readconfig
 test $nonoptargs = 0 || fail "non-option arguments not allowed"