From: "Lynn Bendixsen" Subject: [PATCH] [XM-TEST] Add modules for modularized kernels Date: Fri, 08 Dec 2006 14:53:45 -0700 Message-ID: <45797B1E.30F0.00FC.0@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part735742F9.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --=__Part735742F9.0__= Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Greetings, The ramdisk built by xm-test does not work on modularized kernels (e.g. = SUSE kernels). =20 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 --- 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/Makefi= le.am --- xm-test.3_0_4.untarred/ramdisk/Makefile.am 2006-12-07 08:25:41.0000000= 00 -0700 +++ xm-test/ramdisk/Makefile.am 2006-12-07 08:40:38.000000000 -0700 @@ -35,7 +35,12 @@ XMTEST_MAJ_VER =3D $(shell echo @PACKAGE_VERSION@ | perl -pe 's/(\d+)\.(\d= +)\.\d+/\1.\2/') XMTEST_VER_IMG =3D initrd-$(XMTEST_MAJ_VER)-$(BR_ARCH).img -EXTRA_ROOT_DIRS =3D sys +EXTRA_ROOT_DIRS =3D sys modules + +BLKDRV =3D /lib/modules/$(shell uname -r)/kernel/drivers/xen/blkfront/xenb= lk.ko +NETDRV =3D /lib/modules/$(shell uname -r)/kernel/drivers/xen/netfront/xenn= et.ko +PKTDRV =3D /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/ramdis= k/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@novell.com 801-861-2887 Novell, Inc.=20 SUSE* Linux Enterprise 10 Your Linux is ready=20 http://www.novell.com/linux --=__Part735742F9.0__= Content-Type: text/plain; name="add-kernel-mods-to-ramdisk.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="add-kernel-mods-to-ramdisk.patch" diff -ruN xm-test.3_0_4.untarred/ramdisk/Makefile.am xm-test/ramdisk/Makefi= le.am --- xm-test.3_0_4.untarred/ramdisk/Makefile.am 2006-12-07 08:25:41.0000000= 00 -0700 +++ xm-test/ramdisk/Makefile.am 2006-12-07 08:40:38.000000000 -0700 @@ -35,7 +35,12 @@ XMTEST_MAJ_VER =3D $(shell echo @PACKAGE_VERSION@ | perl -pe 's/(\d+)\.(\d= +)\.\d+/\1.\2/') XMTEST_VER_IMG =3D initrd-$(XMTEST_MAJ_VER)-$(BR_ARCH).img =20 -EXTRA_ROOT_DIRS =3D sys +EXTRA_ROOT_DIRS =3D sys modules + +BLKDRV =3D /lib/modules/$(shell uname -r)/kernel/drivers/xen/blkfront/xenb= lk.ko +NETDRV =3D /lib/modules/$(shell uname -r)/kernel/drivers/xen/netfront/xenn= et.ko +PKTDRV =3D /lib/modules/$(shell uname -r)/kernel/net/packet/af_packet.ko + =20 if HVM all: initrd.img disk.img @@ -59,7 +64,11 @@ =20 $(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/ramdis= k/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 --=__Part735742F9.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part735742F9.0__=--