Skip to contentSkip to conversation

Add modules for modularized kernels

PATCH Applied Lynn Bendixsen 2 participants 2 messages Dec 8, 2006 – Jan 9, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 <[email protected]>
---
Add needed modules to the ramdisk if the modules exist on the current system. (i.e. the current system contains a modularized kernel)

ramdisk/Makefile.am 2006-12-07 08:40:38.000000000 -0700 renamed from ramdisk/Makefile.am 2006-12-07 08:25:41.000000000 -0700 +11 -2
diff -ruN xm-test.3_0_4.untarred/ramdisk/Makefile.am xm-test/ramdisk/Makefile.am
@@ -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)
ramdisk/skel/etc/init.d/rcS 2006-12-07 08:43:16.000000000 -0700 renamed from ramdisk/skel/etc/init.d/rcS 2006-12-07 08:25:41.000000000 -0700 +11 -0
diff -ruN xm-test.3_0_4.untarred/ramdisk/skel/etc/init.d/rcS xm-test/ramdisk/skel/etc/init.d/rcS
@@ -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
[email protected]
801-861-2887

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

ramdisk/Makefile.am +11 -2
diff -ruN xm-test.3_0_4.untarred/ramdisk/Makefile.am xm-test/ramdisk/Makefile.am
@@ -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)
ramdisk/skel/etc/init.d/rcS +11 -0
diff -ruN xm-test.3_0_4.untarred/ramdisk/skel/etc/init.d/rcS xm-test/ramdisk/skel/etc/init.d/rcS
@@ -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

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Applied
#1 lore raw
Quoted 7 lines · Lynn Bendixsen

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 <[email protected]>

Applied. Apologies for the delay -- I lost this one in the flood.

Ewan.