[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] [XM-TEST] Add modules for modularized kernels



Greetings,

The ramdisk built by xm-test does not work on modularized kernels (e.g. SUSE 
kernels).  
The attached patch remedies that by adding the required modules to the ramdisk. 
 For this patch to work it must be built on a machine booted to the same kernel 
as the target machine.


Signed- off- by: Lynn Bendixsen <lbendixs@xxxxxxxxxx>
---
Add needed modules to the ramdisk if the modules exist on the current system. 
(i.e. the current system contains a modularized kernel)

diff -ruN xm-test.3_0_4.untarred/ramdisk/Makefile.am xm-test/ramdisk/Makefile.am
--- xm-test.3_0_4.untarred/ramdisk/Makefile.am  2006-12-07 08:25:41.000000000 
-0700
+++ xm-test/ramdisk/Makefile.am 2006-12-07 08:40:38.000000000 -0700
@@ -35,7 +35,12 @@
 XMTEST_MAJ_VER = $(shell echo @PACKAGE_VERSION@ | perl -pe 
's/(\d+)\.(\d+)\.\d+/\1.\2/')
 XMTEST_VER_IMG = initrd-$(XMTEST_MAJ_VER)-$(BR_ARCH).img

-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
@@ -59,7 +64,11 @@

 $(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)
diff -ruN xm-test.3_0_4.untarred/ramdisk/skel/etc/init.d/rcS 
xm-test/ramdisk/skel/etc/init.d/rcS
--- xm-test.3_0_4.untarred/ramdisk/skel/etc/init.d/rcS  2006-12-07 
08:25:41.000000000 -0700
+++ xm-test/ramdisk/skel/etc/init.d/rcS 2006-12-07 08:43:16.000000000 -0700
@@ -6,3 +6,14 @@
 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

---


Lynn Bendixsen
Software Engineer
lbendixs@xxxxxxxxxx
801-861-2887

Novell, Inc. 
SUSE* Linux Enterprise 10
Your Linux is ready 
http://www.novell.com/linux

Attachment: add-kernel-mods-to-ramdisk.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.