Add needed modules to the ramdisk if the modules exist on the current system.
authorEwan Mellor <ewan@xensource.com>
Tue, 9 Jan 2007 17:23:22 +0000 (17:23 +0000)
committerEwan Mellor <ewan@xensource.com>
Tue, 9 Jan 2007 17:23:22 +0000 (17:23 +0000)
(i.e. the current system contains a modularized kernel)

Signed-off-by: Lynn Bendixsen <lbendixs@novell.com>
tools/xm-test/ramdisk/Makefile.am
tools/xm-test/ramdisk/skel/etc/init.d/rcS

index b6c59d60e5fa72672a27c1a9f4cc4e9848e26173..1de0d1423da6fd5abcd10af9a6bd2f3c2bc8ad46 100644 (file)
@@ -36,7 +36,12 @@ XMTEST_MAJ_VER = $(shell echo @PACKAGE_VERSION@ | perl -pe 's/(\d+)\.(\d+)\.\d+/
 XMTEST_VER_IMG = initrd-$(XMTEST_MAJ_VER)-$(BR_ARCH).img
 XMTEST_DL_IMG = $(shell echo $(XMTEST_VER_IMG) | sed -e 's/x86_64/i386/g')
 
-EXTRA_ROOT_DIRS = sys
+EXTRA_ROOT_DIRS = sys modules
+
+BLKDRV = /lib/modules/$(shell uname -r)/kernel/drivers/xen/blkfront/xenblk.ko
+NETDRV = /lib/modules/$(shell uname -r)/kernel/drivers/xen/netfront/xennet.ko
+PKTDRV = /lib/modules/$(shell uname -r)/kernel/net/packet/af_packet.ko
+
 
 if HVM
 all: initrd.img disk.img
@@ -60,7 +65,11 @@ $(BR_IMG): $(BR_SRC)
 
 $(XMTEST_VER_IMG): $(BR_IMG)
        chmod a+x skel/etc/init.d/rcS
-       (cd skel; mkdir -p $(EXTRA_ROOT_DIRS); tar cf - .) \
+       cd skel && mkdir -p $(EXTRA_ROOT_DIRS)
+       -[ -e "$(BLKDRV)" ] && cp $(BLKDRV) skel/modules
+       -[ -e "$(NETDRV)" ] && cp $(NETDRV) skel/modules
+       -[ -e "$(PKTDRV)" ] && cp $(PKTDRV) skel/modules
+       (cd skel; tar cf - .) \
                | (cd $(BR_SRC)/$(BR_ROOT); tar xvf -)
        cd $(BR_SRC) && make
        cp $(BR_IMG) $(XMTEST_VER_IMG)
index b3a92109e93746bd82eda8cf2a5b1623c85f9b16..4c294f3dff77e1d486033125f001c21ce03a51f1 100644 (file)
@@ -6,3 +6,14 @@ mount -a
 if uname -r | grep -q '^2.6'; then
        mount -t sysfs none /sys
 fi
+
+# If the block, net, and packet drivers are modules, we need to load them
+if test -e /modules/xenblk.ko; then
+       insmod /modules/xenblk.ko > /dev/null 2>&1
+fi
+if test -e /modules/xennet.ko; then
+       insmod /modules/xennet.ko > /dev/null 2>&1
+fi
+if test -e /modules/af_packet.ko; then
+       insmod /modules/af_packet.ko > /dev/null 2>&1
+fi