All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cam Macdonell <cam-edFDblaTWIyXbbII50Afww@public.gmane.org>
To: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org
Subject: Re: [PATCH] [RESEND] Move libkvm (v2)
Date: Wed, 31 Oct 2007 10:09:36 -0600	[thread overview]
Message-ID: <4728A8C0.6030807@cs.ualberta.ca> (raw)
In-Reply-To: <45227892356863ce29e9.1193719433@basalt>


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=<kvm git repo>").

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 <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> 
> ---
> 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 <string.h>
>  #include <errno.h>
>  #include <sys/ioctl.h>
> -#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 <stdint.h>
>  
> 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 <kvmctl.h>
> +#include <libkvm.h>
>  #include <pthread.h>
>  #include <sys/utsname.h>
>  
> 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 <libkvm.h>
>  #include "test/x86/apic.h"
>  
>  #include <stdio.h>
> 
> -------------------------------------------------------------------------
> 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/

  parent reply	other threads:[~2007-10-31 16:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-30  4:43 [PATCH] [RESEND] Move libkvm (v2) Hollis Blanchard
2007-10-30 11:19 ` Avi Kivity
2007-10-31 16:09 ` Cam Macdonell [this message]
     [not found]   ` <4728A8C0.6030807-edFDblaTWIyXbbII50Afww@public.gmane.org>
2007-10-31 16:56     ` Hollis Blanchard
2007-10-31 17:10       ` Cam Macdonell
2007-10-31 22:13     ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4728A8C0.6030807@cs.ualberta.ca \
    --to=cam-edfdblatwiyxbbii50afww@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.