From: Eduardo Habkost <[EMAIL PROTECTED]>

/configure --with-kvm-trace  will set a CONFIG_KVM_TRACE option on a
kernel/config.kbuild file. This file can be included from the Kbuild
files to get kvm-specific CONFIG_* definitions.

Signed-off-by: Eduardo Habkost <[EMAIL PROTECTED]>
Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>

diff --git a/.gitignore b/.gitignore
index bb35cca..0cabc17 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,6 +24,7 @@ vgabios/*.txt
 extboot/extboot.bin
 extboot/extboot.img
 extboot/signrom
+kernel/config.kbuild
 kernel/modules.order
 kernel/Module.symvers
 kernel/Modules.symvers
diff --git a/configure b/configure
index 3bb10ce..78c2f9c 100755
--- a/configure
+++ b/configure
@@ -8,6 +8,7 @@ objcopy=objcopy
 want_module=1
 qemu_cflags=
 qemu_ldflags=
+kvm_trace=
 qemu_opts=()
 cross_prefix=
 arch=`uname -m`
@@ -22,6 +23,7 @@ usage() {
            --cross-prefix=PREFIX  prefix for cross compile
            --prefix=PREFIX        where to install things ($prefix)
            --with-patched-kernel  don't use external module
+           --with-kvm-trace       Enable kvm_trace
            --kerneldir=DIR        kernel build directory ($kerneldir)
            --qemu-cflags=CFLAGS   CFLAGS to add to qemu configuration
            --qemu-ldflags=LDFLAGS LDFLAGS to add to qemu configuration
@@ -56,6 +58,9 @@ while [[ "$1" = -* ]]; do
        --with-patched-kernel)
            want_module=
            ;;
+       --with-kvm-trace)
+           kvm_trace=y
+           ;;
        --qemu-cflags)
            qemu_cflags="$arg"
            ;;
@@ -131,3 +136,9 @@ CC=$cross_prefix$cc
 LD=$cross_prefix$ld
 OBJCOPY=$cross_prefix$objcopy
 EOF
+
+if [ -n "$want_module" ];then
+cat <<EOF > kernel/config.kbuild
+CONFIG_KVM_TRACE=$kvm_trace
+EOF
+fi
diff --git a/kernel/Makefile b/kernel/Makefile
index 151183a..9842dab 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -1,4 +1,5 @@
 include ../config.mak
+include config.kbuild
 
 ARCH_DIR = $(if $(filter $(ARCH),x86_64 i386),x86,$(ARCH))
 ARCH_CONFIG := $(shell echo $(ARCH_DIR) | tr '[:lower:]' '[:upper:]')
@@ -33,12 +34,16 @@ hack-files-ia64 = kvm_main.c kvm_fw.c
 
 hack-files = $(hack-files-$(ARCH_DIR))
 
+ifeq ($(CONFIG_KVM_TRACE),y)
+module_defines += -DCONFIG_KVM_TRACE=y
+endif
+
 all:: header-link prerequisite
 #      include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat
        $(MAKE) -C $(KERNELDIR) M=`pwd` \
                LINUXINCLUDE="-I`pwd`/include -Iinclude 
-Iarch/${ARCH_DIR}/include -I`pwd`/include-compat \
                -include include/linux/autoconf.h \
-               -include `pwd`/$(ARCH_DIR)/external-module-compat.h"
+               -include `pwd`/$(ARCH_DIR)/external-module-compat.h 
$(module_defines)"
                "$$@"
 
 sync: header-sync source-sync header-link
diff --git a/kernel/x86/Kbuild b/kernel/x86/Kbuild
index 8dc0483..bc584f9 100644
--- a/kernel/x86/Kbuild
+++ b/kernel/x86/Kbuild
@@ -1,3 +1,7 @@
+# trick to get the kvm-specific CONFIG_KVM_* definitions,
+# because the kernel source tree won't have them
+include $(obj)/../config.kbuild
+
 obj-m := kvm.o kvm-intel.o kvm-amd.o
 kvm-objs := kvm_main.o x86.o mmu.o x86_emulate.o ../anon_inodes.o irq.o 
i8259.o \
         lapic.o ioapic.o preempt.o i8254.o coalesced_mmio.o \
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to