Please find my reworked patch attached. Support for pre-f1d28fb04
kernels was tested with 2.6.16.1. I CC-ed everyone who contributed to
this thread, thanks for your help. I hope the "bureaucracy" is correct.
I'm not a kernel developer and thus only know about the contribution
process what I found in the documentation.

so long
Maik

----

When kvm-userspace is build with a different kernel version than the
running kernel the depmod at the end will fail. This patch fixed the
problem.

Signed-off-by: Maik Hentsche <[EMAIL PROTECTED]>
Signed-off-by: Joerg Roedel <[EMAIL PROTECTED]>


-- 
           \           AMD Saxony Limited Liability Company & Co. KG
 Operating |         Wilschdorfer Landstr. 101, 01109 Dresden, Germany
  System   |                  Register Court Dresden: HRA 4896
 Research  |              General Partner authorized to represent:
  Center   |             AMD Saxony LLC (Wilmington, Delaware, US)
           / General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe,
Thomas McCoy
diff --git a/configure b/configure
index 63f956c..97a7cb7 100755
--- a/configure
+++ b/configure
@@ -15,6 +15,12 @@ qemu_opts=()
 cross_prefix=
 arch=`uname -m`
 target_exec=
+# don't use uname if kerneldir is set
+no_uname=
+depmod_version=
+if [ -z "TMPDIR" ] ; then 
+    TMPDIR=.
+fi
 
 usage() {
     cat <<-EOF
@@ -56,6 +62,7 @@ while [[ "$1" = -* ]]; do
 	    ;;
 	--kerneldir)
 	    kerneldir="$arg"
+            no_uname=1
 	    ;;
 	--with-patched-kernel)
 	    want_module=
@@ -112,6 +119,21 @@ if [ -d "$kerneldir/include2" ]; then
     kernelsourcedir=${kerneldir%/*}/source
 fi
 
+if [ -n "$no_uname" ]; then
+    if [ -e "$kerneldir/.kernelrelease" ]; then
+        depmod_version=`cat "$kerneldir/.kernelrelease"`
+        
+    elif [ -e "$kerneldir/include/config/kernel.release" ]; then
+            depmod_version=`cat "$kerneldir/include/config/kernel.release"`
+    else
+        echo 
+        echo "Error: kernelversion not found"
+        echo "Please make sure your kernel is configured"
+        echo
+        exit 1
+    fi
+fi
+
 #configure user dir
 (cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \
           --arch="$arch" --processor="$processor" \
@@ -143,6 +165,7 @@ CC=$cross_prefix$cc
 LD=$cross_prefix$ld
 OBJCOPY=$cross_prefix$objcopy
 AR=$cross_prefix$ar
+DEPMOD_VERSION=$depmod_version
 EOF
 
 cat <<EOF > kernel/config.kbuild
diff --git a/kernel/Makefile b/kernel/Makefile
index 41449d6..8315e3d 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -107,7 +107,7 @@ install:
 		 $(ORIGMODDIR)/arch/$(ARCH_DIR)/kvm/*.ko; do \
 		if [ -f "$$i" ]; then mv "$$i" "$$i.orig"; fi; \
 	done
-	/sbin/depmod -a
+	/sbin/depmod -a $(DEPMOD_VERSION)
 
 tmpspec = .tmp.kvm-kmod.spec
 

Attachment: signature.asc
Description: PGP signature

Reply via email to