of xm-test (i.e., don't use a ramdisk from 0.4.0 with 0.5.0. 0.5.0
should work for 0.5.3 though)
+
+BUILDING with HVM Support
+=========================
+
If you'd like to build and run this with hardware virtual machine assist
(HVM) support to test fully virtualized disk images on VMX hardware,
please add the --enable-vmx-support option to configure:
Otherwise, you can always rerun the create script using the -k option
to use a specific kernel.
+The disk.img created for HVM testing must contain a pcnet32 driver for
+network tests. The ramdisk/bin/create_disk_image script will, by default,
+look in the /lib/modules directory associated with the kernel being
+used. If you'd like to specify a different location for the driver or
+want to tell the script that the driver is built into the kernel, please
+use the "--with-driver-dir=DRVDIR" configure option. If built into
+the kernel, please use the key word "builtin" with the option:
+
+# ./autogen
+# ./configure --enable-vmx-support --with-driver-dir=builtin
+- or -
+# ./configure --enable-vmx-support --with-driver-dir=/driver/directory
+# make
+
Xm-test will look for disk.img in the ramdisk directory when run by
default.
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:
###############################################################################
function cleanup()
{
+ umount "$MNT"
+ rm -Rf "$MNT";
if [ "$LOOPD" ]; then
losetup -d $LOOPD
fi
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
}
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
{
while [ $# -gt 0 ]; do
case $1 in
+ -d|--drvdir)
+ shift
+ DRVDIR=${1}
+ shift
+ ;;
-i|--image)
shift
IMAGE=${1}
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`
fi
copy_kernel_to_image
+if [ ! "$DRVDIR" = "builtin" ]; then
+ copy_netdriver_to_image
+fi
#add_getty_to_inittab
lilo_image