From 7f87d2e9a824ef0d11288e9fdf4f11e15353ca23 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 18 Mar 2009 11:55:09 +0200 Subject: [PATCH] kvm: external module: Add a ./configure script for the external module This will aid in splitting the kernel and userspace packages. Signed-off-by: Avi Kivity --- configure | 36 +++++----------------- kernel/Makefile | 2 +- configure => kernel/configure | 70 +++---------------------------------------- 3 files changed, 13 insertions(+), 95 deletions(-) copy configure => kernel/configure (51%) diff --git a/configure b/configure index c3910cd9..a832cdf6 100755 --- a/configure +++ b/configure @@ -1,7 +1,6 @@ #!/bin/bash prefix=/usr/local -kernelsourcedir= kerneldir=/lib/modules/$(uname -r)/build cc=gcc ld=ld @@ -114,28 +113,14 @@ esac processor=${arch#*-} arch=${arch%%-*} -# see if we have split build and source directories -if [ -d "$kerneldir/include2" ]; then - kernelsourcedir=${kerneldir%/*}/source -fi - -if [ -n "$no_uname" -a "$want_module" ]; 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"` - elif [ -e "$kerneldir/.config" ]; then - depmod_version=$(awk '/Linux kernel version:/ { print $NF }' \ - "$kerneldir/.config") - else - echo - echo "Error: kernelversion not found" - echo "Please make sure your kernel is configured" - echo - exit 1 - fi -fi +#configure kernel module +(cd kernel; + ./configure \ + --kerneldir="$kerneldir" \ + --arch="$arch" \ + ${cross_prefix:+"--cross-prefix=$cross_prefix"} \ + ${kvm_trace:+"--with-kvm-trace"} +) #configure user dir (cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \ @@ -167,9 +152,4 @@ CC=$cross_prefix$cc LD=$cross_prefix$ld OBJCOPY=$cross_prefix$objcopy AR=$cross_prefix$ar -DEPMOD_VERSION=$depmod_version -EOF - -cat < kernel/config.kbuild -EXT_CONFIG_KVM_TRACE=$kvm_trace EOF diff --git a/kernel/Makefile b/kernel/Makefile index b7883ceb..5dbb8f0d 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -1,4 +1,4 @@ -include ../config.mak +include config.mak include config.kbuild ARCH_DIR = $(if $(filter $(ARCH),x86_64 i386),x86,$(ARCH)) diff --git a/configure b/kernel/configure similarity index 51% copy from configure copy to kernel/configure index c3910cd9..79fb093d 100755 --- a/configure +++ b/kernel/configure @@ -1,20 +1,14 @@ #!/bin/bash -prefix=/usr/local kernelsourcedir= kerneldir=/lib/modules/$(uname -r)/build cc=gcc ld=ld objcopy=objcopy ar=ar -want_module=1 -qemu_cflags= -qemu_ldflags= kvm_trace= -qemu_opts=() cross_prefix= arch=`uname -m` -target_exec= # don't use uname if kerneldir is set no_uname= depmod_version= @@ -29,21 +23,10 @@ usage() { Options include: --arch=ARCH architecture to compile for ($arch) --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 - - Any additional option is given to qemu's configure verbatim; including: - + --help this helpful text EOF - cd qemu - ./configure --help | egrep "enable-|disable-" \ - | grep -v user | grep -v system | grep -v kqemu | grep -v kvm \ - | sed -e "s/^ / /g" \ - | sed -e"s/ enable/enable/g" | sed -e "s/ disable/disable/g" exit 1 } @@ -57,25 +40,13 @@ while [[ "$1" = -* ]]; do hasarg=1 fi case "$opt" in - --prefix) - prefix="$arg" - ;; --kerneldir) kerneldir="$arg" no_uname=1 ;; - --with-patched-kernel) - want_module= - ;; --with-kvm-trace) kvm_trace=y ;; - --qemu-cflags) - qemu_cflags="$arg" - ;; - --qemu-ldflags) - qemu_ldflags="$arg" - ;; --arch) arch="$arg" ;; @@ -86,28 +57,14 @@ while [[ "$1" = -* ]]; do usage ;; *) - qemu_opts=("${qemu_opts[@]}" "$opt${hasarg:+=$arg}") + usage ;; esac done - -#set kenel directory -libkvm_kerneldir=$(readlink -f kernel) - case $arch in i?86*|x86_64*) arch=${arch/#i?86/i386} - target_exec="x86_64-softmmu" - qemu_cflags="$qemu_cflags -DCONFIG_X86" - ;; - ia64*) - target_exec="ia64-softmmu" - ;; - powerpc*) - target_exec="ppcemb-softmmu" - qemu_cflags="$qemu_cflags -I $PWD/libfdt" - qemu_ldflags="$qemu_ldflags -L $PWD/libfdt" ;; esac @@ -119,7 +76,7 @@ if [ -d "$kerneldir/include2" ]; then kernelsourcedir=${kerneldir%/*}/source fi -if [ -n "$no_uname" -a "$want_module" ]; then +if [ -n "$no_uname" ]; then if [ -e "$kerneldir/.kernelrelease" ]; then depmod_version=`cat "$kerneldir/.kernelrelease"` @@ -137,31 +94,12 @@ if [ -n "$no_uname" -a "$want_module" ]; then fi fi -#configure user dir -(cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \ - --arch="$arch" --processor="$processor" \ - ${cross_prefix:+"--cross-prefix=$cross_prefix"}) - -#configure qemu -(cd qemu; ./configure --target-list=$target_exec \ - --disable-kqemu \ - --extra-cflags="-I $PWD/../libkvm $qemu_cflags" \ - --extra-ldflags="-L $PWD/../libkvm $qemu_ldflags" \ - --kerneldir="$libkvm_kerneldir" \ - --prefix="$prefix" \ - ${cross_prefix:+"--cross-prefix=$cross_prefix"} \ - ${cross_prefix:+"--cpu=$arch"} "${qemu_opts[@]}" -) || usage - - cat < config.mak ARCH=$arch PROCESSOR=$processor PREFIX=$prefix KERNELDIR=$kerneldir KERNELSOURCEDIR=$kernelsourcedir -LIBKVM_KERNELDIR=$libkvm_kerneldir -WANT_MODULE=$want_module CROSS_COMPILE=$cross_prefix CC=$cross_prefix$cc LD=$cross_prefix$ld @@ -170,6 +108,6 @@ AR=$cross_prefix$ar DEPMOD_VERSION=$depmod_version EOF -cat < kernel/config.kbuild +cat < config.kbuild EXT_CONFIG_KVM_TRACE=$kvm_trace EOF -- 2.11.4.GIT