From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cam Macdonell Subject: Re: [PATCH] [RESEND] Move libkvm (v2) Date: Wed, 31 Oct 2007 10:09:36 -0600 Message-ID: <4728A8C0.6030807@cs.ualberta.ca> References: <45227892356863ce29e9.1193719433@basalt> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org To: Hollis Blanchard Return-path: In-Reply-To: <45227892356863ce29e9.1193719433@basalt> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Hi Hollis and Avi, I run into a compile problem with libkvm when compiling kvm-49. It caused the compile problem mentioned in my email yesterday. It has to with the line in libkvm/Makefile CFLAGS += -I $(KERNELDIR)/include when compiling kvm-49 (git or snapshot), this include points to my resident kernel's version of kvm.h instead of the local one copied with "make sync LINUX="). in kvm-48, KERNELDIR points to the kvm-userspace/kernel/ directory (under the git repo), but in the more recent versions it changes to /lib/modules/2.6.22.9-61.fc6/build/include. Here are the compiles from kvm-48 (kvmctl.c) and 49 (libkvm.c) respectively, kvm-48: gcc -m64 -I /home/cam/research/KVM/Sakwatamau/kvm-48/kernel/include -MMD -MF ./.kvmctl.d -g -fomit-frame-pointer -Wall -fno-stack-protector -c -o kvmctl.o kvmctl.c kvm-49: cc -MMD -MF ./.libkvm.d -g -fomit-frame-pointer -Wall -fno-stack-protector -I /lib/modules/2.6.22.9-61.fc6/build/include -c -o libkvm.o libkvm.c what is KERNELDIR supposed to point to - the install location for the modules or the location of kernel source? When configuring, I tried setting --kerneldir to the repo copy, but that didn't work. Thanks, Cam Hollis Blanchard wrote: > Move libkvm into its own directory. No functional changes. > > Signed-off-by: Hollis Blanchard > > --- > I've build-tested this pretty thoroughly on x86(32). > > Changes from v1: update libkvm.h #include guard macro. > > diff --git a/Makefile b/Makefile > --- a/Makefile > +++ b/Makefile > @@ -5,16 +5,17 @@ DESTDIR= > > rpmrelease = devel > > -.PHONY: kernel user qemu bios clean > +.PHONY: kernel user libkvm qemu bios clean > > -all: $(if $(WANT_MODULE), kernel) user qemu > +all: $(if $(WANT_MODULE), kernel) user libkvm qemu > > kcmd = $(if $(WANT_MODULE),,@\#) > > -qemu kernel user: > +qemu kernel user libkvm: > $(MAKE) -C $@ > > -qemu: user > +qemu: libkvm > +user: libkvm > > bios: > $(MAKE) -C $@ > @@ -41,7 +42,7 @@ install-rpm: > > install: > $(kcmd)make -C kernel DESTDIR="$(DESTDIR)" install > - make -C user DESTDIR="$(DESTDIR)" install > + make -C libkvm DESTDIR="$(DESTDIR)" install > make -C qemu DESTDIR="$(DESTDIR)" install > > tmpspec = .tmp.kvm.spec > @@ -59,6 +60,7 @@ srpm: > sed 's/^Release:.*/Release: $(rpmrelease)/' kvm.spec > $(tmpspec) > tar czf SOURCES/kvm.tar.gz qemu > tar czf SOURCES/user.tar.gz user > + tar czf SOURCES/libkvm.tar.gz libkvm > tar czf SOURCES/kernel.tar.gz kernel > tar czf SOURCES/scripts.tar.gz scripts > cp Makefile configure kvm_stat SOURCES > @@ -66,7 +68,7 @@ srpm: > $(RM) $(tmpspec) > > clean: > - for i in $(if $(WANT_MODULE), kernel) user qemu; do \ > + for i in $(if $(WANT_MODULE), kernel) user libkvm qemu; do \ > make -C $$i clean; \ > done > rm -f config.mak user/config.mak > diff --git a/configure b/configure > --- a/configure > +++ b/configure > @@ -108,8 +108,8 @@ fi > > #configure qemu > (cd qemu; ./configure --target-list=$target_exec \ > - --disable-kqemu --extra-cflags="-I $PWD/../user $qemu_cflags" \ > - --extra-ldflags="-L $PWD/../user $qemu_ldflags" \ > + --disable-kqemu --extra-cflags="-I $PWD/../libkvm $qemu_cflags" \ > + --extra-ldflags="-L $PWD/../libkvm $qemu_ldflags" \ > --enable-kvm --kernel-path="$libkvm_kerneldir" \ > ${enable_alsa:+"--enable-alsa"} \ > ${disable_vnc_tls:+"--disable-vnc-tls"} \ > diff --git a/libkvm/Makefile b/libkvm/Makefile > new file mode 100644 > --- /dev/null > +++ b/libkvm/Makefile > @@ -0,0 +1,37 @@ > +include ../config.mak > +include config-$(ARCH).mak > + > +# cc-option > +# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0) > +cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \ > + > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) > + > +CFLAGS += $(autodepend-flags) -g -fomit-frame-pointer -Wall > +CFLAGS += $(call cc-option, -fno-stack-protector, "") > +CFLAGS += $(call cc-option, -fno-stack-protector-all, "") > +CFLAGS += -I $(KERNELDIR)/include > + > +LDFLAGS += $(CFLAGS) > + > +CXXFLAGS = $(autodepend-flags) > + > +autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d > + > + > +all: libkvm.a > + > +libkvm.a: libkvm.o > + $(AR) rcs $@ $^ > + > +install: > + install -D libkvm.h $(DESTDIR)/$(PREFIX)/include/libkvm.h > + install -D $(KERNELDIR)/include/linux/kvm.h \ > + $(DESTDIR)/$(PREFIX)/include/linux/kvm.h > + install -D $(KERNELDIR)/include/linux/kvm_para.h \ > + $(DESTDIR)/$(PREFIX)/include/linux/kvm_para.h > + install -D libkvm.a $(DESTDIR)/$(PREFIX)/$(LIBDIR)/libkvm.a > + > +-include .*.d > + > +clean: > + $(RM) *.o *.a .*.d > diff --git a/libkvm/config-i386.mak b/libkvm/config-i386.mak > new file mode 100644 > --- /dev/null > +++ b/libkvm/config-i386.mak > @@ -0,0 +1,2 @@ > + > +LIBDIR := /lib > diff --git a/libkvm/config-x86_64.mak b/libkvm/config-x86_64.mak > new file mode 100644 > --- /dev/null > +++ b/libkvm/config-x86_64.mak > @@ -0,0 +1,2 @@ > + > +LIBDIR := /lib64 > diff --git a/user/kvm-abi-10.h b/libkvm/kvm-abi-10.h > rename from user/kvm-abi-10.h > rename to libkvm/kvm-abi-10.h > diff --git a/user/kvmctl.c b/libkvm/libkvm.c > rename from user/kvmctl.c > rename to libkvm/libkvm.c > --- a/libkvm/libkvm.c > +++ b/libkvm/libkvm.c > @@ -34,7 +34,7 @@ > #include > #include > #include > -#include "kvmctl.h" > +#include "libkvm.h" > #include "kvm-abi-10.h" > > static int kvm_abi = EXPECTED_KVM_API_VERSION; > diff --git a/user/kvmctl.h b/libkvm/libkvm.h > rename from user/kvmctl.h > rename to libkvm/libkvm.h > --- a/libkvm/libkvm.h > +++ b/libkvm/libkvm.h > @@ -2,8 +2,8 @@ > * libkvm API > */ > > -#ifndef KVMCTL_H > -#define KVMCTL_H > +#ifndef LIBKVM_H > +#define LIBKVM_H > > #include > > diff --git a/qemu/Makefile.target b/qemu/Makefile.target > --- a/qemu/Makefile.target > +++ b/qemu/Makefile.target > @@ -419,7 +419,7 @@ ifdef CONFIG_KVM_KERNEL_INC > ifdef CONFIG_KVM_KERNEL_INC > CFLAGS += -I $(CONFIG_KVM_KERNEL_INC) > LIBS += -lkvm > -DEPLIBS += ../user/libkvm.a > +DEPLIBS += ../libkvm/libkvm.a > endif > > ifdef CONFIG_VNC_TLS > diff --git a/qemu/hw/vga.c b/qemu/hw/vga.c > --- a/qemu/hw/vga.c > +++ b/qemu/hw/vga.c > @@ -1413,7 +1413,7 @@ void vga_invalidate_scanlines(VGAState * > > #ifdef USE_KVM > > -#include "kvmctl.h" > +#include "libkvm.h" > extern kvm_context_t kvm_context; > > static int bitmap_get_dirty(unsigned long *bitmap, unsigned nr) > diff --git a/qemu/hw/vmport.c b/qemu/hw/vmport.c > --- a/qemu/hw/vmport.c > +++ b/qemu/hw/vmport.c > @@ -23,7 +23,7 @@ > */ > #include "vl.h" > #include "cpu-all.h" > -#include "kvmctl.h" > +#include "libkvm.h" > > #define VMPORT_CMD_GETVERSION 0x0a > #define VMPORT_CMD_GETRAMSIZE 0x14 > diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c > --- a/qemu/qemu-kvm.c > +++ b/qemu/qemu-kvm.c > @@ -18,7 +18,7 @@ int kvm_irqchip = 1; > #include "vl.h" > > #include "qemu-kvm.h" > -#include > +#include > #include > #include > > diff --git a/qemu/qemu-kvm.h b/qemu/qemu-kvm.h > --- a/qemu/qemu-kvm.h > +++ b/qemu/qemu-kvm.h > @@ -2,7 +2,7 @@ > #define QEMU_KVM_H > > #include "cpu.h" > -#include "kvmctl.h" > +#include "libkvm.h" > > int kvm_main_loop(void); > int kvm_qemu_init(void); > diff --git a/user/Makefile b/user/Makefile > --- a/user/Makefile > +++ b/user/Makefile > @@ -20,8 +20,9 @@ CFLAGS += $(autodepend-flags) -g -fomit- > CFLAGS += $(autodepend-flags) -g -fomit-frame-pointer -Wall > CFLAGS += $(call cc-option, -fno-stack-protector, "") > CFLAGS += $(call cc-option, -fno-stack-protector-all, "") > +CFLAGS += -I ../libkvm > > -LDFLAGS += $(CFLAGS) > +LDFLAGS += $(CFLAGS) -L ../libkvm > > CXXFLAGS = $(autodepend-flags) > > @@ -30,17 +31,6 @@ kvmctl: LDFLAGS += -pthread -lrt > kvmctl: LDFLAGS += -pthread -lrt > > kvmctl: $(kvmctl_objs) > - > -libkvm.a: $(libkvm_objs) > - $(AR) rcs $@ $^ > - > -install: > - install -D kvmctl.h $(DESTDIR)/$(PREFIX)/include/kvmctl.h > - install -D $(KERNELDIR)/include/linux/kvm.h \ > - $(DESTDIR)/$(PREFIX)/include/linux/kvm.h > - install -D $(KERNELDIR)/include/linux/kvm_para.h \ > - $(DESTDIR)/$(PREFIX)/include/linux/kvm_para.h > - install -D libkvm.a $(DESTDIR)/$(PREFIX)/$(LIBDIR)/libkvm.a > > %.flat: %.o > $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,flat.lds $^ > diff --git a/user/config-i386.mak b/user/config-i386.mak > --- a/user/config-i386.mak > +++ b/user/config-i386.mak > @@ -1,4 +1,3 @@ LIBDIR = /lib > -LIBDIR = /lib > TEST_DIR=test/x86 > cstart.o = $(TEST_DIR)/cstart.o > bits = 32 > diff --git a/user/config-x86-common.mak b/user/config-x86-common.mak > --- a/user/config-x86-common.mak > +++ b/user/config-x86-common.mak > @@ -1,10 +1,8 @@ > #This is a make file with common rules for both x86 & x86-64 > > -all: kvmctl libkvm.a test_cases > +all: kvmctl test_cases > > -kvmctl_objs=kvmctl.o main.o > - > -libkvm_objs=kvmctl.o > +kvmctl_objs=../libkvm/libkvm.a main.o > > balloon_ctl: balloon_ctl.o > > diff --git a/user/config-x86_64.mak b/user/config-x86_64.mak > --- a/user/config-x86_64.mak > +++ b/user/config-x86_64.mak > @@ -1,4 +1,3 @@ LIBDIR = /lib64 > -LIBDIR = /lib64 > TEST_DIR=test/x86 > cstart.o = $(TEST_DIR)/cstart64.o > bits = 64 > diff --git a/user/main.c b/user/main.c > --- a/user/main.c > +++ b/user/main.c > @@ -16,7 +16,7 @@ > > #define _GNU_SOURCE > > -#include "kvmctl.h" > +#include > #include "test/x86/apic.h" > > #include > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > kvm-devel mailing list > kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > https://lists.sourceforge.net/lists/listinfo/kvm-devel ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/