aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2008-09-22 14:52:08 -0300
committerAvi Kivity <avi@redhat.com>2008-09-24 16:46:31 +0300
commit409a5e63cb249754d3c3163067b006ce40ef0e0a (patch)
treef0ef15ca40696853f4268118e608229318c0ff58
parentkvm: external module: relay_open() compat (diff)
downloadqemu-kvm-409a5e63cb249754d3c3163067b006ce40ef0e0a.tar.gz
qemu-kvm-409a5e63cb249754d3c3163067b006ce40ef0e0a.tar.bz2
qemu-kvm-409a5e63cb249754d3c3163067b006ce40ef0e0a.zip
kvm: external module: add --with-kvm-trace arg to configure
/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 <ehabkost@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--kvm/.gitignore1
-rwxr-xr-xkvm/configure11
-rw-r--r--kvm/kernel/Makefile7
-rw-r--r--kvm/kernel/x86/Kbuild4
4 files changed, 22 insertions, 1 deletions
diff --git a/kvm/.gitignore b/kvm/.gitignore
index bb35cca22..0cabc17a4 100644
--- a/kvm/.gitignore
+++ b/kvm/.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/kvm/configure b/kvm/configure
index 3bb10ce9f..78c2f9cf5 100755
--- a/kvm/configure
+++ b/kvm/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/kvm/kernel/Makefile b/kvm/kernel/Makefile
index 151183aeb..9842dabf5 100644
--- a/kvm/kernel/Makefile
+++ b/kvm/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/kvm/kernel/x86/Kbuild b/kvm/kernel/x86/Kbuild
index 8dc048373..bc584f98c 100644
--- a/kvm/kernel/x86/Kbuild
+++ b/kvm/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 \