aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xm-test/ramdisk
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-01-29 10:55:28 +0100
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-01-29 10:55:28 +0100
commite2f6e7621988388a5139a0a4e8a3509906be04ba (patch)
tree9dcb16bdeffaa02a78b46bc6dc6e2ad417b32fc6 /tools/xm-test/ramdisk
parent99957fb4c400c63513efccd4b0cbab27c1dabd9f (diff)
downloadxen-e2f6e7621988388a5139a0a4e8a3509906be04ba.tar.gz
xen-e2f6e7621988388a5139a0a4e8a3509906be04ba.tar.bz2
xen-e2f6e7621988388a5139a0a4e8a3509906be04ba.zip
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>
Diffstat (limited to 'tools/xm-test/ramdisk')
-rw-r--r--tools/xm-test/ramdisk/Makefile.am11
-rw-r--r--tools/xm-test/ramdisk/bin/create_disk_image53
2 files changed, 61 insertions, 3 deletions
diff --git a/tools/xm-test/ramdisk/Makefile.am b/tools/xm-test/ramdisk/Makefile.am
index 216928bd42..21133f5c4e 100644
--- a/tools/xm-test/ramdisk/Makefile.am
+++ b/tools/xm-test/ramdisk/Makefile.am
@@ -45,10 +45,15 @@ initrd.img: $(XMTEST_VER_IMG)
disk.img: $(XMTEST_VER_IMG)
chmod a+x $(VMX_SCRIPT)
- @if test "$(VMXKERNEL)" = "no" ; then \
- $(VMX_SCRIPT) -r $(XMTEST_VER_IMG); \
- else \
+ @if test ! "$(VMXKERNEL)" = "no" -a ! "$(DRVDIR)" = "no"; then \
+ $(VMX_SCRIPT) -r $(XMTEST_VER_IMG) -k $(VMXKERNEL) \
+ -d $(DRVDIR); \
+ elif test "$(VMXKERNEL)" = "no" -a ! "$(DRVDIR)" = "no"; then \
+ $(VMX_SCRIPT) -r $(XMTEST_VER_IMG) -d $(DRVDIR); \
+ elif test ! "$(VMXKERNEL)" = "no" -a "$(DRVDIR)" = "no"; then \
$(VMX_SCRIPT) -r $(XMTEST_VER_IMG) -k $(VMXKERNEL); \
+ else \
+ $(VMX_SCRIPT) -r $(XMTEST_VER_IMG); \
fi
existing:
diff --git a/tools/xm-test/ramdisk/bin/create_disk_image b/tools/xm-test/ramdisk/bin/create_disk_image
index dad6d2494b..836e8a5c14 100644
--- a/tools/xm-test/ramdisk/bin/create_disk_image
+++ b/tools/xm-test/ramdisk/bin/create_disk_image
@@ -20,6 +20,8 @@
###############################################################################
function cleanup()
{
+ umount "$MNT"
+ rm -Rf "$MNT";
if [ "$LOOPD" ]; then
losetup -d $LOOPD
fi
@@ -49,10 +51,22 @@ Command creates a vmx guest disk image for xm-test.
Usage: $0 [OPTIONS]
OPTIONS:
+ -d|--dvrdir <name> Directory where to fine network driver
+ to use for disk image.
-i|--image <name> Image name to create.
-k|--kernel <name> Kernel name to use for disk image.
-r|--rootfs <image> Rootfs image to use for disk image.
+This script currently only supports the pcnet32 driver for network
+tests. If a dvrdir isn't added on the command-line, it will look
+in /lib/modules/ directory relating to the supplied kernel. If the
+network driver is built into the kernel, you can specify the key word
+"builtin" with the -d option and the script will continue.
+
+Note: The pcnet32 driver relies upon mii.ko. This script will look
+for that module in the same location as the pcnet32 driver, either
+for the kernel or the location used with the -d option.
+
EOU
}
@@ -79,6 +93,7 @@ function initialize_globals()
PROGNAME="create_disk_image"
IMAGE="disk.img"
KERNEL=""
+ DRVDIR=""
LCONF="lilo.conf"
LOOPD="" # Loop device for entire disk image
LOOPP="" # Loop device for ext partition
@@ -96,6 +111,11 @@ function get_options()
{
while [ $# -gt 0 ]; do
case $1 in
+ -d|--drvdir)
+ shift
+ DRVDIR=${1}
+ shift
+ ;;
-i|--image)
shift
IMAGE=${1}
@@ -221,6 +241,36 @@ function copy_kernel_to_image()
cp "$KERNEL" "$MNT/boot"
}
+function copy_netdriver_to_image()
+{
+ local kernel=`basename $KERNEL`
+ local kversion=$( echo $kernel | sed 's/^vmlinuz-//' )
+ local fdir="/lib/modules/$kversion/kernel/drivers/net"
+
+ mkdir "$MNT/lib/modules"
+ if [ -e "$DRVDIR" ]; then
+ if [ -e "$DRVDIR/pcnet32.ko" ]; then
+ cp $DRVDIR/mii.ko $MNT/lib/modules
+ cp $DRVDIR/pcnet32.ko $MNT/lib/modules
+ else
+ die "Failed to find pcnet32.ko at $DRVDIR."
+ fi
+ elif [ -e "$fdir/pcnet32.ko" ]; then
+ cp $fdir/mii.ko $MNT/lib/modules
+ cp $fdir/pcnet32.ko $MNT/lib/modules
+ else
+ die "Xm-test requires the pcnet32 driver to run."
+ fi
+
+ # Make sure that modules will be installed
+ if [ -e "$MNT/etc/init.d/rcS" ]; then
+ echo "insmod /lib/modules/mii.ko" >> $MNT/etc/init.d/rcS
+ echo "insmod /lib/modules/pcnet32.ko" >> $MNT/etc/init.d/rcS
+ else
+ die "Failed to add insmod command to rcS file on image."
+ fi
+}
+
function lilo_image()
{
local kernel=`basename $KERNEL`
@@ -303,6 +353,9 @@ if [ $? -ne 0 ]; then
fi
copy_kernel_to_image
+if [ ! "$DRVDIR" = "builtin" ]; then
+ copy_netdriver_to_image
+fi
#add_getty_to_inittab
lilo_image