ia64/xen-unstable

changeset 8699:4cce50ba4520

Adding network testing support for xm-test with hvm.
1) Added capability for create_disk_image script to copy pcnet32
driver to disk.img. Added new cmdline option so can specify
driver directory.
2) Added configuration --with-driver-dir=DVRDIR option so
can specify where driver is at configure time. "builtin"
keyword lets specify that driver is built into kernel.
3) Updated Makefile.am to build with new options.
4) Updated README to reflect changes.

Signed-off-by: Daniel Stekloff <dsteklof@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Sun Jan 29 10:55:28 2006 +0100 (2006-01-29)
parents d05c39dcc374
children 1712b52e0074 6411e42ae497
files tools/xm-test/README tools/xm-test/configure.ac tools/xm-test/ramdisk/Makefile.am tools/xm-test/ramdisk/bin/create_disk_image
line diff
     1.1 --- a/tools/xm-test/README	Sun Jan 29 10:54:52 2006 +0100
     1.2 +++ b/tools/xm-test/README	Sun Jan 29 10:55:28 2006 +0100
     1.3 @@ -55,6 +55,10 @@ you should not attempt to use a ramdisk 
     1.4  of xm-test (i.e., don't use a ramdisk from 0.4.0 with 0.5.0.  0.5.0
     1.5  should work for 0.5.3 though)
     1.6  
     1.7 +
     1.8 +BUILDING with HVM Support
     1.9 +=========================
    1.10 +
    1.11  If you'd like to build and run this with hardware virtual machine assist
    1.12  (HVM) support to test fully virtualized disk images on VMX hardware, 
    1.13  please add the --enable-vmx-support option to configure:
    1.14 @@ -81,6 +85,20 @@ with the "--with-vmx-kernel=KERNEL" opti
    1.15  Otherwise, you can always rerun the create script using the -k option
    1.16  to use a specific kernel. 
    1.17  
    1.18 +The disk.img created for HVM testing must contain a pcnet32 driver for
    1.19 +network tests. The ramdisk/bin/create_disk_image script will, by default,
    1.20 +look in the /lib/modules directory associated with the kernel being
    1.21 +used. If you'd like to specify a different location for the driver or
    1.22 +want to tell the script that the driver is built into the kernel, please
    1.23 +use the "--with-driver-dir=DRVDIR" configure option. If built into
    1.24 +the kernel, please use the key word "builtin" with the option:
    1.25 +
    1.26 +# ./autogen
    1.27 +# ./configure --enable-vmx-support --with-driver-dir=builtin
    1.28 +- or -
    1.29 +# ./configure --enable-vmx-support --with-driver-dir=/driver/directory
    1.30 +# make
    1.31 +
    1.32  Xm-test will look for disk.img in the ramdisk directory when run by 
    1.33  default.
    1.34  
     2.1 --- a/tools/xm-test/configure.ac	Sun Jan 29 10:54:52 2006 +0100
     2.2 +++ b/tools/xm-test/configure.ac	Sun Jan 29 10:55:28 2006 +0100
     2.3 @@ -46,6 +46,14 @@ AC_ARG_WITH(vmx-kernel,
     2.4  dnl substitute @VMXKERNEL@ in all Makefiles
     2.5  AC_SUBST(VMXKERNEL)
     2.6  
     2.7 +AC_ARG_WITH(driver-dir,
     2.8 +	[[  --with-driver-dir=drvdir       Look in this directory for the pcnet32 driver for the vmx disk.img. drvdir can equal key word "builtin" if driver is built into the kernel]],
     2.9 +	DRVDIR=$withval,
    2.10 +	DRVDIR="no")
    2.11 +
    2.12 +dnl substitute @DRVDIR@ in all Makefiles
    2.13 +AC_SUBST(DRVDIR)
    2.14 +
    2.15  AC_SUBST(TENV)
    2.16  AC_SUBST(PACKAGE_VERSION)
    2.17  
     3.1 --- a/tools/xm-test/ramdisk/Makefile.am	Sun Jan 29 10:54:52 2006 +0100
     3.2 +++ b/tools/xm-test/ramdisk/Makefile.am	Sun Jan 29 10:55:28 2006 +0100
     3.3 @@ -45,10 +45,15 @@ initrd.img: $(XMTEST_VER_IMG)
     3.4  
     3.5  disk.img: $(XMTEST_VER_IMG)
     3.6  	chmod a+x $(VMX_SCRIPT)
     3.7 -	@if test "$(VMXKERNEL)" = "no" ; then \
     3.8 +	@if test ! "$(VMXKERNEL)" = "no" -a ! "$(DRVDIR)" = "no"; then \
     3.9 +		$(VMX_SCRIPT) -r $(XMTEST_VER_IMG) -k $(VMXKERNEL) \
    3.10 +			-d $(DRVDIR); \
    3.11 +	elif test "$(VMXKERNEL)" = "no" -a ! "$(DRVDIR)" = "no"; then \
    3.12 +		$(VMX_SCRIPT) -r $(XMTEST_VER_IMG) -d $(DRVDIR); \
    3.13 +	elif test ! "$(VMXKERNEL)" = "no" -a "$(DRVDIR)" = "no"; then \
    3.14 +		$(VMX_SCRIPT) -r $(XMTEST_VER_IMG) -k $(VMXKERNEL); \
    3.15 +	else \
    3.16  		$(VMX_SCRIPT) -r $(XMTEST_VER_IMG); \
    3.17 -	else \
    3.18 -		$(VMX_SCRIPT) -r $(XMTEST_VER_IMG) -k $(VMXKERNEL); \
    3.19  	fi
    3.20  
    3.21  existing:
     4.1 --- a/tools/xm-test/ramdisk/bin/create_disk_image	Sun Jan 29 10:54:52 2006 +0100
     4.2 +++ b/tools/xm-test/ramdisk/bin/create_disk_image	Sun Jan 29 10:55:28 2006 +0100
     4.3 @@ -20,6 +20,8 @@
     4.4  ###############################################################################
     4.5  function cleanup()
     4.6  {
     4.7 +	umount "$MNT"
     4.8 +	rm -Rf "$MNT";
     4.9  	if [ "$LOOPD" ]; then
    4.10  		losetup -d $LOOPD
    4.11  	fi
    4.12 @@ -49,10 +51,22 @@ Command creates a vmx guest disk image f
    4.13  Usage: $0 [OPTIONS]
    4.14  
    4.15  OPTIONS:
    4.16 +    -d|--dvrdir <name>       Directory where to fine network driver 
    4.17 +                             to use for disk image. 
    4.18      -i|--image <name>        Image name to create.
    4.19      -k|--kernel <name>       Kernel name to use for disk image.
    4.20      -r|--rootfs <image>      Rootfs image to use for disk image.
    4.21  
    4.22 +This script currently only supports the pcnet32 driver for network
    4.23 +tests. If a dvrdir isn't added on the command-line, it will look
    4.24 +in /lib/modules/ directory relating to the supplied kernel. If the
    4.25 +network driver is built into the kernel, you can specify the key word
    4.26 +"builtin" with the -d option and the script will continue.
    4.27 +
    4.28 +Note: The pcnet32 driver relies upon mii.ko. This script will look
    4.29 +for that module in the same location as the pcnet32 driver, either
    4.30 +for the kernel or the location used with the -d option.
    4.31 +
    4.32  EOU
    4.33  }
    4.34  
    4.35 @@ -79,6 +93,7 @@ function initialize_globals()
    4.36  	PROGNAME="create_disk_image"
    4.37  	IMAGE="disk.img"
    4.38  	KERNEL=""
    4.39 +	DRVDIR=""
    4.40  	LCONF="lilo.conf"
    4.41  	LOOPD=""    # Loop device for entire disk image
    4.42  	LOOPP=""    # Loop device for ext partition
    4.43 @@ -96,6 +111,11 @@ function get_options()
    4.44  {
    4.45  	while [ $# -gt 0 ]; do
    4.46  		case $1 in
    4.47 +			-d|--drvdir)
    4.48 +				shift
    4.49 +				DRVDIR=${1}
    4.50 +				shift
    4.51 +				;;
    4.52  			-i|--image)
    4.53  				shift
    4.54  				IMAGE=${1}
    4.55 @@ -221,6 +241,36 @@ function copy_kernel_to_image()
    4.56  	cp "$KERNEL" "$MNT/boot"
    4.57  }
    4.58  
    4.59 +function copy_netdriver_to_image()
    4.60 +{
    4.61 +	local kernel=`basename $KERNEL`
    4.62 +	local kversion=$( echo $kernel | sed 's/^vmlinuz-//' )
    4.63 +	local fdir="/lib/modules/$kversion/kernel/drivers/net"
    4.64 +                                                                                
    4.65 +	mkdir "$MNT/lib/modules"
    4.66 +	if [ -e "$DRVDIR" ]; then
    4.67 +		if [ -e "$DRVDIR/pcnet32.ko" ]; then
    4.68 +			cp $DRVDIR/mii.ko $MNT/lib/modules
    4.69 +			cp $DRVDIR/pcnet32.ko $MNT/lib/modules
    4.70 +		else
    4.71 +			die "Failed to find pcnet32.ko at $DRVDIR."
    4.72 +		fi
    4.73 +	elif [ -e "$fdir/pcnet32.ko" ]; then
    4.74 +		cp $fdir/mii.ko $MNT/lib/modules
    4.75 +		cp $fdir/pcnet32.ko $MNT/lib/modules
    4.76 +	else
    4.77 +		die "Xm-test requires the pcnet32 driver to run."
    4.78 +	fi
    4.79 +
    4.80 +	# Make sure that modules will be installed
    4.81 +	if [ -e "$MNT/etc/init.d/rcS" ]; then
    4.82 +		echo "insmod /lib/modules/mii.ko" >> $MNT/etc/init.d/rcS
    4.83 +		echo "insmod /lib/modules/pcnet32.ko" >> $MNT/etc/init.d/rcS
    4.84 +	else
    4.85 +		die "Failed to add insmod command to rcS file on image."
    4.86 +	fi
    4.87 +}
    4.88 +
    4.89  function lilo_image()
    4.90  {
    4.91  	local kernel=`basename $KERNEL`
    4.92 @@ -303,6 +353,9 @@ if [ $? -ne 0 ]; then
    4.93  fi
    4.94  
    4.95  copy_kernel_to_image
    4.96 +if [ ! "$DRVDIR" = "builtin" ]; then
    4.97 +	copy_netdriver_to_image
    4.98 +fi
    4.99  #add_getty_to_inittab
   4.100  
   4.101  lilo_image